22 #ifndef FIFE_SOUNDEMITTER_H_
23 #define FIFE_SOUNDEMITTER_H_
30 #include <boost/function.hpp>
36 #include "util/time/timeevent.h"
38 #include "soundclip.h"
48 typedef boost::function0<void> type_callback;
66 alSourcei(m_source, AL_SOURCE_RELATIVE, relative ? AL_TRUE : AL_FALSE);
74 alSourcef (m_source, AL_ROLLOFF_FACTOR, rolloff);
98 void reset(
bool defaultall =
false);
120 alSourcePause(m_source);
129 alSourcef(m_source, AL_GAIN, gain);
138 alGetSourcef(m_source, AL_GAIN, &tmp);
157 return m_soundclip->
getDecoder()->getBitResolution();
166 return m_soundclip->
getDecoder()->getSampleRate();
175 return m_soundclip->
getDecoder()->getDecodedLength();
185 double samplerate =
static_cast<double>(
getSampleRate()) / 1000.0;
188 double stereo = (
isStereo() ? 2.0 : 1.0);
189 double time = ( size / (samplerate * bitres) ) / stereo;
191 return static_cast<uint64_t
>(time);
207 alSource3f(m_source, AL_POSITION, x, y, z);
213 alSource3f(m_source, AL_VELOCITY, x, y, z);
219 virtual void updateEvent(uint32_t time);
223 void attachSoundClip();
225 SoundManager* m_manager;
228 uint32_t m_soundclipid;
230 uint32_t m_emitterid;
232 type_callback m_callback;