23#include <simgear/sg_inlines.h>
24#include <simgear/sound/sample_group.hxx>
31 _frequency(frequency_hz),
33 _interval(interval_secs),
40 auto soundManager =
globals->get_subsystem<SGSoundMgr>();
47 _sgr =
globals->get_subsystem<SGSoundMgr>()->find(
"avionics",
true);
48 _sgr->tie_to_listener();
51void AudioIdent::stop()
53 if (_sgr && _sgr->exists( _fx_name ) )
54 _sgr->stop( _fx_name );
58void AudioIdent::start()
64 _sgr->play_once(_fx_name);
73 SG_CLAMP_RANGE(volumeNorm, 0.0, 1.0);
74 SGSoundSample *sound = _sgr->find( _fx_name );
75 if ( sound != NULL ) {
76 sound->set_volume( volumeNorm );
92 if ((_ident == ident ) || (volumeNorm == 0))
102 if ( _sgr->exists( _fx_name ) )
103 _sgr->remove( _fx_name );
105 if (!ident.empty()) {
107 sound->set_volume( volumeNorm );
108 if (!_sgr->add( sound, _fx_name )) {
109 SG_LOG(SG_SOUND, SG_WARN,
"Failed to add sound '" << _fx_name <<
"' for ident '" << ident <<
"'" );
118 }
catch (sg_io_exception& e) {
119 SG_LOG(SG_SOUND, SG_ALERT, e.getFormattedMessage());
127 if( !_running || _interval < SGLimitsd::min() )
132 if( _timer < SGLimitsd::min() ) {
void setIdent(const std::string &ident, double volumeNorm)
void setVolumeNorm(double volumeNorm)
AudioIdent(const std::string &fx_name, const double interval_secs, const int frequency)
DMEAudioIdent(const std::string &fx_name)
SGSoundSample * make_ident(const std::string &id, const int freq=LO_FREQUENCY)
static FGMorse * instance()
LOCAudioIdent(const std::string &fx_name)
VORAudioIdent(const std::string &fx_name)