FIFE
be64c707dea6b3250bd4355bf5c825d25920087d
|
#include <soundeffectmanager.h>
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... | |
Definition at line 46 of file soundeffectmanager.h.
|
private |
Holds SoundEffects together with the added SoundEmitters.
Definition at line 166 of file soundeffectmanager.h.
|
private |
Holds SoundFilters together with the added SoundEffects.
Definition at line 174 of file soundeffectmanager.h.
|
private |
Holds SoundFilters together with the added SoundEmitters.
Definition at line 171 of file soundeffectmanager.h.
FIFE::SoundEffectManager::SoundEffectManager | ( | ) |
Constructor.
Definition at line 87 of file soundeffectmanager.cpp.
FIFE::SoundEffectManager::~SoundEffectManager | ( | ) |
Destructor.
Definition at line 95 of file soundeffectmanager.cpp.
void FIFE::SoundEffectManager::activateEffect | ( | SoundEffect * | effect, |
SoundEmitter * | emitter | ||
) |
Internal function to do the OpenAL calls to activate the SoundEffect for the SoundEmitter.
Definition at line 386 of file soundeffectmanager.cpp.
References FIFE::SoundEmitter::getEffectNumber(), FIFE::SoundEffect::getFilter(), FIFE::SoundFilter::getFilterId(), FIFE::SoundEffect::getSlotId(), FIFE::SoundEmitter::getSource(), and FIFE::SoundEffect::isEnabled().
Referenced by FIFE::SoundManager::activateEffect(), addEmitterToSoundEffect(), and enableSoundEffect().
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().
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().
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().
void FIFE::SoundEffectManager::addSoundFilterToSoundEffect | ( | SoundEffect * | effect, |
SoundFilter * | filter | ||
) |
Adds given SoundFilter to the SoundEffect.
Note: A SoundEffect can only have one SoundFilter.
Definition at line 344 of file soundeffectmanager.cpp.
References FIFE::_log, disableSoundEffect(), enableSoundEffect(), FL_WARN, FIFE::SoundEffect::getFilter(), FIFE::SoundEffect::isEnabled(), m_filterdEffects, and FIFE::SoundEffect::setFilter().
Referenced by FIFE::SoundManager::addSoundFilterToSoundEffect().
|
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().
SoundEffect * FIFE::SoundEffectManager::createSoundEffect | ( | SoundEffectType | type | ) |
Creates SoundEffect of the specific type.
type | See SoundEffectType |
Definition at line 191 of file soundeffectmanager.cpp.
References m_effects, FIFE::SE_EFFECT_AUTOWAH, FIFE::SE_EFFECT_CHORUS, FIFE::SE_EFFECT_COMPRESSOR, FIFE::SE_EFFECT_DISTORTION, FIFE::SE_EFFECT_EAXREVERB, FIFE::SE_EFFECT_ECHO, FIFE::SE_EFFECT_EQUALIZER, FIFE::SE_EFFECT_FLANGER, FIFE::SE_EFFECT_FREQUENCY_SHIFTER, FIFE::SE_EFFECT_PITCH_SHIFTER, FIFE::SE_EFFECT_REVERB, FIFE::SE_EFFECT_RING_MODULATOR, and FIFE::SE_EFFECT_VOCAL_MORPHER.
Referenced by FIFE::SoundManager::createSoundEffect().
SoundEffect * FIFE::SoundEffectManager::createSoundEffectPreset | ( | SoundEffectPreset | type | ) |
Creates EaxReverb SoundEffect and loads the specific preset type.
type | See SoundEffectPreset |
Definition at line 226 of file soundeffectmanager.cpp.
References FIFE::EaxReverb::loadPreset(), m_effects, and m_presets.
Referenced by FIFE::SoundManager::createSoundEffectPreset().
SoundFilter * FIFE::SoundEffectManager::createSoundFilter | ( | SoundFilterType | type | ) |
Creates SoundFilter of the specific type.
type | See SoundFilterType |
Definition at line 403 of file soundeffectmanager.cpp.
References m_filters.
Referenced by FIFE::SoundManager::createSoundFilter().
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().
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().
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().
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().
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().
void FIFE::SoundEffectManager::disableSoundEffect | ( | SoundEffect * | effect | ) |
Disables given SoundEffect.
Definition at line 287 of file soundeffectmanager.cpp.
References FIFE::alAuxiliaryEffectSloti, deactivateEffect(), FIFE::SoundEffect::getSlotId(), FIFE::SoundEffect::isEnabled(), m_effectEmitters, m_freeSlots, FIFE::SoundEffect::setEnabled(), and FIFE::SoundEffect::setSlotId().
Referenced by addSoundFilterToSoundEffect(), deleteSoundEffect(), deleteSoundFilter(), FIFE::SoundManager::disableSoundEffect(), and removeSoundFilterFromSoundEffect().
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().
void FIFE::SoundEffectManager::enableSoundEffect | ( | SoundEffect * | effect | ) |
Enables given SoundEffect.
Definition at line 261 of file soundeffectmanager.cpp.
References FIFE::_log, activateEffect(), FIFE::alAuxiliaryEffectSloti, FL_WARN, FIFE::SoundEffect::getEffectId(), FIFE::SoundEffect::getFilter(), FIFE::SoundFilter::getFilterId(), FIFE::SoundEffect::isEnabled(), m_effectEmitters, m_freeSlots, FIFE::SoundEffect::setEnabled(), and FIFE::SoundEffect::setSlotId().
Referenced by addSoundFilterToSoundEffect(), deleteSoundFilter(), FIFE::SoundManager::enableSoundEffect(), and removeSoundFilterFromSoundEffect().
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().
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().
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().
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().
void FIFE::SoundEffectManager::removeSoundFilterFromSoundEffect | ( | SoundEffect * | effect, |
SoundFilter * | filter | ||
) |
Removes given SoundFilter from the SoundEffect.
Definition at line 357 of file soundeffectmanager.cpp.
References FIFE::_log, disableSoundEffect(), enableSoundEffect(), FL_WARN, FIFE::SoundEffect::isEnabled(), m_filterdEffects, and FIFE::SoundEffect::setFilter().
Referenced by deleteSoundEffect(), and FIFE::SoundManager::removeSoundFilterFromSoundEffect().
|
private |
If sound effect module is active.
Definition at line 154 of file soundeffectmanager.h.
Referenced by init(), and isActive().
|
private |
Maximal created effect slots, can be different to MAX_EFFECT_SLOTS.
Definition at line 158 of file soundeffectmanager.h.
Referenced by init().
|
private |
|
private |
Definition at line 167 of file soundeffectmanager.h.
Referenced by addEmitterToSoundEffect(), deleteSoundEffect(), disableSoundEffect(), enableSoundEffect(), and removeEmitterFromSoundEffect().
|
private |
Holds all SoundEffects.
Definition at line 164 of file soundeffectmanager.h.
Referenced by createSoundEffect(), createSoundEffectPreset(), deleteSoundEffect(), and ~SoundEffectManager().
|
private |
Holds handles for effects.
Definition at line 156 of file soundeffectmanager.h.
Referenced by init().
|
private |
Definition at line 175 of file soundeffectmanager.h.
Referenced by addSoundFilterToSoundEffect(), deleteSoundFilter(), and removeSoundFilterFromSoundEffect().
|
private |
Definition at line 172 of file soundeffectmanager.h.
Referenced by addEmitterToDirectSoundFilter(), deleteSoundFilter(), disableDirectSoundFilter(), enableDirectSoundFilter(), and removeEmitterFromDirectSoundFilter().
|
private |
Holds all SoundFilters.
Definition at line 169 of file soundeffectmanager.h.
Referenced by createSoundFilter(), deleteSoundFilter(), and ~SoundEffectManager().
|
private |
Holds free handles for effect slots.
Definition at line 160 of file soundeffectmanager.h.
Referenced by disableSoundEffect(), enableSoundEffect(), and init().
|
private |
Maximal effect slots per Source.
Definition at line 162 of file soundeffectmanager.h.
Referenced by addEmitterToSoundEffect(), and init().
|
private |
Establishes the relationship between SoundEffectPreset and EFXEAXREVERBPROPERTIES.
Definition at line 177 of file soundeffectmanager.h.
Referenced by createPresets(), and createSoundEffectPreset().