]> git.mxchange.org Git - simgear.git/commitdiff
Rename update() to update_late() for the sound manager to be able to initialize it...
authorehofman <ehofman>
Mon, 5 Oct 2009 08:56:40 +0000 (08:56 +0000)
committerTim Moore <timoore@redhat.com>
Tue, 6 Oct 2009 05:22:06 +0000 (07:22 +0200)
simgear/sound/sample_group.cxx
simgear/sound/sample_group.hxx
simgear/sound/soundmgr_openal.cxx
simgear/sound/soundmgr_openal.hxx

index ffa23e680262dad8875340d69d38a157aac736fa..c01b0cbb64d8aa41bb12f6c2087e4574640f9c5e 100644 (file)
@@ -62,6 +62,7 @@ SGSampleGroup::SGSampleGroup ( SGSoundMgr *smgr, const string &refname ) :
 {
     _smgr->add(this, refname);
     _active = _smgr->is_working();
+    _refname = refname;
     _samples.clear();
 }
 
@@ -434,7 +435,7 @@ bool SGSampleGroup::testForALError(string s)
 {
     ALenum error = alGetError();
     if (error != AL_NO_ERROR)  {
-       SG_LOG( SG_GENERAL, SG_ALERT, "AL Error (sample group): "
+       SG_LOG( SG_GENERAL, SG_ALERT, "AL Error (" << _refname << "): "
                                       << alGetString(error) << " at " << s);
        return true;
     }
index 3e277014f0c39b93cde67d35d163bbd8e189f8c5..d9c279229b75161d77eb357c04e0bfbafe23cb85 100644 (file)
@@ -174,6 +174,8 @@ private:
     bool testForALError(string s);
     bool testForError(void *p, string s);
 
+    string _refname;
+
     void update_sample_config( SGSoundSample *sound );
 };
 
index 543960e063c39d93a3be4d865dad7182237d480e..ac2d8352d8fba8a7d8dc0d546a7bb848726e6441 100644 (file)
@@ -194,9 +194,15 @@ void SGSoundMgr::unbind ()
     _sources_in_use.clear();
 }
 
+void SGSoundMgr::update( double dt )
+{
+    // nothing to do in the regular update,e verything is done on the following
+    // function
+}
+
 
 // run the audio scheduler
-void SGSoundMgr::update( double dt ) {
+void SGSoundMgr::update_late( double dt ) {
     if (_working) {
         sample_group_map_iterator sample_grp_current = _sample_groups.begin();
         sample_group_map_iterator sample_grp_end = _sample_groups.end();
@@ -334,7 +340,7 @@ void SGSoundMgr::release_source( unsigned int source )
             if ( result == AL_PLAYING ) {
                 alSourceStop( source );
             }
-            testForALError("free_source");
+            testForALError("release source");
 
             _free_sources.push_back(source);
             _sources_in_use.erase(_sources_in_use.begin()+i,
index 9610905741127772be01c33c237abb4ff91dcdef..2c40eecaf5a4e448bbd91826484598da459cb44b 100644 (file)
@@ -80,6 +80,7 @@ public:
     void bind();
     void unbind();
     void update(double dt);
+    void update_late(double dt);
     
     void suspend();
     void resume();
@@ -157,8 +158,8 @@ public:
      */
     void release_source( unsigned int source );
 
-    bool load(string &samplepath, void **data, int *format, unsigned int*size,
-                                  int *freq );
+    static bool load(string &samplepath, void **data, int *format,
+                                         unsigned int*size, int *freq );
 
 
 private: