SoundManager::~SoundManager(){ //Stop all the sounds Mix_HaltChannel(-1); //Destroying the background music destroySound(&m_BackgroundMusic); destroySound(&m_LaserSound); destroySound(&m_ZombieSound); Mix_CloseAudio(); };
cSoundPlayer::~cSoundPlayer() { if (maximumVoices > -1) { for (int i = 0; i < maximumVoices; i++) { destroySound(i, true); } } }
void SoundManager::destroySound(Sound *sound) { // Lock Mutex OGREAL_LOCK_AUTO_MUTEX destroySound(sound->getName()); }
void xrSASH::ReleaseEngine() { m_bReinitEngine = true; destroyInput(); Console->Destroy(); destroySound(); destroyEngine(); }
void getNextSoundInternal(bool toAdd) { if(soundMode == SOUND_ONESHOT) return; destroySound(); switch(soundMode) { case SOUND_NEXTFILE: if(getNextSong()) // if there is a next song { soundLoaded = false; } else { exitSound(0,0); } break; case SOUND_RANDFILE: int tmpCur = 0; if(nextRandomList(getFileName(), &tmpCur)) // look in playlist first { moveCursorAbsolute(tmpCur); soundLoaded = false; } else { int x = randFile(getFileName(), SOUNDFILE, getBrowserEntries()); if(x == -1) { exitSound(0,0); return; } moveCursorAbsolute(x); if(toAdd) { addToRandomList(getFileName(), x); } soundLoaded = false; } break; } }
void SoundManager::launchBackGroundMusic(const std::string & filename){ //If a background music is running if(m_BackgroundMusic != NULL){ Mix_FadeOutChannel(0, 1000); } Mix_HaltChannel(0); destroySound(&m_BackgroundMusic); loadSound(&m_BackgroundMusic, filename); if(m_BackgroundMusic != NULL){ if(Mix_FadeInChannel(0, m_BackgroundMusic, -1, 1000) == -1){ std::cout << "SOUNDMANAGER : Impossible to play : " << filename << std::endl; } } }
//------------------------------------------------------------------------- void SoundSystem::removeSoundPlayInfo(SoundPlayInfo* _cp, bool _allowDestroySound) { // Stop the playing stop(_cp); // Remove information from the list of currently playing sounds. Sound* sound = _cp->sound; sound->mSoundPlayInfo = nullptr; mSoundPlayInfos.erase(_cp->playInfoIterator); // Destroy the sound if it's needed and if it's allowed if(_allowDestroySound && sound->mDestroyOnEnd && sound->mLoopMode == SoundLoopMode::PLAY_ONCE && sound->mNumPlayed != 0) { destroySound(sound); } }
//----------------------------------------------------------------------------- LLFFTSound::~LLFFTSound() { destroySound(); #ifdef _WINDOWS BASS_Free(); #endif // clean up event vector int size = (int)m_vEventVec.size(); for (int i=0; i<size; i++) { LLEvent* se = m_vEventVec[i]; delete se; m_vEventVec[i] = NULL; } m_vEventVec.clear(); }
void getPrevSound(int x, int y) { if(hold && getControlID() != CONTROL_L) return; if(sndMode == TYPE_PLS) { previousPlaylistField(); return; } if(soundMode == SOUND_ONESHOT) return; destroySound(); switch(soundMode) { case SOUND_NEXTFILE: if(getPrevSong()) // if there is a prev song soundLoaded = false; else { exitSound(0,0); } break; case SOUND_RANDFILE: int tmpCur = 0; if(prevRandomList(getFileName(), &tmpCur)) { moveCursorAbsolute(tmpCur); soundLoaded = false; } else { destroyRandomList(); exitSound(0,0); } break; } }
void cSoundPlayer::think() { if (maximumVoices < 0) return; for(int i = 0;i < maximumVoices; i++) { int pos; int voice = voices[i]; //if it contains a voice get its position if(voice != -1) { pos = voice_get_position(voice); } else { pos = -2; } //if it is at the end then release it if(pos == -1) { destroySound(voice, true); } } }
SDLSound::~SDLSound() { destroySound(); }
void exitSound(int x, int y) { destroySound(); setMode(BROWSER); createBrowser(false); }
GsSound::~GsSound(void) { destroySound(); }