1
0
Fork 0

Assorted small soundsystem related fixes.

This commit is contained in:
ehofman 2009-10-20 11:31:42 +00:00 committed by Tim Moore
parent e2678830ba
commit 6e2974ea57
4 changed files with 9 additions and 3 deletions

View file

@ -24,6 +24,7 @@
#include <simgear/sound/soundmgr_openal.hxx> #include <simgear/sound/soundmgr_openal.hxx>
#include <math.h> #include <math.h>
#include <string> #include <string>
#include <memory>
using std::string; using std::string;
@ -200,8 +201,9 @@ void FGAIPlane::Render(const string& refname, const float volume, bool repeating
if(voice) { if(voice) {
string buf = vPtr->WriteMessage((char*)pending_transmission.c_str(), voice); string buf = vPtr->WriteMessage((char*)pending_transmission.c_str(), voice);
if(voice && (volume > 0.05)) { if(voice && (volume > 0.05)) {
std::auto_ptr<unsigned char> ptr( buf.c_str() );
SGSoundSample* simple = 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 // TODO - at the moment the volume can't be changed
// after the transmission has started. // after the transmission has started.
simple->set_volume(volume); simple->set_volume(volume);

View file

@ -25,6 +25,7 @@
#include "ATC.hxx" #include "ATC.hxx"
#include <iostream> #include <iostream>
#include <memory>
#include <simgear/sound/soundmgr_openal.hxx> #include <simgear/sound/soundmgr_openal.hxx>
#include <simgear/structure/exception.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, // >>> Beware: must pass a (new) object to the (add) method,
// >>> because the (remove) method is going to do a (delete) // >>> because the (remove) method is going to do a (delete)
// >>> whether that's what you want or not. // >>> whether that's what you want or not.
std::auto_ptr<unsigned char> ptr; std::auto_ptr<unsigned char> ptr( (unsigned char*)buf.c_str() );
ptr.reset((unsigned char*) buf.c_str());
SGSoundSample *simple = SGSoundSample *simple =
new SGSoundSample(ptr, buf.length(), 8000); new SGSoundSample(ptr, buf.length(), 8000);
// TODO - at the moment the volume can't be changed // TODO - at the moment the volume can't be changed

View file

@ -21,6 +21,8 @@
// $Id$ // $Id$
#include <memory>
#include "beacon.hxx" #include "beacon.hxx"
#include <simgear/structure/exception.hxx> #include <simgear/structure/exception.hxx>

View file

@ -21,6 +21,8 @@
// $Id$ // $Id$
#include <memory>
#include <simgear/constants.h> #include <simgear/constants.h>
#include "morse.hxx" #include "morse.hxx"