diff --git a/src/Sound/voiceplayer.cxx b/src/Sound/voiceplayer.cxx index 365be7a95..de178b70e 100644 --- a/src/Sound/voiceplayer.cxx +++ b/src/Sound/voiceplayer.cxx @@ -61,6 +61,30 @@ using std::vector; #define test_bits(_bits, _test) (((_bits) & (_test)) != 0) +///////////////////////////////////////////////////////////////////////// +// FGVoicePlayer::Voice::SampleElement /////////////////////////// +///////////////////////////////////////////////////////////////////////// + +void FGVoicePlayer::Voice::SampleElement::play (float volume) +{ + if (_sample && (volume > 0.05)) { set_volume(volume); _sample->play_once(); } +} + +void FGVoicePlayer::Voice::SampleElement::stop () +{ + if (_sample) _sample->stop(); +} + +bool FGVoicePlayer::Voice::SampleElement::is_playing () +{ + return _sample ? _sample->is_playing() : false; +} + +void FGVoicePlayer::Voice::SampleElement::set_volume (float volume) +{ + if (_sample) _sample->set_volume(volume * _volume); +} + /////////////////////////////////////////////////////////////////////////////// // FGVoicePlayer ////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// diff --git a/src/Sound/voiceplayer.hxx b/src/Sound/voiceplayer.hxx index 92ed2502f..be5e7765b 100644 --- a/src/Sound/voiceplayer.hxx +++ b/src/Sound/voiceplayer.hxx @@ -30,9 +30,9 @@ #include #include -#include class SGSampleGroup; +class SGSoundSample; #include
@@ -149,13 +149,13 @@ public: float _volume; public: - inline SampleElement (SGSharedPtr sample, float volume = 1.0) + SampleElement (SGSharedPtr sample, float volume = 1.0) : _sample(sample), _volume(volume) { silence = false; } - virtual inline void play (float volume) { if (_sample && (volume > 0.05)) { set_volume(volume); _sample->play_once(); } } - virtual inline void stop () { if (_sample) _sample->stop(); } - virtual inline bool is_playing () { return _sample ? _sample->is_playing() : false; } - virtual inline void set_volume (float volume) { if (_sample) _sample->set_volume(volume * _volume); } + virtual void play (float volume); + virtual void stop (); + virtual bool is_playing (); + virtual void set_volume (float volume); }; /////////////////////////////////////////////////////////////////////////