#include <simgear/props/props.hxx>
#include <simgear/props/tiedpropertylist.hxx>
-#include <simgear/sound/sample_openal.hxx>
class SGSampleGroup;
+class SGSoundSample;
#include <Main/globals.hxx>
float _volume;
public:
- inline 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); }
+ SampleElement (SGSharedPtr<SGSoundSample> sample, float volume = 1.0);
+
+ virtual void play (float volume);
+ virtual void stop ();
+ virtual bool is_playing ();
+ virtual void set_volume (float volume);
};
/////////////////////////////////////////////////////////////////////////
SGSoundSample *get_sample (const char *name);
inline void append (Voice *voice, Voice::Element *element) { voice->append(element); }
- inline void append (Voice *voice, const char *sample_name) { voice->append(new Voice::SampleElement(get_sample(sample_name))); }
+ void append (Voice *voice, const char *sample_name);
inline void append (Voice *voice, double silence) { voice->append(new Voice::SilenceElement(silence)); }
inline void make_voice (Voice **voice) { *voice = new Voice(this); _voices.push_back(*voice); }