示例#1
0
文件: digi.c 项目: osgcc/descent-mac
void digi_set_midi_volume(int n)
{
	int old_volume = midi_volume;
	
	if (!digi_initialized) return;

	if (n < 0)
		midi_volume = 0;
	else if (n > 255)
		midi_volume = 255;
	else
		midi_volume = n;
	
#ifdef MAC_SHAREWARE
	SetSongVolume(midi_volume);
#else
	redbook_set_volume(midi_volume);
#endif
	
	if (!old_volume && midi_volume) {
#ifdef MAC_SHAREWARE
		ChangeSystemVoices(MAX_MUSIC_CHANNELS, 4 + (digi_max_channels/2), digi_max_channels);
#endif
		digi_play_midi_song(digi_last_midi_song, digi_last_midi_song_loop);
	} else if (old_volume && !midi_volume) {
		digi_stop_current_song();
#ifndef MAC_SHAREWARE
		digi_cd_started = 0;
#else
		ChangeSystemVoices(0, digi_max_channels/2, digi_max_channels);
#endif

	}
}
示例#2
0
void MainScreen::become_front() {
    InterfaceScreen::become_front();
    if (Preferences::preferences()->play_idle_music() && !SongIsPlaying()) {
        LoadSong(kTitleSongID);
        SetSongVolume(kMaxMusicVolume);
        PlaySong();
    }
}
示例#3
0
bool CSoundManager::StopSong(int Nr, bool Paused)
{
	if (its_Songs[Nr] == NULL)
		return false;

	SetSongVolume(Nr, its_Songs[Nr]->Volume);

	if (Paused == false)
		FMUSIC_StopSong(its_Songs[Nr]->SongData);			// Ganz anhalten ?
	else
		FMUSIC_SetPaused(its_Songs[Nr]->SongData, true);		// oder nur pausieren ?

	return true;
} // StopSong
示例#4
0
bool CSoundManager::PlaySong(int Nr, bool Paused)
{
	if (false == InitSuccessfull)
		return false;

	if (its_Songs[Nr] == NULL)
		return false;	

	if (Paused == false)
	{
		FMUSIC_PlaySong(its_Songs[Nr]->SongData);			// Von vorne abspielen ?
		its_Songs[Nr]->FadingVolume = 0.0f;
		SetSongVolume(Nr, its_GlobalMusicVolume);
	}
	else
	{
		SetSongVolume(Nr, its_Songs[Nr]->Volume);
		FMUSIC_SetPaused(its_Songs[Nr]->SongData, false);	// oder Pause aufheben ?
	}

	CurrentSongNr = Nr;

	return true;
} // PlaySong
示例#5
0
void ScrollTextScreen::become_front() {
    // If a song was requested, play it.
    if (_play_song && Preferences::preferences()->play_idle_music()) {
        if (SongIsPlaying()) {
            StopAndUnloadSong();
        }
        LoadSong(_song_id);
        SetSongVolume(kMaxMusicVolume);
        PlaySong();
    }

    _start = now_usecs();
    _next_shift = _start;

    _clip = Rect(0, 0, world.width(), kScrollTextHeight);
    _clip.center_in(world);

    _position = _build_pix.size().as_rect();
    _position.center_in(_clip);
    _position.offset(0, _clip.bottom - _position.top);
}
示例#6
0
void CSoundManager::SetAllSongVolumes(void)
{
	for (int i=0; i<MAX_SONGS; i++)
		if (its_Songs[i] != NULL)
			SetSongVolume(i, its_GlobalMusicVolume);
} // SetAllSongVolumes