Slightly rearrange the buffer removing code. This should make sure the source is always stopped (required by the OpenAL spec) before a buffer is removed and added to the free source list.

This commit is contained in:
Erik Hofman 2011-11-23 09:41:13 +01:00
parent 0a08ee836c
commit 3c9fec78fa

View File

@ -94,12 +94,19 @@ void SGSampleGroup::update( double dt ) {
ALint result = AL_STOPPED;
if ( sample->is_valid_source() ) {
int source = sample->get_source();
alGetSourcei( source, AL_SOURCE_STATE, &result );
if ( sample->is_looping() ) {
sample->no_valid_source();
_smgr->release_source( sample->get_source() );
if ( result != AL_STOPPED ) {
alSourceStop( source );
alGetSourcei( source, AL_SOURCE_STATE, &result );
}
if ( result == AL_STOPPED ) {
sample->no_valid_source();
_smgr->release_source( sample->get_source() );
}
}
else
alGetSourcei( sample->get_source(), AL_SOURCE_STATE, &result );
}
if ( result == AL_STOPPED ) {