void SimpleAudioEngine::end() { checkALError("end"); // clear all the sounds EffectsMap::const_iterator end = s_effects.end(); for (EffectsMap::iterator it = s_effects.begin(); it != end; it++) { alSourceStop(it->second->source); checkALError("end"); alDeleteBuffers(1, &it->second->buffer); checkALError("end"); alDeleteSources(1, &it->second->source); checkALError("end"); delete it->second; } s_effects.clear(); // and the background too stopBackground(true); for (BackgroundMusicsMap::iterator it = s_backgroundMusics.begin(); it != s_backgroundMusics.end(); ++it) { alSourceStop(it->second->source); checkALError("end"); alDeleteBuffers(1, &it->second->buffer); checkALError("end"); alDeleteSources(1, &it->second->source); checkALError("end"); delete it->second; } s_backgroundMusics.clear(); }
void SimpleAudioEngine::end() { checkALError("end:init"); // clear all the sound effects EffectsMap::const_iterator end = s_effects.end(); for (auto it = s_effects.begin(); it != end; ++it) { alSourceStop(it->second->source); checkALError("end:alSourceStop"); alDeleteSources(1, &it->second->source); checkALError("end:alDeleteSources"); alDeleteBuffers(1, &it->second->buffer); checkALError("end:alDeleteBuffers"); delete it->second; } s_effects.clear(); // and the background music too stopBackground(true); for (auto it = s_backgroundMusics.begin(); it != s_backgroundMusics.end(); ++it) { alSourceStop(it->second->source); checkALError("end:alSourceStop"); alDeleteSources(1, &it->second->source); checkALError("end:alDeleteSources"); alDeleteBuffers(1, &it->second->buffer); checkALError("end:alDeleteBuffers"); delete it->second; } s_backgroundMusics.clear(); CC_SAFE_DELETE(s_engine); }
void SimpleAudioEngine::end() { // clear all the sounds EffectsMap::const_iterator end = s_effects.end(); for (EffectsMap::iterator it = s_effects.begin(); it != end; it++) { Mix_FreeChunk(it->second->chunk); delete it->second; } s_effects.clear(); // and the background too stopBackground(true); for (BackgroundMusicsMap::iterator it = s_backgroundMusics.begin(); it != s_backgroundMusics.end(); ++it) { Mix_FreeMusic(it->second->music); delete it->second; } s_backgroundMusics.clear(); }