fix sound buffer resource leak
Openal doesn't remove buffers unless they were disconnected form their source.
This commit is contained in:
@@ -113,6 +113,8 @@ void SGSampleGroup::update( double dt ) {
|
||||
sample->stop();
|
||||
if ( !sample->is_queue() ) {
|
||||
ALuint buffer = sample->get_buffer();
|
||||
// disconnect buffer from its source - otherwise it cannot be deleted
|
||||
alSourceUnqueueBuffers(sample->get_source(), 1, &buffer);
|
||||
alDeleteBuffers( 1, &buffer );
|
||||
testForALError("buffer remove");
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ public:
|
||||
/**
|
||||
* Request to stop playing the refered audio sample.
|
||||
* @param refname Reference name of the audio sample to stop
|
||||
* @return true if the audio sample exsists and is scheduled to stop
|
||||
* @return true if the audio sample exists and is scheduled to stop
|
||||
*/
|
||||
bool stop( const string& refname );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user