SoundManager::~SoundManager(){ //Stop all the sounds Mix_HaltChannel(-1); //Destroying the background music destroySound(&m_BackgroundMusic); destroySound(&m_LaserSound); destroySound(&m_ZombieSound); Mix_CloseAudio(); };
void SoundSystem::HaltAllChannels(void) { if (!initialized) return; Mix_HaltChannel(-1); for (int i = 0; i < MAX_SOUNDS; i++) channels[i] = -1; }
void game_titlescreen() { gamestate_over = true; gamestate_pause = false; gamestate_title = true; game_setstatustext("",0); Mix_FadeOutMusic(sound_fadetime); Mix_HaltChannel(-1); }
d_define_method(track, set_channel)(struct s_object *self, int channel) { d_using(track); if ((track_attributes->next_channel = channel) == d_track_auto_channel) track_attributes->auto_channel = d_true; else Mix_HaltChannel(channel); /* nothing */ track_attributes->auto_channel = d_false; return self; }
bool Sample::stop() { if (m_Channel != -1) { Mix_HaltChannel(m_Channel); m_Channel = -1; return true; } return false; }
void I_StopSound (int handle) { if(!sound_initialized) return; channel_in_use[handle] = -1; Mix_HaltChannel(handle); }
audio::~audio() { Mix_HaltChannel(-1); Mix_HaltMusic(); free_music(); delete sfact; Mix_CloseAudio(); SDL_QuitSubSystem(SDL_INIT_AUDIO); }
void stopSound(int channel) { if (channel < 0 || game.audio == FALSE || game.sfxDefaultVolume == 0 || channel > MAX_CHANNELS) { return; } Mix_HaltChannel(channel); }
void I_ShutdownSound(void) { int i; I_ShutdownMusic(); Mix_HaltChannel(-1); for (i=0 ; i<NUMSFX ; i++) Mix_FreeChunk( S_sfx[i].chunk ); SDL_CloseAudio(); }
// // FreeResources // void Game::FreeResources() { int i; if(!framework->GetNoSound()) { Mix_HaltChannel(-1); Mix_FreeChunk(pickAmmoSnd); Mix_FreeChunk(killSnd); Mix_FreeChunk(shootSnd); Mix_FreeChunk(MGshootSnd); Mix_FreeChunk(startSnd); Mix_FreeChunk(PlayerHurt); Mix_FreeChunk(EnemyHurt); Mix_FreeChunk(PlayerDead); Mix_FreeChunk(pickKey); Mix_FreeChunk(pickHealth); Mix_FreeChunk(framework->EnemyShoot); Mix_FreeChunk(framework->ClosingDoor); Mix_FreeChunk(framework->OpeningDoor); Mix_FreeChunk(HeartBeat); Mix_FreeChunk(LVLClear); Mix_HaltMusic(); Mix_FreeMusic(music1); } SDL_FreeSurface(keyImg); SDL_FreeSurface(fireImg); SDL_FreeSurface(gunImg); SDL_FreeSurface(gunHudImg); SDL_FreeSurface(headRedImg); SDL_FreeSurface(hudBgImg); SDL_FreeSurface(headImg); SDL_FreeSurface(crosshairImg); SDL_FreeSurface(MGgunHudImg); SDL_FreeSurface(MGgunImg); SDL_FreeSurface(MGfireImg); for(i=0; i<MAX_SPRITES; i++) { if(textures[i] != NULL) SDL_FreeSurface(spriteImgs[i]); else break; } for(i=0; i<MAX_TEXTURES; i++) { if(textures[i][0] != NULL) { SDL_FreeSurface(textures[i][0]); SDL_FreeSurface(textures[i][1]); } else break; } }
void CGame::StopFuse (void) { mStage->RemoveDrawable (mFuse); // stop fuse sound if (mFuseChannel >= 0) Mix_HaltChannel (mFuseChannel); mFuseChannel = -1; }
Sound::~Sound() { Mix_HaltChannel(-1); for ( Mix_Chunk *c : chunks) { if ( c == nullptr ) continue; Mix_FreeChunk(c); } Mix_CloseAudio(); }
void vsSoundSystem::Deinit() { StopMusic(); #if !TARGET_OS_IPHONE Mix_HaltChannel(-1); #endif vsLog(" ++ Sound channels in use: %d", m_channelsInUse); vsLog(" ++ Max sound channels in use: %d", m_maxChannelsInUse); }
void MainApp::onUnloadWorld() { PEON_DELETE( m_pFont ); PEON_DELETE( m_pFontTexture ); Mix_HaltChannel( m_iSound ); Mix_FreeChunk( m_pSound ); }
void C_SoundSystem::UnloadSound(Mix_Chunk* sound) { if (sound) { if(Mix_Playing(-1) != 0) { Mix_HaltChannel(-1); //TODO: Should only stop the channel the sound is playing on } Mix_FreeChunk(sound); } }
void PGE_Sounds::clearSoundBuffer() { Mix_HaltChannel(-1); for (QHash<QString, Mix_Chunk* >::iterator it=chunksBuffer.begin(); it!=chunksBuffer.end(); ++it) { Mix_FreeChunk((*it)); } chunksBuffer.clear(); Mix_ReserveChannels(0); }
void audio::cleanup() { Mix_HaltChannel(-1); Mix_HaltMusic(); free_music(); if (sfact != NULL) delete sfact; Mix_CloseAudio(); SDL_QuitSubSystem(SDL_INIT_AUDIO); }
void soundLib::stop_repeated_sfx() { //std::cout << ">>>>>> soundLib::stop_repeated_sfx._repeated_sfx_channel: " << _repeated_sfx_channel << std::endl; if (_repeated_sfx_channel == -1) { return; } Mix_HaltChannel(_repeated_sfx_channel); _repeated_sfx = -1; _repeated_sfx_channel = -1; }
void snd_halt_chan(int han, int ms) { if (han >= MIX_CHANNELS) han %= MIX_CHANNELS; if (ms) Mix_FadeOutChannel(han, ms); else { Mix_HaltChannel(han); } }
int JukeBox::StopAll() const { if (!m_init) return 0; const Config* cfg = Config::GetConstInstance(); if (!cfg->GetSoundMusic() && !cfg->GetSoundEffects()) return 0; // halt playback on all channels return Mix_HaltChannel(-1); }
void SD_StopDigitized(void) { DigiPlaying = false; DigiPriority = 0; SoundPositioned = false; if ((DigiMode == sds_PC) && (SoundMode == sdm_PC)) SDL_SoundFinished(); Mix_HaltChannel(-1); }
void LevelScene::collectGarbagePlayers() { QVector<LVL_Player *> stillVizible;//Avoid camera crash (which uses a cached render list) while(!dead_players.isEmpty()) { LVL_Player *corpse = dead_players.last(); dead_players.pop_back(); if(corpse->isInRenderList()) { stillVizible.push_back(corpse);//Avoid camera crash (which uses a cached render list) continue; } LVL_Player::deathReason reason = corpse->kill_reason; #if (QT_VERSION >= 0x050400) players.removeAll(corpse); #else //He-he, it's a great workaround for a Qt less than 5.4 which has QVector without removeAll() function while(1) { const QVector<LVL_Player *>::const_iterator ce = players.cend(), cit = std::find(players.cbegin(), ce, corpse); if (cit == ce) break; const QVector<LVL_Player *>::iterator e = players.end(), it = std::remove(players.begin() + (cit - players.cbegin()), e, corpse); players.erase(it, e); break; } #endif luaEngine.destoryLuaPlayer(corpse); switch(reason) { case LVL_Player::deathReason::DEAD_burn: case LVL_Player::deathReason::DEAD_fall: case LVL_Player::deathReason::DEAD_killed: if(players.size() > 0) PGE_Audio::playSoundByRole(obj_sound_role::PlayerDied); else { Mix_HaltChannel(-1); PGE_Audio::playSoundByRole(obj_sound_role::LevelFailed); } break; } if(reason==LVL_Player::deathReason::DEAD_burn) PGE_Audio::playSoundByRole(obj_sound_role::NpcLavaBurn); } dead_players.append(stillVizible); if(players.isEmpty()) { PGE_MusPlayer::MUS_stopMusic(); setExiting(4000, LvlExit::EXIT_PlayerDeath); } }
void SDLSoundManager::play(SoundManager::SoundID sid, std::string channel, FPoint pos, bool loop) { SoundMapIterator it; VirtualChannelMapIterator vcit = channels.end(); if (!sid || !AUDIO || !SOUND_VOLUME) return; it = sounds.find(sid); if (it == sounds.end()) return; /* create playback object and start playback of sound chunk */ Playback p; p.sid = sid; p.location = pos; p.virtual_channel = channel; p.loop = loop; p.finished = false; if (p.virtual_channel != GLOBAL_VIRTUAL_CHANNEL) { /* if playback exists, stop it befor playin next sound */ vcit = channels.find(p.virtual_channel); if (vcit != channels.end()) Mix_HaltChannel(vcit->second); vcit = channels.insert(std::pair<std::string, int>(p.virtual_channel, -1)).first; } // Let playback own a reference to prevent unloading playbacked sound. if (!loop) it->second->refCnt++; Mix_ChannelFinished(&channel_finished); int c = Mix_PlayChannel(-1, it->second->chunk, (loop ? -1 : 0)); if (c == -1) logError("SoundManager: Failed to play sound, no more channels available."); // precalculate mixing volume if sound has a location Uint8 d = 0; if (p.location.x != 0 || p.location.y != 0) { float v = 255.0f * (calcDist(lastPos, p.location) / (SOUND_FALLOFF)); clamp(v, 0.f, 255.f); d = Uint8(v); } Mix_SetPosition(c, 0, d); if (vcit != channels.end()) vcit->second = c; playback.insert(std::pair<int, Playback>(c, p)); }
void ChannelInternalState::Halt() { if (IsStream()) { #ifdef PINDROP_MULTISTREAM Mix_HaltMusicCh(channel_id_); #else Mix_HaltMusic(); #endif // PINDROP_MULTISTREAM } else { Mix_HaltChannel(channel_id_); } }
void cAudio_Sound :: Stop( void ) { // if not loaded or not playing if( !m_data || m_channel < 0 ) { return; } Mix_HaltChannel( m_channel ); m_channel = -1; }
void Sound_Quit() { int i; if (SoundEnabled) { Mix_HaltChannel(-1); for (i=0; i<SFX_CNT; i++) Mix_FreeChunk(SfxData[i]); Mix_CloseAudio(); } }
static void I_SDL_StopSound(int handle) { if (!sound_initialized) return; Mix_HaltChannel(handle); // Sound data is no longer needed; release the // sound data being used for this channel ReleaseSoundOnChannel(handle); }
void SDLMixerSource::stop() { if (channel == -1) return; // TODO bool oldfollow = followview; setFollowingView(false); // unregister in backend followview = oldfollow; Mix_HaltChannel(channel); channel = -1; }
/* Halt playing of a particular group of channels */ int Mix_HaltGroup(int tag) { int i; for ( i=0; i<num_channels; ++i ) { if( mix_channel[i].tag == tag ) { Mix_HaltChannel(i); } } return(0); }
SoundEffect::~SoundEffect() { if (channel != -1) Mix_HaltChannel(channel); if (enabled) Mix_FreeChunk(sound); if (--loadCount == 0) Mix_CloseAudio(); }