22 #ifndef FIFE_SOUNDEMITTER_H_
23 #define FIFE_SOUNDEMITTER_H_
30 #include <boost/function.hpp>
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);
138 alGetSourcef(
m_source, AL_GAIN, &tmp);
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);
void setGain(float gain)
Sets the gain of the emitter.
void reset(bool defaultall=false)
Reset the emitter, free all internal buffers.
bool isStereo() const
Tests if the audio data is stereo data or mono.
void setCallback(const type_callback &cb)
Sets the callback to use when the STREAM has finished being played.
void pause()
Pauses playing the audio file.
bool isStereo()
Tests if the audio data is stereo data or mono.
boost::function0< void > type_callback
void release()
Releases the emitter.
void setCursor(SoundPositionType type, float value)
Sets the cursor position in the audio file.
uint64_t getSampleRate()
Returns the sample rate.
Interface for events to be registered with TimeManager.
void setSoundClip(SoundClipPtr soundclip)
Sets the sound clip to be used by this emitter.
SoundPositionType
Different types of audio-file positions.
void attachSoundClip()
Internal function to attach a soundclip to the source.
void setPosition(float x, float y, float z)
Sets the position of the SoundEmitter in the virtual audio space.
void play()
Plays the associated audio file.
virtual uint64_t getDecodedLength() const =0
Returns the decoded length of the file in bytes.
int16_t getBitResolution() const
Returns the bit resolution.
uint32_t getId() const
Returns the emitter-id.
float getCursor(SoundPositionType type)
Returns the cursor position in the audio file.
void setLooping(bool loop)
Sets the playing mode.
int16_t getBitResolution()
Returns the bit resolution.
SoundDecoder * getDecoder() const
Returns the attached decoder.
uint64_t getSampleRate() const
Returns the sample rate.
float getGain()
Returns the gain of the emitter.
virtual void updateEvent(uint32_t time)
Implementation of the pure virtual function from TimeEvent to update streaming.
void setVelocity(float x, float y, float z)
Sets the velocity of the SoundEmitter in the virtual audio space.
uint64_t getDuration()
Returns the duration of the sound clip in milliseconds.
The class for playing audio files.
void setPositioning(bool relative)
Sets Positioning-Type Default is false.
uint64_t getDecodedLength()
Returns the length of the decoded length in bytes.
SoundClipPtr getSoundClip()
Get the current sound clip used by this emitter.
SoundEmitter(SoundManager *manager, uint32_t uid)
void stop()
Stops playing the audio file and rewinds to the beginning.
void setRolloff(float rolloff)
Sets the AL_ROLEOFF_FACTOR.