static void stopBackground(bool bReleaseData) { // The background music might have been already stopped // Stop request can come from // - stopBackgroundMusic(..) // - end(..) if (s_backgroundSource != AL_NONE) alSourceStop(s_backgroundSource); if (bReleaseData) { for (auto it = s_backgroundMusics.begin(); it != s_backgroundMusics.end(); ++it) { if (it->second->source == s_backgroundSource) { alDeleteSources(1, &it->second->source); checkALError("stopBackground:alDeleteSources"); alDeleteBuffers(1, &it->second->buffer); checkALError("stopBackground:alDeleteBuffers"); delete it->second; s_backgroundMusics.erase(it); break; } } } s_backgroundSource = AL_NONE; }
static void stopBackground(bool bReleaseData) { alSourceStop(s_backgroundSource); if (bReleaseData) { for (BackgroundMusicsMap::iterator it = s_backgroundMusics.begin(); it != s_backgroundMusics.end(); ++it) { if (it->second->source == s_backgroundSource) { alDeleteBuffers(1, &it->second->buffer); checkALError("stopBackground"); alDeleteSources(1, &it->second->source); checkALError("stopBackground"); delete it->second; s_backgroundMusics.erase(it); break; } } } s_backgroundSource = AL_NONE; }