KDvoid SimpleAudioEngine::stopAllEffects ( KDvoid )
{
	for (SoundList::iterator it = l_aEffectList.begin(); it != l_aEffectList.end(); it++)
	{
		if (it->second)
		{
			xmSoundStop(it->second);
		}
	}
}
Ejemplo n.º 2
0
SoundBuffer::~SoundBuffer()
{
    // To prevent the iterator from becoming invalid, move the entire buffer to another
    // container. Otherwise calling resetBuffer would result in detachSound being
    // called which removes the sound from the internal list.
    SoundList sounds;
    sounds.swap(m_sounds);

    // Detach the buffer from the sounds that use it (to avoid OpenAL errors)
    for (SoundList::const_iterator it = sounds.begin(); it != sounds.end(); ++it)
        (*it)->resetBuffer();
}
SimpleAudioEngine::~SimpleAudioEngine ( KDvoid )
{
	for ( SoundList::iterator it = l_aMusicList.begin ( ); it != l_aMusicList.end ( ); it++ )
	{
		if ( it->second )
		{
			xmSoundClose ( it->second );
			it->second = nullptr;
		}
	}
	l_aMusicList.clear ( );

	for ( SoundList::iterator it = l_aEffectList.begin ( ); it != l_aEffectList.end ( ); it++ )
	{
		if ( it->second )
		{
			xmSoundClose ( it->second );
			it->second = nullptr;
		}
	}
	l_aEffectList.clear ( );
}