FIFE
be64c707dea6b3250bd4355bf5c825d25920087d
|
The class for playing audio files. More...
#include <soundemitter.h>
Classes | |
struct | internData |
buffers OpenAL data More... | |
Public Member Functions | |
SoundEmitter (SoundManager *manager, uint32_t uid) | |
~SoundEmitter () | |
void | setSource (ALuint source) |
Sets openAl-source. More... | |
ALuint | getSource () const |
Return openAl-source. More... | |
bool | isActive () const |
Return if the Emitter is active / have an openAl-source. More... | |
void | update () |
Called once a frame from the SoundManager. More... | |
uint32_t | getId () const |
Returns the emitter-id. More... | |
void | setRelativePositioning (bool relative) |
Sets Positioning-Type Default is false. More... | |
bool | isRelativePositioning () const |
Return Positioning-Type. More... | |
void | setReferenceDistance (float distance) |
Sets the distance under which the volume for the SoundEmitter would normally drop by half (before being influenced by rolloff factor or max distance. More... | |
float | getReferenceDistance () const |
Return the reference distance. More... | |
void | setMaxDistance (float distance) |
Sets the max distance used with the Inverse Clamped Distance Model to set the distance where there will no longer be any attenuation of the source. More... | |
float | getMaxDistance () const |
Return the max distance. More... | |
void | setRolloff (float rolloff) |
Sets the AL_ROLEOFF_FACTOR. More... | |
float | getRolloff () const |
Return the AL_ROLEOFF_FACTOR. More... | |
void | setSoundClip (SoundClipPtr soundClip) |
Sets the sound clip to be used by this emitter. More... | |
SoundClipPtr | getSoundClip () |
Get the current sound clip used by this emitter. More... | |
void | setSoundClip (const std::string &name) |
Sets the sound clip to be used by this emitter. More... | |
void | reset (bool defaultall=false) |
Reset the emitter, free all internal buffers. More... | |
void | release () |
Releases the emitter. More... | |
void | setLooping (bool loop) |
Sets the playing mode. More... | |
bool | isLooping () const |
Return playing mode. More... | |
void | play () |
Plays the associated audio file. More... | |
void | play (float inTime, float outTime) |
Plays the associated audio file with fade in and / or out. More... | |
void | stop () |
Stops playing the audio file and rewinds to the beginning. More... | |
void | stop (float time) |
Stops playing the audio file after time with fade out. More... | |
void | pause () |
Pauses playing the audio file. More... | |
void | rewind () |
Rewinds the associated audio file. More... | |
void | setGain (float gain) |
Sets the gain of the emitter. More... | |
float | getGain () const |
Returns the gain of the emitter. More... | |
void | setMaxGain (float gain) |
Sets the max. More... | |
float | getMaxGain () const |
Returns the max. More... | |
void | setMinGain (float gain) |
Sets the min. More... | |
float | getMinGain () const |
Returns the min. More... | |
bool | isStereo () |
Tests if the audio data is stereo data or mono. More... | |
int16_t | getBitResolution () |
Returns the bit resolution. More... | |
uint64_t | getSampleRate () |
Returns the sample rate. More... | |
uint64_t | getDecodedLength () |
Returns the length of the decoded length in bytes. More... | |
uint64_t | getDuration () |
Returns the duration of the sound clip in milliseconds. More... | |
uint32_t | getPlayTimestamp () |
Returns timestamp of the last play start in milliseconds. More... | |
bool | isFinished () |
Returns true if clip is finished. More... | |
void | setCursor (SoundPositionType type, float value) |
Sets the cursor position in the audio file. More... | |
float | getCursor (SoundPositionType type) |
Returns the cursor position in the audio file. More... | |
void | setPosition (const AudioSpaceCoordinate &position) |
Sets the position of the SoundEmitter in the virtual audio space. More... | |
AudioSpaceCoordinate | getPosition () const |
Return the position of the SoundEmitter in the virtual audio space. More... | |
bool | isPosition () const |
Return if it is a positional SoundEmitter. More... | |
void | setDirection (const AudioSpaceCoordinate &direction) |
Sets the direction of the SoundEmitter in the virtual audio space. More... | |
AudioSpaceCoordinate | getDirection () const |
Return the direction of the SoundEmitter in the virtual audio space. More... | |
void | setPitch (float pitch) |
Sets pitch multiplier. More... | |
float | getPitch () const |
Return pitch multiplier. More... | |
void | setVelocity (const AudioSpaceCoordinate &velocity) |
Sets the velocity of the SoundEmitter in the virtual audio space. More... | |
AudioSpaceCoordinate | getVelocity () const |
Return the velocity of the SoundEmitter in the virtual audio space. More... | |
void | setConeInnerAngle (float inner) |
Sets inner angle of the sound cone, in degrees. More... | |
float | getConeInnerAngle () const |
Return inner angle of the sound cone, in degrees. More... | |
void | setConeOuterAngle (float outer) |
Sets outer angle of the sound cone, in degrees. More... | |
float | getConeOuterAngle () const |
Return outer angle of the sound cone, in degrees. More... | |
void | setConeOuterGain (float gain) |
Sets the gain when outside the oriented cone. More... | |
float | getConeOuterGain () const |
Return the gain when outside the oriented cone. More... | |
SoundStateType | getState () |
Returns the state of the audio file. More... | |
void | setGroup (const std::string &group) |
Sets the group name. More... | |
const std::string & | getGroup () |
Return the group name. More... | |
void | addEffect (SoundEffect *effect) |
Adds effect. More... | |
void | removeEffect (SoundEffect *effect) |
Removes effect. More... | |
uint8_t | getEffectCount () |
Return the number of effects. More... | |
uint8_t | getEffectNumber (SoundEffect *effect) |
Return the number of the given effect. More... | |
void | setDirectFilter (SoundFilter *filter) |
Sets the direct filter. More... | |
SoundFilter * | getDirectFilter () |
Return the direct filter. More... | |
void | activateEffects () |
Activates effects if the Emitter got the openAL-source. More... | |
void | deactivateEffects () |
Deactivates effects if the Emitter loses the openAL-source. More... | |
void | setCheckDifference () |
Sets the time difference between play and the first check if it's playable. More... | |
void | addListener (SoundEmitterListener *listener) |
Adds new SoundEmitter listener. More... | |
void | removeListener (SoundEmitterListener *listener) |
Removes associated SoundEmitter listener. More... | |
Private Member Functions | |
void | attachSoundClip () |
Internal function to attach a SoundClip to the source. More... | |
void | detachSoundClip () |
Internal function to detach a SoundClip from the source. More... | |
void | syncData () |
Updates OpenAL with collected data. More... | |
void | checkFade () |
Updates fade in and out. More... | |
void | resetInternData () |
Resets collected data to defaults. More... | |
void | callOnSoundFinished () |
Calls the Listeners if a sound finished. More... | |
Private Attributes | |
SoundManager * | m_manager |
Access to the SoundManager. More... | |
ALuint | m_source |
The openAL-source. More... | |
SoundFilter * | m_directFilter |
Applied direct sound filter. More... | |
SoundClipPtr | m_soundClip |
The attached sound clip. More... | |
uint32_t | m_soundClipId |
Id of the attached sound clip. More... | |
uint32_t | m_streamId |
The id of the stream. More... | |
uint32_t | m_emitterId |
The emitter-id. More... | |
struct FIFE::SoundEmitter::internData | m_internData |
std::string | m_group |
the group name More... | |
float | m_samplesOffset |
saves sample offset for played stream parts More... | |
bool | m_active |
is active More... | |
bool | m_fadeIn |
fade in clip More... | |
bool | m_fadeOut |
fade out clip More... | |
float | m_origGain |
original gain More... | |
uint32_t | m_fadeInStartTimestamp |
fade in start time More... | |
uint32_t | m_fadeInEndTimestamp |
fade in end time More... | |
uint32_t | m_fadeOutStartTimestamp |
fade out start time More... | |
uint32_t | m_fadeOutEndTimestamp |
fade out end time More... | |
uint32_t | m_playCheckDifference |
time difference between play and first check More... | |
std::vector< SoundEffect * > | m_effects |
holds pointer to applied SoundEffects More... | |
std::vector< SoundEmitterListener * > | m_listeners |
listeners for sound related events More... | |
The class for playing audio files.
Definition at line 70 of file soundemitter.h.
FIFE::SoundEmitter::SoundEmitter | ( | SoundManager * | manager, |
uint32_t | uid | ||
) |
Definition at line 44 of file soundemitter.cpp.
References FIFE::SoundManager::isActive(), m_manager, and resetInternData().
FIFE::SoundEmitter::~SoundEmitter | ( | ) |
Definition at line 71 of file soundemitter.cpp.
References FIFE::SoundManager::isActive(), m_manager, and reset().
void FIFE::SoundEmitter::activateEffects | ( | ) |
Activates effects if the Emitter got the openAL-source.
Definition at line 853 of file soundemitter.cpp.
References FIFE::SoundManager::activateEffect(), FIFE::SoundManager::activateFilter(), m_directFilter, m_effects, and m_manager.
Referenced by setSource().
void FIFE::SoundEmitter::addEffect | ( | SoundEffect * | effect | ) |
Adds effect.
Used from SoundEffectManager.
Definition at line 801 of file soundemitter.cpp.
References m_effects.
Referenced by FIFE::SoundEffectManager::addEmitterToSoundEffect().
void FIFE::SoundEmitter::addListener | ( | SoundEmitterListener * | listener | ) |
Adds new SoundEmitter listener.
listener | to add |
Definition at line 881 of file soundemitter.cpp.
References m_listeners.
|
private |
Internal function to attach a SoundClip to the source.
Definition at line 283 of file soundemitter.cpp.
References FIFE::_log, FIFE::SoundClip::acquireStream(), FIFE::SoundClip::beginStreaming(), FIFE::BUFFER_NUM, CHECK_OPENAL_LOG, FIFE::SoundClip::countBuffers(), FIFE::SoundClip::getBuffers(), isActive(), FIFE::SoundClip::isStream(), FIFE::LogManager::LEVEL_ERROR, FIFE::SoundEmitter::internData::loop, m_internData, m_soundClip, m_source, and m_streamId.
Referenced by setSoundClip(), and syncData().
|
private |
Calls the Listeners if a sound finished.
Definition at line 898 of file soundemitter.cpp.
References m_emitterId, m_listeners, and m_soundClipId.
Referenced by stop().
|
private |
Updates fade in and out.
Definition at line 775 of file soundemitter.cpp.
References FIFE::TimeManager::getTime(), FIFE::DynamicSingleton< TimeManager >::instance(), m_fadeIn, m_fadeInEndTimestamp, m_fadeInStartTimestamp, m_fadeOut, m_fadeOutEndTimestamp, m_fadeOutStartTimestamp, m_origGain, setGain(), and stop().
Referenced by update().
void FIFE::SoundEmitter::deactivateEffects | ( | ) |
Deactivates effects if the Emitter loses the openAL-source.
Definition at line 864 of file soundemitter.cpp.
References FIFE::SoundManager::deactivateEffect(), FIFE::SoundManager::deactivateFilter(), m_directFilter, m_effects, and m_manager.
Referenced by setSource().
|
private |
Internal function to detach a SoundClip from the source.
Definition at line 307 of file soundemitter.cpp.
References FIFE::_log, CHECK_OPENAL_LOG, getState(), isActive(), FIFE::SoundClip::isStream(), FIFE::LogManager::LEVEL_ERROR, m_soundClip, m_soundClipId, m_source, m_streamId, FIFE::SoundClip::quitStreaming(), FIFE::SharedPtr< T >::reset(), FIFE::SD_PAUSED_STATE, FIFE::SD_PLAYING_STATE, and stop().
Referenced by setSoundClip().
int16_t FIFE::SoundEmitter::getBitResolution | ( | ) |
Returns the bit resolution.
Definition at line 454 of file soundemitter.cpp.
References FIFE::SoundDecoder::getBitResolution(), FIFE::SoundClip::getDecoder(), and m_soundClip.
Referenced by getCursor(), getDuration(), and setCursor().
float FIFE::SoundEmitter::getConeInnerAngle | ( | ) | const |
Return inner angle of the sound cone, in degrees.
Definition at line 657 of file soundemitter.cpp.
References FIFE::SoundEmitter::internData::coneInnerAngle, and m_internData.
float FIFE::SoundEmitter::getConeOuterAngle | ( | ) | const |
Return outer angle of the sound cone, in degrees.
Definition at line 668 of file soundemitter.cpp.
References FIFE::SoundEmitter::internData::coneOuterAngle, and m_internData.
float FIFE::SoundEmitter::getConeOuterGain | ( | ) | const |
Return the gain when outside the oriented cone.
Definition at line 679 of file soundemitter.cpp.
References FIFE::SoundEmitter::internData::coneOuterGain, and m_internData.
float FIFE::SoundEmitter::getCursor | ( | SoundPositionType | type | ) |
Returns the cursor position in the audio file.
Definition at line 563 of file soundemitter.cpp.
References FIFE::_log, CHECK_OPENAL_LOG, getBitResolution(), getSampleRate(), isActive(), isStereo(), FIFE::SoundClip::isStream(), FIFE::LogManager::LEVEL_ERROR, m_samplesOffset, m_soundClip, m_source, FIFE::SD_BYTE_POS, FIFE::SD_SAMPLE_POS, and FIFE::SD_TIME_POS.
Referenced by play().
uint64_t FIFE::SoundEmitter::getDecodedLength | ( | ) |
Returns the length of the decoded length in bytes.
Definition at line 468 of file soundemitter.cpp.
References FIFE::SoundDecoder::getDecodedLength(), FIFE::SoundClip::getDecoder(), and m_soundClip.
Referenced by getDuration().
SoundFilter * FIFE::SoundEmitter::getDirectFilter | ( | ) |
Return the direct filter.
Used from SoundEffectManager.
Definition at line 849 of file soundemitter.cpp.
References m_directFilter.
Referenced by FIFE::SoundEffectManager::addEmitterToDirectSoundFilter().
AudioSpaceCoordinate FIFE::SoundEmitter::getDirection | ( | ) | const |
Return the direction of the SoundEmitter in the virtual audio space.
Definition at line 181 of file soundemitter.cpp.
References FIFE::SoundEmitter::internData::direction, and m_internData.
uint64_t FIFE::SoundEmitter::getDuration | ( | ) |
Returns the duration of the sound clip in milliseconds.
Definition at line 475 of file soundemitter.cpp.
References getBitResolution(), getDecodedLength(), getSampleRate(), isStereo(), and m_soundClip.
Referenced by isFinished(), play(), and syncData().
uint8_t FIFE::SoundEmitter::getEffectCount | ( | ) |
Return the number of effects.
Used from SoundEffectManager.
Definition at line 824 of file soundemitter.cpp.
References m_effects.
Referenced by FIFE::SoundEffectManager::addEmitterToSoundEffect().
uint8_t FIFE::SoundEmitter::getEffectNumber | ( | SoundEffect * | effect | ) |
Return the number of the given effect.
Used from SoundEffectManager.
Definition at line 834 of file soundemitter.cpp.
References m_effects.
Referenced by FIFE::SoundEffectManager::activateEffect(), and FIFE::SoundEffectManager::deactivateEffect().
float FIFE::SoundEmitter::getGain | ( | ) | const |
Returns the gain of the emitter.
Definition at line 421 of file soundemitter.cpp.
References m_internData, and FIFE::SoundEmitter::internData::volume.
const std::string & FIFE::SoundEmitter::getGroup | ( | ) |
Return the group name.
Definition at line 720 of file soundemitter.cpp.
References m_group.
Referenced by FIFE::SoundManager::addToGroup(), and FIFE::SoundManager::removeFromGroup().
uint32_t FIFE::SoundEmitter::getId | ( | ) | const |
Returns the emitter-id.
Definition at line 158 of file soundemitter.cpp.
References m_emitterId.
Referenced by FIFE::SoundManager::deleteEmitter(), and FIFE::SoundSource::~SoundSource().
float FIFE::SoundEmitter::getMaxDistance | ( | ) | const |
Return the max distance.
Definition at line 635 of file soundemitter.cpp.
References m_internData, and FIFE::SoundEmitter::internData::maxDistance.
float FIFE::SoundEmitter::getMaxGain | ( | ) | const |
Returns the max.
gain of the emitter
Definition at line 432 of file soundemitter.cpp.
References m_internData, and FIFE::SoundEmitter::internData::maxVolume.
float FIFE::SoundEmitter::getMinGain | ( | ) | const |
Returns the min.
gain of the emitter
Definition at line 443 of file soundemitter.cpp.
References m_internData, and FIFE::SoundEmitter::internData::minVolume.
float FIFE::SoundEmitter::getPitch | ( | ) | const |
Return pitch multiplier.
Can only be positiv.
Definition at line 194 of file soundemitter.cpp.
References m_internData, and FIFE::SoundEmitter::internData::pitch.
uint32_t FIFE::SoundEmitter::getPlayTimestamp | ( | ) |
Returns timestamp of the last play start in milliseconds.
Definition at line 490 of file soundemitter.cpp.
References m_internData, and FIFE::SoundEmitter::internData::playTimestamp.
AudioSpaceCoordinate FIFE::SoundEmitter::getPosition | ( | ) | const |
Return the position of the SoundEmitter in the virtual audio space.
Definition at line 608 of file soundemitter.cpp.
References m_internData, and FIFE::SoundEmitter::internData::position.
Referenced by FIFE::SoundManager::update().
float FIFE::SoundEmitter::getReferenceDistance | ( | ) | const |
Return the reference distance.
Definition at line 624 of file soundemitter.cpp.
References m_internData, and FIFE::SoundEmitter::internData::refDistance.
float FIFE::SoundEmitter::getRolloff | ( | ) | const |
Return the AL_ROLEOFF_FACTOR.
Rolloff factor judges the strength of attenuation over distance.
Definition at line 205 of file soundemitter.cpp.
References m_internData, and FIFE::SoundEmitter::internData::rolloff.
uint64_t FIFE::SoundEmitter::getSampleRate | ( | ) |
Returns the sample rate.
Definition at line 461 of file soundemitter.cpp.
References FIFE::SoundClip::getDecoder(), FIFE::SoundDecoder::getSampleRate(), and m_soundClip.
Referenced by getCursor(), getDuration(), and setCursor().
SoundClipPtr FIFE::SoundEmitter::getSoundClip | ( | ) |
Get the current sound clip used by this emitter.
Definition at line 274 of file soundemitter.cpp.
References m_soundClip.
Referenced by FIFE::SoundManager::update().
ALuint FIFE::SoundEmitter::getSource | ( | ) | const |
Return openAl-source.
Definition at line 99 of file soundemitter.cpp.
References m_source.
Referenced by FIFE::SoundEffectManager::activateEffect(), FIFE::SoundEffectManager::activateFilter(), FIFE::SoundEffectManager::deactivateEffect(), and FIFE::SoundEffectManager::deactivateFilter().
SoundStateType FIFE::SoundEmitter::getState | ( | ) |
Returns the state of the audio file.
Definition at line 683 of file soundemitter.cpp.
References isActive(), m_internData, m_source, FIFE::SD_INITIAL_STATE, FIFE::SD_PAUSED_STATE, FIFE::SD_PLAYING_STATE, FIFE::SD_STOPPED_STATE, FIFE::SD_UNKNOWN_STATE, and FIFE::SoundEmitter::internData::soundState.
Referenced by detachSoundClip(), isFinished(), play(), setCheckDifference(), and update().
AudioSpaceCoordinate FIFE::SoundEmitter::getVelocity | ( | ) | const |
Return the velocity of the SoundEmitter in the virtual audio space.
Definition at line 646 of file soundemitter.cpp.
References m_internData, and FIFE::SoundEmitter::internData::velocity.
bool FIFE::SoundEmitter::isActive | ( | ) | const |
Return if the Emitter is active / have an openAl-source.
Definition at line 103 of file soundemitter.cpp.
References m_active.
Referenced by FIFE::SoundEffectManager::addEmitterToDirectSoundFilter(), attachSoundClip(), detachSoundClip(), getCursor(), getState(), isFinished(), pause(), play(), FIFE::SoundManager::releaseSource(), FIFE::SoundEffectManager::removeEmitterFromDirectSoundFilter(), FIFE::SoundEffectManager::removeEmitterFromSoundEffect(), reset(), rewind(), setConeInnerAngle(), setConeOuterAngle(), setConeOuterGain(), setCursor(), setDirection(), setGain(), setLooping(), setMaxDistance(), setMaxGain(), setMinGain(), setPitch(), setPosition(), setReferenceDistance(), setRelativePositioning(), setRolloff(), setVelocity(), stop(), syncData(), and FIFE::SoundManager::update().
bool FIFE::SoundEmitter::isFinished | ( | ) |
Returns true if clip is finished.
Definition at line 494 of file soundemitter.cpp.
References getDuration(), getState(), FIFE::TimeManager::getTime(), FIFE::DynamicSingleton< TimeManager >::instance(), isActive(), isLooping(), m_internData, m_playCheckDifference, FIFE::SoundEmitter::internData::playTimestamp, and FIFE::SD_STOPPED_STATE.
Referenced by FIFE::SoundManager::update().
bool FIFE::SoundEmitter::isLooping | ( | ) | const |
Return playing mode.
Definition at line 339 of file soundemitter.cpp.
References FIFE::SoundEmitter::internData::loop, and m_internData.
Referenced by isFinished(), and FIFE::SoundSource::setActionAudio().
bool FIFE::SoundEmitter::isPosition | ( | ) | const |
Return if it is a positional SoundEmitter.
Definition at line 612 of file soundemitter.cpp.
References FIFE::Math< T >::Equal(), m_internData, FIFE::SoundEmitter::internData::position, FIFE::PointType3D< T >::x, FIFE::PointType3D< T >::y, and FIFE::PointType3D< T >::z.
Referenced by FIFE::SoundManager::update().
bool FIFE::SoundEmitter::isRelativePositioning | ( | ) | const |
Return Positioning-Type.
Definition at line 169 of file soundemitter.cpp.
References m_internData, and FIFE::SoundEmitter::internData::relative.
bool FIFE::SoundEmitter::isStereo | ( | ) |
Tests if the audio data is stereo data or mono.
Definition at line 447 of file soundemitter.cpp.
References FIFE::SoundClip::getDecoder(), FIFE::SoundDecoder::isStereo(), and m_soundClip.
Referenced by getCursor(), getDuration(), and setCursor().
void FIFE::SoundEmitter::pause | ( | ) |
Pauses playing the audio file.
Definition at line 394 of file soundemitter.cpp.
References isActive(), m_internData, m_soundClip, m_source, FIFE::SD_PAUSED_STATE, and FIFE::SoundEmitter::internData::soundState.
Referenced by FIFE::SoundManager::pause().
void FIFE::SoundEmitter::play | ( | ) |
Plays the associated audio file.
Definition at line 343 of file soundemitter.cpp.
References getCursor(), FIFE::TimeManager::getTime(), FIFE::DynamicSingleton< TimeManager >::instance(), isActive(), m_internData, m_playCheckDifference, m_soundClip, m_source, FIFE::SoundEmitter::internData::playTimestamp, FIFE::SD_PAUSED_STATE, FIFE::SD_PLAYING_STATE, FIFE::SD_TIME_POS, and FIFE::SoundEmitter::internData::soundState.
Referenced by FIFE::SoundManager::play(), play(), and FIFE::SoundSource::setActionAudio().
void FIFE::SoundEmitter::play | ( | float | inTime, |
float | outTime | ||
) |
Plays the associated audio file with fade in and / or out.
Definition at line 356 of file soundemitter.cpp.
References FIFE::Math< T >::Equal(), getDuration(), getState(), m_fadeIn, m_fadeInEndTimestamp, m_fadeInStartTimestamp, m_fadeOut, m_fadeOutEndTimestamp, m_fadeOutStartTimestamp, m_internData, m_origGain, play(), FIFE::SoundEmitter::internData::playTimestamp, FIFE::SD_PLAYING_STATE, setGain(), and FIFE::SoundEmitter::internData::volume.
void FIFE::SoundEmitter::release | ( | ) |
Releases the emitter.
Definition at line 257 of file soundemitter.cpp.
References m_emitterId, m_manager, and FIFE::SoundManager::releaseEmitter().
void FIFE::SoundEmitter::removeEffect | ( | SoundEffect * | effect | ) |
Removes effect.
Used from SoundEffectManager.
Definition at line 815 of file soundemitter.cpp.
References m_effects.
Referenced by FIFE::SoundEffectManager::removeEmitterFromSoundEffect().
void FIFE::SoundEmitter::removeListener | ( | SoundEmitterListener * | listener | ) |
Removes associated SoundEmitter listener.
listener | to remove |
Definition at line 885 of file soundemitter.cpp.
References FIFE::_log, FL_WARN, and m_listeners.
void FIFE::SoundEmitter::reset | ( | bool | defaultall = false | ) |
Reset the emitter, free all internal buffers.
defaultall | If set to true, emitter position, velocity, gain and type will be set to the default values |
Definition at line 209 of file soundemitter.cpp.
References FIFE::SoundManager::deactivateFilter(), isActive(), FIFE::SoundClip::isStream(), m_directFilter, m_effects, m_fadeIn, m_fadeOut, m_group, m_manager, m_origGain, m_samplesOffset, m_soundClip, m_soundClipId, m_source, m_streamId, FIFE::SoundClip::quitStreaming(), FIFE::SoundManager::releaseSource(), FIFE::SoundManager::removeEmitterFromSoundEffect(), FIFE::SoundManager::removeFromGroup(), FIFE::SharedPtr< T >::reset(), resetInternData(), and syncData().
Referenced by FIFE::SoundSource::setActionAudio(), and ~SoundEmitter().
|
private |
Resets collected data to defaults.
Definition at line 755 of file soundemitter.cpp.
References FIFE::SoundEmitter::internData::coneInnerAngle, FIFE::SoundEmitter::internData::coneOuterAngle, FIFE::SoundEmitter::internData::coneOuterGain, FIFE::SoundEmitter::internData::direction, FIFE::SoundEmitter::internData::loop, m_internData, FIFE::SoundEmitter::internData::maxDistance, FIFE::SoundEmitter::internData::maxVolume, FIFE::SoundEmitter::internData::minVolume, FIFE::SoundEmitter::internData::pitch, FIFE::SoundEmitter::internData::playTimestamp, FIFE::SoundEmitter::internData::position, FIFE::SoundEmitter::internData::refDistance, FIFE::SoundEmitter::internData::relative, FIFE::SoundEmitter::internData::rolloff, FIFE::SD_UNKNOWN_STATE, FIFE::SoundEmitter::internData::soundState, FIFE::SoundEmitter::internData::velocity, and FIFE::SoundEmitter::internData::volume.
Referenced by reset(), and SoundEmitter().
void FIFE::SoundEmitter::rewind | ( | ) |
Rewinds the associated audio file.
Definition at line 401 of file soundemitter.cpp.
References isActive(), FIFE::SoundClip::isStream(), m_internData, m_samplesOffset, m_soundClip, m_source, FIFE::SoundEmitter::internData::playTimestamp, FIFE::SD_BYTE_POS, and setCursor().
Referenced by FIFE::SoundManager::rewind(), FIFE::SoundSource::setActionAudio(), and stop().
void FIFE::SoundEmitter::setCheckDifference | ( | ) |
Sets the time difference between play and the first check if it's playable.
Definition at line 875 of file soundemitter.cpp.
References getState(), FIFE::TimeManager::getTime(), FIFE::DynamicSingleton< TimeManager >::instance(), m_internData, m_playCheckDifference, FIFE::SoundEmitter::internData::playTimestamp, and FIFE::SD_PLAYING_STATE.
Referenced by FIFE::SoundManager::update().
void FIFE::SoundEmitter::setConeInnerAngle | ( | float | inner | ) |
Sets inner angle of the sound cone, in degrees.
Default 360
Definition at line 650 of file soundemitter.cpp.
References FIFE::SoundEmitter::internData::coneInnerAngle, isActive(), m_internData, and m_source.
Referenced by syncData(), and FIFE::SoundSource::updateSoundEmitter().
void FIFE::SoundEmitter::setConeOuterAngle | ( | float | outer | ) |
Sets outer angle of the sound cone, in degrees.
Default 360
Definition at line 661 of file soundemitter.cpp.
References FIFE::SoundEmitter::internData::coneOuterAngle, isActive(), m_internData, and m_source.
Referenced by syncData(), and FIFE::SoundSource::updateSoundEmitter().
void FIFE::SoundEmitter::setConeOuterGain | ( | float | gain | ) |
Sets the gain when outside the oriented cone.
Definition at line 672 of file soundemitter.cpp.
References FIFE::SoundEmitter::internData::coneOuterGain, isActive(), m_internData, and m_source.
Referenced by syncData(), and FIFE::SoundSource::updateSoundEmitter().
void FIFE::SoundEmitter::setCursor | ( | SoundPositionType | type, |
float | value | ||
) |
Sets the cursor position in the audio file.
Definition at line 508 of file soundemitter.cpp.
References FIFE::_log, FIFE::SoundClip::acquireStream(), FIFE::BUFFER_NUM, CHECK_OPENAL_LOG, getBitResolution(), FIFE::SoundClip::getBuffers(), getSampleRate(), isActive(), isStereo(), FIFE::SoundClip::isStream(), FIFE::LogManager::LEVEL_ERROR, m_samplesOffset, m_soundClip, m_source, m_streamId, FIFE::SD_BYTE_POS, FIFE::SD_SAMPLE_POS, FIFE::SD_TIME_POS, and FIFE::SoundClip::setStreamPos().
Referenced by rewind(), and syncData().
void FIFE::SoundEmitter::setDirectFilter | ( | SoundFilter * | filter | ) |
Sets the direct filter.
Used from SoundEffectManager.
Definition at line 845 of file soundemitter.cpp.
References m_directFilter.
Referenced by FIFE::SoundEffectManager::addEmitterToDirectSoundFilter(), and FIFE::SoundEffectManager::removeEmitterFromDirectSoundFilter().
void FIFE::SoundEmitter::setDirection | ( | const AudioSpaceCoordinate & | direction | ) |
Sets the direction of the SoundEmitter in the virtual audio space.
Definition at line 173 of file soundemitter.cpp.
References FIFE::SoundEmitter::internData::direction, isActive(), m_internData, m_source, FIFE::PointType3D< T >::x, FIFE::PointType3D< T >::y, and FIFE::PointType3D< T >::z.
Referenced by FIFE::SoundSource::setDirection(), and syncData().
void FIFE::SoundEmitter::setGain | ( | float | gain | ) |
Sets the gain of the emitter.
gain | The gain value. 0=silence ... 1.0=normal loudness. |
Definition at line 414 of file soundemitter.cpp.
References isActive(), m_internData, m_source, and FIFE::SoundEmitter::internData::volume.
Referenced by checkFade(), play(), syncData(), and FIFE::SoundSource::updateSoundEmitter().
void FIFE::SoundEmitter::setGroup | ( | const std::string & | group | ) |
Sets the group name.
Adds the emitter automatically to the group.
Definition at line 708 of file soundemitter.cpp.
References FIFE::SoundManager::addToGroup(), m_group, m_manager, and FIFE::SoundManager::removeFromGroup().
Referenced by FIFE::SoundSource::updateSoundEmitter().
void FIFE::SoundEmitter::setLooping | ( | bool | loop | ) |
Sets the playing mode.
Definition at line 328 of file soundemitter.cpp.
References isActive(), FIFE::SoundClip::isStream(), FIFE::SoundEmitter::internData::loop, m_internData, m_soundClip, and m_source.
Referenced by syncData(), and FIFE::SoundSource::updateSoundEmitter().
void FIFE::SoundEmitter::setMaxDistance | ( | float | distance | ) |
Sets the max distance used with the Inverse Clamped Distance Model to set the distance where there will no longer be any attenuation of the source.
Definition at line 628 of file soundemitter.cpp.
References utf8::distance(), isActive(), m_internData, m_source, and FIFE::SoundEmitter::internData::maxDistance.
Referenced by syncData(), and FIFE::SoundSource::updateSoundEmitter().
void FIFE::SoundEmitter::setMaxGain | ( | float | gain | ) |
Sets the max.
gain of the emitter
gain | The gain value. 0=silence ... 1.0=normal loudness. |
Definition at line 425 of file soundemitter.cpp.
References isActive(), m_internData, m_source, and FIFE::SoundEmitter::internData::maxVolume.
Referenced by syncData(), and FIFE::SoundSource::updateSoundEmitter().
void FIFE::SoundEmitter::setMinGain | ( | float | gain | ) |
Sets the min.
gain of the emitter
gain | The gain value. 0=silence ... 1.0=normal loudness. |
Definition at line 436 of file soundemitter.cpp.
References isActive(), m_internData, m_source, and FIFE::SoundEmitter::internData::minVolume.
Referenced by syncData(), and FIFE::SoundSource::updateSoundEmitter().
void FIFE::SoundEmitter::setPitch | ( | float | pitch | ) |
Sets pitch multiplier.
Can only be positiv.
Definition at line 185 of file soundemitter.cpp.
References isActive(), m_internData, m_source, and FIFE::SoundEmitter::internData::pitch.
Referenced by syncData(), and FIFE::SoundSource::updateSoundEmitter().
void FIFE::SoundEmitter::setPosition | ( | const AudioSpaceCoordinate & | position | ) |
Sets the position of the SoundEmitter in the virtual audio space.
Definition at line 601 of file soundemitter.cpp.
References isActive(), m_internData, m_source, FIFE::SoundEmitter::internData::position, FIFE::PointType3D< T >::x, FIFE::PointType3D< T >::y, and FIFE::PointType3D< T >::z.
Referenced by FIFE::SoundSource::setPosition(), syncData(), and FIFE::SoundSource::updateSoundEmitter().
void FIFE::SoundEmitter::setReferenceDistance | ( | float | distance | ) |
Sets the distance under which the volume for the SoundEmitter would normally drop by half (before being influenced by rolloff factor or max distance.
Default 1.0
Definition at line 617 of file soundemitter.cpp.
References utf8::distance(), isActive(), m_internData, m_source, and FIFE::SoundEmitter::internData::refDistance.
Referenced by syncData(), and FIFE::SoundSource::updateSoundEmitter().
void FIFE::SoundEmitter::setRelativePositioning | ( | bool | relative | ) |
Sets Positioning-Type Default is false.
relative | If set to true, the emitters position will be interpreted relative to the listener object |
Definition at line 162 of file soundemitter.cpp.
References isActive(), m_internData, m_source, and FIFE::SoundEmitter::internData::relative.
Referenced by syncData(), and FIFE::SoundSource::updateSoundEmitter().
void FIFE::SoundEmitter::setRolloff | ( | float | rolloff | ) |
Sets the AL_ROLEOFF_FACTOR.
Rolloff factor judges the strength of attenuation over distance.
rolloff | Rolloff factor. You'll need to do a lot of testing to find a value which suits your needs. Default 1.0 |
Definition at line 198 of file soundemitter.cpp.
References isActive(), m_internData, m_source, and FIFE::SoundEmitter::internData::rolloff.
Referenced by syncData(), and FIFE::SoundSource::updateSoundEmitter().
void FIFE::SoundEmitter::setSoundClip | ( | SoundClipPtr | soundClip | ) |
Sets the sound clip to be used by this emitter.
soundClip | SoundClipPtr of the sound to be used. |
Definition at line 261 of file soundemitter.cpp.
References attachSoundClip(), detachSoundClip(), FIFE::IResource::getHandle(), m_soundClip, and m_soundClipId.
Referenced by FIFE::SoundManager::createEmitter(), setSoundClip(), and FIFE::SoundSource::updateSoundEmitter().
void FIFE::SoundEmitter::setSoundClip | ( | const std::string & | name | ) |
Sets the sound clip to be used by this emitter.
name | The name of the sound to be used. |
Definition at line 278 of file soundemitter.cpp.
References FIFE::SoundClipManager::get(), FIFE::DynamicSingleton< SoundClipManager >::instance(), and setSoundClip().
void FIFE::SoundEmitter::setSource | ( | ALuint | source | ) |
Sets openAl-source.
Definition at line 79 of file soundemitter.cpp.
References activateEffects(), deactivateEffects(), m_active, m_source, and syncData().
Referenced by FIFE::SoundManager::releaseSource(), and FIFE::SoundManager::setEmitterSource().
void FIFE::SoundEmitter::setVelocity | ( | const AudioSpaceCoordinate & | velocity | ) |
Sets the velocity of the SoundEmitter in the virtual audio space.
Definition at line 639 of file soundemitter.cpp.
References isActive(), m_internData, m_source, FIFE::SoundEmitter::internData::velocity, FIFE::PointType3D< T >::x, FIFE::PointType3D< T >::y, and FIFE::PointType3D< T >::z.
Referenced by syncData(), and FIFE::SoundSource::updateSoundEmitter().
void FIFE::SoundEmitter::stop | ( | ) |
Stops playing the audio file and rewinds to the beginning.
Definition at line 377 of file soundemitter.cpp.
References callOnSoundFinished(), isActive(), m_internData, m_soundClip, m_source, FIFE::SoundEmitter::internData::playTimestamp, rewind(), FIFE::SD_STOPPED_STATE, and FIFE::SoundEmitter::internData::soundState.
Referenced by checkFade(), detachSoundClip(), FIFE::SoundSource::setActionAudio(), FIFE::SoundManager::stop(), and update().
void FIFE::SoundEmitter::stop | ( | float | time | ) |
Stops playing the audio file after time with fade out.
Definition at line 387 of file soundemitter.cpp.
References FIFE::TimeManager::getTime(), FIFE::DynamicSingleton< TimeManager >::instance(), m_fadeOut, m_fadeOutEndTimestamp, m_fadeOutStartTimestamp, m_internData, m_origGain, and FIFE::SoundEmitter::internData::volume.
|
private |
Updates OpenAL with collected data.
Definition at line 724 of file soundemitter.cpp.
References attachSoundClip(), FIFE::SoundEmitter::internData::coneInnerAngle, FIFE::SoundEmitter::internData::coneOuterAngle, FIFE::SoundEmitter::internData::coneOuterGain, FIFE::SoundEmitter::internData::direction, getDuration(), FIFE::TimeManager::getTime(), FIFE::DynamicSingleton< TimeManager >::instance(), isActive(), FIFE::SoundEmitter::internData::loop, m_internData, m_playCheckDifference, m_soundClip, m_source, FIFE::SoundEmitter::internData::maxDistance, FIFE::SoundEmitter::internData::maxVolume, FIFE::SoundEmitter::internData::minVolume, FIFE::SoundEmitter::internData::pitch, FIFE::SoundEmitter::internData::playTimestamp, FIFE::SoundEmitter::internData::position, FIFE::SoundEmitter::internData::refDistance, FIFE::SoundEmitter::internData::relative, FIFE::SoundEmitter::internData::rolloff, FIFE::SD_PLAYING_STATE, FIFE::SD_TIME_POS, setConeInnerAngle(), setConeOuterAngle(), setConeOuterGain(), setCursor(), setDirection(), setGain(), setLooping(), setMaxDistance(), setMaxGain(), setMinGain(), setPitch(), setPosition(), setReferenceDistance(), setRelativePositioning(), setRolloff(), setVelocity(), FIFE::SoundEmitter::internData::soundState, FIFE::SoundEmitter::internData::velocity, and FIFE::SoundEmitter::internData::volume.
Referenced by reset(), and setSource().
void FIFE::SoundEmitter::update | ( | ) |
Called once a frame from the SoundManager.
Definition at line 107 of file soundemitter.cpp.
References FIFE::_log, CHECK_OPENAL_LOG, checkFade(), getState(), FIFE::SoundClip::getStream(), FIFE::SoundClip::isStream(), FIFE::LogManager::LEVEL_ERROR, FIFE::SoundEmitter::internData::loop, m_fadeIn, m_fadeOut, m_internData, m_samplesOffset, m_soundClip, m_source, m_streamId, FIFE::SD_BYTE_POS, FIFE::SD_STOPPED_STATE, FIFE::SoundClip::setStreamPos(), FIFE::SoundEmitter::internData::soundState, and stop().
Referenced by FIFE::SoundManager::update().
|
private |
|
private |
Applied direct sound filter.
Definition at line 415 of file soundemitter.h.
Referenced by activateEffects(), deactivateEffects(), getDirectFilter(), reset(), and setDirectFilter().
|
private |
holds pointer to applied SoundEffects
Definition at line 469 of file soundemitter.h.
Referenced by activateEffects(), addEffect(), deactivateEffects(), getEffectCount(), getEffectNumber(), removeEffect(), and reset().
|
private |
The emitter-id.
Definition at line 423 of file soundemitter.h.
Referenced by callOnSoundFinished(), getId(), and release().
|
private |
fade in clip
Definition at line 453 of file soundemitter.h.
Referenced by checkFade(), play(), reset(), and update().
|
private |
fade in end time
Definition at line 461 of file soundemitter.h.
Referenced by checkFade(), and play().
|
private |
fade in start time
Definition at line 459 of file soundemitter.h.
Referenced by checkFade(), and play().
|
private |
fade out clip
Definition at line 455 of file soundemitter.h.
Referenced by checkFade(), play(), reset(), stop(), and update().
|
private |
fade out end time
Definition at line 465 of file soundemitter.h.
Referenced by checkFade(), play(), and stop().
|
private |
fade out start time
Definition at line 463 of file soundemitter.h.
Referenced by checkFade(), play(), and stop().
|
private |
the group name
Definition at line 447 of file soundemitter.h.
Referenced by getGroup(), reset(), and setGroup().
|
private |
Referenced by attachSoundClip(), getConeInnerAngle(), getConeOuterAngle(), getConeOuterGain(), getDirection(), getGain(), getMaxDistance(), getMaxGain(), getMinGain(), getPitch(), getPlayTimestamp(), getPosition(), getReferenceDistance(), getRolloff(), getState(), getVelocity(), isFinished(), isLooping(), isPosition(), isRelativePositioning(), pause(), play(), resetInternData(), rewind(), setCheckDifference(), setConeInnerAngle(), setConeOuterAngle(), setConeOuterGain(), setDirection(), setGain(), setLooping(), setMaxDistance(), setMaxGain(), setMinGain(), setPitch(), setPosition(), setReferenceDistance(), setRelativePositioning(), setRolloff(), setVelocity(), stop(), syncData(), and update().
|
private |
listeners for sound related events
Definition at line 471 of file soundemitter.h.
Referenced by addListener(), callOnSoundFinished(), and removeListener().
|
private |
Access to the SoundManager.
Definition at line 411 of file soundemitter.h.
Referenced by activateEffects(), deactivateEffects(), release(), reset(), setGroup(), SoundEmitter(), and ~SoundEmitter().
|
private |
original gain
Definition at line 457 of file soundemitter.h.
Referenced by checkFade(), play(), reset(), and stop().
|
private |
time difference between play and first check
Definition at line 467 of file soundemitter.h.
Referenced by isFinished(), play(), setCheckDifference(), and syncData().
|
private |
saves sample offset for played stream parts
Definition at line 449 of file soundemitter.h.
Referenced by getCursor(), reset(), rewind(), setCursor(), and update().
|
private |
The attached sound clip.
Definition at line 417 of file soundemitter.h.
Referenced by attachSoundClip(), detachSoundClip(), getBitResolution(), getCursor(), getDecodedLength(), getDuration(), getSampleRate(), getSoundClip(), isStereo(), pause(), play(), reset(), rewind(), setCursor(), setLooping(), setSoundClip(), stop(), syncData(), and update().
|
private |
Id of the attached sound clip.
Definition at line 419 of file soundemitter.h.
Referenced by callOnSoundFinished(), detachSoundClip(), reset(), and setSoundClip().
|
private |
The openAL-source.
Definition at line 413 of file soundemitter.h.
Referenced by attachSoundClip(), detachSoundClip(), getCursor(), getSource(), getState(), pause(), play(), reset(), rewind(), setConeInnerAngle(), setConeOuterAngle(), setConeOuterGain(), setCursor(), setDirection(), setGain(), setLooping(), setMaxDistance(), setMaxGain(), setMinGain(), setPitch(), setPosition(), setReferenceDistance(), setRelativePositioning(), setRolloff(), setSource(), setVelocity(), stop(), syncData(), and update().
|
private |
The id of the stream.
Definition at line 421 of file soundemitter.h.
Referenced by attachSoundClip(), detachSoundClip(), reset(), setCursor(), and update().