fgTie("/radios/nav1/radials/selected", this,
&FGRadioStack::get_nav1_sel_radial,
&FGRadioStack::set_nav1_sel_radial);
- fgTie("/radios/nav1/on", this,
- &FGRadioStack::get_nav1_on_btn,
- &FGRadioStack::set_nav1_on_btn);
+ fgTie("/radios/nav1/volume", this,
+ &FGRadioStack::get_nav1_vol_btn,
+ &FGRadioStack::set_nav1_vol_btn);
fgTie("/radios/nav1/ident", this,
&FGRadioStack::get_nav1_ident_btn,
&FGRadioStack::set_nav1_ident_btn);
fgTie("/radios/nav2/radials/selected", this,
&FGRadioStack::get_nav2_sel_radial,
&FGRadioStack::set_nav2_sel_radial);
- fgTie("/radios/nav2/on", this,
- &FGRadioStack::get_nav2_on_btn,
- &FGRadioStack::set_nav2_on_btn);
+ fgTie("/radios/nav2/volume", this,
+ &FGRadioStack::get_nav2_vol_btn,
+ &FGRadioStack::set_nav2_vol_btn);
fgTie("/radios/nav2/ident", this,
&FGRadioStack::get_nav2_ident_btn,
&FGRadioStack::set_nav2_ident_btn);
&FGRadioStack::get_adf_alt_freq, &FGRadioStack::set_adf_alt_freq);
fgTie("/radios/adf/rotation", this,
&FGRadioStack::get_adf_rotation, &FGRadioStack::set_adf_rotation);
- fgTie("/radios/adf/on", this,
- &FGRadioStack::get_adf_on_btn,
- &FGRadioStack::set_adf_on_btn);
+ fgTie("/radios/adf/volume", this,
+ &FGRadioStack::get_adf_vol_btn,
+ &FGRadioStack::set_adf_vol_btn);
fgTie("/radios/adf/ident", this,
&FGRadioStack::get_adf_ident_btn,
&FGRadioStack::set_adf_ident_btn);
if ( nav1_valid && nav1_inrange ) {
// play station ident via audio system if on + ident,
// otherwise turn it off
- if ( nav1_on_btn && nav1_ident_btn ) {
+ if ( nav1_vol_btn > 0.1 && nav1_ident_btn ) {
+ FGSimpleSound *sound;
+ sound = globals->get_soundmgr()->find( "nav1-vor-ident" );
+ sound->set_volume( nav1_vol_btn * 0.3 );
+ sound = globals->get_soundmgr()->find( "nav1-dme-ident" );
+ sound->set_volume( nav1_vol_btn * 0.3 );
if ( nav1_last_time <
globals->get_time_params()->get_cur_time() - 30 ) {
nav1_last_time = globals->get_time_params()->get_cur_time();
if ( nav2_valid && nav2_inrange ) {
// play station ident via audio system if on + ident,
// otherwise turn it off
- if ( nav2_on_btn && nav2_ident_btn ) {
+ if ( nav2_vol_btn > 0.1 && nav2_ident_btn ) {
+ FGSimpleSound *sound;
+ sound = globals->get_soundmgr()->find( "nav2-vor-ident" );
+ sound->set_volume( nav2_vol_btn * 0.3 );
+ sound = globals->get_soundmgr()->find( "nav2-dme-ident" );
+ sound->set_volume( nav2_vol_btn * 0.3 );
if ( nav2_last_time <
globals->get_time_params()->get_cur_time() - 30 ) {
nav2_last_time = globals->get_time_params()->get_cur_time();
if ( adf_valid && adf_inrange ) {
// play station ident via audio system if on + ident,
// otherwise turn it off
- if ( adf_on_btn && adf_ident_btn ) {
+ if ( adf_vol_btn > 0.1 && adf_ident_btn ) {
+ FGSimpleSound *sound;
+ sound = globals->get_soundmgr()->find( "adf-ident" );
+ sound->set_volume( adf_vol_btn * 0.3 );
if ( adf_last_time <
globals->get_time_params()->get_cur_time() - 30 ) {
adf_last_time = globals->get_time_params()->get_cur_time();
double nav1_heading;
double nav1_target_gs;
double nav1_magvar;
- bool nav1_on_btn;
+ double nav1_vol_btn;
bool nav1_ident_btn;
string nav2_ident;
double nav2_heading;
double nav2_target_gs;
double nav2_magvar;
- bool nav2_on_btn;
+ double nav2_vol_btn;
bool nav2_ident_btn;
string adf_ident;
double adf_x;
double adf_y;
double adf_z;
- bool adf_on_btn;
+ double adf_vol_btn;
bool adf_ident_btn;
// model standard VOR/DME/TACAN service volumes as per AIM 1-1-8
inline void set_nav1_sel_radial( double radial ) {
nav1_sel_radial = radial; need_update = true;
}
- inline void set_nav1_on_btn( bool val ) { nav1_on_btn = val; }
+ inline void set_nav1_vol_btn( double val ) {
+ if ( val < 0.0 ) val = 0.0;
+ if ( val > 1.0 ) val = 1.0;
+ nav1_vol_btn = val;
+ }
inline void set_nav1_ident_btn( bool val ) { nav1_ident_btn = val; }
// NAV2 Setters
inline void set_nav2_sel_radial( double radial ) {
nav2_sel_radial = radial; need_update = true;
}
- inline void set_nav2_on_btn( bool val ) { nav2_on_btn = val; }
+ inline void set_nav2_vol_btn( double val ) {
+ if ( val < 0.0 ) val = 0.0;
+ if ( val > 1.0 ) val = 1.0;
+ nav2_vol_btn = val;
+ }
inline void set_nav2_ident_btn( bool val ) { nav2_ident_btn = val; }
// ADF Setters
}
inline void set_adf_alt_freq( double freq ) { adf_alt_freq = freq; }
inline void set_adf_rotation( double rot ) { adf_rotation = rot; }
- inline void set_adf_on_btn( bool val ) { adf_on_btn = val; }
+ inline void set_adf_vol_btn( double val ) {
+ if ( val < 0.0 ) val = 0.0;
+ if ( val > 1.0 ) val = 1.0;
+ adf_vol_btn = val;
+ }
inline void set_adf_ident_btn( bool val ) { adf_ident_btn = val; }
inline double get_nav1_magvar() const { return nav1_magvar; }
double get_nav1_heading_needle_deflection() const;
double get_nav1_gs_needle_deflection() const;
- inline bool get_nav1_on_btn() const { return nav1_on_btn; }
+ inline double get_nav1_vol_btn() const { return nav1_vol_btn; }
inline bool get_nav1_ident_btn() const { return nav1_ident_btn; }
inline bool get_nav2_inrange() const { return nav2_inrange; }
inline double get_nav2_magvar() const { return nav2_magvar; }
double get_nav2_heading_needle_deflection() const;
double get_nav2_gs_needle_deflection() const;
- inline bool get_nav2_on_btn() const { return nav2_on_btn; }
+ inline double get_nav2_vol_btn() const { return nav2_vol_btn; }
inline bool get_nav2_ident_btn() const { return nav2_ident_btn; }
inline bool get_adf_inrange() const { return adf_inrange; }
inline double get_adf_lon() const { return adf_lon; }
inline double get_adf_lat() const { return adf_lat; }
inline double get_adf_heading() const { return adf_heading; }
- inline bool get_adf_on_btn() const { return adf_on_btn; }
+ inline double get_adf_vol_btn() const { return adf_vol_btn; }
inline bool get_adf_ident_btn() const { return adf_ident_btn; }
};
// 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,
// 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 );
}
+// 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 ) {