]> git.mxchange.org Git - flightgear.git/blobdiff - src/Sound/soundmgr.cxx
MSVC fixes.
[flightgear.git] / src / Sound / soundmgr.cxx
index 24d3154b61d4f1e59d81234f496df6eee4b0a223..8903da4f97690ac30fa90b0ea74b37ae8a90cd2e 100644 (file)
@@ -135,8 +135,8 @@ bool FGSoundMgr::remove( const string& refname ) {
        // audio scheduler)
        FGSimpleSound *sample = it->second;
 
-       cout << "Playing "
-            << sample->get_sample()->getPlayCount() << " instances!" << endl;
+       // cout << "Playing " << sample->get_sample()->getPlayCount()
+       //      << " instances!" << endl;
 
        audio_sched->stopSample( sample->get_sample() );
        audio_sched->addSampleEnvelope( sample->get_sample(), 0, 0, 
@@ -146,8 +146,8 @@ bool FGSoundMgr::remove( const string& refname ) {
                                        NULL,
                                        SL_VOLUME_ENVELOPE );
 
-#if defined ( PLIB_AUDIO_IS_BROKEN )
-       // if PLIB_AUDIO_IS_BROKEN, we can't reliably remove sounds
+#if defined ( PLIB_1_2_X )
+       // if PLIB_1_2_X, we can't reliably remove sounds
        // that are currently being played. :-( So, let's just not
        // remove them and return false.  The effects of this are that
        // the sound sample will continue to finish playing (or
@@ -158,15 +158,15 @@ bool FGSoundMgr::remove( const string& refname ) {
        // are you going to do?  Hopefully the plib team will do a new
        // stable relase with these problems fixed.
 
-       cout << "plib broken audio, skipping actual remove" << endl;
+       // cout << "plib broken audio, skipping actual remove" << endl;
 
        return false;
 #else
        // must call audio_sched->update() after stopping the sound
        // but before deleting it.
        audio_sched -> update();
-       cout << "Still playing "
-            << sample->get_sample()->getPlayCount() << " instances!" << endl;
+       // cout << "Still playing " << sample->get_sample()->getPlayCount()
+       //      << " instances!" << endl;
 
        delete sample;
         sounds.erase( it );
@@ -190,6 +190,18 @@ bool FGSoundMgr::exists( const string& refname ) {
 }
 
 
+// return a pointer to the FGSimpleSound if the specified sound exists
+// in the sound manager system, otherwise return NULL
+FGSimpleSound *FGSoundMgr::find( const string& refname ) {
+    sound_map_iterator it = sounds.find( refname );
+    if ( it != sounds.end() ) {
+       return it->second;
+   } else {
+       return NULL;
+    }
+}
+
+
 // tell the scheduler to play the indexed sample in a continuous
 // loop
 bool FGSoundMgr::play_looped( const string& refname ) {
@@ -212,7 +224,7 @@ bool FGSoundMgr::play_looped( const string& refname ) {
 
 
 // tell the scheduler to play the indexed sample once
-bool FGSoundMgr::FGSoundMgr::play_once( const string& refname ) {
+bool FGSoundMgr::play_once( const string& refname ) {
     sound_map_iterator it = sounds.find( refname );
     if ( it != sounds.end() ) {
        FGSimpleSound *sample = it->second;