void CEFX::SetHeightRolloffModifer(const float& mod) { heightRolloffModifier = mod; if (!supported) return; alEffectf(sfxReverb, AL_EAXREVERB_ROOM_ROLLOFF_FACTOR, sfxProperties->properties_f[AL_EAXREVERB_ROOM_ROLLOFF_FACTOR] * heightRolloffModifier); alAuxiliaryEffectSloti(sfxSlot, AL_EFFECTSLOT_EFFECT, sfxReverb); }
void CEFX::CommitEffects() { if (!supported) return; //! commit reverb properties for (std::map<ALuint, ALfloat>::iterator it = sfxProperties->properties_f.begin(); it != sfxProperties->properties_f.end(); ++it) alEffectf(sfxReverb, it->first, it->second); for (std::map<ALuint, ALint>::iterator it = sfxProperties->properties_i.begin(); it != sfxProperties->properties_i.end(); ++it) alEffecti(sfxReverb, it->first, it->second); for (std::map<ALuint, float3>::iterator it = sfxProperties->properties_v.begin(); it != sfxProperties->properties_v.end(); ++it) alEffectfv(sfxReverb, it->first, (ALfloat*)&it->second[0]); alEffectf(sfxReverb, AL_EAXREVERB_ROOM_ROLLOFF_FACTOR, sfxProperties->properties_f[AL_EAXREVERB_ROOM_ROLLOFF_FACTOR] * heightRolloffModifier); alAuxiliaryEffectSloti(sfxSlot, AL_EFFECTSLOT_EFFECT, sfxReverb); for (std::map<ALuint, ALfloat>::iterator it=sfxProperties->filter_properties_f.begin(); it != sfxProperties->filter_properties_f.end(); ++it) alFilterf(sfxFilter, it->first, it->second); updates++; }
AL_API ALvoid AL_APIENTRY alEffectfv(ALuint effect, ALenum param, ALfloat *pflValues) { ALCcontext *Context; Context = alcGetCurrentContext(); SuspendContext(Context); if (effect && alIsEffect(effect)) { ALeffect *ALEffect = (ALeffect*)ALTHUNK_LOOKUPENTRY(effect); if(ALEffect->type == AL_EFFECT_REVERB) { switch(param) { case AL_REVERB_DENSITY: case AL_REVERB_DIFFUSION: case AL_REVERB_GAIN: case AL_REVERB_GAINHF: case AL_REVERB_DECAY_TIME: case AL_REVERB_DECAY_HFRATIO: case AL_REVERB_REFLECTIONS_GAIN: case AL_REVERB_REFLECTIONS_DELAY: case AL_REVERB_LATE_REVERB_GAIN: case AL_REVERB_LATE_REVERB_DELAY: case AL_REVERB_AIR_ABSORPTION_GAINHF: case AL_REVERB_ROOM_ROLLOFF_FACTOR: alEffectf(effect, param, pflValues[0]); break; default: alSetError(AL_INVALID_ENUM); break; } } else alSetError(AL_INVALID_ENUM); } else alSetError(AL_INVALID_NAME); ProcessContext(Context); }
void Equalizer::setMid2Width(float value) { value = std::min(value, 1.0f); value = std::max(value, 0.01f); m_mid2Width = value; alEffectf(m_effect, AL_EQUALIZER_MID2_WIDTH, m_mid2Width); }
void Equalizer::setHighGain(float value) { value = std::min(value, 7.943f); value = std::max(value, 0.126f); m_highGain = value; alEffectf(m_effect, AL_EQUALIZER_HIGH_GAIN, m_highGain); }
ALboolean QOpenALEngine::SetEFXEAXReverbProperties(EFXEAXREVERBPROPERTIES *pEFXEAXReverb, ALuint uiEffect) { ALboolean bReturn = AL_FALSE; if (pEFXEAXReverb) { // Clear AL Error code alGetError(); alEffectf(uiEffect, AL_EAXREVERB_DENSITY, pEFXEAXReverb->flDensity); alEffectf(uiEffect, AL_EAXREVERB_DIFFUSION, pEFXEAXReverb->flDiffusion); alEffectf(uiEffect, AL_EAXREVERB_GAIN, pEFXEAXReverb->flGain); alEffectf(uiEffect, AL_EAXREVERB_GAINHF, pEFXEAXReverb->flGainHF); alEffectf(uiEffect, AL_EAXREVERB_GAINLF, pEFXEAXReverb->flGainLF); alEffectf(uiEffect, AL_EAXREVERB_DECAY_TIME, pEFXEAXReverb->flDecayTime); alEffectf(uiEffect, AL_EAXREVERB_DECAY_HFRATIO, pEFXEAXReverb->flDecayHFRatio); alEffectf(uiEffect, AL_EAXREVERB_DECAY_LFRATIO, pEFXEAXReverb->flDecayLFRatio); alEffectf(uiEffect, AL_EAXREVERB_REFLECTIONS_GAIN, pEFXEAXReverb->flReflectionsGain); alEffectf(uiEffect, AL_EAXREVERB_REFLECTIONS_DELAY, pEFXEAXReverb->flReflectionsDelay); alEffectfv(uiEffect, AL_EAXREVERB_REFLECTIONS_PAN, pEFXEAXReverb->flReflectionsPan); alEffectf(uiEffect, AL_EAXREVERB_LATE_REVERB_GAIN, pEFXEAXReverb->flLateReverbGain); alEffectf(uiEffect, AL_EAXREVERB_LATE_REVERB_DELAY, pEFXEAXReverb->flLateReverbDelay); alEffectfv(uiEffect, AL_EAXREVERB_LATE_REVERB_PAN, pEFXEAXReverb->flLateReverbPan); alEffectf(uiEffect, AL_EAXREVERB_ECHO_TIME, pEFXEAXReverb->flEchoTime); alEffectf(uiEffect, AL_EAXREVERB_ECHO_DEPTH, pEFXEAXReverb->flEchoDepth); alEffectf(uiEffect, AL_EAXREVERB_MODULATION_TIME, pEFXEAXReverb->flModulationTime); alEffectf(uiEffect, AL_EAXREVERB_MODULATION_DEPTH, pEFXEAXReverb->flModulationDepth); alEffectf(uiEffect, AL_EAXREVERB_AIR_ABSORPTION_GAINHF, pEFXEAXReverb->flAirAbsorptionGainHF); alEffectf(uiEffect, AL_EAXREVERB_HFREFERENCE, pEFXEAXReverb->flHFReference); alEffectf(uiEffect, AL_EAXREVERB_LFREFERENCE, pEFXEAXReverb->flLFReference); alEffectf(uiEffect, AL_EAXREVERB_ROOM_ROLLOFF_FACTOR, pEFXEAXReverb->flRoomRolloffFactor); alEffecti(uiEffect, AL_EAXREVERB_DECAY_HFLIMIT, pEFXEAXReverb->iDecayHFLimit); if (alGetError() == AL_NO_ERROR) bReturn = AL_TRUE; } return bReturn; }
void FrequencyShifter::setFrequency(float value) { value = std::min(value, 24000.0f); value = std::max(value, 0.0f); m_frequency = value; alEffectf(m_effect, AL_FREQUENCY_SHIFTER_FREQUENCY, m_frequency); }
AL_API ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint iValue) { ALCcontext *Context; ALCdevice *Device; ALeffect *ALEffect; Context = GetContextSuspended(); if(!Context) return; Device = Context->Device; if((ALEffect=LookupEffect(Device->EffectMap, effect)) != NULL) { if(param == AL_EFFECT_TYPE) { ALboolean isOk = (iValue == AL_EFFECT_NULL || (iValue == AL_EFFECT_EAXREVERB && !DisabledEffects[EAXREVERB]) || (iValue == AL_EFFECT_REVERB && !DisabledEffects[REVERB]) || (iValue == AL_EFFECT_ECHO && !DisabledEffects[ECHO]) || (iValue == AL_EFFECT_RING_MODULATOR && !DisabledEffects[MODULATOR])); if(isOk) InitEffectParams(ALEffect, iValue); else alSetError(Context, AL_INVALID_VALUE); } else if(ALEffect->type == AL_EFFECT_EAXREVERB) { switch(param) { case AL_EAXREVERB_DECAY_HFLIMIT: if(iValue >= AL_EAXREVERB_MIN_DECAY_HFLIMIT && iValue <= AL_EAXREVERB_MAX_DECAY_HFLIMIT) ALEffect->Reverb.DecayHFLimit = iValue; else alSetError(Context, AL_INVALID_VALUE); break; default: alSetError(Context, AL_INVALID_ENUM); break; } } else if(ALEffect->type == AL_EFFECT_REVERB) { switch(param) { case AL_REVERB_DECAY_HFLIMIT: if(iValue >= AL_REVERB_MIN_DECAY_HFLIMIT && iValue <= AL_REVERB_MAX_DECAY_HFLIMIT) ALEffect->Reverb.DecayHFLimit = iValue; else alSetError(Context, AL_INVALID_VALUE); break; default: alSetError(Context, AL_INVALID_ENUM); break; } } else if(ALEffect->type == AL_EFFECT_ECHO) { switch(param) { default: alSetError(Context, AL_INVALID_ENUM); break; } } else if(ALEffect->type == AL_EFFECT_RING_MODULATOR) { switch(param) { case AL_RING_MODULATOR_FREQUENCY: case AL_RING_MODULATOR_HIGHPASS_CUTOFF: alEffectf(effect, param, (ALfloat)iValue); break; case AL_RING_MODULATOR_WAVEFORM: if(iValue >= AL_RING_MODULATOR_MIN_WAVEFORM && iValue <= AL_RING_MODULATOR_MAX_WAVEFORM) ALEffect->Modulator.Waveform = iValue; else alSetError(Context, AL_INVALID_VALUE); break; default: alSetError(Context, AL_INVALID_ENUM); break; } } else alSetError(Context, AL_INVALID_ENUM); } else alSetError(Context, AL_INVALID_NAME); ProcessContext(Context); }
ALvoid AL_APIENTRY alEffectfv(ALuint effect, ALenum param, ALfloat *pflValues) { ALCcontext *Context; Context = alcGetCurrentContext(); SuspendContext(Context); if (effect && alIsEffect(effect)) { ALeffect *ALEffect = (ALeffect*)ALTHUNK_LOOKUPENTRY(effect); if(ALEffect->type == AL_EFFECT_EAXREVERB) { switch(param) { case AL_EAXREVERB_DENSITY: case AL_EAXREVERB_DIFFUSION: case AL_EAXREVERB_GAIN: case AL_EAXREVERB_GAINHF: case AL_EAXREVERB_GAINLF: case AL_EAXREVERB_DECAY_TIME: case AL_EAXREVERB_DECAY_HFRATIO: case AL_EAXREVERB_DECAY_LFRATIO: case AL_EAXREVERB_REFLECTIONS_GAIN: case AL_EAXREVERB_REFLECTIONS_DELAY: case AL_EAXREVERB_LATE_REVERB_GAIN: case AL_EAXREVERB_LATE_REVERB_DELAY: case AL_EAXREVERB_AIR_ABSORPTION_GAINHF: case AL_EAXREVERB_ECHO_TIME: case AL_EAXREVERB_ECHO_DEPTH: case AL_EAXREVERB_MODULATION_TIME: case AL_EAXREVERB_MODULATION_DEPTH: case AL_EAXREVERB_HFREFERENCE: case AL_EAXREVERB_LFREFERENCE: case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR: alEffectf(effect, param, pflValues[0]); break; case AL_EAXREVERB_REFLECTIONS_PAN: if(!isnan(pflValues[0]) && !isnan(pflValues[1]) && !isnan(pflValues[2])) { ALEffect->Reverb.ReflectionsPan[0] = pflValues[0]; ALEffect->Reverb.ReflectionsPan[1] = pflValues[1]; ALEffect->Reverb.ReflectionsPan[2] = pflValues[2]; } else alSetError(AL_INVALID_VALUE); break; case AL_EAXREVERB_LATE_REVERB_PAN: if(!isnan(pflValues[0]) && !isnan(pflValues[1]) && !isnan(pflValues[2])) { ALEffect->Reverb.LateReverbPan[0] = pflValues[0]; ALEffect->Reverb.LateReverbPan[1] = pflValues[1]; ALEffect->Reverb.LateReverbPan[2] = pflValues[2]; } else alSetError(AL_INVALID_VALUE); break; default: alSetError(AL_INVALID_ENUM); break; } } else if(ALEffect->type == AL_EFFECT_REVERB) { switch(param) { case AL_REVERB_DENSITY: case AL_REVERB_DIFFUSION: case AL_REVERB_GAIN: case AL_REVERB_GAINHF: case AL_REVERB_DECAY_TIME: case AL_REVERB_DECAY_HFRATIO: case AL_REVERB_REFLECTIONS_GAIN: case AL_REVERB_REFLECTIONS_DELAY: case AL_REVERB_LATE_REVERB_GAIN: case AL_REVERB_LATE_REVERB_DELAY: case AL_REVERB_AIR_ABSORPTION_GAINHF: case AL_REVERB_ROOM_ROLLOFF_FACTOR: alEffectf(effect, param, pflValues[0]); break; default: alSetError(AL_INVALID_ENUM); break; } } else if(ALEffect->type == AL_EFFECT_ECHO) { switch(param) { case AL_ECHO_DELAY: case AL_ECHO_LRDELAY: case AL_ECHO_DAMPING: case AL_ECHO_FEEDBACK: case AL_ECHO_SPREAD: alEffectf(effect, param, pflValues[0]); break; default: alSetError(AL_INVALID_ENUM); break; } } else alSetError(AL_INVALID_ENUM); } else alSetError(AL_INVALID_NAME); ProcessContext(Context); }
void Autowah::setResonance(float value) { value = std::min(value, 1000.0f); value = std::max(value, 2.0f); m_resonance = value; alEffectf(m_effect, AL_AUTOWAH_RESONANCE, m_resonance); }
void EaxReverb::setDiffusion(float value) { value = std::min(value, 1.0f); value = std::max(value, 0.0f); m_diffusion = value; alEffectf(m_effect, AL_EAXREVERB_DIFFUSION, m_diffusion); }
void Autowah::setAttackTime(float value) { value = std::min(value, 1.0f); value = std::max(value, 0.0001f); m_attackTime = value; alEffectf(m_effect, AL_AUTOWAH_ATTACK_TIME, m_attackTime); }
void Autowah::setReleaseTime(float value) { value = std::min(value, 1.0f); value = std::max(value, 0.0001f); m_releaseTime = value; alEffectf(m_effect, AL_AUTOWAH_RELEASE_TIME, m_releaseTime); }
void RingModulator::setHighpassCutoff(float value) { value = std::min(value, 24000.0f); value = std::max(value, 0.0f); m_highpassCutoff = value; alEffectf(m_effect, AL_RING_MODULATOR_HIGHPASS_CUTOFF, m_highpassCutoff); }
void RingModulator::setFrequency(float value) { value = std::min(value, 8000.0f); value = std::max(value, 0.0f); m_frequency = value; alEffectf(m_effect, AL_RING_MODULATOR_FREQUENCY, m_frequency); }
void VocalMorpher::setRate(float value) { value = std::min(value, 10.0f); value = std::max(value, 0.0f); m_rate = value; alEffectf(m_effect, AL_VOCAL_MORPHER_RATE, m_rate); }
void Equalizer::setHighCutoff(float value) { value = std::min(value, 16000.0f); value = std::max(value, 4000.0f); m_highCutoff = value; alEffectf(m_effect, AL_EQUALIZER_HIGH_CUTOFF, m_highCutoff); }
void Autowah::setPeakGain(float value) { value = std::min(value, 31621.0f); value = std::max(value, 0.00003f); m_peakGain = value; alEffectf(m_effect, AL_AUTOWAH_PEAK_GAIN, m_peakGain); }
void EaxReverb::setDensity(float value) { value = std::min(value, 1.0f); value = std::max(value, 0.0f); m_density = value; alEffectf(m_effect, AL_EAXREVERB_DENSITY, m_density); }
void Equalizer::setLowGain(float value) { value = std::min(value, 7.943f); value = std::max(value, 0.126f); m_lowGain = value; alEffectf(m_effect, AL_EQUALIZER_LOW_GAIN, m_lowGain); }
void EaxReverb::setGainHf(float value) { value = std::min(value, 1.0f); value = std::max(value, 0.0f); m_gainHf = value; alEffectf(m_effect, AL_EAXREVERB_GAINHF, m_gainHf); }
void Equalizer::setLowCutoff(float value) { value = std::min(value, 800.0f); value = std::max(value, 50.0f); m_lowCutoff = value; alEffectf(m_effect, AL_EQUALIZER_LOW_CUTOFF, m_lowCutoff); }
AL_API ALvoid AL_APIENTRY alEffectfv(ALuint effect, ALenum param, ALfloat *pflValues) { ALCcontext *Context; ALCdevice *Device; ALeffect *ALEffect; Context = GetContextSuspended(); if(!Context) return; Device = Context->Device; if((ALEffect=LookupEffect(Device->EffectMap, effect)) != NULL) { if(ALEffect->type == AL_EFFECT_EAXREVERB) { switch(param) { case AL_EAXREVERB_DENSITY: case AL_EAXREVERB_DIFFUSION: case AL_EAXREVERB_GAIN: case AL_EAXREVERB_GAINHF: case AL_EAXREVERB_GAINLF: case AL_EAXREVERB_DECAY_TIME: case AL_EAXREVERB_DECAY_HFRATIO: case AL_EAXREVERB_DECAY_LFRATIO: case AL_EAXREVERB_REFLECTIONS_GAIN: case AL_EAXREVERB_REFLECTIONS_DELAY: case AL_EAXREVERB_LATE_REVERB_GAIN: case AL_EAXREVERB_LATE_REVERB_DELAY: case AL_EAXREVERB_AIR_ABSORPTION_GAINHF: case AL_EAXREVERB_ECHO_TIME: case AL_EAXREVERB_ECHO_DEPTH: case AL_EAXREVERB_MODULATION_TIME: case AL_EAXREVERB_MODULATION_DEPTH: case AL_EAXREVERB_HFREFERENCE: case AL_EAXREVERB_LFREFERENCE: case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR: alEffectf(effect, param, pflValues[0]); break; case AL_EAXREVERB_REFLECTIONS_PAN: if(!isnan(pflValues[0]) && !isnan(pflValues[1]) && !isnan(pflValues[2])) { ALEffect->Reverb.ReflectionsPan[0] = pflValues[0]; ALEffect->Reverb.ReflectionsPan[1] = pflValues[1]; ALEffect->Reverb.ReflectionsPan[2] = pflValues[2]; } else alSetError(Context, AL_INVALID_VALUE); break; case AL_EAXREVERB_LATE_REVERB_PAN: if(!isnan(pflValues[0]) && !isnan(pflValues[1]) && !isnan(pflValues[2])) { ALEffect->Reverb.LateReverbPan[0] = pflValues[0]; ALEffect->Reverb.LateReverbPan[1] = pflValues[1]; ALEffect->Reverb.LateReverbPan[2] = pflValues[2]; } else alSetError(Context, AL_INVALID_VALUE); break; default: alSetError(Context, AL_INVALID_ENUM); break; } } else if(ALEffect->type == AL_EFFECT_REVERB) { switch(param) { case AL_REVERB_DENSITY: case AL_REVERB_DIFFUSION: case AL_REVERB_GAIN: case AL_REVERB_GAINHF: case AL_REVERB_DECAY_TIME: case AL_REVERB_DECAY_HFRATIO: case AL_REVERB_REFLECTIONS_GAIN: case AL_REVERB_REFLECTIONS_DELAY: case AL_REVERB_LATE_REVERB_GAIN: case AL_REVERB_LATE_REVERB_DELAY: case AL_REVERB_AIR_ABSORPTION_GAINHF: case AL_REVERB_ROOM_ROLLOFF_FACTOR: alEffectf(effect, param, pflValues[0]); break; default: alSetError(Context, AL_INVALID_ENUM); break; } } else if(ALEffect->type == AL_EFFECT_ECHO) { switch(param) { case AL_ECHO_DELAY: case AL_ECHO_LRDELAY: case AL_ECHO_DAMPING: case AL_ECHO_FEEDBACK: case AL_ECHO_SPREAD: alEffectf(effect, param, pflValues[0]); break; default: alSetError(Context, AL_INVALID_ENUM); break; } } else if(ALEffect->type == AL_EFFECT_RING_MODULATOR) { switch(param) { case AL_RING_MODULATOR_FREQUENCY: case AL_RING_MODULATOR_HIGHPASS_CUTOFF: alEffectf(effect, param, pflValues[0]); break; default: alSetError(Context, AL_INVALID_ENUM); break; } } else alSetError(Context, AL_INVALID_ENUM); } else alSetError(Context, AL_INVALID_NAME); ProcessContext(Context); }
void Flanger::setFeedback(float value) { value = std::min(value, 1.0f); value = std::max(value, -1.0f); m_feedback = value; alEffectf(m_effect, AL_FLANGER_FEEDBACK, m_feedback); }
static ALvoid CDECL wine_alEffectf(ALuint eid, ALenum param, ALfloat value) { alEffectf(eid, param, value); }
void Flanger::setDepth(float value) { value = std::min(value, 1.0f); value = std::max(value, 0.0f); m_depth = value; alEffectf(m_effect, AL_FLANGER_DEPTH, m_depth); }
void Equalizer::setMid2Gain(float value) { value = std::min(value, 7.943f); value = std::max(value, 0.126f); m_mid2Gain = value; alEffectf(m_effect, AL_EQUALIZER_MID2_GAIN, m_mid2Gain); }
void Flanger::setDelay(float value) { value = std::min(value, 0.004f); value = std::max(value, 0.0f); m_delay = value; alEffectf(m_effect, AL_FLANGER_DELAY, m_delay); }
void Equalizer::setMid2Center(float value) { value = std::min(value, 8000.0f); value = std::max(value, 1000.0f); m_mid2Center = value; alEffectf(m_effect, AL_EQUALIZER_MID2_CENTER, m_mid2Center); }
void Flanger::setRate(float value) { value = std::min(value, 10.0f); value = std::max(value, 0.0f); m_rate = value; alEffectf(m_effect, AL_FLANGER_RATE, m_rate); }