From: Erik Hofman Date: Mon, 2 Aug 2010 09:43:53 +0000 (+0200) Subject: Actually enable looping for a sample queue X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=879dc295a89adea906ed8aac7d82cb35c8ee346c;p=simgear.git Actually enable looping for a sample queue --- diff --git a/simgear/sound/sample_group.cxx b/simgear/sound/sample_group.cxx index 99a5a0eb..26da0f93 100644 --- a/simgear/sound/sample_group.cxx +++ b/simgear/sound/sample_group.cxx @@ -134,13 +134,14 @@ void SGSampleGroup::update( double dt ) { ALuint source = _smgr->request_source(); if (alIsSource(source) == AL_TRUE ) { + ALboolean looping = sample->is_looping() ? AL_TRUE : AL_FALSE; if ( sample->is_queue() ) { sample->set_source( source ); update_sample_config( sample ); alSourcef( source, AL_ROLLOFF_FACTOR, 0.3 ); - alSourcei( source, AL_LOOPING, AL_FALSE); + alSourcei( source, AL_LOOPING, looping ); alSourcei( source, AL_SOURCE_RELATIVE, AL_FALSE ); alSourcePlay( source ); testForALError("sample play"); @@ -154,15 +155,12 @@ void SGSampleGroup::update( double dt ) { ALuint buffer = sample->get_buffer(); if ( alIsBuffer(buffer) == AL_TRUE ) { - ALboolean looping; - alSourcei( source, AL_BUFFER, buffer ); testForALError("assign buffer to source"); sample->set_source( source ); update_sample_config( sample ); - looping = sample->is_looping() ? AL_TRUE : AL_FALSE; alSourcei( source, AL_LOOPING, looping ); alSourcef( source, AL_ROLLOFF_FACTOR, 0.3 ); alSourcei( source, AL_SOURCE_RELATIVE, AL_FALSE ); diff --git a/simgear/sound/sample_queue.cxx b/simgear/sound/sample_queue.cxx index a7eeac1a..a367ed25 100644 --- a/simgear/sound/sample_queue.cxx +++ b/simgear/sound/sample_queue.cxx @@ -64,6 +64,7 @@ SGSampleQueue::SGSampleQueue( int freq, int format ) : _master_volume(1.0), _reference_dist(500.0), _max_dist(3000.0), + _loop(false), _playing(false), _changed(true) { diff --git a/simgear/sound/sample_queue.hxx b/simgear/sound/sample_queue.hxx index 32d49d3e..3d2c46a8 100644 --- a/simgear/sound/sample_queue.hxx +++ b/simgear/sound/sample_queue.hxx @@ -144,6 +144,7 @@ private: float _master_volume; float _reference_dist; float _max_dist; + bool _loop; bool _playing; bool _changed;