Esempio n. 1
0
void CSound::StopSong (ESong Song)
{
    // If the sound works
    if (m_SoundOK)
    {    
        // If the song exists
        if (m_CurrentSong != NULL)
        {
            // Stop playing current song (we don't know which one is playing)
            FreeSong(m_ESong);
        }
    }
}
Esempio n. 2
0
void digi_stop_current_song()
{
#ifdef MAC_SHAREWARE
	if ( digi_midi_song_playing ) {
		if ( !IsSongDone() )
			EndSong();										// stop the song 
		FreeSong();										// free the resources used.
		ReleaseResource(Midi_handle);
		ReleaseResource(Song_handle);
		Song_handle = NULL;
		Midi_handle = NULL;
		digi_midi_song_playing = 0;
	}
#else
	stop_redbook();
	digi_midi_song_playing = 0;
#endif
}
Esempio n. 3
0
void CSound::PlaySong (ESong Song)
{
    bool result = true;
    // If the sound works
    if (m_SoundOK)
    {    
        // If a song exists free it unless it is the same
        if (m_CurrentSong != NULL && m_ESong != Song) FreeSong(Song);
		
        // note: songs are loaded dynamically because of an error in libmikmod (used by SDL_mixer)
        // load new song (if necessary)
        if (m_ESong != Song || m_CurrentSong == NULL) {
            switch (Song) {
                case SONG_MATCH_MUSIC_1_NORMAL:
                    result = LoadSong   (SONG_MATCH_MUSIC_1_NORMAL    , SND_MATCH_MUSIC_1_NORMAL);
                    break;
                case SONG_MATCH_MUSIC_1_FAST:
                    result = LoadSong   (SONG_MATCH_MUSIC_1_FAST      , SND_MATCH_MUSIC_1_FAST  );
                    break;
                case SONG_MENU_MUSIC:
                    result = LoadSong   (SONG_MENU_MUSIC              , SND_MENU_MUSIC          );
                    break;
                case SONG_CONTROLS_MUSIC:
                    result = LoadSong   (SONG_CONTROLS_MUSIC          , SND_CONTROLS_MUSIC      );
                    break;
                case SONG_TITLE_MUSIC:
                    result = LoadSong   (SONG_TITLE_MUSIC             , SND_TITLE_MUSIC         );
                    break;
                default:
                    result = false;
            }
        }
	
        if (result)
        {
            // Start playing this song (-1 infinite loop)
            Mix_PlayMusic(m_CurrentSong, -1);
            m_ESong = Song;
        }
    }
}