FIFE  be64c707dea6b3250bd4355bf5c825d25920087d
FIFE::SoundEffectManager Class Reference

#include <soundeffectmanager.h>

+ Collaboration diagram for FIFE::SoundEffectManager:

Public Member Functions

 SoundEffectManager ()
 Constructor. More...
 
 ~SoundEffectManager ()
 Destructor. More...
 
void init (ALCdevice *device)
 Initializes the effect system. More...
 
bool isActive () const
 Returns true if sound effect module is active. More...
 
SoundEffectcreateSoundEffect (SoundEffectType type)
 Creates SoundEffect of the specific type. More...
 
SoundEffectcreateSoundEffectPreset (SoundEffectPreset type)
 Creates EaxReverb SoundEffect and loads the specific preset type. More...
 
void deleteSoundEffect (SoundEffect *effect)
 Deletes given SoundEffect. More...
 
void enableSoundEffect (SoundEffect *effect)
 Enables given SoundEffect. More...
 
void disableSoundEffect (SoundEffect *effect)
 Disables given SoundEffect. More...
 
void addEmitterToSoundEffect (SoundEffect *effect, SoundEmitter *emitter)
 Adds given SoundEmitter to the specific SoundEffect. More...
 
void removeEmitterFromSoundEffect (SoundEffect *effect, SoundEmitter *emitter)
 Removes given SoundEmitter from the specific SoundEffect. More...
 
void addSoundFilterToSoundEffect (SoundEffect *effect, SoundFilter *filter)
 Adds given SoundFilter to the SoundEffect. More...
 
void removeSoundFilterFromSoundEffect (SoundEffect *effect, SoundFilter *filter)
 Removes given SoundFilter from the SoundEffect. More...
 
void activateEffect (SoundEffect *effect, SoundEmitter *emitter)
 Internal function to do the OpenAL calls to activate the SoundEffect for the SoundEmitter. More...
 
void deactivateEffect (SoundEffect *effect, SoundEmitter *emitter)
 Internal function to do the OpenAL calls to deactivate the SoundEffect for the SoundEmitter. More...
 
SoundFiltercreateSoundFilter (SoundFilterType type)
 Creates SoundFilter of the specific type. More...
 
void deleteSoundFilter (SoundFilter *filter)
 Deletes given SoundFilter. More...
 
void enableDirectSoundFilter (SoundFilter *filter)
 Enables given direct SoundFilter. More...
 
void disableDirectSoundFilter (SoundFilter *filter)
 Disables given SoundFilter. More...
 
void addEmitterToDirectSoundFilter (SoundFilter *filter, SoundEmitter *emitter)
 Adds given SoundEmitter to the specific direct SoundFilter Note: A SoundEmitter can only have one direct filter. More...
 
void removeEmitterFromDirectSoundFilter (SoundFilter *filter, SoundEmitter *emitter)
 Removes given SoundEmitter from the specific direct SoundFilter. More...
 
void activateFilter (SoundFilter *filter, SoundEmitter *emitter)
 Internal function to do the OpenAL calls to activate the SoundFilter for the SoundEmitter. More...
 
void deactivateFilter (SoundFilter *filter, SoundEmitter *emitter)
 Internal function to do the OpenAL calls to deactivate the SoundFilter for the SoundEmitter. More...
 

Private Types

typedef std::map< SoundEffect *, std::vector< SoundEmitter * > > SoundEffectEmitterMap
 Holds SoundEffects together with the added SoundEmitters. More...
 
typedef std::map< SoundFilter *, std::vector< SoundEmitter * > > SoundFilterEmitterMap
 Holds SoundFilters together with the added SoundEmitters. More...
 
typedef std::map< SoundFilter *, std::vector< SoundEffect * > > SoundFilterEffectMap
 Holds SoundFilters together with the added SoundEffects. More...
 

Private Member Functions

void createPresets ()
 Inital the presets. More...
 

Private Attributes

ALCdevice * m_device
 OpenAL device. More...
 
bool m_active
 If sound effect module is active. More...
 
ALuint m_effectSlots [MAX_EFFECT_SLOTS]
 Holds handles for effects. More...
 
uint16_t m_createdSlots
 Maximal created effect slots, can be different to MAX_EFFECT_SLOTS. More...
 
std::queue< ALuint > m_freeSlots
 Holds free handles for effect slots. More...
 
ALint m_maxSlots
 Maximal effect slots per Source. More...
 
std::vector< SoundEffect * > m_effects
 Holds all SoundEffects. More...
 
SoundEffectEmitterMap m_effectEmitters
 
std::vector< SoundFilter * > m_filters
 Holds all SoundFilters. More...
 
SoundFilterEmitterMap m_filterdEmitters
 
SoundFilterEffectMap m_filterdEffects
 
std::map< SoundEffectPreset, EFXEAXREVERBPROPERTIES > m_presets
 Establishes the relationship between SoundEffectPreset and EFXEAXREVERBPROPERTIES. More...
 

Detailed Description

Definition at line 46 of file soundeffectmanager.h.

Member Typedef Documentation

◆ SoundEffectEmitterMap

typedef std::map<SoundEffect*, std::vector<SoundEmitter*> > FIFE::SoundEffectManager::SoundEffectEmitterMap
private

Holds SoundEffects together with the added SoundEmitters.

Definition at line 166 of file soundeffectmanager.h.

◆ SoundFilterEffectMap

typedef std::map<SoundFilter*, std::vector<SoundEffect*> > FIFE::SoundEffectManager::SoundFilterEffectMap
private

Holds SoundFilters together with the added SoundEffects.

Definition at line 174 of file soundeffectmanager.h.

◆ SoundFilterEmitterMap

typedef std::map<SoundFilter*, std::vector<SoundEmitter*> > FIFE::SoundEffectManager::SoundFilterEmitterMap
private

Holds SoundFilters together with the added SoundEmitters.

Definition at line 171 of file soundeffectmanager.h.

Constructor & Destructor Documentation

◆ SoundEffectManager()

FIFE::SoundEffectManager::SoundEffectManager ( )

Constructor.

Definition at line 87 of file soundeffectmanager.cpp.

◆ ~SoundEffectManager()

FIFE::SoundEffectManager::~SoundEffectManager ( )

Destructor.

Definition at line 95 of file soundeffectmanager.cpp.

References m_effects, and m_filters.

Member Function Documentation

◆ activateEffect()

void FIFE::SoundEffectManager::activateEffect ( SoundEffect effect,
SoundEmitter emitter 
)

◆ activateFilter()

void FIFE::SoundEffectManager::activateFilter ( SoundFilter filter,
SoundEmitter emitter 
)

Internal function to do the OpenAL calls to activate the SoundFilter for the SoundEmitter.

Definition at line 512 of file soundeffectmanager.cpp.

References FIFE::SoundFilter::getFilterId(), FIFE::SoundEmitter::getSource(), and FIFE::SoundFilter::isEnabled().

Referenced by FIFE::SoundManager::activateFilter(), addEmitterToDirectSoundFilter(), and enableDirectSoundFilter().

+ Here is the caller graph for this function:

◆ addEmitterToDirectSoundFilter()

void FIFE::SoundEffectManager::addEmitterToDirectSoundFilter ( SoundFilter filter,
SoundEmitter emitter 
)

Adds given SoundEmitter to the specific direct SoundFilter Note: A SoundEmitter can only have one direct filter.

Definition at line 472 of file soundeffectmanager.cpp.

References FIFE::_log, activateFilter(), FL_WARN, FIFE::SoundEmitter::getDirectFilter(), FIFE::SoundEmitter::isActive(), m_filterdEmitters, and FIFE::SoundEmitter::setDirectFilter().

Referenced by FIFE::SoundManager::addEmitterToDirectSoundFilter().

+ Here is the caller graph for this function:

◆ addEmitterToSoundEffect()

void FIFE::SoundEffectManager::addEmitterToSoundEffect ( SoundEffect effect,
SoundEmitter emitter 
)

Adds given SoundEmitter to the specific SoundEffect.

Note: A SoundEmitter can only have a limited number of effects, usually 4.

Definition at line 305 of file soundeffectmanager.cpp.

References FIFE::_log, activateEffect(), FIFE::SoundEmitter::addEffect(), FL_WARN, FIFE::SoundEmitter::getEffectCount(), isActive(), m_effectEmitters, and m_maxSlots.

Referenced by FIFE::SoundManager::addEmitterToSoundEffect().

+ Here is the caller graph for this function:

◆ addSoundFilterToSoundEffect()

void FIFE::SoundEffectManager::addSoundFilterToSoundEffect ( SoundEffect effect,
SoundFilter filter 
)

◆ createPresets()

void FIFE::SoundEffectManager::createPresets ( )
private

Inital the presets.

Definition at line 524 of file soundeffectmanager.cpp.

References m_presets, FIFE::SE_PRESET_ALLEY, FIFE::SE_PRESET_ARENA, FIFE::SE_PRESET_AUDITORIUM, FIFE::SE_PRESET_BATHROOM, FIFE::SE_PRESET_CARPETEDHALLWAY, FIFE::SE_PRESET_CASTLE_ALCOVE, FIFE::SE_PRESET_CASTLE_COURTYARD, FIFE::SE_PRESET_CASTLE_CUPBOARD, FIFE::SE_PRESET_CASTLE_HALL, FIFE::SE_PRESET_CASTLE_LARGEROOM, FIFE::SE_PRESET_CASTLE_LONGPASSAGE, FIFE::SE_PRESET_CASTLE_MEDIUMROOM, FIFE::SE_PRESET_CASTLE_SHORTPASSAGE, FIFE::SE_PRESET_CASTLE_SMALLROOM, FIFE::SE_PRESET_CAVE, FIFE::SE_PRESET_CHAPEL, FIFE::SE_PRESET_CITY, FIFE::SE_PRESET_CITY_ABANDONED, FIFE::SE_PRESET_CITY_LIBRARY, FIFE::SE_PRESET_CITY_MUSEUM, FIFE::SE_PRESET_CITY_STREETS, FIFE::SE_PRESET_CITY_SUBWAY, FIFE::SE_PRESET_CITY_UNDERPASS, FIFE::SE_PRESET_CONCERTHALL, FIFE::SE_PRESET_DIZZY, FIFE::SE_PRESET_DOME_SAINTPAULS, FIFE::SE_PRESET_DOME_TOMB, FIFE::SE_PRESET_DRIVING_COMMENTATOR, FIFE::SE_PRESET_DRIVING_EMPTYGRANDSTAND, FIFE::SE_PRESET_DRIVING_FULLGRANDSTAND, FIFE::SE_PRESET_DRIVING_INCAR_LUXURY, FIFE::SE_PRESET_DRIVING_INCAR_RACER, FIFE::SE_PRESET_DRIVING_INCAR_SPORTS, FIFE::SE_PRESET_DRIVING_PITGARAGE, FIFE::SE_PRESET_DRIVING_TUNNEL, FIFE::SE_PRESET_DRUGGED, FIFE::SE_PRESET_DUSTYROOM, FIFE::SE_PRESET_FACTORY_ALCOVE, FIFE::SE_PRESET_FACTORY_COURTYARD, FIFE::SE_PRESET_FACTORY_CUPBOARD, FIFE::SE_PRESET_FACTORY_HALL, FIFE::SE_PRESET_FACTORY_LARGEROOM, FIFE::SE_PRESET_FACTORY_LONGPASSAGE, FIFE::SE_PRESET_FACTORY_MEDIUMROOM, FIFE::SE_PRESET_FACTORY_SHORTPASSAGE, FIFE::SE_PRESET_FACTORY_SMALLROOM, FIFE::SE_PRESET_FOREST, FIFE::SE_PRESET_GENERIC, FIFE::SE_PRESET_HALLWAY, FIFE::SE_PRESET_HANGAR, FIFE::SE_PRESET_ICEPALACE_ALCOVE, FIFE::SE_PRESET_ICEPALACE_COURTYARD, FIFE::SE_PRESET_ICEPALACE_CUPBOARD, FIFE::SE_PRESET_ICEPALACE_HALL, FIFE::SE_PRESET_ICEPALACE_LARGEROOM, FIFE::SE_PRESET_ICEPALACE_LONGPASSAGE, FIFE::SE_PRESET_ICEPALACE_MEDIUMROOM, FIFE::SE_PRESET_ICEPALACE_SHORTPASSAGE, FIFE::SE_PRESET_ICEPALACE_SMALLROOM, FIFE::SE_PRESET_LIVINGROOM, FIFE::SE_PRESET_MOOD_HEAVEN, FIFE::SE_PRESET_MOOD_HELL, FIFE::SE_PRESET_MOOD_MEMORY, FIFE::SE_PRESET_MOUNTAINS, FIFE::SE_PRESET_OUTDOORS_BACKYARD, FIFE::SE_PRESET_OUTDOORS_CREEK, FIFE::SE_PRESET_OUTDOORS_DEEPCANYON, FIFE::SE_PRESET_OUTDOORS_ROLLINGPLAINS, FIFE::SE_PRESET_OUTDOORS_VALLEY, FIFE::SE_PRESET_PADDEDCELL, FIFE::SE_PRESET_PARKINGLOT, FIFE::SE_PRESET_PIPE_LARGE, FIFE::SE_PRESET_PIPE_LONGTHIN, FIFE::SE_PRESET_PIPE_RESONANT, FIFE::SE_PRESET_PIPE_SMALL, FIFE::SE_PRESET_PLAIN, FIFE::SE_PRESET_PREFAB_CARAVAN, FIFE::SE_PRESET_PREFAB_OUTHOUSE, FIFE::SE_PRESET_PREFAB_PRACTISEROOM, FIFE::SE_PRESET_PREFAB_SCHOOLROOM, FIFE::SE_PRESET_PREFAB_WORKSHOP, FIFE::SE_PRESET_PSYCHOTIC, FIFE::SE_PRESET_QUARRY, FIFE::SE_PRESET_ROOM, FIFE::SE_PRESET_SEWERPIPE, FIFE::SE_PRESET_SMALLWATERROOM, FIFE::SE_PRESET_SPACESTATION_ALCOVE, FIFE::SE_PRESET_SPACESTATION_CUPBOARD, FIFE::SE_PRESET_SPACESTATION_HALL, FIFE::SE_PRESET_SPACESTATION_LARGEROOM, FIFE::SE_PRESET_SPACESTATION_LONGPASSAGE, FIFE::SE_PRESET_SPACESTATION_MEDIUMROOM, FIFE::SE_PRESET_SPACESTATION_SHORTPASSAGE, FIFE::SE_PRESET_SPACESTATION_SMALLROOM, FIFE::SE_PRESET_SPORT_EMPTYSTADIUM, FIFE::SE_PRESET_SPORT_FULLSTADIUM, FIFE::SE_PRESET_SPORT_GYMNASIUM, FIFE::SE_PRESET_SPORT_LARGESWIMMINGPOOL, FIFE::SE_PRESET_SPORT_SMALLSWIMMINGPOOL, FIFE::SE_PRESET_SPORT_SQUASHCOURT, FIFE::SE_PRESET_SPORT_STADIUMTANNOY, FIFE::SE_PRESET_STONECORRIDOR, FIFE::SE_PRESET_STONEROOM, FIFE::SE_PRESET_UNDERWATER, FIFE::SE_PRESET_WOODEN_ALCOVE, FIFE::SE_PRESET_WOODEN_COURTYARD, FIFE::SE_PRESET_WOODEN_CUPBOARD, FIFE::SE_PRESET_WOODEN_HALL, FIFE::SE_PRESET_WOODEN_LARGEROOM, FIFE::SE_PRESET_WOODEN_LONGPASSAGE, FIFE::SE_PRESET_WOODEN_MEDIUMROOM, FIFE::SE_PRESET_WOODEN_SHORTPASSAGE, and FIFE::SE_PRESET_WOODEN_SMALLROOM.

Referenced by init().

+ Here is the caller graph for this function:

◆ createSoundEffect()

◆ createSoundEffectPreset()

SoundEffect * FIFE::SoundEffectManager::createSoundEffectPreset ( SoundEffectPreset  type)

Creates EaxReverb SoundEffect and loads the specific preset type.

Parameters
typeSee SoundEffectPreset

Definition at line 226 of file soundeffectmanager.cpp.

References FIFE::EaxReverb::loadPreset(), m_effects, and m_presets.

Referenced by FIFE::SoundManager::createSoundEffectPreset().

+ Here is the caller graph for this function:

◆ createSoundFilter()

SoundFilter * FIFE::SoundEffectManager::createSoundFilter ( SoundFilterType  type)

Creates SoundFilter of the specific type.

Parameters
typeSee SoundFilterType

Definition at line 403 of file soundeffectmanager.cpp.

References m_filters.

Referenced by FIFE::SoundManager::createSoundFilter().

+ Here is the caller graph for this function:

◆ deactivateEffect()

void FIFE::SoundEffectManager::deactivateEffect ( SoundEffect effect,
SoundEmitter emitter 
)

Internal function to do the OpenAL calls to deactivate the SoundEffect for the SoundEmitter.

Definition at line 395 of file soundeffectmanager.cpp.

References FIFE::SoundEmitter::getEffectNumber(), FIFE::SoundEmitter::getSource(), and FIFE::SoundEffect::isEnabled().

Referenced by FIFE::SoundManager::deactivateEffect(), disableSoundEffect(), and removeEmitterFromSoundEffect().

+ Here is the caller graph for this function:

◆ deactivateFilter()

void FIFE::SoundEffectManager::deactivateFilter ( SoundFilter filter,
SoundEmitter emitter 
)

Internal function to do the OpenAL calls to deactivate the SoundFilter for the SoundEmitter.

Definition at line 518 of file soundeffectmanager.cpp.

References FIFE::SoundEmitter::getSource(), and FIFE::SoundFilter::isEnabled().

Referenced by FIFE::SoundManager::deactivateFilter(), disableDirectSoundFilter(), and removeEmitterFromDirectSoundFilter().

+ Here is the caller graph for this function:

◆ deleteSoundEffect()

void FIFE::SoundEffectManager::deleteSoundEffect ( SoundEffect effect)

Deletes given SoundEffect.

Deactivates for SoundEmitters are automatically done.

Definition at line 239 of file soundeffectmanager.cpp.

References disableSoundEffect(), FIFE::SoundEffect::getFilter(), m_effectEmitters, m_effects, and removeSoundFilterFromSoundEffect().

Referenced by FIFE::SoundManager::deleteSoundEffect().

+ Here is the caller graph for this function:

◆ deleteSoundFilter()

void FIFE::SoundEffectManager::deleteSoundFilter ( SoundFilter filter)

Deletes given SoundFilter.

Deactivates for SoundEmitters and Effects are automatically done.

Definition at line 409 of file soundeffectmanager.cpp.

References disableDirectSoundFilter(), disableSoundEffect(), enableSoundEffect(), m_filterdEffects, m_filterdEmitters, and m_filters.

Referenced by FIFE::SoundManager::deleteSoundFilter().

+ Here is the caller graph for this function:

◆ disableDirectSoundFilter()

void FIFE::SoundEffectManager::disableDirectSoundFilter ( SoundFilter filter)

Disables given SoundFilter.

Only SoundFilters for SoundEmitters are meant.

Definition at line 456 of file soundeffectmanager.cpp.

References deactivateFilter(), FIFE::SoundFilter::isEnabled(), m_filterdEmitters, and FIFE::SoundFilter::setEnabled().

Referenced by deleteSoundFilter(), and FIFE::SoundManager::disableDirectSoundFilter().

+ Here is the caller graph for this function:

◆ disableSoundEffect()

◆ enableDirectSoundFilter()

void FIFE::SoundEffectManager::enableDirectSoundFilter ( SoundFilter filter)

Enables given direct SoundFilter.

Only SoundFilters for SoundEmitters are meant.

Definition at line 440 of file soundeffectmanager.cpp.

References activateFilter(), FIFE::SoundFilter::isEnabled(), m_filterdEmitters, and FIFE::SoundFilter::setEnabled().

Referenced by FIFE::SoundManager::enableDirectSoundFilter().

+ Here is the caller graph for this function:

◆ enableSoundEffect()

◆ init()

void FIFE::SoundEffectManager::init ( ALCdevice *  device)

Initializes the effect system.

Definition at line 105 of file soundeffectmanager.cpp.

References FIFE::_log, FIFE::alGenAuxiliaryEffectSlots, createPresets(), FL_WARN, m_active, m_createdSlots, m_device, m_effectSlots, m_freeSlots, m_maxSlots, and FIFE::MAX_EFFECT_SLOTS.

Referenced by FIFE::SoundManager::init().

+ Here is the caller graph for this function:

◆ isActive()

bool FIFE::SoundEffectManager::isActive ( ) const

Returns true if sound effect module is active.

Definition at line 187 of file soundeffectmanager.cpp.

References m_active.

Referenced by addEmitterToSoundEffect().

+ Here is the caller graph for this function:

◆ removeEmitterFromDirectSoundFilter()

void FIFE::SoundEffectManager::removeEmitterFromDirectSoundFilter ( SoundFilter filter,
SoundEmitter emitter 
)

Removes given SoundEmitter from the specific direct SoundFilter.

Definition at line 484 of file soundeffectmanager.cpp.

References FIFE::_log, deactivateFilter(), FL_WARN, FIFE::SoundEmitter::isActive(), m_filterdEmitters, and FIFE::SoundEmitter::setDirectFilter().

Referenced by FIFE::SoundManager::removeEmitterFromDirectSoundFilter().

+ Here is the caller graph for this function:

◆ removeEmitterFromSoundEffect()

void FIFE::SoundEffectManager::removeEmitterFromSoundEffect ( SoundEffect effect,
SoundEmitter emitter 
)

Removes given SoundEmitter from the specific SoundEffect.

Definition at line 317 of file soundeffectmanager.cpp.

References FIFE::_log, deactivateEffect(), FL_WARN, FIFE::SoundEmitter::isActive(), m_effectEmitters, and FIFE::SoundEmitter::removeEffect().

Referenced by FIFE::SoundManager::removeEmitterFromSoundEffect().

+ Here is the caller graph for this function:

◆ removeSoundFilterFromSoundEffect()

void FIFE::SoundEffectManager::removeSoundFilterFromSoundEffect ( SoundEffect effect,
SoundFilter filter 
)

Member Data Documentation

◆ m_active

bool FIFE::SoundEffectManager::m_active
private

If sound effect module is active.

Definition at line 154 of file soundeffectmanager.h.

Referenced by init(), and isActive().

◆ m_createdSlots

uint16_t FIFE::SoundEffectManager::m_createdSlots
private

Maximal created effect slots, can be different to MAX_EFFECT_SLOTS.

Definition at line 158 of file soundeffectmanager.h.

Referenced by init().

◆ m_device

ALCdevice* FIFE::SoundEffectManager::m_device
private

OpenAL device.

Definition at line 152 of file soundeffectmanager.h.

Referenced by init().

◆ m_effectEmitters

SoundEffectEmitterMap FIFE::SoundEffectManager::m_effectEmitters
private

◆ m_effects

std::vector<SoundEffect*> FIFE::SoundEffectManager::m_effects
private

Holds all SoundEffects.

Definition at line 164 of file soundeffectmanager.h.

Referenced by createSoundEffect(), createSoundEffectPreset(), deleteSoundEffect(), and ~SoundEffectManager().

◆ m_effectSlots

ALuint FIFE::SoundEffectManager::m_effectSlots[MAX_EFFECT_SLOTS]
private

Holds handles for effects.

Definition at line 156 of file soundeffectmanager.h.

Referenced by init().

◆ m_filterdEffects

SoundFilterEffectMap FIFE::SoundEffectManager::m_filterdEffects
private

◆ m_filterdEmitters

◆ m_filters

std::vector<SoundFilter*> FIFE::SoundEffectManager::m_filters
private

Holds all SoundFilters.

Definition at line 169 of file soundeffectmanager.h.

Referenced by createSoundFilter(), deleteSoundFilter(), and ~SoundEffectManager().

◆ m_freeSlots

std::queue<ALuint> FIFE::SoundEffectManager::m_freeSlots
private

Holds free handles for effect slots.

Definition at line 160 of file soundeffectmanager.h.

Referenced by disableSoundEffect(), enableSoundEffect(), and init().

◆ m_maxSlots

ALint FIFE::SoundEffectManager::m_maxSlots
private

Maximal effect slots per Source.

Definition at line 162 of file soundeffectmanager.h.

Referenced by addEmitterToSoundEffect(), and init().

◆ m_presets

std::map<SoundEffectPreset, EFXEAXREVERBPROPERTIES> FIFE::SoundEffectManager::m_presets
private

Establishes the relationship between SoundEffectPreset and EFXEAXREVERBPROPERTIES.

Definition at line 177 of file soundeffectmanager.h.

Referenced by createPresets(), and createSoundEffectPreset().


The documentation for this class was generated from the following files: