Make FGVoicePlayer.hxx not require sample_openal.hxx
This commit is contained in:
parent
7b8804bd40
commit
21d50b11f5
2 changed files with 30 additions and 6 deletions
|
@ -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 //////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -30,9 +30,9 @@
|
|||
|
||||
#include <simgear/props/props.hxx>
|
||||
#include <simgear/props/tiedpropertylist.hxx>
|
||||
#include <simgear/sound/sample_openal.hxx>
|
||||
|
||||
class SGSampleGroup;
|
||||
class SGSoundSample;
|
||||
|
||||
#include <Main/globals.hxx>
|
||||
|
||||
|
@ -149,13 +149,13 @@ public:
|
|||
float _volume;
|
||||
|
||||
public:
|
||||
inline SampleElement (SGSharedPtr<SGSoundSample> sample, float volume = 1.0)
|
||||
SampleElement (SGSharedPtr<SGSoundSample> 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);
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Reference in a new issue