]> git.mxchange.org Git - simgear.git/blobdiff - simgear/sound/sample_queue.cxx
Remove the dependency on boost for STANDALONE mode
[simgear.git] / simgear / sound / sample_queue.cxx
index a367ed25355cb6cfa6c09cf5ab6ea2e7785eb4b0..4af91d7879502faae48299954a91ef5f9421d640 100644 (file)
@@ -1,3 +1,4 @@
+
 // queue.cxx -- Audio sample encapsulation class
 // 
 // Written by Curtis Olson, started April 2004.
 #  include <simgear_config.h>
 #endif
 
-#include <stdlib.h>    // rand()
+#include <cstdlib>     // rand()
+#include <cstring>
 
 #include <simgear/debug/logstream.hxx>
 #include <simgear/structure/exception.hxx>
 #include <simgear/misc/sg_path.hxx>
-#include <simgear/math/SGMath.hxx>
 
 #include "soundmgr_openal.hxx"
 #include "sample_queue.hxx"
+#include "soundmgr_openal_private.hxx"
 
+using std::string;
 
 //
 // SGSampleQueue
 
 // empty constructor
 SGSampleQueue::SGSampleQueue( int freq, int format ) :
-    _absolute_pos(SGVec3d::zeros()),
-    _relative_pos(SGVec3d::zeros()),
-    _direction(SGVec3d::zeros()),
-    _velocity(SGVec3f::zeros()),
-    _orientation(SGQuatd::zeros()),
-    _orivec(SGVec3f::zeros()),
-    _base_pos(SGVec3d::zeros()),
-    _rotation(SGQuatd::zeros()),
     _refname(random_string()),
-    _format(format),
-    _freq(freq),
-    _valid_source(false),
-    _source(SGSoundMgr::NO_SOURCE),
-    _inner_angle(360.0),
-    _outer_angle(360.0),
-    _outer_gain(0.0),
-    _pitch(1.0),
-    _volume(1.0),
-    _master_volume(1.0),
-    _reference_dist(500.0),
-    _max_dist(3000.0),
-    _loop(false),
-    _playing(false),
-    _changed(true)
+    _playing(false)
 {
+    _freq = freq;
+    _format = format;
     _buffers.clear();
 }
 
@@ -77,6 +60,7 @@ SGSampleQueue::~SGSampleQueue() {
 
 void SGSampleQueue::stop()
 {
+#ifdef ENABLE_SOUND
     ALint num;
     alGetSourcei(_source, AL_BUFFERS_PROCESSED, &num);
     for (int i=0; i<num; i++) {
@@ -85,13 +69,14 @@ void SGSampleQueue::stop()
         alDeleteBuffers(1, &buffer);
     }
     _buffers.clear();
-
+#endif
     _playing = false;
     _changed = true;
 }
 
 void SGSampleQueue::add( const void* smp_data, size_t len )
 {
+#ifdef ENABLE_SOUND
     const ALvoid *data = (const ALvoid *)smp_data;
     ALuint buffer;
     ALint num;
@@ -112,14 +97,13 @@ void SGSampleQueue::add( const void* smp_data, size_t len )
         alBufferData(buffer, _format, data, len, _freq);
         _buffers.push_back(buffer);
     }
+#endif
 }
 
 void SGSampleQueue::set_source( unsigned int sid )
 {
-    _source = sid;
-    _valid_source = true;
-    _changed = true;
-
+    SGSoundSample::set_source(sid);
+#ifdef ENABLE_SOUND
     ALuint num = _buffers.size();
     for (unsigned int i=0; i < num; i++)
     {
@@ -127,7 +111,7 @@ void SGSampleQueue::set_source( unsigned int sid )
         alSourceQueueBuffers(_source, 1, &buffer);
     }
     _buffers.clear();
-
+#endif
 }
 
 string SGSampleQueue::random_string() {