]> git.mxchange.org Git - simgear.git/commitdiff
Actually enable looping for a sample queue
authorErik Hofman <erik@ehofman.com>
Mon, 2 Aug 2010 09:43:53 +0000 (11:43 +0200)
committerErik Hofman <erik@ehofman.com>
Mon, 2 Aug 2010 09:43:53 +0000 (11:43 +0200)
simgear/sound/sample_group.cxx
simgear/sound/sample_queue.cxx
simgear/sound/sample_queue.hxx

index 99a5a0eb3689fa40b398e97d0fe3ad98f08d8b69..26da0f937f8bce37e787d967025474150ae8d642 100644 (file)
@@ -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 );
index a7eeac1aa12e8ae3b3bed185a81a5b42a5ee6100..a367ed25355cb6cfa6c09cf5ab6ea2e7785eb4b0 100644 (file)
@@ -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)
 {
index 32d49d3eb74010214a559e7a2681d5a940242ab6..3d2c46a861d2d47cda53dc1c21d8feba1da322cc 100644 (file)
@@ -144,6 +144,7 @@ private:
     float _master_volume;
     float _reference_dist;
     float _max_dist;
+    bool _loop;
 
     bool _playing;
     bool _changed;