22#ifndef __SOUND_VOICEPLAYER_HXX
23#define __SOUND_VOICEPLAYER_HXX
31#include <simgear/props/props.hxx>
32#include <simgear/props/tiedpropertylist.hxx>
40# pragma warning( push )
41# pragma warning( disable: 4355 )
56 template <
class C,
class VT,
class DT>
64 : _obj(obj), _data(data), _getter(getter), _setter(setter) {}
69 return (_obj.*_getter)(_data);
71 return SGRawValue<VT>::DefaultValue();
77 (_obj.*_setter)(_data, value);
83 virtual SGRawValue<VT> *
clone ()
const
100 inline void tie (SGPropertyNode *node,
const SGRawValue<T> &raw_value)
106 inline void tie (SGPropertyNode *node,
107 const char *relative_path,
108 const SGRawValue<T> &raw_value)
110 Tie(node->getNode(relative_path,
true),raw_value);
136 virtual inline void play (
float volume) {}
148 SGSharedPtr<SGSoundSample> _sample;
152 SampleElement (SGSharedPtr<SGSoundSample> sample,
float volume = 1.0);
154 virtual void play (
float volume);
155 virtual void stop ();
171 : _duration(duration) {
silence =
true; }
173 virtual inline void play (
float volume) { start_time =
globals->get_sim_time_sec(); }
174 virtual inline bool is_playing () {
return globals->get_sim_time_sec() - start_time < _duration; }
184 :
element(NULL), player(_player), volume(1.0) {}
191 void stop (
bool now);
201 std::vector<Element *> elements;
202 std::vector<Element *>::iterator iter;
238 void play (Voice *_voice,
unsigned int flags = 0);
244 void stop (
unsigned int flags = 0);
249 void bind (SGPropertyNode *node,
const char* default_dir_prefix);
265 inline void tie (SGPropertyNode *node,
const char *
name, T *ptr)
267 properties_handler->
tie
268 (node, (std::string(
"speaker/") +
name).c_str(),
286 properties_handler(_properties_handler),
292 void bind (SGPropertyNode *node);
301 SGSharedPtr<SGSampleGroup>
_sgr;
304 std::map< std::string, SGSharedPtr<SGSoundSample> >
samples;
313 void append (Voice *
voice,
const char *sample_name);
320 template <
class T1,
class T2>
322 template <
class T1,
class T2,
class T3>
324 template <
class T1,
class T2,
class T3,
class T4>
void tie(SGPropertyNode *node, const char *relative_path, const SGRawValue< T > &raw_value)
void tie(SGPropertyNode *node, const SGRawValue< T > &raw_value)
void(C::* setter_t)(DT, VT)
virtual bool setValue(VT value)
virtual SGRawValue< VT > * clone() const
virtual VT getValue() const
RawValueMethodsData(C &obj, DT data, getter_t getter=0, setter_t setter=0)
VT(C::* getter_t)(DT) const
T get_property(T *ptr) const
Speaker(FGVoicePlayer *_player, PropertiesHandler *_properties_handler)
void set_property(T *ptr, T value)
void update_configuration()
void bind(SGPropertyNode *node)
virtual void play(float volume)
virtual void set_volume(float volume)
virtual bool is_playing()=0
SampleElement(SGSharedPtr< SGSoundSample > sample, float volume=1.0)
virtual bool is_playing()
virtual void set_volume(float volume)
virtual bool is_playing()
SilenceElement(double duration)
virtual void play(float volume)
void set_volume(float _volume)
void append(Element *_element)
Voice(FGVoicePlayer *_player)
SGSharedPtr< SGSampleGroup > _sgr
void make_voice(Voice **voice, T1 e1, T2 e2)
void make_voice(Voice **voice)
struct FGVoicePlayer::@054217056221357017171266312225347342161325347250 conf
void make_voice(Voice **voice, T1 e1, T2 e2, T3 e3, T4 e4)
void set_volume(float _volume)
void bind(SGPropertyNode *node, const char *default_dir_prefix)
SGSoundSample * get_sample(const char *name)
void append(Voice *voice, double silence)
void make_voice(Voice **voice, T1 e1)
void append(Voice *voice, Voice::Element *element)
void play(Voice *_voice, unsigned int flags=0)
std::map< std::string, SGSharedPtr< SGSoundSample > > samples
void make_voice(Voice **voice, T1 e1, T2 e2, T3 e3)
std::vector< Voice * > _voices
FGVoicePlayer(PropertiesHandler *properties_handler, std::string _dev_name)
void stop(unsigned int flags=0)