int len;
unsigned char* buf = vPtr->WriteMessage((char*)pending_transmission.c_str(), len, voice);
if(voice) {
- SGSoundSample* simple = new SGSoundSample(buf, len, 8000);
+ SGSoundSample* simple = new SGSoundSample(buf, len, 8000, false);
// 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"));
int len;
unsigned char* buf = vPtr->WriteMessage((char*)msg.c_str(), len, voice);
if(voice) {
- SGSoundSample* simple = new SGSoundSample(buf, len, 8000);
+ SGSoundSample *simple
+ = new SGSoundSample(buf, len, 8000, false);
// 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;
+ free( rawSoundData );
+ delete SoundData;
}
// Load the two voice files - one containing the raw sound data (.wav) and one containing the word positions (.vce).
}
last_cg_offset = cg_offset;
- SG_LOG( SG_IO, SG_INFO, "before sending reset command." );
+ SG_LOG( SG_IO, SG_ALERT, "before sending reset command." );
if( fgGetBool("/sim/presets/onground") ) {
sprintf( cmd, "reset=ground" );
}
result = write_fifo( '1', pd1, cmd, strlen(cmd) );
- SG_LOG( SG_IO, SG_INFO, "Remote FDM init() finished." );
+ SG_LOG( SG_IO, SG_ALERT, "Remote FDM init() finished." );
#endif
}
sgVec3 source_pos_offset;
sgSubVec3( source_pos_offset,
view_location->get_view_pos(), acmodel_loc->get_view_pos() );
+ // cout << "pos all = " << source_pos_offset[0] << " " << source_pos_offset[1] << " " << source_pos_offset[2] << endl;
globals->get_soundmgr()->set_source_pos_all( source_pos_offset );
// set the velocity
sgSubVec3( source_vel, source_pos_offset, last_pos_offset );
sgScaleVec3( source_vel, delta_time_sec );
sgCopyVec3( last_pos_offset, source_pos_offset );
+ // cout << "vel = " << source_vel[0] << " " << source_vel[1] << " " << source_vel[2] << endl;
globals->get_soundmgr()->set_source_vel_all( source_vel );
// Right now we make a simplifying assumption that the listener is
// always positioned at the origin.
sgVec3 listener_pos;
sgSetVec3( listener_pos, 0.0, 0.0, 0.0 );
+ // cout << "listener = " << listener_pos[0] << " " << listener_pos[1] << " " << listener_pos[2] << endl;
globals->get_soundmgr()->set_listener_pos( listener_pos );
#endif
// master switches
fgSetBool( "/controls/engines/engine[0]/master-bat",
- switch_matrix[board][5][1] );
+ switch_matrix[board][4][1] );
fgSetBool( "/controls/engines/engine[1]/master-bat",
- switch_matrix[board][5][1] );
+ switch_matrix[board][4][1] );
fgSetBool( "/controls/engines/engine[0]/master-alt",
- switch_matrix[board][4][1] );
+ switch_matrix[board][5][1] );
fgSetBool( "/controls/engines/engine[1]/master-alt",
- switch_matrix[board][4][1] );
+ switch_matrix[board][5][1] );
fgSetBool( "/controls/switches/master-avionics",
switch_matrix[board][0][3] );
// constructor
-FGBeacon::FGBeacon() {
+FGBeacon::FGBeacon() :
+ inner(NULL),
+ middle(NULL),
+ outer(NULL)
+{
}
// destructor
FGBeacon::~FGBeacon() {
+ delete inner;
+ delete middle;
+ delete outer;
}
int len;
unsigned char *ptr;
+ unsigned char inner_buf[ INNER_SIZE ] ;
+ unsigned char middle_buf[ MIDDLE_SIZE ] ;
+ unsigned char outer_buf[ OUTER_SIZE ] ;
+
// Make inner marker beacon sound
len= (int)(INNER_DIT_LEN / 2.0 );
unsigned char inner_dit[INNER_DIT_LEN];
ptr += INNER_DIT_LEN;
}
- inner = new SGSoundSample( inner_buf, INNER_SIZE, BYTES_PER_SECOND );
+ inner = new SGSoundSample( inner_buf, INNER_SIZE, BYTES_PER_SECOND, false );
inner->set_reference_dist( 10.0 );
inner->set_max_dist( 20.0 );
ptr += MIDDLE_DIT_LEN;
memcpy( ptr, middle_dah, MIDDLE_DAH_LEN );
- middle = new SGSoundSample( middle_buf, MIDDLE_SIZE, BYTES_PER_SECOND );
+ middle = new SGSoundSample( middle_buf, MIDDLE_SIZE, BYTES_PER_SECOND,
+ false );
middle->set_reference_dist( 10.0 );
middle->set_max_dist( 20.0 );
ptr += OUTER_DAH_LEN;
memcpy( ptr, outer_dah, OUTER_DAH_LEN );
- outer = new SGSoundSample( outer_buf, OUTER_SIZE, BYTES_PER_SECOND );
+ outer = new SGSoundSample( outer_buf, OUTER_SIZE, BYTES_PER_SECOND, false );
outer->set_reference_dist( 10.0 );
outer->set_max_dist( 20.0 );
private:
- unsigned char inner_buf[ INNER_SIZE ] ;
- unsigned char middle_buf[ MIDDLE_SIZE ] ;
- unsigned char outer_buf[ OUTER_SIZE ] ;
-
SGSoundSample *inner;
SGSoundSample *middle;
SGSoundSample *outer;
// 4. create the simple sound and return
SGSoundSample *sample = new SGSoundSample( buffer, length,
- BYTES_PER_SECOND );
+ BYTES_PER_SECOND,
+ false );
+
+ // clean up the buffer
+ delete [] buffer;
+
sample->set_reference_dist( 10.0 );
sample->set_max_dist( 20.0 );