opengl_LIBS="$LIBS"
LIBS="$base_LIBS"
+dnl check for OpenAL libraries
+case "${host}" in
+*)
+ dnl default unix style machines
+
+ AC_SEARCH_LIBS(alGenBuffers, openal)
+ ;;
+
+esac
+
+openal_LIBS="$LIBS"
+LIBS="$base_LIBS"
+
AC_SUBST(base_LIBS)
+AC_SUBST(openal_LIBS)
AC_SUBST(opengl_LIBS)
AC_SUBST(thread_LIBS)
AC_SUBST(network_LIBS)
#include <Main/fg_props.hxx>
#include <simgear/math/point3d.hxx>
#include <simgear/debug/logstream.hxx>
-#include <simgear/sound/soundmgr.hxx>
+#include <simgear/sound/soundmgr_openal.hxx>
#include <math.h>
#include <string>
SG_USING_STD(string);
int len;
unsigned char* buf = vPtr->WriteMessage((char*)pending_transmission.c_str(), len, voice);
if(voice) {
- SGSimpleSound* simple = new SGSimpleSound(buf, len);
+ SGSoundSample* simple = new SGSoundSample(buf, len, 8000);
// TODO - at the moment the volume is always set off comm1
// and can't be changed after the transmission has started.
simple->set_volume(5.0 * fgGetDouble("/radios/comm[0]/volume"));
# include <config.h>
#endif
-#include <simgear/sound/soundmgr.hxx>
+#include <simgear/sound/soundmgr_openal.hxx>
#include <Main/globals.hxx>
#include <Main/fg_props.hxx>
int len;
unsigned char* buf = vPtr->WriteMessage((char*)msg.c_str(), len, voice);
if(voice) {
- SGSimpleSound* simple = new SGSimpleSound(buf, len);
+ SGSoundSample* simple = new SGSoundSample(buf, len, 8000);
// TODO - at the moment the volume is always set off comm1
// and can't be changed after the transmission has started.
simple->set_volume(5.0 * fgGetDouble("/radios/comm[0]/volume"));
}
FGATCVoice::~FGATCVoice() {
- delete SoundData;
+ // delete SoundData;
}
// Load the two voice files - one containing the raw sound data (.wav) and one containing the word positions (.vce).
// Return true if successful.
bool FGATCVoice::LoadVoice(string voice) {
+ // FIXME CLO: disabled to try to see if this is causign problemcs
+ // return false;
+
ifstream fin;
SGPath path = globals->get_fg_root();
- string soundPath = "ATC/" + voice + ".wav";
- path.append(soundPath);
+ path.append( "ATC" );
+
+ string file = voice + ".wav";
- SoundData = new slSample( (char*)path.c_str() );
- rawDataSize = SoundData->getLength();
- rawSoundData = (char*)SoundData->getBuffer();
+ SoundData = new SGSoundSample( path.c_str(), file.c_str() );
+ rawDataSize = SoundData->get_size();
+ rawSoundData = SoundData->get_data();
path = globals->get_fg_root();
string wordPath = "ATC/" + voice + ".vce";
#ifndef _FG_ATC_VOICE
#define _FG_ATC_VOICE
-#include <plib/sl.h>
-
#include <simgear/compiler.h>
#if defined( SG_HAVE_STD_INCLUDES ) || defined( __BORLANDC__ ) || (__APPLE__)
#include <list>
#include <string>
+#include <simgear/sound/sample_openal.hxx>
+
SG_USING_STD(map);
SG_USING_STD(list);
SG_USING_STD(string);
// the sound and word position data
char* rawSoundData;
unsigned int rawDataSize;
- slSample* SoundData;
+ SGSoundSample *SoundData;
// A map of words vs. byte position and length in rawSoundData
atc_word_map_type wordMap;
// play station ident via audio system if on + ant mode,
// otherwise turn it off
if ( vol_btn >= 0.01 && audio_btn ) {
- SGSimpleSound *sound;
+ SGSoundSample *sound;
sound = globals->get_soundmgr()->find( "adf-ident" );
if ( sound != NULL ) {
if ( !adf_btn ) {
if ( globals->get_soundmgr()->exists( "adf-ident" ) ) {
globals->get_soundmgr()->remove( "adf-ident" );
}
- SGSimpleSound *sound;
+ SGSoundSample *sound;
sound = morse.make_ident( trans_ident, LO_FREQUENCY );
sound->set_volume( 0.3 );
globals->get_soundmgr()->add( sound, "adf-ident" );
// cout << "OUTER MARKER" << endl;
if ( last_beacon != FGMkrBeacon::OUTER ) {
if ( ! globals->get_soundmgr()->exists( "outer-marker" ) ) {
- SGSimpleSound *sound = beacon.get_outer();
+ SGSoundSample *sound = beacon.get_outer();
sound->set_volume( 0.3 );
globals->get_soundmgr()->add( sound, "outer-marker" );
}
// cout << "MIDDLE MARKER" << endl;
if ( last_beacon != FGMkrBeacon::MIDDLE ) {
if ( ! globals->get_soundmgr()->exists( "middle-marker" ) ) {
- SGSimpleSound *sound = beacon.get_middle();
+ SGSoundSample *sound = beacon.get_middle();
sound->set_volume( 0.3 );
globals->get_soundmgr()->add( sound, "middle-marker" );
}
// cout << "INNER MARKER" << endl;
if ( last_beacon != FGMkrBeacon::INNER ) {
if ( ! globals->get_soundmgr()->exists( "inner-marker" ) ) {
- SGSimpleSound *sound = beacon.get_inner();
+ SGSoundSample *sound = beacon.get_inner();
sound->set_volume( 0.3 );
globals->get_soundmgr()->add( sound, "inner-marker" );
}
if ( power_btn && (bus_power->getDoubleValue() > 1.0)
&& nav_ident_btn && audio_btn )
{
- SGSimpleSound *sound;
+ SGSoundSample *sound;
sound = globals->get_soundmgr()->find( nav_fx_name );
if ( sound != NULL ) {
sound->set_volume( nav_vol_btn );
if ( globals->get_soundmgr()->exists( nav_fx_name ) ) {
globals->get_soundmgr()->remove( nav_fx_name );
}
- SGSimpleSound *sound;
+ SGSoundSample *sound;
sound = morse.make_ident( nav_trans_ident, LO_FREQUENCY );
sound->set_volume( 0.3 );
globals->get_soundmgr()->add( sound, nav_fx_name );
if ( globals->get_soundmgr()->exists( nav_fx_name ) ) {
globals->get_soundmgr()->remove( nav_fx_name );
}
- SGSimpleSound *sound;
+ SGSoundSample *sound;
sound = morse.make_ident( nav_trans_ident, LO_FREQUENCY );
sound->set_volume( 0.3 );
if ( globals->get_soundmgr()->add( sound, nav_fx_name ) ) {
$(network_LIBS) \
-lz \
$(opengl_LIBS) \
- $(audio_LIBS)
+ $(openal_LIBS)
metar_SOURCES = metar_main.cxx
}
#endif
+#ifdef ENABLE_AUDIO_SUPPORT
+ ////////////////////////////////////////////////////////////////////
+ // Initialize the sound subsystem.
+ ////////////////////////////////////////////////////////////////////
+
+ globals->set_soundmgr(new SGSoundMgr);
+ globals->get_soundmgr()->init();
+ globals->get_soundmgr()->bind();
+
+
+ ////////////////////////////////////////////////////////////////////
+ // Initialize the sound-effects subsystem.
+ ////////////////////////////////////////////////////////////////////
+
+ globals->add_subsystem("fx", new FGFX);
+
+#endif
+
////////////////////////////////////////////////////////////////////
// Initialise ATC display system
////////////////////////////////////////////////////////////////////
globals->set_AI_mgr(new FGAIMgr);
globals->get_AI_mgr()->init();
-
////////////////////////////////////////////////////////////////////
// Initialise the AI Model Manager
////////////////////////////////////////////////////////////////////
globals->add_subsystem("ai_model", new FGAIManager);
-#ifdef ENABLE_AUDIO_SUPPORT
- ////////////////////////////////////////////////////////////////////
- // Initialize the sound subsystem.
- ////////////////////////////////////////////////////////////////////
-
- globals->set_soundmgr(new SGSoundMgr);
- globals->get_soundmgr()->init();
- globals->get_soundmgr()->bind();
-
-
- ////////////////////////////////////////////////////////////////////
- // Initialize the sound-effects subsystem.
- ////////////////////////////////////////////////////////////////////
-
- globals->add_subsystem("fx", new FGFX);
-
-#endif
-
globals->add_subsystem("instrumentation", new FGInstrumentMgr);
globals->add_subsystem("systems", new FGSystemMgr);
#include <simgear/timing/sg_time.hxx>
#include <simgear/misc/sg_path.hxx>
#include <simgear/scene/material/matlib.hxx>
-#include <simgear/sound/soundmgr.hxx>
+#include <simgear/sound/soundmgr_openal.hxx>
#include STL_IOSTREAM
ptr += INNER_DIT_LEN;
}
- inner = new SGSimpleSound( inner_buf, INNER_SIZE );
+ inner = new SGSoundSample( inner_buf, INNER_SIZE, BYTES_PER_SECOND );
// Make middle marker beacon sound
len= (int)(MIDDLE_DIT_LEN / 2.0 );
ptr += MIDDLE_DIT_LEN;
memcpy( ptr, middle_dah, MIDDLE_DAH_LEN );
- middle = new SGSimpleSound( middle_buf, MIDDLE_SIZE );
+ middle = new SGSoundSample( middle_buf, MIDDLE_SIZE, BYTES_PER_SECOND );
// Make outer marker beacon sound
len= (int)(OUTER_DAH_LEN * 3.0 / 4.0 );
ptr += OUTER_DAH_LEN;
memcpy( ptr, outer_dah, OUTER_DAH_LEN );
- outer = new SGSimpleSound( outer_buf, OUTER_SIZE );
+ outer = new SGSoundSample( outer_buf, OUTER_SIZE, BYTES_PER_SECOND );
return true;
}
#endif
#include <simgear/compiler.h>
-#include <simgear/sound/soundmgr.hxx>
+#include <simgear/sound/soundmgr_openal.hxx>
#include <plib/sl.h>
#include <plib/sm.h>
unsigned char middle_buf[ MIDDLE_SIZE ] ;
unsigned char outer_buf[ OUTER_SIZE ] ;
- SGSimpleSound *inner;
- SGSimpleSound *middle;
- SGSimpleSound *outer;
+ SGSoundSample *inner;
+ SGSoundSample *middle;
+ SGSoundSample *outer;
public:
// allocate and initialize sound samples
bool init();
- SGSimpleSound *get_inner() { return inner; }
- SGSimpleSound *get_middle() { return middle; }
- SGSimpleSound *get_outer() { return outer; }
+ SGSoundSample *get_inner() { return inner; }
+ SGSoundSample *get_middle() { return middle; }
+ SGSoundSample *get_outer() { return outer; }
};
#endif
#include <simgear/misc/sg_path.hxx>
#include <simgear/props/props.hxx>
-#include <simgear/sound/sound.hxx>
+#include <simgear/sound/xmlsound.hxx>
#include <Main/fg_props.hxx>
node = root.getNode("fx");
for (i = 0; i < node->nChildren(); i++) {
- SGSound *sound = new SGSound();
+ SGXmlSound *sound = new SGXmlSound();
sound->init(globals->get_props(), node->getChild(i),
globals->get_soundmgr(), globals->get_fg_root());
#include <simgear/structure/subsystem_mgr.hxx>
-class SGSound;
+class SGXmlSound;
/**
* Generator for FlightGear sound effects.
private:
- vector<SGSound *> _sound;
+ vector<SGXmlSound *> _sound;
};
int i, j;
for ( i = 0; i < trans_len; ++i ) {
- float level = ( sin( (double) i * 2.0 * SGD_PI / (8000.0 / freq) ) )
+ float level = ( sin( (double) i * 2.0 * SGD_PI / (BYTES_PER_SECOND / freq) ) )
* ((double)i / trans_len) / 2.0 + 0.5;
/* Convert to unsigned byte */
}
for ( i = trans_len; i < len - trans_len; ++i ) {
- float level = ( sin( (double) i * 2.0 * SGD_PI / (8000.0 / freq) ) )
+ float level = ( sin( (double) i * 2.0 * SGD_PI / (BYTES_PER_SECOND / freq) ) )
/ 2.0 + 0.5;
/* Convert to unsigned byte */
}
j = trans_len;
for ( i = len - trans_len; i < len; ++i ) {
- float level = ( sin( (double) i * 2.0 * SGD_PI / (8000.0 / freq) ) )
+ float level = ( sin( (double) i * 2.0 * SGD_PI / (BYTES_PER_SECOND / freq) ) )
* ((double)j / trans_len) / 2.0 + 0.5;
--j;
}
-// make a SGSimpleSound morse code transmission for the specified string
-SGSimpleSound *FGMorse::make_ident( const string& id, const int freq ) {
+// make a SGSoundSample morse code transmission for the specified string
+SGSoundSample *FGMorse::make_ident( const string& id, const int freq ) {
char *idptr = (char *)id.c_str();
int length = 0;
buf_ptr += SPACE_SIZE;
// 4. create the simple sound and return
- SGSimpleSound *sample = new SGSimpleSound( buffer, length );
+ SGSoundSample *sample = new SGSoundSample( buffer, length,
+ BYTES_PER_SECOND );
return sample;
}
#endif
#include <simgear/compiler.h>
-#include <simgear/sound/soundmgr.hxx>
-
-#include <plib/sl.h>
-#include <plib/sm.h>
+#include <simgear/sound/soundmgr_openal.hxx>
// Quoting from http://www.kluft.com/~ikluft/ham/morse-intro.html by
static const char DAH = '2';
static const char end = '0';
-static const int BYTES_PER_SECOND = 8000;
+static const int BYTES_PER_SECOND = 22050;
// static const int BEAT_LENGTH = 240; // milleseconds (5 wpm)
static const int BEAT_LENGTH = 92; // milleseconds (13 wpm)
static const int TRANSITION_BYTES = (int)(0.005 * BYTES_PER_SECOND);
bool init();
// make a SimpleSound morse code transmission for the specified string
- SGSimpleSound *make_ident( const string& id,
- const int freq = LO_FREQUENCY );
+ SGSoundSample *make_ident( const string& id,
+ const int freq = LO_FREQUENCY );
};