43 m_emitterid(uid), m_loop(false) {
72 alSourcei(
m_source, AL_BUFFER, AL_NONE);
89 alSourcei(
m_source, AL_LOOPING, AL_FALSE);
122 alSourcei(
m_source, AL_LOOPING, AL_FALSE);
133 alGetSourcei(
m_source, AL_BUFFERS_PROCESSED, &procs);
136 alSourceUnqueueBuffers(
m_source, 1, &buffer);
147 alGetSourcei(
m_source, AL_BUFFERS_QUEUED, &bufs);
158 alSourceQueueBuffers(
m_source, 1, &buffer);
167 alSourcei(
m_source, AL_LOOPING, loop ? AL_TRUE : AL_FALSE);
169 alSourcei(
m_source, AL_LOOPING, AL_FALSE);
207 alSourcef(
m_source, AL_BYTE_OFFSET, value);
210 alSourcef(
m_source, AL_SAMPLE_OFFSET, value);
213 alSourcef(
m_source, AL_SEC_OFFSET, value);
220 alGetSourcei(
m_source, AL_SOURCE_STATE, &state);
222 if (state == AL_PLAYING || AL_PAUSED) {
236 if (state == AL_PLAYING) {
254 alGetSourcef(
m_source, AL_BYTE_OFFSET, &pos);
257 alGetSourcef(
m_source, AL_SAMPLE_OFFSET, &pos);
260 alGetSourcef(
m_source, AL_SEC_OFFSET, &pos);
bool getStream(uint32_t streamid, ALuint buffer)
Refill a processed buffer with new data.
void setGain(float gain)
Sets the gain of the emitter.
void registerEvent(TimeEvent *event)
Adds a TimeEvent.
void reset(bool defaultall=false)
Reset the emitter, free all internal buffers.
void reset(T *ptr=0)
reset this pointer to a null shared pointer this can be used to lower the reference count of the shar...
void setCallback(const type_callback &cb)
Sets the callback to use when the STREAM has finished being played.
static Logger _log(LM_AUDIO)
#define CHECK_OPENAL_LOG(logger, level, msg)
bool isStream() const
Does this SoundClip require a streaming mechanism?
bool isActive() const
Returns true if audio module is active.
static TimeManager * instance()
boost::function0< void > type_callback
void release()
Releases the emitter.
void setCursor(SoundPositionType type, float value)
Sets the cursor position in the audio file.
void unregisterEvent(TimeEvent *event)
Removes a TimeEvent.
void acquireStream(uint32_t streamid)
Fills the streaming-buffers with initial data.
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.
float getCursor(SoundPositionType type)
Returns the cursor position in the audio file.
float getStreamPos(uint32_t streamid, SoundPositionType type) const
Gets the stream position.
void setLooping(bool loop)
Sets the playing mode.
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.
void setPeriod(int32_t period)
Set the period of the event.
void quitStreaming(uint32_t streamid)
Quits Streaming.
void setPositioning(bool relative)
Sets Positioning-Type Default is false.
ALuint * getBuffers(uint32_t streamid=0) const
Returns the array of buffers for queuing.
uint32_t countBuffers() const
Returns the number of buffers used by the SoundClip (only for non-streaming sound clips) ...
SoundEmitter(SoundManager *manager, uint32_t uid)
void stop()
Stops playing the audio file and rewinds to the beginning.
ResourceHandle getHandle()
bool setStreamPos(uint32_t streamid, SoundPositionType type, float value)
Sets the stream position.
uint32_t beginStreaming()
Starts streaming the soundclip.
void releaseEmitter(uint32_t emitterid)
Release an emitter-instance given by emitter-id.