- SGSoundSample *sound = _sgr->find( nav_fx_name );
- double vol = vol_btn_node->getFloatValue();
- SG_CLAMP_RANGE(vol, 0.0, 1.0);
-
- if ( sound != NULL ) {
- sound->set_volume( vol );
- } else {
- SG_LOG( SG_COCKPIT, SG_ALERT, "Can't find nav-vor-ident sound" );
- }
-
- sound = _sgr->find( dme_fx_name );
- if ( sound != NULL ) {
- sound->set_volume( vol );
- } else {
- SG_LOG( SG_COCKPIT, SG_ALERT, "Can't find nav-dme-ident sound" );
- }
-
- const int NUM_IDENT_SLOTS = 5;
- const time_t SLOT_LENGTH = 5; // seconds
-
- // There are N slots numbered 0 through (NUM_IDENT_SLOTS-1) inclusive.
- // Each slot is 5 seconds long.
- // Slots 0 is for DME
- // the rest are for azimuth.
- time_t now = globals->get_time_params()->get_cur_time();
- if ((now >= last_time) && (now < last_time + SLOT_LENGTH)) {
- return; // wait longer
- }
-
- last_time = now;
- play_count = ++play_count % NUM_IDENT_SLOTS;
-
- // Previous ident is out of time; if still playing, cut it off:
- _sgr->stop( nav_fx_name );
- _sgr->stop( dme_fx_name );
- if (play_count == 0) { // the DME slot
- if (_dmeInRange && dme_serviceable_node->getBoolValue()) {
- // play DME ident
- if (vol > 0.05) _sgr->play_once( dme_fx_name );
- }
- } else { // NAV slot
- if (inrange_node->getBoolValue() && nav_serviceable_node->getBoolValue()) {
- if (vol > 0.05) _sgr->play_once(nav_fx_name);
- }
- }