]> git.mxchange.org Git - flightgear.git/commitdiff
Assorted small soundsystem related fixes.
authorehofman <ehofman>
Tue, 20 Oct 2009 11:31:42 +0000 (11:31 +0000)
committerTim Moore <timoore@redhat.com>
Wed, 21 Oct 2009 14:27:45 +0000 (16:27 +0200)
src/ATCDCL/AIPlane.cxx
src/ATCDCL/ATC.cxx
src/Sound/beacon.cxx
src/Sound/morse.cxx

index eecc070d908a6ed8a2f4c1a51f1617afa11996f0..0706fe3675b7d9eca62b709fb7a26e61d5f1408a 100644 (file)
@@ -24,6 +24,7 @@
 #include <simgear/sound/soundmgr_openal.hxx>
 #include <math.h>
 #include <string>
+#include <memory>
 using std::string;
 
 
@@ -200,8 +201,9 @@ void FGAIPlane::Render(const string& refname, const float volume, bool repeating
        if(voice) {
            string buf = vPtr->WriteMessage((char*)pending_transmission.c_str(), voice);
            if(voice && (volume > 0.05)) {
+                std::auto_ptr<unsigned char> ptr( buf.c_str() );
                SGSoundSample* simple = 
-                   new SGSoundSample((unsigned char*)buf.c_str(), buf.length(), 8000 );
+                   new SGSoundSample(ptr, buf.length(), 8000 );
                 // TODO - at the moment the volume can't be changed 
                // after the transmission has started.
                simple->set_volume(volume);
index 480257bc71acb74e186bea2a0d0290b611aca5b5..9a8d1602882b10df304608c9d55e3b3f05198989 100644 (file)
@@ -25,6 +25,7 @@
 #include "ATC.hxx"
 
 #include <iostream>
+#include <memory>
 
 #include <simgear/sound/soundmgr_openal.hxx>
 #include <simgear/structure/exception.hxx>
@@ -237,8 +238,7 @@ void FGATC::Render(string& msg, const float volume,
 // >>> Beware: must pass a (new) object to the (add) method,
 // >>> because the (remove) method is going to do a (delete)
 // >>> whether that's what you want or not.
-                               std::auto_ptr<unsigned char> ptr;
-                                ptr.reset((unsigned char*) buf.c_str());
+                               std::auto_ptr<unsigned char> ptr( (unsigned char*)buf.c_str() );
                                SGSoundSample *simple = 
                                    new SGSoundSample(ptr,  buf.length(), 8000);
                                // TODO - at the moment the volume can't be changed 
index 6de5f46242ca16649f2be8242555e3d52d40d107..497cbf03277ee37a143b1aef485e50b5bb21a9e3 100644 (file)
@@ -21,6 +21,8 @@
 // $Id$
 
 
+#include <memory>
+
 #include "beacon.hxx"
 
 #include <simgear/structure/exception.hxx>
index c9195e78d7a5672b6d949488fcd80b0f1ed28703..0943b8a8613e50c50f0e54d98c1c84f01fee3d96 100644 (file)
@@ -21,6 +21,8 @@
 // $Id$
 
 
+#include <memory>
+
 #include <simgear/constants.h>
 
 #include "morse.hxx"