22 #ifndef FIFE_SOUNDMANAGER_H 23 #define FIFE_SOUNDMANAGER_H 323 void play(
const std::string& group);
329 void pause(
const std::string& group);
335 void stop(
const std::string& group);
341 void rewind(
const std::string& group);
348 void setGain(
const std::string& group,
float gain);
355 void setMaxGain(
const std::string& group,
float gain);
362 void setMinGain(
const std::string& group,
float gain);
void setMinGain(const std::string &group, float gain)
Sets min gain for all emitters of the group.
void enableDirectSoundFilter(SoundFilter *filter)
Enables given direct SoundFilter.
const uint16_t MAX_SOURCES
void setListenerVelocity(const AudioSpaceCoordinate &velocity)
Sets the velocity of the listener (alter ego).
void deleteSoundFilter(SoundFilter *filter)
Deletes given SoundFilter.
void deleteEmitter(SoundEmitter *emitter)
Release given emitter.
void removeFromGroup(SoundEmitter *emitter)
Removes the emitter from group.
SoundManagerState m_state
State of the SoundManager.
float m_volume
volume to support setVolume-calls before initialization
void unmute()
Unmutes to volume before mute() was called.
float getDopplerFactor() const
Return factor for doppler effect.
void setListenerPosition(const AudioSpaceCoordinate &position)
Sets the position of the listener (alter ego).
void addEmitterToDirectSoundFilter(SoundFilter *filter, SoundEmitter *emitter)
Adds given SoundEmitter to the specific direct SoundFilter Note: A SoundEmitter can only have one dir...
SoundEffectPreset
Presets for EAX Reverb.
std::map< std::string, std::vector< SoundEmitter * > > EmitterGroups
void removeEmitterFromDirectSoundFilter(SoundFilter *filter, SoundEmitter *emitter)
Removes given SoundEmitter from the specific direct SoundFilter.
void enableSoundEffect(SoundEffect *effect)
Enables given SoundEffect.
void stop()
Stops all SoundEmitters.
SoundEffectManager * m_effectManager
SoundEmitter * createEmitter()
Returns a pointer to an allocated emitter-instance.
Base class for Efx sound effects.
The class defines filters.
std::vector< SoundEmitter * > m_emitterVec
emitter-vector, holds all emitters
void disableDirectSoundFilter(SoundFilter *filter)
Disables given SoundFilter.
void removeGroup(const std::string &group)
Remove group and resets the group for the affected emitters.
EmitterGroups::iterator EmitterGroupsIterator
AudioSpaceCoordinate getListenerPosition() const
Return the position of the listener (alter ego).
ALuint m_sources[MAX_SOURCES]
Holds handles for sources.
SoundDistanceModelType m_distanceModel
Selected distance model.
void removeSoundFilterFromSoundEffect(SoundEffect *effect, SoundFilter *filter)
Removes given SoundFilter from the SoundEffect.
SoundDistanceModelType getDistanceModel() const
Return the distance mode.
void activateEffect(SoundEffect *effect, SoundEmitter *emitter)
Internal function to do the OpenAL calls to activate the SoundEffect for the SoundEmitter.
ALCcontext * m_context
OpenAL context.
float getVolume() const
Return the Master Volume.
void deactivateEffect(SoundEffect *effect, SoundEmitter *emitter)
Internal function to do the OpenAL calls to deactivate the SoundEffect for the SoundEmitter.
AudioSpaceCoordinate getListenerVelocity() const
Return the velocity of the listener (alter ego).
void init()
Initializes the audio system.
SoundEffect * createSoundEffectPreset(SoundEffectPreset type)
Creates EaxReverb SoundEffect and loads the specific preset type.
void deactivateFilter(SoundFilter *filter, SoundEmitter *emitter)
Internal function to do the OpenAL calls to deactivate the SoundFilter for the SoundEmitter.
void setDopplerFactor(float factor)
Sets factor for doppler effect.
void setVolume(float vol)
Sets the Master Volume.
void removeEmitterFromSoundEffect(SoundEffect *effect, SoundEmitter *emitter)
Removes given SoundEmitter from the specific SoundEffect.
std::queue< ALuint > m_freeSources
Holds free handles for sources.
void addEmitterToSoundEffect(SoundEffect *effect, SoundEmitter *emitter)
Adds given SoundEmitter to the specific SoundEffect.
void setMaxGain(const std::string &group, float gain)
Sets max gain for all emitters of the group.
ALCdevice * m_device
OpenAL device.
SoundDistanceModelType
Distance model from OpenAL.
std::map< SoundEmitter *, ALuint > m_activeEmitters
Map that holds active Emitters together with the used source handle.
void removeAllGroups()
Remove all groups and resets the group of affected emitters.
void update()
Called once a frame and updates the sound objects.
void addToGroup(SoundEmitter *emitter)
Adds the emitter to group.
void releaseSource(SoundEmitter *emitter)
Release the source handle.
std::iterator_traits< octet_iterator >::difference_type distance(octet_iterator first, octet_iterator last)
SoundFilter * createSoundFilter(SoundFilterType type)
Creates SoundFilter of the specific type.
void addSoundFilterToSoundEffect(SoundEffect *effect, SoundFilter *filter)
Adds given SoundFilter to the SoundEffect.
The class for playing audio files.
void activateFilter(SoundFilter *filter, SoundEmitter *emitter)
Internal function to do the OpenAL calls to activate the SoundFilter for the SoundEmitter.
SoundEffectType
Sound effect type.
float m_maxDistance
distance that removes a active Emitter
ALCcontext * getContext() const
Returns an openAL context.
void pause()
Pauses all SoundEmitters.
float getListenerMaxDistance() const
Return the maximal listener distance.
SoundEffect * createSoundEffect(SoundEffectType type)
Creates SoundEffect of the specific type.
void disableSoundEffect(SoundEffect *effect)
Disables given SoundEffect.
AudioSpaceCoordinate getListenerOrientation() const
Return the orientation of the listener (alter ego).
void setGain(const std::string &group, float gain)
Sets gain for all emitters of the group.
void setEmitterSource(SoundEmitter *emitter)
Sets the source handle.
SoundFilterType
Sound filter type.
void play()
Plays all SoundEmitters.
void releaseEmitter(uint32_t emitterId)
Release an emitter-instance given by emitter-id.
void deleteSoundEffect(SoundEffect *effect)
Deletes given SoundEffect.
SoundManagerState
SoundManager state.
void rewind()
Rewinds all SoundEmitters.
void setListenerMaxDistance(float distance)
Sets the maximal listener distance.
uint16_t m_createdSources
Maximal created sources, can be different to MAX_SOURCES.
void setDistanceModel(SoundDistanceModelType model)
Sets the distance model.
EmitterGroups m_groups
A map that holds the groups together with the appended emitters.
SoundEmitter * getEmitter(uint32_t emitterId) const
Returns a pointer to an emitter-instance given by emitterId.
bool isActive() const
Returns true if audio module is active.
float m_muteVol
volume before mute() was called
void setListenerOrientation(const AudioSpaceCoordinate &orientation)
Sets the orientation of the listener (alter ego).