mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 08:34:40 +00:00
update openal-soft to 1.24.3
keeping the alt 87514151c4 (diff-73a8dc1ce58605f6c5ea53548454c3bae516ec5132a29c9d7ff7edf9730c75be)
This commit is contained in:
parent
12db0500e8
commit
ba32094b7b
276 changed files with 49304 additions and 8712 deletions
|
|
@ -4,15 +4,13 @@
|
|||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "AL/efx.h"
|
||||
|
||||
#include "alc/effects/base.h"
|
||||
#include "alc/context.h"
|
||||
#include "alnumeric.h"
|
||||
#include "effects.h"
|
||||
|
||||
#ifdef ALSOFT_EAX
|
||||
#include "alnumeric.h"
|
||||
#if ALSOFT_EAX
|
||||
#include "al/eax/effect.h"
|
||||
#include "al/eax/exception.h"
|
||||
#include "al/eax/utils.h"
|
||||
|
|
@ -35,75 +33,68 @@ constexpr EffectProps genDefaultProps() noexcept
|
|||
|
||||
const EffectProps AutowahEffectProps{genDefaultProps()};
|
||||
|
||||
void AutowahEffectHandler::SetParami(AutowahProps&, ALenum param, int)
|
||||
{ throw effect_exception{AL_INVALID_ENUM, "Invalid autowah integer property 0x%04x", param}; }
|
||||
void AutowahEffectHandler::SetParamiv(AutowahProps&, ALenum param, const int*)
|
||||
{
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid autowah integer vector property 0x%04x",
|
||||
param};
|
||||
}
|
||||
void AutowahEffectHandler::SetParami(ALCcontext *context, AutowahProps&, ALenum param, int)
|
||||
{ context->throw_error(AL_INVALID_ENUM, "Invalid autowah integer property {:#04x}", as_unsigned(param)); }
|
||||
void AutowahEffectHandler::SetParamiv(ALCcontext *context, AutowahProps&, ALenum param, const int*)
|
||||
{ context->throw_error(AL_INVALID_ENUM, "Invalid autowah integer vector property {:#04x}", as_unsigned(param)); }
|
||||
|
||||
void AutowahEffectHandler::SetParamf(AutowahProps &props, ALenum param, float val)
|
||||
void AutowahEffectHandler::SetParamf(ALCcontext *context, AutowahProps &props, ALenum param, float val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_AUTOWAH_ATTACK_TIME:
|
||||
if(!(val >= AL_AUTOWAH_MIN_ATTACK_TIME && val <= AL_AUTOWAH_MAX_ATTACK_TIME))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Autowah attack time out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "Autowah attack time out of range");
|
||||
props.AttackTime = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_AUTOWAH_RELEASE_TIME:
|
||||
if(!(val >= AL_AUTOWAH_MIN_RELEASE_TIME && val <= AL_AUTOWAH_MAX_RELEASE_TIME))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Autowah release time out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "Autowah release time out of range");
|
||||
props.ReleaseTime = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_AUTOWAH_RESONANCE:
|
||||
if(!(val >= AL_AUTOWAH_MIN_RESONANCE && val <= AL_AUTOWAH_MAX_RESONANCE))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Autowah resonance out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "Autowah resonance out of range");
|
||||
props.Resonance = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_AUTOWAH_PEAK_GAIN:
|
||||
if(!(val >= AL_AUTOWAH_MIN_PEAK_GAIN && val <= AL_AUTOWAH_MAX_PEAK_GAIN))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Autowah peak gain out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "Autowah peak gain out of range");
|
||||
props.PeakGain = val;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid autowah float property 0x%04x", param};
|
||||
return;
|
||||
}
|
||||
}
|
||||
void AutowahEffectHandler::SetParamfv(AutowahProps &props, ALenum param, const float *vals)
|
||||
{ SetParamf(props, param, *vals); }
|
||||
|
||||
void AutowahEffectHandler::GetParami(const AutowahProps&, ALenum param, int*)
|
||||
{ throw effect_exception{AL_INVALID_ENUM, "Invalid autowah integer property 0x%04x", param}; }
|
||||
void AutowahEffectHandler::GetParamiv(const AutowahProps&, ALenum param, int*)
|
||||
{
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid autowah integer vector property 0x%04x",
|
||||
param};
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid autowah float property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void AutowahEffectHandler::SetParamfv(ALCcontext *context, AutowahProps &props, ALenum param, const float *vals)
|
||||
{ SetParamf(context, props, param, *vals); }
|
||||
|
||||
void AutowahEffectHandler::GetParamf(const AutowahProps &props, ALenum param, float *val)
|
||||
void AutowahEffectHandler::GetParami(ALCcontext *context, const AutowahProps&, ALenum param, int*)
|
||||
{ context->throw_error(AL_INVALID_ENUM, "Invalid autowah integer property {:#04x}", as_unsigned(param)); }
|
||||
void AutowahEffectHandler::GetParamiv(ALCcontext *context, const AutowahProps&, ALenum param, int*)
|
||||
{ context->throw_error(AL_INVALID_ENUM, "Invalid autowah integer vector property {:#04x}", as_unsigned(param)); }
|
||||
|
||||
void AutowahEffectHandler::GetParamf(ALCcontext *context, const AutowahProps &props, ALenum param, float *val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_AUTOWAH_ATTACK_TIME: *val = props.AttackTime; break;
|
||||
case AL_AUTOWAH_RELEASE_TIME: *val = props.ReleaseTime; break;
|
||||
case AL_AUTOWAH_RESONANCE: *val = props.Resonance; break;
|
||||
case AL_AUTOWAH_PEAK_GAIN: *val = props.PeakGain; break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid autowah float property 0x%04x", param};
|
||||
case AL_AUTOWAH_ATTACK_TIME: *val = props.AttackTime; return;
|
||||
case AL_AUTOWAH_RELEASE_TIME: *val = props.ReleaseTime; return;
|
||||
case AL_AUTOWAH_RESONANCE: *val = props.Resonance; return;
|
||||
case AL_AUTOWAH_PEAK_GAIN: *val = props.PeakGain; return;
|
||||
}
|
||||
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid autowah float property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void AutowahEffectHandler::GetParamfv(const AutowahProps &props, ALenum param, float *vals)
|
||||
{ GetParamf(props, param, vals); }
|
||||
void AutowahEffectHandler::GetParamfv(ALCcontext *context, const AutowahProps &props, ALenum param, float *vals)
|
||||
{ GetParamf(context, props, param, vals); }
|
||||
|
||||
#ifdef ALSOFT_EAX
|
||||
#if ALSOFT_EAX
|
||||
namespace {
|
||||
|
||||
using AutowahCommitter = EaxCommitter<EaxAutowahCommitter>;
|
||||
|
|
|
|||
|
|
@ -7,9 +7,12 @@
|
|||
#include "AL/al.h"
|
||||
#include "AL/efx.h"
|
||||
|
||||
#include "alc/context.h"
|
||||
#include "alnumeric.h"
|
||||
#include "core/logging.h"
|
||||
#include "effects.h"
|
||||
|
||||
#ifdef ALSOFT_EAX
|
||||
#if ALSOFT_EAX
|
||||
#include <cassert>
|
||||
#include "al/eax/effect.h"
|
||||
#include "al/eax/exception.h"
|
||||
|
|
@ -41,7 +44,8 @@ constexpr ALenum EnumFromWaveform(ChorusWaveform type)
|
|||
case ChorusWaveform::Sinusoid: return AL_CHORUS_WAVEFORM_SINUSOID;
|
||||
case ChorusWaveform::Triangle: return AL_CHORUS_WAVEFORM_TRIANGLE;
|
||||
}
|
||||
throw std::runtime_error{"Invalid chorus waveform: "+std::to_string(static_cast<int>(type))};
|
||||
throw std::runtime_error{fmt::format("Invalid chorus waveform: {}",
|
||||
int{al::to_underlying(type)})};
|
||||
}
|
||||
|
||||
constexpr EffectProps genDefaultChorusProps() noexcept
|
||||
|
|
@ -72,7 +76,7 @@ constexpr EffectProps genDefaultFlangerProps() noexcept
|
|||
|
||||
const EffectProps ChorusEffectProps{genDefaultChorusProps()};
|
||||
|
||||
void ChorusEffectHandler::SetParami(ChorusProps &props, ALenum param, int val)
|
||||
void ChorusEffectHandler::SetParami(ALCcontext *context, ChorusProps &props, ALenum param, int val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
|
|
@ -80,89 +84,90 @@ void ChorusEffectHandler::SetParami(ChorusProps &props, ALenum param, int val)
|
|||
if(auto formopt = WaveformFromEnum(val))
|
||||
props.Waveform = *formopt;
|
||||
else
|
||||
throw effect_exception{AL_INVALID_VALUE, "Invalid chorus waveform: 0x%04x", val};
|
||||
break;
|
||||
context->throw_error(AL_INVALID_VALUE, "Invalid chorus waveform: {:#04x}",
|
||||
as_unsigned(val));
|
||||
return;
|
||||
|
||||
case AL_CHORUS_PHASE:
|
||||
if(!(val >= AL_CHORUS_MIN_PHASE && val <= AL_CHORUS_MAX_PHASE))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Chorus phase out of range: %d", val};
|
||||
context->throw_error(AL_INVALID_VALUE, "Chorus phase out of range: {}", val);
|
||||
props.Phase = val;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid chorus integer property 0x%04x", param};
|
||||
return;
|
||||
}
|
||||
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid chorus integer property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void ChorusEffectHandler::SetParamiv(ChorusProps &props, ALenum param, const int *vals)
|
||||
{ SetParami(props, param, *vals); }
|
||||
void ChorusEffectHandler::SetParamf(ChorusProps &props, ALenum param, float val)
|
||||
void ChorusEffectHandler::SetParamiv(ALCcontext *context, ChorusProps &props, ALenum param, const int *vals)
|
||||
{ SetParami(context, props, param, *vals); }
|
||||
void ChorusEffectHandler::SetParamf(ALCcontext *context, ChorusProps &props, ALenum param, float val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_CHORUS_RATE:
|
||||
if(!(val >= AL_CHORUS_MIN_RATE && val <= AL_CHORUS_MAX_RATE))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Chorus rate out of range: %f", val};
|
||||
context->throw_error(AL_INVALID_VALUE, "Chorus rate out of range: {:f}", val);
|
||||
props.Rate = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_CHORUS_DEPTH:
|
||||
if(!(val >= AL_CHORUS_MIN_DEPTH && val <= AL_CHORUS_MAX_DEPTH))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Chorus depth out of range: %f", val};
|
||||
context->throw_error(AL_INVALID_VALUE, "Chorus depth out of range: {:f}", val);
|
||||
props.Depth = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_CHORUS_FEEDBACK:
|
||||
if(!(val >= AL_CHORUS_MIN_FEEDBACK && val <= AL_CHORUS_MAX_FEEDBACK))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Chorus feedback out of range: %f", val};
|
||||
context->throw_error(AL_INVALID_VALUE, "Chorus feedback out of range: {:f}", val);
|
||||
props.Feedback = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_CHORUS_DELAY:
|
||||
if(!(val >= AL_CHORUS_MIN_DELAY && val <= AL_CHORUS_MAX_DELAY))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Chorus delay out of range: %f", val};
|
||||
context->throw_error(AL_INVALID_VALUE, "Chorus delay out of range: {:f}", val);
|
||||
props.Delay = val;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid chorus float property 0x%04x", param};
|
||||
return;
|
||||
}
|
||||
}
|
||||
void ChorusEffectHandler::SetParamfv(ChorusProps &props, ALenum param, const float *vals)
|
||||
{ SetParamf(props, param, *vals); }
|
||||
|
||||
void ChorusEffectHandler::GetParami(const ChorusProps &props, ALenum param, int *val)
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid chorus float property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void ChorusEffectHandler::SetParamfv(ALCcontext *context, ChorusProps &props, ALenum param, const float *vals)
|
||||
{ SetParamf(context, props, param, *vals); }
|
||||
|
||||
void ChorusEffectHandler::GetParami(ALCcontext *context, const ChorusProps &props, ALenum param, int *val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_CHORUS_WAVEFORM: *val = EnumFromWaveform(props.Waveform); break;
|
||||
case AL_CHORUS_PHASE: *val = props.Phase; break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid chorus integer property 0x%04x", param};
|
||||
case AL_CHORUS_WAVEFORM: *val = EnumFromWaveform(props.Waveform); return;
|
||||
case AL_CHORUS_PHASE: *val = props.Phase; return;
|
||||
}
|
||||
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid chorus integer property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void ChorusEffectHandler::GetParamiv(const ChorusProps &props, ALenum param, int *vals)
|
||||
{ GetParami(props, param, vals); }
|
||||
void ChorusEffectHandler::GetParamf(const ChorusProps &props, ALenum param, float *val)
|
||||
void ChorusEffectHandler::GetParamiv(ALCcontext *context, const ChorusProps &props, ALenum param, int *vals)
|
||||
{ GetParami(context, props, param, vals); }
|
||||
void ChorusEffectHandler::GetParamf(ALCcontext *context, const ChorusProps &props, ALenum param, float *val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_CHORUS_RATE: *val = props.Rate; break;
|
||||
case AL_CHORUS_DEPTH: *val = props.Depth; break;
|
||||
case AL_CHORUS_FEEDBACK: *val = props.Feedback; break;
|
||||
case AL_CHORUS_DELAY: *val = props.Delay; break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid chorus float property 0x%04x", param};
|
||||
case AL_CHORUS_RATE: *val = props.Rate; return;
|
||||
case AL_CHORUS_DEPTH: *val = props.Depth; return;
|
||||
case AL_CHORUS_FEEDBACK: *val = props.Feedback; return;
|
||||
case AL_CHORUS_DELAY: *val = props.Delay; return;
|
||||
}
|
||||
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid chorus float property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void ChorusEffectHandler::GetParamfv(const ChorusProps &props, ALenum param, float *vals)
|
||||
{ GetParamf(props, param, vals); }
|
||||
void ChorusEffectHandler::GetParamfv(ALCcontext *context, const ChorusProps &props, ALenum param, float *vals)
|
||||
{ GetParamf(context, props, param, vals); }
|
||||
|
||||
|
||||
const EffectProps FlangerEffectProps{genDefaultFlangerProps()};
|
||||
|
||||
void FlangerEffectHandler::SetParami(ChorusProps &props, ALenum param, int val)
|
||||
void FlangerEffectHandler::SetParami(ALCcontext *context, ChorusProps &props, ALenum param, int val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
|
|
@ -170,87 +175,88 @@ void FlangerEffectHandler::SetParami(ChorusProps &props, ALenum param, int val)
|
|||
if(auto formopt = WaveformFromEnum(val))
|
||||
props.Waveform = *formopt;
|
||||
else
|
||||
throw effect_exception{AL_INVALID_VALUE, "Invalid flanger waveform: 0x%04x", val};
|
||||
break;
|
||||
context->throw_error(AL_INVALID_VALUE, "Invalid flanger waveform: {:#04x}",
|
||||
as_unsigned(val));
|
||||
return;
|
||||
|
||||
case AL_FLANGER_PHASE:
|
||||
if(!(val >= AL_FLANGER_MIN_PHASE && val <= AL_FLANGER_MAX_PHASE))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Flanger phase out of range: %d", val};
|
||||
context->throw_error(AL_INVALID_VALUE, "Flanger phase out of range: {}", val);
|
||||
props.Phase = val;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid flanger integer property 0x%04x", param};
|
||||
return;
|
||||
}
|
||||
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid flanger integer property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void FlangerEffectHandler::SetParamiv(ChorusProps &props, ALenum param, const int *vals)
|
||||
{ SetParami(props, param, *vals); }
|
||||
void FlangerEffectHandler::SetParamf(ChorusProps &props, ALenum param, float val)
|
||||
void FlangerEffectHandler::SetParamiv(ALCcontext *context, ChorusProps &props, ALenum param, const int *vals)
|
||||
{ SetParami(context, props, param, *vals); }
|
||||
void FlangerEffectHandler::SetParamf(ALCcontext *context, ChorusProps &props, ALenum param, float val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_FLANGER_RATE:
|
||||
if(!(val >= AL_FLANGER_MIN_RATE && val <= AL_FLANGER_MAX_RATE))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Flanger rate out of range: %f", val};
|
||||
context->throw_error(AL_INVALID_VALUE, "Flanger rate out of range: {:f}", val);
|
||||
props.Rate = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_FLANGER_DEPTH:
|
||||
if(!(val >= AL_FLANGER_MIN_DEPTH && val <= AL_FLANGER_MAX_DEPTH))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Flanger depth out of range: %f", val};
|
||||
context->throw_error(AL_INVALID_VALUE, "Flanger depth out of range: {:f}", val);
|
||||
props.Depth = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_FLANGER_FEEDBACK:
|
||||
if(!(val >= AL_FLANGER_MIN_FEEDBACK && val <= AL_FLANGER_MAX_FEEDBACK))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Flanger feedback out of range: %f", val};
|
||||
context->throw_error(AL_INVALID_VALUE, "Flanger feedback out of range: {:f}", val);
|
||||
props.Feedback = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_FLANGER_DELAY:
|
||||
if(!(val >= AL_FLANGER_MIN_DELAY && val <= AL_FLANGER_MAX_DELAY))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Flanger delay out of range: %f", val};
|
||||
context->throw_error(AL_INVALID_VALUE, "Flanger delay out of range: {:f}", val);
|
||||
props.Delay = val;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid flanger float property 0x%04x", param};
|
||||
return;
|
||||
}
|
||||
}
|
||||
void FlangerEffectHandler::SetParamfv(ChorusProps &props, ALenum param, const float *vals)
|
||||
{ SetParamf(props, param, *vals); }
|
||||
|
||||
void FlangerEffectHandler::GetParami(const ChorusProps &props, ALenum param, int *val)
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid flanger float property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void FlangerEffectHandler::SetParamfv(ALCcontext *context, ChorusProps &props, ALenum param, const float *vals)
|
||||
{ SetParamf(context, props, param, *vals); }
|
||||
|
||||
void FlangerEffectHandler::GetParami(ALCcontext *context, const ChorusProps &props, ALenum param, int *val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_FLANGER_WAVEFORM: *val = EnumFromWaveform(props.Waveform); break;
|
||||
case AL_FLANGER_PHASE: *val = props.Phase; break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid flanger integer property 0x%04x", param};
|
||||
case AL_FLANGER_WAVEFORM: *val = EnumFromWaveform(props.Waveform); return;
|
||||
case AL_FLANGER_PHASE: *val = props.Phase; return;
|
||||
}
|
||||
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid flanger integer property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void FlangerEffectHandler::GetParamiv(const ChorusProps &props, ALenum param, int *vals)
|
||||
{ GetParami(props, param, vals); }
|
||||
void FlangerEffectHandler::GetParamf(const ChorusProps &props, ALenum param, float *val)
|
||||
void FlangerEffectHandler::GetParamiv(ALCcontext *context, const ChorusProps &props, ALenum param, int *vals)
|
||||
{ GetParami(context, props, param, vals); }
|
||||
void FlangerEffectHandler::GetParamf(ALCcontext *context, const ChorusProps &props, ALenum param, float *val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_FLANGER_RATE: *val = props.Rate; break;
|
||||
case AL_FLANGER_DEPTH: *val = props.Depth; break;
|
||||
case AL_FLANGER_FEEDBACK: *val = props.Feedback; break;
|
||||
case AL_FLANGER_DELAY: *val = props.Delay; break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid flanger float property 0x%04x", param};
|
||||
case AL_FLANGER_RATE: *val = props.Rate; return;
|
||||
case AL_FLANGER_DEPTH: *val = props.Depth; return;
|
||||
case AL_FLANGER_FEEDBACK: *val = props.Feedback; return;
|
||||
case AL_FLANGER_DELAY: *val = props.Delay; return;
|
||||
}
|
||||
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid flanger float property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void FlangerEffectHandler::GetParamfv(const ChorusProps &props, ALenum param, float *vals)
|
||||
{ GetParamf(props, param, vals); }
|
||||
void FlangerEffectHandler::GetParamfv(ALCcontext *context, const ChorusProps &props, ALenum param, float *vals)
|
||||
{ GetParamf(context, props, param, vals); }
|
||||
|
||||
|
||||
#ifdef ALSOFT_EAX
|
||||
#if ALSOFT_EAX
|
||||
namespace {
|
||||
|
||||
struct EaxChorusTraits {
|
||||
|
|
@ -558,6 +564,17 @@ public:
|
|||
al_props_.Depth = props.flDepth;
|
||||
al_props_.Feedback = props.flFeedback;
|
||||
al_props_.Delay = props.flDelay;
|
||||
if(EaxTraceCommits) UNLIKELY
|
||||
{
|
||||
TRACE("Chorus/flanger commit:\n"
|
||||
" Waveform: {}\n"
|
||||
" Phase: {}\n"
|
||||
" Rate: {:f}\n"
|
||||
" Depth: {:f}\n"
|
||||
" Feedback: {:f}\n"
|
||||
" Delay: {:f}", al::to_underlying(al_props_.Waveform), al_props_.Phase,
|
||||
al_props_.Rate, al_props_.Depth, al_props_.Feedback, al_props_.Delay);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@
|
|||
#include "AL/al.h"
|
||||
#include "AL/efx.h"
|
||||
|
||||
#include "alc/effects/base.h"
|
||||
#include "alc/context.h"
|
||||
#include "alnumeric.h"
|
||||
#include "effects.h"
|
||||
|
||||
#ifdef ALSOFT_EAX
|
||||
#include "alnumeric.h"
|
||||
#if ALSOFT_EAX
|
||||
#include "al/eax/effect.h"
|
||||
#include "al/eax/exception.h"
|
||||
#include "al/eax/utils.h"
|
||||
|
|
@ -28,53 +28,46 @@ constexpr EffectProps genDefaultProps() noexcept
|
|||
|
||||
const EffectProps CompressorEffectProps{genDefaultProps()};
|
||||
|
||||
void CompressorEffectHandler::SetParami(CompressorProps &props, ALenum param, int val)
|
||||
void CompressorEffectHandler::SetParami(ALCcontext *context, CompressorProps &props, ALenum param, int val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_COMPRESSOR_ONOFF:
|
||||
if(!(val >= AL_COMPRESSOR_MIN_ONOFF && val <= AL_COMPRESSOR_MAX_ONOFF))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Compressor state out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "Compressor state out of range");
|
||||
props.OnOff = (val != AL_FALSE);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid compressor integer property 0x%04x",
|
||||
param};
|
||||
return;
|
||||
}
|
||||
}
|
||||
void CompressorEffectHandler::SetParamiv(CompressorProps &props, ALenum param, const int *vals)
|
||||
{ SetParami(props, param, *vals); }
|
||||
void CompressorEffectHandler::SetParamf(CompressorProps&, ALenum param, float)
|
||||
{ throw effect_exception{AL_INVALID_ENUM, "Invalid compressor float property 0x%04x", param}; }
|
||||
void CompressorEffectHandler::SetParamfv(CompressorProps&, ALenum param, const float*)
|
||||
{
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid compressor float-vector property 0x%04x",
|
||||
param};
|
||||
}
|
||||
|
||||
void CompressorEffectHandler::GetParami(const CompressorProps &props, ALenum param, int *val)
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid compressor integer property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void CompressorEffectHandler::SetParamiv(ALCcontext *context, CompressorProps &props, ALenum param, const int *vals)
|
||||
{ SetParami(context, props, param, *vals); }
|
||||
void CompressorEffectHandler::SetParamf(ALCcontext *context, CompressorProps&, ALenum param, float)
|
||||
{ context->throw_error(AL_INVALID_ENUM, "Invalid compressor float property {:#04x}", as_unsigned(param)); }
|
||||
void CompressorEffectHandler::SetParamfv(ALCcontext *context, CompressorProps&, ALenum param, const float*)
|
||||
{ context->throw_error(AL_INVALID_ENUM, "Invalid compressor float-vector property {:#04x}", as_unsigned(param)); }
|
||||
|
||||
void CompressorEffectHandler::GetParami(ALCcontext *context, const CompressorProps &props, ALenum param, int *val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_COMPRESSOR_ONOFF: *val = props.OnOff; break;
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid compressor integer property 0x%04x",
|
||||
param};
|
||||
case AL_COMPRESSOR_ONOFF: *val = props.OnOff; return;
|
||||
}
|
||||
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid compressor integer property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void CompressorEffectHandler::GetParamiv(const CompressorProps &props, ALenum param, int *vals)
|
||||
{ GetParami(props, param, vals); }
|
||||
void CompressorEffectHandler::GetParamf(const CompressorProps&, ALenum param, float*)
|
||||
{ throw effect_exception{AL_INVALID_ENUM, "Invalid compressor float property 0x%04x", param}; }
|
||||
void CompressorEffectHandler::GetParamfv(const CompressorProps&, ALenum param, float*)
|
||||
{
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid compressor float-vector property 0x%04x",
|
||||
param};
|
||||
}
|
||||
void CompressorEffectHandler::GetParamiv(ALCcontext *context, const CompressorProps &props, ALenum param, int *vals)
|
||||
{ GetParami(context, props, param, vals); }
|
||||
void CompressorEffectHandler::GetParamf(ALCcontext *context, const CompressorProps&, ALenum param, float*)
|
||||
{ context->throw_error(AL_INVALID_ENUM, "Invalid compressor float property {:#04x}", as_unsigned(param)); }
|
||||
void CompressorEffectHandler::GetParamfv(ALCcontext *context, const CompressorProps&, ALenum param, float*)
|
||||
{ context->throw_error(AL_INVALID_ENUM, "Invalid compressor float-vector property {:#04x}", as_unsigned(param)); }
|
||||
|
||||
|
||||
#ifdef ALSOFT_EAX
|
||||
#if ALSOFT_EAX
|
||||
namespace {
|
||||
|
||||
using CompressorCommitter = EaxCommitter<EaxCompressorCommitter>;
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@
|
|||
|
||||
#include "AL/al.h"
|
||||
|
||||
#include "alc/context.h"
|
||||
#include "alc/inprogext.h"
|
||||
#include "alnumeric.h"
|
||||
#include "alspan.h"
|
||||
#include "core/effects/base.h"
|
||||
#include "effects.h"
|
||||
|
||||
|
||||
|
|
@ -28,90 +28,49 @@ constexpr EffectProps genDefaultProps() noexcept
|
|||
|
||||
const EffectProps ConvolutionEffectProps{genDefaultProps()};
|
||||
|
||||
void ConvolutionEffectHandler::SetParami(ConvolutionProps& /*props*/, ALenum param, int /*val*/)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid convolution effect integer property 0x%04x",
|
||||
param};
|
||||
}
|
||||
}
|
||||
void ConvolutionEffectHandler::SetParamiv(ConvolutionProps &props, ALenum param, const int *vals)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
default:
|
||||
SetParami(props, param, *vals);
|
||||
}
|
||||
}
|
||||
void ConvolutionEffectHandler::SetParamf(ConvolutionProps& /*props*/, ALenum param, float /*val*/)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid convolution effect float property 0x%04x",
|
||||
param};
|
||||
}
|
||||
}
|
||||
void ConvolutionEffectHandler::SetParamfv(ConvolutionProps &props, ALenum param, const float *values)
|
||||
void ConvolutionEffectHandler::SetParami(ALCcontext *context, ConvolutionProps& /*props*/, ALenum param, int /*val*/)
|
||||
{ context->throw_error(AL_INVALID_ENUM, "Invalid convolution effect integer property {:#04x}", as_unsigned(param)); }
|
||||
void ConvolutionEffectHandler::SetParamiv(ALCcontext *context, ConvolutionProps &props, ALenum param, const int *vals)
|
||||
{ SetParami(context, props, param, *vals); }
|
||||
|
||||
void ConvolutionEffectHandler::SetParamf(ALCcontext *context, ConvolutionProps& /*props*/, ALenum param, float /*val*/)
|
||||
{ context->throw_error(AL_INVALID_ENUM, "Invalid convolution effect float property {:#04x}", as_unsigned(param)); }
|
||||
void ConvolutionEffectHandler::SetParamfv(ALCcontext *context, ConvolutionProps &props, ALenum param, const float *values)
|
||||
{
|
||||
static constexpr auto finite_checker = [](float val) -> bool { return std::isfinite(val); };
|
||||
al::span<const float> vals;
|
||||
|
||||
switch(param)
|
||||
{
|
||||
case AL_CONVOLUTION_ORIENTATION_SOFT:
|
||||
vals = {values, 6_uz};
|
||||
auto vals = al::span{values, 6_uz};
|
||||
if(!std::all_of(vals.cbegin(), vals.cend(), finite_checker))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Property 0x%04x value out of range", param};
|
||||
context->throw_error(AL_INVALID_VALUE, "Convolution orientation out of range", param);
|
||||
|
||||
std::copy_n(vals.cbegin(), props.OrientAt.size(), props.OrientAt.begin());
|
||||
std::copy_n(vals.cbegin()+3, props.OrientUp.size(), props.OrientUp.begin());
|
||||
break;
|
||||
|
||||
default:
|
||||
SetParamf(props, param, *values);
|
||||
return;
|
||||
}
|
||||
|
||||
SetParamf(context, props, param, *values);
|
||||
}
|
||||
|
||||
void ConvolutionEffectHandler::GetParami(const ConvolutionProps& /*props*/, ALenum param, int* /*val*/)
|
||||
void ConvolutionEffectHandler::GetParami(ALCcontext *context, const ConvolutionProps& /*props*/, ALenum param, int* /*val*/)
|
||||
{ context->throw_error(AL_INVALID_ENUM, "Invalid convolution effect integer property {:#04x}", as_unsigned(param)); }
|
||||
void ConvolutionEffectHandler::GetParamiv(ALCcontext *context, const ConvolutionProps &props, ALenum param, int *vals)
|
||||
{ GetParami(context, props, param, vals); }
|
||||
|
||||
void ConvolutionEffectHandler::GetParamf(ALCcontext *context, const ConvolutionProps& /*props*/, ALenum param, float* /*val*/)
|
||||
{ context->throw_error(AL_INVALID_ENUM, "Invalid convolution effect float property {:#04x}", as_unsigned(param)); }
|
||||
void ConvolutionEffectHandler::GetParamfv(ALCcontext *context, const ConvolutionProps &props, ALenum param, float *values)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid convolution effect integer property 0x%04x",
|
||||
param};
|
||||
}
|
||||
}
|
||||
void ConvolutionEffectHandler::GetParamiv(const ConvolutionProps &props, ALenum param, int *vals)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
default:
|
||||
GetParami(props, param, vals);
|
||||
}
|
||||
}
|
||||
void ConvolutionEffectHandler::GetParamf(const ConvolutionProps& /*props*/, ALenum param, float* /*val*/)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid convolution effect float property 0x%04x",
|
||||
param};
|
||||
}
|
||||
}
|
||||
void ConvolutionEffectHandler::GetParamfv(const ConvolutionProps &props, ALenum param, float *values)
|
||||
{
|
||||
al::span<float> vals;
|
||||
switch(param)
|
||||
{
|
||||
case AL_CONVOLUTION_ORIENTATION_SOFT:
|
||||
vals = {values, 6_uz};
|
||||
auto vals = al::span{values, 6_uz};
|
||||
std::copy(props.OrientAt.cbegin(), props.OrientAt.cend(), vals.begin());
|
||||
std::copy(props.OrientUp.cbegin(), props.OrientUp.cend(), vals.begin()+3);
|
||||
break;
|
||||
|
||||
default:
|
||||
GetParamf(props, param, values);
|
||||
return;
|
||||
}
|
||||
|
||||
GetParamf(context, props, param, values);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@
|
|||
#include "AL/al.h"
|
||||
#include "AL/alext.h"
|
||||
|
||||
#include "alc/effects/base.h"
|
||||
#include "alc/context.h"
|
||||
#include "alnumeric.h"
|
||||
#include "effects.h"
|
||||
|
||||
|
||||
|
|
@ -32,91 +33,81 @@ constexpr EffectProps genDefaultLfeProps() noexcept
|
|||
|
||||
const EffectProps DedicatedDialogEffectProps{genDefaultDialogProps()};
|
||||
|
||||
void DedicatedDialogEffectHandler::SetParami(DedicatedProps&, ALenum param, int)
|
||||
{ throw effect_exception{AL_INVALID_ENUM, "Invalid dedicated integer property 0x%04x", param}; }
|
||||
void DedicatedDialogEffectHandler::SetParamiv(DedicatedProps&, ALenum param, const int*)
|
||||
{
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid dedicated integer-vector property 0x%04x",
|
||||
param};
|
||||
}
|
||||
void DedicatedDialogEffectHandler::SetParamf(DedicatedProps &props, ALenum param, float val)
|
||||
void DedicatedDialogEffectHandler::SetParami(ALCcontext *context, DedicatedProps&, ALenum param, int)
|
||||
{ context->throw_error(AL_INVALID_ENUM, "Invalid dedicated integer property {:#04x}", as_unsigned(param)); }
|
||||
void DedicatedDialogEffectHandler::SetParamiv(ALCcontext *context, DedicatedProps&, ALenum param, const int*)
|
||||
{ context->throw_error(AL_INVALID_ENUM, "Invalid dedicated integer-vector property {:#04x}", as_unsigned(param)); }
|
||||
void DedicatedDialogEffectHandler::SetParamf(ALCcontext *context, DedicatedProps &props, ALenum param, float val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_DEDICATED_GAIN:
|
||||
if(!(val >= 0.0f && std::isfinite(val)))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Dedicated gain out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "Dedicated gain out of range");
|
||||
props.Gain = val;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid dedicated float property 0x%04x", param};
|
||||
return;
|
||||
}
|
||||
}
|
||||
void DedicatedDialogEffectHandler::SetParamfv(DedicatedProps &props, ALenum param, const float *vals)
|
||||
{ SetParamf(props, param, *vals); }
|
||||
|
||||
void DedicatedDialogEffectHandler::GetParami(const DedicatedProps&, ALenum param, int*)
|
||||
{ throw effect_exception{AL_INVALID_ENUM, "Invalid dedicated integer property 0x%04x", param}; }
|
||||
void DedicatedDialogEffectHandler::GetParamiv(const DedicatedProps&, ALenum param, int*)
|
||||
{
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid dedicated integer-vector property 0x%04x",
|
||||
param};
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid dedicated float property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void DedicatedDialogEffectHandler::GetParamf(const DedicatedProps &props, ALenum param, float *val)
|
||||
void DedicatedDialogEffectHandler::SetParamfv(ALCcontext *context, DedicatedProps &props, ALenum param, const float *vals)
|
||||
{ SetParamf(context, props, param, *vals); }
|
||||
|
||||
void DedicatedDialogEffectHandler::GetParami(ALCcontext *context, const DedicatedProps&, ALenum param, int*)
|
||||
{ context->throw_error(AL_INVALID_ENUM, "Invalid dedicated integer property {:#04x}", as_unsigned(param)); }
|
||||
void DedicatedDialogEffectHandler::GetParamiv(ALCcontext *context, const DedicatedProps&, ALenum param, int*)
|
||||
{ context->throw_error(AL_INVALID_ENUM, "Invalid dedicated integer-vector property {:#04x}", as_unsigned(param)); }
|
||||
void DedicatedDialogEffectHandler::GetParamf(ALCcontext *context, const DedicatedProps &props, ALenum param, float *val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_DEDICATED_GAIN: *val = props.Gain; break;
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid dedicated float property 0x%04x", param};
|
||||
case AL_DEDICATED_GAIN: *val = props.Gain; return;
|
||||
}
|
||||
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid dedicated float property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void DedicatedDialogEffectHandler::GetParamfv(const DedicatedProps &props, ALenum param, float *vals)
|
||||
{ GetParamf(props, param, vals); }
|
||||
void DedicatedDialogEffectHandler::GetParamfv(ALCcontext *context, const DedicatedProps &props, ALenum param, float *vals)
|
||||
{ GetParamf(context, props, param, vals); }
|
||||
|
||||
|
||||
const EffectProps DedicatedLfeEffectProps{genDefaultLfeProps()};
|
||||
|
||||
void DedicatedLfeEffectHandler::SetParami(DedicatedProps&, ALenum param, int)
|
||||
{ throw effect_exception{AL_INVALID_ENUM, "Invalid dedicated integer property 0x%04x", param}; }
|
||||
void DedicatedLfeEffectHandler::SetParamiv(DedicatedProps&, ALenum param, const int*)
|
||||
{
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid dedicated integer-vector property 0x%04x",
|
||||
param};
|
||||
}
|
||||
void DedicatedLfeEffectHandler::SetParamf(DedicatedProps &props, ALenum param, float val)
|
||||
void DedicatedLfeEffectHandler::SetParami(ALCcontext *context, DedicatedProps&, ALenum param, int)
|
||||
{ context->throw_error(AL_INVALID_ENUM, "Invalid dedicated integer property {:#04x}", as_unsigned(param)); }
|
||||
void DedicatedLfeEffectHandler::SetParamiv(ALCcontext *context, DedicatedProps&, ALenum param, const int*)
|
||||
{ context->throw_error(AL_INVALID_ENUM, "Invalid dedicated integer-vector property {:#04x}", as_unsigned(param)); }
|
||||
void DedicatedLfeEffectHandler::SetParamf(ALCcontext *context, DedicatedProps &props, ALenum param, float val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_DEDICATED_GAIN:
|
||||
if(!(val >= 0.0f && std::isfinite(val)))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Dedicated gain out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "Dedicated gain out of range");
|
||||
props.Gain = val;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid dedicated float property 0x%04x", param};
|
||||
return;
|
||||
}
|
||||
}
|
||||
void DedicatedLfeEffectHandler::SetParamfv(DedicatedProps &props, ALenum param, const float *vals)
|
||||
{ SetParamf(props, param, *vals); }
|
||||
|
||||
void DedicatedLfeEffectHandler::GetParami(const DedicatedProps&, ALenum param, int*)
|
||||
{ throw effect_exception{AL_INVALID_ENUM, "Invalid dedicated integer property 0x%04x", param}; }
|
||||
void DedicatedLfeEffectHandler::GetParamiv(const DedicatedProps&, ALenum param, int*)
|
||||
{
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid dedicated integer-vector property 0x%04x",
|
||||
param};
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid dedicated float property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void DedicatedLfeEffectHandler::GetParamf(const DedicatedProps &props, ALenum param, float *val)
|
||||
void DedicatedLfeEffectHandler::SetParamfv(ALCcontext *context, DedicatedProps &props, ALenum param, const float *vals)
|
||||
{ SetParamf(context, props, param, *vals); }
|
||||
|
||||
void DedicatedLfeEffectHandler::GetParami(ALCcontext *context, const DedicatedProps&, ALenum param, int*)
|
||||
{ context->throw_error(AL_INVALID_ENUM, "Invalid dedicated integer property {:#04x}", as_unsigned(param)); }
|
||||
void DedicatedLfeEffectHandler::GetParamiv(ALCcontext *context, const DedicatedProps&, ALenum param, int*)
|
||||
{ context->throw_error(AL_INVALID_ENUM, "Invalid dedicated integer-vector property {:#04x}", as_unsigned(param)); }
|
||||
void DedicatedLfeEffectHandler::GetParamf(ALCcontext *context, const DedicatedProps &props, ALenum param, float *val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_DEDICATED_GAIN: *val = props.Gain; break;
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid dedicated float property 0x%04x", param};
|
||||
case AL_DEDICATED_GAIN: *val = props.Gain; return;
|
||||
}
|
||||
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid dedicated float property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void DedicatedLfeEffectHandler::GetParamfv(const DedicatedProps &props, ALenum param, float *vals)
|
||||
{ GetParamf(props, param, vals); }
|
||||
void DedicatedLfeEffectHandler::GetParamfv(ALCcontext *context, const DedicatedProps &props, ALenum param, float *vals)
|
||||
{ GetParamf(context, props, param, vals); }
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@
|
|||
#include "AL/al.h"
|
||||
#include "AL/efx.h"
|
||||
|
||||
#include "alc/effects/base.h"
|
||||
#include "alc/context.h"
|
||||
#include "alnumeric.h"
|
||||
#include "effects.h"
|
||||
|
||||
#ifdef ALSOFT_EAX
|
||||
#include "alnumeric.h"
|
||||
#if ALSOFT_EAX
|
||||
#include "al/eax/effect.h"
|
||||
#include "al/eax/exception.h"
|
||||
#include "al/eax/utils.h"
|
||||
|
|
@ -32,80 +32,76 @@ constexpr EffectProps genDefaultProps() noexcept
|
|||
|
||||
const EffectProps DistortionEffectProps{genDefaultProps()};
|
||||
|
||||
void DistortionEffectHandler::SetParami(DistortionProps&, ALenum param, int)
|
||||
{ throw effect_exception{AL_INVALID_ENUM, "Invalid distortion integer property 0x%04x", param}; }
|
||||
void DistortionEffectHandler::SetParamiv(DistortionProps&, ALenum param, const int*)
|
||||
{
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid distortion integer-vector property 0x%04x",
|
||||
param};
|
||||
}
|
||||
void DistortionEffectHandler::SetParamf(DistortionProps &props, ALenum param, float val)
|
||||
void DistortionEffectHandler::SetParami(ALCcontext *context, DistortionProps&, ALenum param, int)
|
||||
{ context->throw_error(AL_INVALID_ENUM, "Invalid distortion integer property {:#04x}", as_unsigned(param)); }
|
||||
void DistortionEffectHandler::SetParamiv(ALCcontext *context, DistortionProps&, ALenum param, const int*)
|
||||
{ context->throw_error(AL_INVALID_ENUM, "Invalid distortion integer-vector property {:#04x}", as_unsigned(param)); }
|
||||
|
||||
void DistortionEffectHandler::SetParamf(ALCcontext *context, DistortionProps &props, ALenum param, float val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_DISTORTION_EDGE:
|
||||
if(!(val >= AL_DISTORTION_MIN_EDGE && val <= AL_DISTORTION_MAX_EDGE))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Distortion edge out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "Distortion edge out of range");
|
||||
props.Edge = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_DISTORTION_GAIN:
|
||||
if(!(val >= AL_DISTORTION_MIN_GAIN && val <= AL_DISTORTION_MAX_GAIN))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Distortion gain out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "Distortion gain out of range");
|
||||
props.Gain = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_DISTORTION_LOWPASS_CUTOFF:
|
||||
if(!(val >= AL_DISTORTION_MIN_LOWPASS_CUTOFF && val <= AL_DISTORTION_MAX_LOWPASS_CUTOFF))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Distortion low-pass cutoff out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "Distortion low-pass cutoff out of range");
|
||||
props.LowpassCutoff = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_DISTORTION_EQCENTER:
|
||||
if(!(val >= AL_DISTORTION_MIN_EQCENTER && val <= AL_DISTORTION_MAX_EQCENTER))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Distortion EQ center out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "Distortion EQ center out of range");
|
||||
props.EQCenter = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_DISTORTION_EQBANDWIDTH:
|
||||
if(!(val >= AL_DISTORTION_MIN_EQBANDWIDTH && val <= AL_DISTORTION_MAX_EQBANDWIDTH))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Distortion EQ bandwidth out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "Distortion EQ bandwidth out of range");
|
||||
props.EQBandwidth = val;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid distortion float property 0x%04x", param};
|
||||
return;
|
||||
}
|
||||
}
|
||||
void DistortionEffectHandler::SetParamfv(DistortionProps &props, ALenum param, const float *vals)
|
||||
{ SetParamf(props, param, *vals); }
|
||||
|
||||
void DistortionEffectHandler::GetParami(const DistortionProps&, ALenum param, int*)
|
||||
{ throw effect_exception{AL_INVALID_ENUM, "Invalid distortion integer property 0x%04x", param}; }
|
||||
void DistortionEffectHandler::GetParamiv(const DistortionProps&, ALenum param, int*)
|
||||
{
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid distortion integer-vector property 0x%04x",
|
||||
param};
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid distortion float property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void DistortionEffectHandler::GetParamf(const DistortionProps &props, ALenum param, float *val)
|
||||
void DistortionEffectHandler::SetParamfv(ALCcontext *context, DistortionProps &props, ALenum param, const float *vals)
|
||||
{ SetParamf(context, props, param, *vals); }
|
||||
|
||||
void DistortionEffectHandler::GetParami(ALCcontext *context, const DistortionProps&, ALenum param, int*)
|
||||
{ context->throw_error(AL_INVALID_ENUM, "Invalid distortion integer property {:#04x}", as_unsigned(param)); }
|
||||
void DistortionEffectHandler::GetParamiv(ALCcontext *context, const DistortionProps&, ALenum param, int*)
|
||||
{ context->throw_error(AL_INVALID_ENUM, "Invalid distortion integer-vector property {:#04x}", as_unsigned(param)); }
|
||||
|
||||
void DistortionEffectHandler::GetParamf(ALCcontext *context, const DistortionProps &props, ALenum param, float *val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_DISTORTION_EDGE: *val = props.Edge; break;
|
||||
case AL_DISTORTION_GAIN: *val = props.Gain; break;
|
||||
case AL_DISTORTION_LOWPASS_CUTOFF: *val = props.LowpassCutoff; break;
|
||||
case AL_DISTORTION_EQCENTER: *val = props.EQCenter; break;
|
||||
case AL_DISTORTION_EQBANDWIDTH: *val = props.EQBandwidth; break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid distortion float property 0x%04x", param};
|
||||
case AL_DISTORTION_EDGE: *val = props.Edge; return;
|
||||
case AL_DISTORTION_GAIN: *val = props.Gain; return;
|
||||
case AL_DISTORTION_LOWPASS_CUTOFF: *val = props.LowpassCutoff; return;
|
||||
case AL_DISTORTION_EQCENTER: *val = props.EQCenter; return;
|
||||
case AL_DISTORTION_EQBANDWIDTH: *val = props.EQBandwidth; return;
|
||||
}
|
||||
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid distortion float property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void DistortionEffectHandler::GetParamfv(const DistortionProps &props, ALenum param, float *vals)
|
||||
{ GetParamf(props, param, vals); }
|
||||
void DistortionEffectHandler::GetParamfv(ALCcontext *context, const DistortionProps &props, ALenum param, float *vals)
|
||||
{ GetParamf(context, props, param, vals); }
|
||||
|
||||
|
||||
#ifdef ALSOFT_EAX
|
||||
#if ALSOFT_EAX
|
||||
namespace {
|
||||
|
||||
using DistortionCommitter = EaxCommitter<EaxDistortionCommitter>;
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@
|
|||
#include "AL/al.h"
|
||||
#include "AL/efx.h"
|
||||
|
||||
#include "alc/effects/base.h"
|
||||
#include "alc/context.h"
|
||||
#include "alnumeric.h"
|
||||
#include "effects.h"
|
||||
|
||||
#ifdef ALSOFT_EAX
|
||||
#include "alnumeric.h"
|
||||
#if ALSOFT_EAX
|
||||
#include "al/eax/effect.h"
|
||||
#include "al/eax/exception.h"
|
||||
#include "al/eax/utils.h"
|
||||
|
|
@ -35,74 +35,74 @@ constexpr EffectProps genDefaultProps() noexcept
|
|||
|
||||
const EffectProps EchoEffectProps{genDefaultProps()};
|
||||
|
||||
void EchoEffectHandler::SetParami(EchoProps&, ALenum param, int)
|
||||
{ throw effect_exception{AL_INVALID_ENUM, "Invalid echo integer property 0x%04x", param}; }
|
||||
void EchoEffectHandler::SetParamiv(EchoProps&, ALenum param, const int*)
|
||||
{ throw effect_exception{AL_INVALID_ENUM, "Invalid echo integer-vector property 0x%04x", param}; }
|
||||
void EchoEffectHandler::SetParamf(EchoProps &props, ALenum param, float val)
|
||||
void EchoEffectHandler::SetParami(ALCcontext *context, EchoProps&, ALenum param, int)
|
||||
{ context->throw_error(AL_INVALID_ENUM, "Invalid echo integer property {:#04x}", as_unsigned(param)); }
|
||||
void EchoEffectHandler::SetParamiv(ALCcontext *context, EchoProps&, ALenum param, const int*)
|
||||
{ context->throw_error(AL_INVALID_ENUM, "Invalid echo integer-vector property {:#04x}", as_unsigned(param)); }
|
||||
void EchoEffectHandler::SetParamf(ALCcontext *context, EchoProps &props, ALenum param, float val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_ECHO_DELAY:
|
||||
if(!(val >= AL_ECHO_MIN_DELAY && val <= AL_ECHO_MAX_DELAY))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Echo delay out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "Echo delay out of range");
|
||||
props.Delay = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_ECHO_LRDELAY:
|
||||
if(!(val >= AL_ECHO_MIN_LRDELAY && val <= AL_ECHO_MAX_LRDELAY))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Echo LR delay out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "Echo LR delay out of range");
|
||||
props.LRDelay = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_ECHO_DAMPING:
|
||||
if(!(val >= AL_ECHO_MIN_DAMPING && val <= AL_ECHO_MAX_DAMPING))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Echo damping out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "Echo damping out of range");
|
||||
props.Damping = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_ECHO_FEEDBACK:
|
||||
if(!(val >= AL_ECHO_MIN_FEEDBACK && val <= AL_ECHO_MAX_FEEDBACK))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Echo feedback out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "Echo feedback out of range");
|
||||
props.Feedback = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_ECHO_SPREAD:
|
||||
if(!(val >= AL_ECHO_MIN_SPREAD && val <= AL_ECHO_MAX_SPREAD))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Echo spread out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "Echo spread out of range");
|
||||
props.Spread = val;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid echo float property 0x%04x", param};
|
||||
return;
|
||||
}
|
||||
}
|
||||
void EchoEffectHandler::SetParamfv(EchoProps &props, ALenum param, const float *vals)
|
||||
{ SetParamf(props, param, *vals); }
|
||||
|
||||
void EchoEffectHandler::GetParami(const EchoProps&, ALenum param, int*)
|
||||
{ throw effect_exception{AL_INVALID_ENUM, "Invalid echo integer property 0x%04x", param}; }
|
||||
void EchoEffectHandler::GetParamiv(const EchoProps&, ALenum param, int*)
|
||||
{ throw effect_exception{AL_INVALID_ENUM, "Invalid echo integer-vector property 0x%04x", param}; }
|
||||
void EchoEffectHandler::GetParamf(const EchoProps &props, ALenum param, float *val)
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid echo float property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void EchoEffectHandler::SetParamfv(ALCcontext *context, EchoProps &props, ALenum param, const float *vals)
|
||||
{ SetParamf(context, props, param, *vals); }
|
||||
|
||||
void EchoEffectHandler::GetParami(ALCcontext *context, const EchoProps&, ALenum param, int*)
|
||||
{ context->throw_error(AL_INVALID_ENUM, "Invalid echo integer property {:#04x}", as_unsigned(param)); }
|
||||
void EchoEffectHandler::GetParamiv(ALCcontext *context, const EchoProps&, ALenum param, int*)
|
||||
{ context->throw_error(AL_INVALID_ENUM, "Invalid echo integer-vector property {:#04x}", as_unsigned(param)); }
|
||||
void EchoEffectHandler::GetParamf(ALCcontext *context, const EchoProps &props, ALenum param, float *val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_ECHO_DELAY: *val = props.Delay; break;
|
||||
case AL_ECHO_LRDELAY: *val = props.LRDelay; break;
|
||||
case AL_ECHO_DAMPING: *val = props.Damping; break;
|
||||
case AL_ECHO_FEEDBACK: *val = props.Feedback; break;
|
||||
case AL_ECHO_SPREAD: *val = props.Spread; break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid echo float property 0x%04x", param};
|
||||
case AL_ECHO_DELAY: *val = props.Delay; return;
|
||||
case AL_ECHO_LRDELAY: *val = props.LRDelay; return;
|
||||
case AL_ECHO_DAMPING: *val = props.Damping; return;
|
||||
case AL_ECHO_FEEDBACK: *val = props.Feedback; return;
|
||||
case AL_ECHO_SPREAD: *val = props.Spread; return;
|
||||
}
|
||||
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid echo float property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void EchoEffectHandler::GetParamfv(const EchoProps &props, ALenum param, float *vals)
|
||||
{ GetParamf(props, param, vals); }
|
||||
void EchoEffectHandler::GetParamfv(ALCcontext *context, const EchoProps &props, ALenum param, float *vals)
|
||||
{ GetParamf(context, props, param, vals); }
|
||||
|
||||
|
||||
#ifdef ALSOFT_EAX
|
||||
#if ALSOFT_EAX
|
||||
namespace {
|
||||
|
||||
using EchoCommitter = EaxCommitter<EaxEchoCommitter>;
|
||||
|
|
|
|||
|
|
@ -3,23 +3,24 @@
|
|||
|
||||
#include <variant>
|
||||
|
||||
#include "AL/alc.h"
|
||||
#include "AL/al.h"
|
||||
|
||||
#include "al/error.h"
|
||||
#include "core/effects/base.h"
|
||||
#include "opthelpers.h"
|
||||
|
||||
#define DECL_HANDLER(N, T) \
|
||||
struct N { \
|
||||
using prop_type = T; \
|
||||
\
|
||||
static void SetParami(prop_type &props, ALenum param, int val); \
|
||||
static void SetParamiv(prop_type &props, ALenum param, const int *vals); \
|
||||
static void SetParamf(prop_type &props, ALenum param, float val); \
|
||||
static void SetParamfv(prop_type &props, ALenum param, const float *vals);\
|
||||
static void GetParami(const prop_type &props, ALenum param, int *val); \
|
||||
static void GetParamiv(const prop_type &props, ALenum param, int *vals); \
|
||||
static void GetParamf(const prop_type &props, ALenum param, float *val); \
|
||||
static void GetParamfv(const prop_type &props, ALenum param, float *vals);\
|
||||
static void SetParami(ALCcontext *context, prop_type &props, ALenum param, int val); \
|
||||
static void SetParamiv(ALCcontext *context, prop_type &props, ALenum param, const int *vals); \
|
||||
static void SetParamf(ALCcontext *context, prop_type &props, ALenum param, float val); \
|
||||
static void SetParamfv(ALCcontext *context, prop_type &props, ALenum param, const float *vals);\
|
||||
static void GetParami(ALCcontext *context, const prop_type &props, ALenum param, int *val); \
|
||||
static void GetParamiv(ALCcontext *context, const prop_type &props, ALenum param, int *vals); \
|
||||
static void GetParamf(ALCcontext *context, const prop_type &props, ALenum param, float *val); \
|
||||
static void GetParamfv(ALCcontext *context, const prop_type &props, ALenum param, float *vals);\
|
||||
};
|
||||
DECL_HANDLER(NullEffectHandler, std::monostate)
|
||||
DECL_HANDLER(ReverbEffectHandler, ReverbProps)
|
||||
|
|
@ -41,26 +42,23 @@ DECL_HANDLER(ConvolutionEffectHandler, ConvolutionProps)
|
|||
#undef DECL_HANDLER
|
||||
|
||||
|
||||
using effect_exception = al::context_error;
|
||||
|
||||
|
||||
/* Default properties for the given effect types. */
|
||||
extern const EffectProps NullEffectProps;
|
||||
extern const EffectProps ReverbEffectProps;
|
||||
extern const EffectProps StdReverbEffectProps;
|
||||
extern const EffectProps AutowahEffectProps;
|
||||
extern const EffectProps ChorusEffectProps;
|
||||
extern const EffectProps CompressorEffectProps;
|
||||
extern const EffectProps DistortionEffectProps;
|
||||
extern const EffectProps EchoEffectProps;
|
||||
extern const EffectProps EqualizerEffectProps;
|
||||
extern const EffectProps FlangerEffectProps;
|
||||
extern const EffectProps FshifterEffectProps;
|
||||
extern const EffectProps ModulatorEffectProps;
|
||||
extern const EffectProps PshifterEffectProps;
|
||||
extern const EffectProps VmorpherEffectProps;
|
||||
extern const EffectProps DedicatedDialogEffectProps;
|
||||
extern const EffectProps DedicatedLfeEffectProps;
|
||||
extern const EffectProps ConvolutionEffectProps;
|
||||
DECL_HIDDEN extern const EffectProps NullEffectProps;
|
||||
DECL_HIDDEN extern const EffectProps ReverbEffectProps;
|
||||
DECL_HIDDEN extern const EffectProps StdReverbEffectProps;
|
||||
DECL_HIDDEN extern const EffectProps AutowahEffectProps;
|
||||
DECL_HIDDEN extern const EffectProps ChorusEffectProps;
|
||||
DECL_HIDDEN extern const EffectProps CompressorEffectProps;
|
||||
DECL_HIDDEN extern const EffectProps DistortionEffectProps;
|
||||
DECL_HIDDEN extern const EffectProps EchoEffectProps;
|
||||
DECL_HIDDEN extern const EffectProps EqualizerEffectProps;
|
||||
DECL_HIDDEN extern const EffectProps FlangerEffectProps;
|
||||
DECL_HIDDEN extern const EffectProps FshifterEffectProps;
|
||||
DECL_HIDDEN extern const EffectProps ModulatorEffectProps;
|
||||
DECL_HIDDEN extern const EffectProps PshifterEffectProps;
|
||||
DECL_HIDDEN extern const EffectProps VmorpherEffectProps;
|
||||
DECL_HIDDEN extern const EffectProps DedicatedDialogEffectProps;
|
||||
DECL_HIDDEN extern const EffectProps DedicatedLfeEffectProps;
|
||||
DECL_HIDDEN extern const EffectProps ConvolutionEffectProps;
|
||||
|
||||
#endif /* AL_EFFECTS_EFFECTS_H */
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@
|
|||
#include "AL/al.h"
|
||||
#include "AL/efx.h"
|
||||
|
||||
#include "alc/effects/base.h"
|
||||
#include "alc/context.h"
|
||||
#include "alnumeric.h"
|
||||
#include "effects.h"
|
||||
|
||||
#ifdef ALSOFT_EAX
|
||||
#include "alnumeric.h"
|
||||
#if ALSOFT_EAX
|
||||
#include "al/eax/effect.h"
|
||||
#include "al/eax/exception.h"
|
||||
#include "al/eax/utils.h"
|
||||
|
|
@ -37,115 +37,109 @@ constexpr EffectProps genDefaultProps() noexcept
|
|||
|
||||
const EffectProps EqualizerEffectProps{genDefaultProps()};
|
||||
|
||||
void EqualizerEffectHandler::SetParami(EqualizerProps&, ALenum param, int)
|
||||
{ throw effect_exception{AL_INVALID_ENUM, "Invalid equalizer integer property 0x%04x", param}; }
|
||||
void EqualizerEffectHandler::SetParamiv(EqualizerProps&, ALenum param, const int*)
|
||||
{
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid equalizer integer-vector property 0x%04x",
|
||||
param};
|
||||
}
|
||||
void EqualizerEffectHandler::SetParamf(EqualizerProps &props, ALenum param, float val)
|
||||
void EqualizerEffectHandler::SetParami(ALCcontext *context, EqualizerProps&, ALenum param, int)
|
||||
{ context->throw_error(AL_INVALID_ENUM, "Invalid equalizer integer property {:#04x}", as_unsigned(param)); }
|
||||
void EqualizerEffectHandler::SetParamiv(ALCcontext *context, EqualizerProps&, ALenum param, const int*)
|
||||
{ context->throw_error(AL_INVALID_ENUM, "Invalid equalizer integer-vector property {:#04x}", as_unsigned(param)); }
|
||||
void EqualizerEffectHandler::SetParamf(ALCcontext *context, EqualizerProps &props, ALenum param, float val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_EQUALIZER_LOW_GAIN:
|
||||
if(!(val >= AL_EQUALIZER_MIN_LOW_GAIN && val <= AL_EQUALIZER_MAX_LOW_GAIN))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Equalizer low-band gain out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "Equalizer low-band gain out of range");
|
||||
props.LowGain = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_EQUALIZER_LOW_CUTOFF:
|
||||
if(!(val >= AL_EQUALIZER_MIN_LOW_CUTOFF && val <= AL_EQUALIZER_MAX_LOW_CUTOFF))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Equalizer low-band cutoff out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "Equalizer low-band cutoff out of range");
|
||||
props.LowCutoff = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_EQUALIZER_MID1_GAIN:
|
||||
if(!(val >= AL_EQUALIZER_MIN_MID1_GAIN && val <= AL_EQUALIZER_MAX_MID1_GAIN))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Equalizer mid1-band gain out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "Equalizer mid1-band gain out of range");
|
||||
props.Mid1Gain = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_EQUALIZER_MID1_CENTER:
|
||||
if(!(val >= AL_EQUALIZER_MIN_MID1_CENTER && val <= AL_EQUALIZER_MAX_MID1_CENTER))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Equalizer mid1-band center out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "Equalizer mid1-band center out of range");
|
||||
props.Mid1Center = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_EQUALIZER_MID1_WIDTH:
|
||||
if(!(val >= AL_EQUALIZER_MIN_MID1_WIDTH && val <= AL_EQUALIZER_MAX_MID1_WIDTH))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Equalizer mid1-band width out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "Equalizer mid1-band width out of range");
|
||||
props.Mid1Width = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_EQUALIZER_MID2_GAIN:
|
||||
if(!(val >= AL_EQUALIZER_MIN_MID2_GAIN && val <= AL_EQUALIZER_MAX_MID2_GAIN))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Equalizer mid2-band gain out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "Equalizer mid2-band gain out of range");
|
||||
props.Mid2Gain = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_EQUALIZER_MID2_CENTER:
|
||||
if(!(val >= AL_EQUALIZER_MIN_MID2_CENTER && val <= AL_EQUALIZER_MAX_MID2_CENTER))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Equalizer mid2-band center out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "Equalizer mid2-band center out of range");
|
||||
props.Mid2Center = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_EQUALIZER_MID2_WIDTH:
|
||||
if(!(val >= AL_EQUALIZER_MIN_MID2_WIDTH && val <= AL_EQUALIZER_MAX_MID2_WIDTH))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Equalizer mid2-band width out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "Equalizer mid2-band width out of range");
|
||||
props.Mid2Width = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_EQUALIZER_HIGH_GAIN:
|
||||
if(!(val >= AL_EQUALIZER_MIN_HIGH_GAIN && val <= AL_EQUALIZER_MAX_HIGH_GAIN))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Equalizer high-band gain out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "Equalizer high-band gain out of range");
|
||||
props.HighGain = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_EQUALIZER_HIGH_CUTOFF:
|
||||
if(!(val >= AL_EQUALIZER_MIN_HIGH_CUTOFF && val <= AL_EQUALIZER_MAX_HIGH_CUTOFF))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Equalizer high-band cutoff out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "Equalizer high-band cutoff out of range");
|
||||
props.HighCutoff = val;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid equalizer float property 0x%04x", param};
|
||||
return;
|
||||
}
|
||||
}
|
||||
void EqualizerEffectHandler::SetParamfv(EqualizerProps &props, ALenum param, const float *vals)
|
||||
{ SetParamf(props, param, *vals); }
|
||||
|
||||
void EqualizerEffectHandler::GetParami(const EqualizerProps&, ALenum param, int*)
|
||||
{ throw effect_exception{AL_INVALID_ENUM, "Invalid equalizer integer property 0x%04x", param}; }
|
||||
void EqualizerEffectHandler::GetParamiv(const EqualizerProps&, ALenum param, int*)
|
||||
{
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid equalizer integer-vector property 0x%04x",
|
||||
param};
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid equalizer float property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void EqualizerEffectHandler::GetParamf(const EqualizerProps &props, ALenum param, float *val)
|
||||
void EqualizerEffectHandler::SetParamfv(ALCcontext *context, EqualizerProps &props, ALenum param, const float *vals)
|
||||
{ SetParamf(context, props, param, *vals); }
|
||||
|
||||
void EqualizerEffectHandler::GetParami(ALCcontext *context, const EqualizerProps&, ALenum param, int*)
|
||||
{ context->throw_error(AL_INVALID_ENUM, "Invalid equalizer integer property {:#04x}", as_unsigned(param)); }
|
||||
void EqualizerEffectHandler::GetParamiv(ALCcontext *context, const EqualizerProps&, ALenum param, int*)
|
||||
{ context->throw_error(AL_INVALID_ENUM, "Invalid equalizer integer-vector property {:#04x}", as_unsigned(param)); }
|
||||
void EqualizerEffectHandler::GetParamf(ALCcontext *context, const EqualizerProps &props, ALenum param, float *val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_EQUALIZER_LOW_GAIN: *val = props.LowGain; break;
|
||||
case AL_EQUALIZER_LOW_CUTOFF: *val = props.LowCutoff; break;
|
||||
case AL_EQUALIZER_MID1_GAIN: *val = props.Mid1Gain; break;
|
||||
case AL_EQUALIZER_MID1_CENTER: *val = props.Mid1Center; break;
|
||||
case AL_EQUALIZER_MID1_WIDTH: *val = props.Mid1Width; break;
|
||||
case AL_EQUALIZER_MID2_GAIN: *val = props.Mid2Gain; break;
|
||||
case AL_EQUALIZER_MID2_CENTER: *val = props.Mid2Center; break;
|
||||
case AL_EQUALIZER_MID2_WIDTH: *val = props.Mid2Width; break;
|
||||
case AL_EQUALIZER_HIGH_GAIN: *val = props.HighGain; break;
|
||||
case AL_EQUALIZER_HIGH_CUTOFF: *val = props.HighCutoff; break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid equalizer float property 0x%04x", param};
|
||||
case AL_EQUALIZER_LOW_GAIN: *val = props.LowGain; return;
|
||||
case AL_EQUALIZER_LOW_CUTOFF: *val = props.LowCutoff; return;
|
||||
case AL_EQUALIZER_MID1_GAIN: *val = props.Mid1Gain; return;
|
||||
case AL_EQUALIZER_MID1_CENTER: *val = props.Mid1Center; return;
|
||||
case AL_EQUALIZER_MID1_WIDTH: *val = props.Mid1Width; return;
|
||||
case AL_EQUALIZER_MID2_GAIN: *val = props.Mid2Gain; return;
|
||||
case AL_EQUALIZER_MID2_CENTER: *val = props.Mid2Center; return;
|
||||
case AL_EQUALIZER_MID2_WIDTH: *val = props.Mid2Width; return;
|
||||
case AL_EQUALIZER_HIGH_GAIN: *val = props.HighGain; return;
|
||||
case AL_EQUALIZER_HIGH_CUTOFF: *val = props.HighCutoff; return;
|
||||
}
|
||||
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid equalizer float property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void EqualizerEffectHandler::GetParamfv(const EqualizerProps &props, ALenum param, float *vals)
|
||||
{ GetParamf(props, param, vals); }
|
||||
void EqualizerEffectHandler::GetParamfv(ALCcontext *context, const EqualizerProps &props, ALenum param, float *vals)
|
||||
{ GetParamf(context, props, param, vals); }
|
||||
|
||||
|
||||
#ifdef ALSOFT_EAX
|
||||
#if ALSOFT_EAX
|
||||
namespace {
|
||||
|
||||
using EqualizerCommitter = EaxCommitter<EaxEqualizerCommitter>;
|
||||
|
|
|
|||
|
|
@ -7,12 +7,13 @@
|
|||
#include "AL/al.h"
|
||||
#include "AL/efx.h"
|
||||
|
||||
#include "alc/effects/base.h"
|
||||
#include "alc/context.h"
|
||||
#include "alnumeric.h"
|
||||
#include "effects.h"
|
||||
|
||||
#ifdef ALSOFT_EAX
|
||||
#if ALSOFT_EAX
|
||||
#include <cassert>
|
||||
#include "alnumeric.h"
|
||||
|
||||
#include "al/eax/effect.h"
|
||||
#include "al/eax/exception.h"
|
||||
#include "al/eax/utils.h"
|
||||
|
|
@ -39,7 +40,7 @@ constexpr ALenum EnumFromDirection(FShifterDirection dir)
|
|||
case FShifterDirection::Up: return AL_FREQUENCY_SHIFTER_DIRECTION_UP;
|
||||
case FShifterDirection::Off: return AL_FREQUENCY_SHIFTER_DIRECTION_OFF;
|
||||
}
|
||||
throw std::runtime_error{"Invalid direction: "+std::to_string(static_cast<int>(dir))};
|
||||
throw std::runtime_error{fmt::format("Invalid direction: {}", int{al::to_underlying(dir)})};
|
||||
}
|
||||
|
||||
constexpr EffectProps genDefaultProps() noexcept
|
||||
|
|
@ -55,7 +56,7 @@ constexpr EffectProps genDefaultProps() noexcept
|
|||
|
||||
const EffectProps FshifterEffectProps{genDefaultProps()};
|
||||
|
||||
void FshifterEffectHandler::SetParami(FshifterProps &props, ALenum param, int val)
|
||||
void FshifterEffectHandler::SetParami(ALCcontext *context, FshifterProps &props, ALenum param, int val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
|
|
@ -63,81 +64,75 @@ void FshifterEffectHandler::SetParami(FshifterProps &props, ALenum param, int va
|
|||
if(auto diropt = DirectionFromEmum(val))
|
||||
props.LeftDirection = *diropt;
|
||||
else
|
||||
throw effect_exception{AL_INVALID_VALUE,
|
||||
"Unsupported frequency shifter left direction: 0x%04x", val};
|
||||
break;
|
||||
context->throw_error(AL_INVALID_VALUE,
|
||||
"Unsupported frequency shifter left direction: {:#04x}", as_unsigned(val));
|
||||
return;
|
||||
|
||||
case AL_FREQUENCY_SHIFTER_RIGHT_DIRECTION:
|
||||
if(auto diropt = DirectionFromEmum(val))
|
||||
props.RightDirection = *diropt;
|
||||
else
|
||||
throw effect_exception{AL_INVALID_VALUE,
|
||||
"Unsupported frequency shifter right direction: 0x%04x", val};
|
||||
break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM,
|
||||
"Invalid frequency shifter integer property 0x%04x", param};
|
||||
context->throw_error(AL_INVALID_VALUE,
|
||||
"Unsupported frequency shifter right direction: {:#04x}", as_unsigned(val));
|
||||
return;
|
||||
}
|
||||
}
|
||||
void FshifterEffectHandler::SetParamiv(FshifterProps &props, ALenum param, const int *vals)
|
||||
{ SetParami(props, param, *vals); }
|
||||
|
||||
void FshifterEffectHandler::SetParamf(FshifterProps &props, ALenum param, float val)
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid frequency shifter integer property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void FshifterEffectHandler::SetParamiv(ALCcontext *context, FshifterProps &props, ALenum param, const int *vals)
|
||||
{ SetParami(context, props, param, *vals); }
|
||||
|
||||
void FshifterEffectHandler::SetParamf(ALCcontext *context, FshifterProps &props, ALenum param, float val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_FREQUENCY_SHIFTER_FREQUENCY:
|
||||
if(!(val >= AL_FREQUENCY_SHIFTER_MIN_FREQUENCY && val <= AL_FREQUENCY_SHIFTER_MAX_FREQUENCY))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Frequency shifter frequency out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "Frequency shifter frequency out of range");
|
||||
props.Frequency = val;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid frequency shifter float property 0x%04x",
|
||||
param};
|
||||
return;
|
||||
}
|
||||
}
|
||||
void FshifterEffectHandler::SetParamfv(FshifterProps &props, ALenum param, const float *vals)
|
||||
{ SetParamf(props, param, *vals); }
|
||||
|
||||
void FshifterEffectHandler::GetParami(const FshifterProps &props, ALenum param, int *val)
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid frequency shifter float property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void FshifterEffectHandler::SetParamfv(ALCcontext *context, FshifterProps &props, ALenum param, const float *vals)
|
||||
{ SetParamf(context, props, param, *vals); }
|
||||
|
||||
void FshifterEffectHandler::GetParami(ALCcontext *context, const FshifterProps &props, ALenum param, int *val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_FREQUENCY_SHIFTER_LEFT_DIRECTION:
|
||||
*val = EnumFromDirection(props.LeftDirection);
|
||||
break;
|
||||
return;
|
||||
case AL_FREQUENCY_SHIFTER_RIGHT_DIRECTION:
|
||||
*val = EnumFromDirection(props.RightDirection);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM,
|
||||
"Invalid frequency shifter integer property 0x%04x", param};
|
||||
return;
|
||||
}
|
||||
}
|
||||
void FshifterEffectHandler::GetParamiv(const FshifterProps &props, ALenum param, int *vals)
|
||||
{ GetParami(props, param, vals); }
|
||||
|
||||
void FshifterEffectHandler::GetParamf(const FshifterProps &props, ALenum param, float *val)
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid frequency shifter integer property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void FshifterEffectHandler::GetParamiv(ALCcontext *context, const FshifterProps &props, ALenum param, int *vals)
|
||||
{ GetParami(context, props, param, vals); }
|
||||
|
||||
void FshifterEffectHandler::GetParamf(ALCcontext *context, const FshifterProps &props, ALenum param, float *val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_FREQUENCY_SHIFTER_FREQUENCY:
|
||||
*val = props.Frequency;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid frequency shifter float property 0x%04x",
|
||||
param};
|
||||
case AL_FREQUENCY_SHIFTER_FREQUENCY: *val = props.Frequency; return;
|
||||
}
|
||||
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid frequency shifter float property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void FshifterEffectHandler::GetParamfv(const FshifterProps &props, ALenum param, float *vals)
|
||||
{ GetParamf(props, param, vals); }
|
||||
void FshifterEffectHandler::GetParamfv(ALCcontext *context, const FshifterProps &props, ALenum param, float *vals)
|
||||
{ GetParamf(context, props, param, vals); }
|
||||
|
||||
|
||||
#ifdef ALSOFT_EAX
|
||||
#if ALSOFT_EAX
|
||||
namespace {
|
||||
|
||||
using FrequencyShifterCommitter = EaxCommitter<EaxFrequencyShifterCommitter>;
|
||||
|
|
|
|||
|
|
@ -7,12 +7,13 @@
|
|||
#include "AL/al.h"
|
||||
#include "AL/efx.h"
|
||||
|
||||
#include "alc/effects/base.h"
|
||||
#include "alc/context.h"
|
||||
#include "alnumeric.h"
|
||||
#include "effects.h"
|
||||
|
||||
#ifdef ALSOFT_EAX
|
||||
#if ALSOFT_EAX
|
||||
#include <cassert>
|
||||
#include "alnumeric.h"
|
||||
|
||||
#include "al/eax/effect.h"
|
||||
#include "al/eax/exception.h"
|
||||
#include "al/eax/utils.h"
|
||||
|
|
@ -39,8 +40,8 @@ constexpr ALenum EnumFromWaveform(ModulatorWaveform type)
|
|||
case ModulatorWaveform::Sawtooth: return AL_RING_MODULATOR_SAWTOOTH;
|
||||
case ModulatorWaveform::Square: return AL_RING_MODULATOR_SQUARE;
|
||||
}
|
||||
throw std::runtime_error{"Invalid modulator waveform: " +
|
||||
std::to_string(static_cast<int>(type))};
|
||||
throw std::runtime_error{fmt::format("Invalid modulator waveform: {}",
|
||||
int{al::to_underlying(type)})};
|
||||
}
|
||||
|
||||
constexpr EffectProps genDefaultProps() noexcept
|
||||
|
|
@ -56,84 +57,84 @@ constexpr EffectProps genDefaultProps() noexcept
|
|||
|
||||
const EffectProps ModulatorEffectProps{genDefaultProps()};
|
||||
|
||||
void ModulatorEffectHandler::SetParami(ModulatorProps &props, ALenum param, int val)
|
||||
void ModulatorEffectHandler::SetParami(ALCcontext *context, ModulatorProps &props, ALenum param, int val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_RING_MODULATOR_FREQUENCY:
|
||||
case AL_RING_MODULATOR_HIGHPASS_CUTOFF:
|
||||
SetParamf(props, param, static_cast<float>(val));
|
||||
break;
|
||||
SetParamf(context, props, param, static_cast<float>(val));
|
||||
return;
|
||||
|
||||
case AL_RING_MODULATOR_WAVEFORM:
|
||||
if(auto formopt = WaveformFromEmum(val))
|
||||
props.Waveform = *formopt;
|
||||
else
|
||||
throw effect_exception{AL_INVALID_VALUE, "Invalid modulator waveform: 0x%04x", val};
|
||||
break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid modulator integer property 0x%04x",
|
||||
param};
|
||||
context->throw_error(AL_INVALID_VALUE, "Invalid modulator waveform: {:#04x}",
|
||||
as_unsigned(val));
|
||||
return;
|
||||
}
|
||||
}
|
||||
void ModulatorEffectHandler::SetParamiv(ModulatorProps &props, ALenum param, const int *vals)
|
||||
{ SetParami(props, param, *vals); }
|
||||
|
||||
void ModulatorEffectHandler::SetParamf(ModulatorProps &props, ALenum param, float val)
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid modulator integer property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void ModulatorEffectHandler::SetParamiv(ALCcontext *context, ModulatorProps &props, ALenum param, const int *vals)
|
||||
{ SetParami(context, props, param, *vals); }
|
||||
|
||||
void ModulatorEffectHandler::SetParamf(ALCcontext *context, ModulatorProps &props, ALenum param, float val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_RING_MODULATOR_FREQUENCY:
|
||||
if(!(val >= AL_RING_MODULATOR_MIN_FREQUENCY && val <= AL_RING_MODULATOR_MAX_FREQUENCY))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Modulator frequency out of range: %f", val};
|
||||
context->throw_error(AL_INVALID_VALUE, "Modulator frequency out of range: {:f}", val);
|
||||
props.Frequency = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_RING_MODULATOR_HIGHPASS_CUTOFF:
|
||||
if(!(val >= AL_RING_MODULATOR_MIN_HIGHPASS_CUTOFF && val <= AL_RING_MODULATOR_MAX_HIGHPASS_CUTOFF))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Modulator high-pass cutoff out of range: %f", val};
|
||||
context->throw_error(AL_INVALID_VALUE, "Modulator high-pass cutoff out of range: {:f}",
|
||||
val);
|
||||
props.HighPassCutoff = val;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid modulator float property 0x%04x", param};
|
||||
return;
|
||||
}
|
||||
}
|
||||
void ModulatorEffectHandler::SetParamfv(ModulatorProps &props, ALenum param, const float *vals)
|
||||
{ SetParamf(props, param, *vals); }
|
||||
|
||||
void ModulatorEffectHandler::GetParami(const ModulatorProps &props, ALenum param, int *val)
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid modulator float property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void ModulatorEffectHandler::SetParamfv(ALCcontext *context, ModulatorProps &props, ALenum param, const float *vals)
|
||||
{ SetParamf(context, props, param, *vals); }
|
||||
|
||||
void ModulatorEffectHandler::GetParami(ALCcontext *context, const ModulatorProps &props, ALenum param, int *val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_RING_MODULATOR_FREQUENCY: *val = static_cast<int>(props.Frequency); break;
|
||||
case AL_RING_MODULATOR_HIGHPASS_CUTOFF: *val = static_cast<int>(props.HighPassCutoff); break;
|
||||
case AL_RING_MODULATOR_WAVEFORM: *val = EnumFromWaveform(props.Waveform); break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid modulator integer property 0x%04x",
|
||||
param};
|
||||
case AL_RING_MODULATOR_FREQUENCY: *val = static_cast<int>(props.Frequency); return;
|
||||
case AL_RING_MODULATOR_HIGHPASS_CUTOFF: *val = static_cast<int>(props.HighPassCutoff); return;
|
||||
case AL_RING_MODULATOR_WAVEFORM: *val = EnumFromWaveform(props.Waveform); return;
|
||||
}
|
||||
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid modulator integer property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void ModulatorEffectHandler::GetParamiv(const ModulatorProps &props, ALenum param, int *vals)
|
||||
{ GetParami(props, param, vals); }
|
||||
void ModulatorEffectHandler::GetParamf(const ModulatorProps &props, ALenum param, float *val)
|
||||
void ModulatorEffectHandler::GetParamiv(ALCcontext *context, const ModulatorProps &props, ALenum param, int *vals)
|
||||
{ GetParami(context, props, param, vals); }
|
||||
void ModulatorEffectHandler::GetParamf(ALCcontext *context, const ModulatorProps &props, ALenum param, float *val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_RING_MODULATOR_FREQUENCY: *val = props.Frequency; break;
|
||||
case AL_RING_MODULATOR_HIGHPASS_CUTOFF: *val = props.HighPassCutoff; break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid modulator float property 0x%04x", param};
|
||||
case AL_RING_MODULATOR_FREQUENCY: *val = props.Frequency; return;
|
||||
case AL_RING_MODULATOR_HIGHPASS_CUTOFF: *val = props.HighPassCutoff; return;
|
||||
}
|
||||
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid modulator float property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void ModulatorEffectHandler::GetParamfv(const ModulatorProps &props, ALenum param, float *vals)
|
||||
{ GetParamf(props, param, vals); }
|
||||
void ModulatorEffectHandler::GetParamfv(ALCcontext *context, const ModulatorProps &props, ALenum param, float *vals)
|
||||
{ GetParamf(context, props, param, vals); }
|
||||
|
||||
|
||||
#ifdef ALSOFT_EAX
|
||||
#if ALSOFT_EAX
|
||||
namespace {
|
||||
|
||||
using ModulatorCommitter = EaxCommitter<EaxModulatorCommitter>;
|
||||
|
|
|
|||
|
|
@ -4,10 +4,11 @@
|
|||
#include "AL/al.h"
|
||||
#include "AL/efx.h"
|
||||
|
||||
#include "alc/effects/base.h"
|
||||
#include "alc/context.h"
|
||||
#include "alnumeric.h"
|
||||
#include "effects.h"
|
||||
|
||||
#ifdef ALSOFT_EAX
|
||||
#if ALSOFT_EAX
|
||||
#include "al/eax/effect.h"
|
||||
#include "al/eax/exception.h"
|
||||
#endif // ALSOFT_EAX
|
||||
|
|
@ -24,78 +25,46 @@ constexpr EffectProps genDefaultProps() noexcept
|
|||
|
||||
const EffectProps NullEffectProps{genDefaultProps()};
|
||||
|
||||
void NullEffectHandler::SetParami(std::monostate& /*props*/, ALenum param, int /*val*/)
|
||||
void NullEffectHandler::SetParami(ALCcontext *context, std::monostate& /*props*/, ALenum param, int /*val*/)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid null effect integer property 0x%04x",
|
||||
param};
|
||||
}
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid null effect integer property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void NullEffectHandler::SetParamiv(std::monostate &props, ALenum param, const int *vals)
|
||||
void NullEffectHandler::SetParamiv(ALCcontext *context, std::monostate &props, ALenum param, const int *vals)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
default:
|
||||
SetParami(props, param, *vals);
|
||||
}
|
||||
SetParami(context, props, param, *vals);
|
||||
}
|
||||
void NullEffectHandler::SetParamf(std::monostate& /*props*/, ALenum param, float /*val*/)
|
||||
void NullEffectHandler::SetParamf(ALCcontext *context, std::monostate& /*props*/, ALenum param, float /*val*/)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid null effect float property 0x%04x",
|
||||
param};
|
||||
}
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid null effect float property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void NullEffectHandler::SetParamfv(std::monostate &props, ALenum param, const float *vals)
|
||||
void NullEffectHandler::SetParamfv(ALCcontext *context, std::monostate &props, ALenum param, const float *vals)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
default:
|
||||
SetParamf(props, param, *vals);
|
||||
}
|
||||
SetParamf(context, props, param, *vals);
|
||||
}
|
||||
|
||||
void NullEffectHandler::GetParami(const std::monostate& /*props*/, ALenum param, int* /*val*/)
|
||||
void NullEffectHandler::GetParami(ALCcontext *context, const std::monostate& /*props*/, ALenum param, int* /*val*/)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid null effect integer property 0x%04x",
|
||||
param};
|
||||
}
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid null effect integer property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void NullEffectHandler::GetParamiv(const std::monostate &props, ALenum param, int *vals)
|
||||
void NullEffectHandler::GetParamiv(ALCcontext *context, const std::monostate &props, ALenum param, int *vals)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
default:
|
||||
GetParami(props, param, vals);
|
||||
}
|
||||
GetParami(context, props, param, vals);
|
||||
}
|
||||
void NullEffectHandler::GetParamf(const std::monostate& /*props*/, ALenum param, float* /*val*/)
|
||||
void NullEffectHandler::GetParamf(ALCcontext *context, const std::monostate& /*props*/, ALenum param, float* /*val*/)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid null effect float property 0x%04x",
|
||||
param};
|
||||
}
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid null effect float property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void NullEffectHandler::GetParamfv(const std::monostate &props, ALenum param, float *vals)
|
||||
void NullEffectHandler::GetParamfv(ALCcontext *context, const std::monostate &props, ALenum param, float *vals)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
default:
|
||||
GetParamf(props, param, vals);
|
||||
}
|
||||
GetParamf(context, props, param, vals);
|
||||
}
|
||||
|
||||
|
||||
#ifdef ALSOFT_EAX
|
||||
#if ALSOFT_EAX
|
||||
namespace {
|
||||
|
||||
using NullCommitter = EaxCommitter<EaxNullCommitter>;
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@
|
|||
#include "AL/al.h"
|
||||
#include "AL/efx.h"
|
||||
|
||||
#include "alc/effects/base.h"
|
||||
#include "alc/context.h"
|
||||
#include "alnumeric.h"
|
||||
#include "effects.h"
|
||||
|
||||
#ifdef ALSOFT_EAX
|
||||
#include "alnumeric.h"
|
||||
#if ALSOFT_EAX
|
||||
#include "al/eax/effect.h"
|
||||
#include "al/eax/exception.h"
|
||||
#include "al/eax/utils.h"
|
||||
|
|
@ -29,63 +29,55 @@ constexpr EffectProps genDefaultProps() noexcept
|
|||
|
||||
const EffectProps PshifterEffectProps{genDefaultProps()};
|
||||
|
||||
void PshifterEffectHandler::SetParami(PshifterProps &props, ALenum param, int val)
|
||||
void PshifterEffectHandler::SetParami(ALCcontext *context, PshifterProps &props, ALenum param, int val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_PITCH_SHIFTER_COARSE_TUNE:
|
||||
if(!(val >= AL_PITCH_SHIFTER_MIN_COARSE_TUNE && val <= AL_PITCH_SHIFTER_MAX_COARSE_TUNE))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Pitch shifter coarse tune out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "Pitch shifter coarse tune out of range");
|
||||
props.CoarseTune = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_PITCH_SHIFTER_FINE_TUNE:
|
||||
if(!(val >= AL_PITCH_SHIFTER_MIN_FINE_TUNE && val <= AL_PITCH_SHIFTER_MAX_FINE_TUNE))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Pitch shifter fine tune out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "Pitch shifter fine tune out of range");
|
||||
props.FineTune = val;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid pitch shifter integer property 0x%04x",
|
||||
param};
|
||||
return;
|
||||
}
|
||||
}
|
||||
void PshifterEffectHandler::SetParamiv(PshifterProps &props, ALenum param, const int *vals)
|
||||
{ SetParami(props, param, *vals); }
|
||||
|
||||
void PshifterEffectHandler::SetParamf(PshifterProps&, ALenum param, float)
|
||||
{ throw effect_exception{AL_INVALID_ENUM, "Invalid pitch shifter float property 0x%04x", param}; }
|
||||
void PshifterEffectHandler::SetParamfv(PshifterProps&, ALenum param, const float*)
|
||||
{
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid pitch shifter float-vector property 0x%04x",
|
||||
param};
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid pitch shifter integer property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void PshifterEffectHandler::SetParamiv(ALCcontext *context, PshifterProps &props, ALenum param, const int *vals)
|
||||
{ SetParami(context, props, param, *vals); }
|
||||
|
||||
void PshifterEffectHandler::GetParami(const PshifterProps &props, ALenum param, int *val)
|
||||
void PshifterEffectHandler::SetParamf(ALCcontext *context, PshifterProps&, ALenum param, float)
|
||||
{ context->throw_error(AL_INVALID_ENUM, "Invalid pitch shifter float property {:#04x}", as_unsigned(param)); }
|
||||
void PshifterEffectHandler::SetParamfv(ALCcontext *context, PshifterProps &props, ALenum param, const float *vals)
|
||||
{ SetParamf(context, props, param, *vals); }
|
||||
|
||||
void PshifterEffectHandler::GetParami(ALCcontext *context, const PshifterProps &props, ALenum param, int *val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_PITCH_SHIFTER_COARSE_TUNE: *val = props.CoarseTune; break;
|
||||
case AL_PITCH_SHIFTER_FINE_TUNE: *val = props.FineTune; break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid pitch shifter integer property 0x%04x",
|
||||
param};
|
||||
case AL_PITCH_SHIFTER_COARSE_TUNE: *val = props.CoarseTune; return;
|
||||
case AL_PITCH_SHIFTER_FINE_TUNE: *val = props.FineTune; return;
|
||||
}
|
||||
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid pitch shifter integer property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void PshifterEffectHandler::GetParamiv(const PshifterProps &props, ALenum param, int *vals)
|
||||
{ GetParami(props, param, vals); }
|
||||
void PshifterEffectHandler::GetParamiv(ALCcontext *context, const PshifterProps &props, ALenum param, int *vals)
|
||||
{ GetParami(context, props, param, vals); }
|
||||
|
||||
void PshifterEffectHandler::GetParamf(const PshifterProps&, ALenum param, float*)
|
||||
{ throw effect_exception{AL_INVALID_ENUM, "Invalid pitch shifter float property 0x%04x", param}; }
|
||||
void PshifterEffectHandler::GetParamfv(const PshifterProps&, ALenum param, float*)
|
||||
{
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid pitch shifter float vector-property 0x%04x",
|
||||
param};
|
||||
}
|
||||
void PshifterEffectHandler::GetParamf(ALCcontext *context, const PshifterProps&, ALenum param, float*)
|
||||
{ context->throw_error(AL_INVALID_ENUM, "Invalid pitch shifter float property {:#04x}", as_unsigned(param)); }
|
||||
void PshifterEffectHandler::GetParamfv(ALCcontext *context, const PshifterProps &props, ALenum param, float *vals)
|
||||
{ GetParamf(context, props, param, vals); }
|
||||
|
||||
|
||||
#ifdef ALSOFT_EAX
|
||||
#if ALSOFT_EAX
|
||||
namespace {
|
||||
|
||||
using PitchShifterCommitter = EaxCommitter<EaxPitchShifterCommitter>;
|
||||
|
|
|
|||
|
|
@ -9,13 +9,17 @@
|
|||
#include "AL/al.h"
|
||||
#include "AL/efx.h"
|
||||
|
||||
#include "alc/context.h"
|
||||
#include "alnumeric.h"
|
||||
#include "alspan.h"
|
||||
#include "core/effects/base.h"
|
||||
#include "core/logging.h"
|
||||
#include "effects.h"
|
||||
#include "fmt/ranges.h"
|
||||
#include "opthelpers.h"
|
||||
|
||||
#ifdef ALSOFT_EAX
|
||||
#if ALSOFT_EAX
|
||||
#include <cassert>
|
||||
|
||||
#include "al/eax/api.h"
|
||||
#include "al/eax/call.h"
|
||||
#include "al/eax/effect.h"
|
||||
|
|
@ -92,152 +96,149 @@ constexpr EffectProps genDefaultStdProps() noexcept
|
|||
|
||||
const EffectProps ReverbEffectProps{genDefaultProps()};
|
||||
|
||||
void ReverbEffectHandler::SetParami(ReverbProps &props, ALenum param, int val)
|
||||
void ReverbEffectHandler::SetParami(ALCcontext *context, ReverbProps &props, ALenum param, int val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_EAXREVERB_DECAY_HFLIMIT:
|
||||
if(!(val >= AL_EAXREVERB_MIN_DECAY_HFLIMIT && val <= AL_EAXREVERB_MAX_DECAY_HFLIMIT))
|
||||
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb decay hflimit out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "EAX Reverb decay hflimit out of range");
|
||||
props.DecayHFLimit = val != AL_FALSE;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid EAX reverb integer property 0x%04x",
|
||||
param};
|
||||
return;
|
||||
}
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid EAX reverb integer property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void ReverbEffectHandler::SetParamiv(ReverbProps &props, ALenum param, const int *vals)
|
||||
{ SetParami(props, param, *vals); }
|
||||
void ReverbEffectHandler::SetParamf(ReverbProps &props, ALenum param, float val)
|
||||
void ReverbEffectHandler::SetParamiv(ALCcontext *context, ReverbProps &props, ALenum param, const int *vals)
|
||||
{ SetParami(context, props, param, *vals); }
|
||||
void ReverbEffectHandler::SetParamf(ALCcontext *context, ReverbProps &props, ALenum param, float val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_EAXREVERB_DENSITY:
|
||||
if(!(val >= AL_EAXREVERB_MIN_DENSITY && val <= AL_EAXREVERB_MAX_DENSITY))
|
||||
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb density out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "EAX Reverb density out of range");
|
||||
props.Density = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_EAXREVERB_DIFFUSION:
|
||||
if(!(val >= AL_EAXREVERB_MIN_DIFFUSION && val <= AL_EAXREVERB_MAX_DIFFUSION))
|
||||
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb diffusion out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "EAX Reverb diffusion out of range");
|
||||
props.Diffusion = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_EAXREVERB_GAIN:
|
||||
if(!(val >= AL_EAXREVERB_MIN_GAIN && val <= AL_EAXREVERB_MAX_GAIN))
|
||||
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb gain out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "EAX Reverb gain out of range");
|
||||
props.Gain = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_EAXREVERB_GAINHF:
|
||||
if(!(val >= AL_EAXREVERB_MIN_GAINHF && val <= AL_EAXREVERB_MAX_GAINHF))
|
||||
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb gainhf out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "EAX Reverb gainhf out of range");
|
||||
props.GainHF = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_EAXREVERB_GAINLF:
|
||||
if(!(val >= AL_EAXREVERB_MIN_GAINLF && val <= AL_EAXREVERB_MAX_GAINLF))
|
||||
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb gainlf out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "EAX Reverb gainlf out of range");
|
||||
props.GainLF = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_EAXREVERB_DECAY_TIME:
|
||||
if(!(val >= AL_EAXREVERB_MIN_DECAY_TIME && val <= AL_EAXREVERB_MAX_DECAY_TIME))
|
||||
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb decay time out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "EAX Reverb decay time out of range");
|
||||
props.DecayTime = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_EAXREVERB_DECAY_HFRATIO:
|
||||
if(!(val >= AL_EAXREVERB_MIN_DECAY_HFRATIO && val <= AL_EAXREVERB_MAX_DECAY_HFRATIO))
|
||||
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb decay hfratio out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "EAX Reverb decay hfratio out of range");
|
||||
props.DecayHFRatio = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_EAXREVERB_DECAY_LFRATIO:
|
||||
if(!(val >= AL_EAXREVERB_MIN_DECAY_LFRATIO && val <= AL_EAXREVERB_MAX_DECAY_LFRATIO))
|
||||
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb decay lfratio out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "EAX Reverb decay lfratio out of range");
|
||||
props.DecayLFRatio = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_EAXREVERB_REFLECTIONS_GAIN:
|
||||
if(!(val >= AL_EAXREVERB_MIN_REFLECTIONS_GAIN && val <= AL_EAXREVERB_MAX_REFLECTIONS_GAIN))
|
||||
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb reflections gain out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "EAX Reverb reflections gain out of range");
|
||||
props.ReflectionsGain = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_EAXREVERB_REFLECTIONS_DELAY:
|
||||
if(!(val >= AL_EAXREVERB_MIN_REFLECTIONS_DELAY && val <= AL_EAXREVERB_MAX_REFLECTIONS_DELAY))
|
||||
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb reflections delay out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "EAX Reverb reflections delay out of range");
|
||||
props.ReflectionsDelay = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_EAXREVERB_LATE_REVERB_GAIN:
|
||||
if(!(val >= AL_EAXREVERB_MIN_LATE_REVERB_GAIN && val <= AL_EAXREVERB_MAX_LATE_REVERB_GAIN))
|
||||
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb late reverb gain out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "EAX Reverb late reverb gain out of range");
|
||||
props.LateReverbGain = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_EAXREVERB_LATE_REVERB_DELAY:
|
||||
if(!(val >= AL_EAXREVERB_MIN_LATE_REVERB_DELAY && val <= AL_EAXREVERB_MAX_LATE_REVERB_DELAY))
|
||||
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb late reverb delay out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "EAX Reverb late reverb delay out of range");
|
||||
props.LateReverbDelay = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_EAXREVERB_ECHO_TIME:
|
||||
if(!(val >= AL_EAXREVERB_MIN_ECHO_TIME && val <= AL_EAXREVERB_MAX_ECHO_TIME))
|
||||
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb echo time out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "EAX Reverb echo time out of range");
|
||||
props.EchoTime = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_EAXREVERB_ECHO_DEPTH:
|
||||
if(!(val >= AL_EAXREVERB_MIN_ECHO_DEPTH && val <= AL_EAXREVERB_MAX_ECHO_DEPTH))
|
||||
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb echo depth out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "EAX Reverb echo depth out of range");
|
||||
props.EchoDepth = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_EAXREVERB_MODULATION_TIME:
|
||||
if(!(val >= AL_EAXREVERB_MIN_MODULATION_TIME && val <= AL_EAXREVERB_MAX_MODULATION_TIME))
|
||||
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb modulation time out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "EAX Reverb modulation time out of range");
|
||||
props.ModulationTime = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_EAXREVERB_MODULATION_DEPTH:
|
||||
if(!(val >= AL_EAXREVERB_MIN_MODULATION_DEPTH && val <= AL_EAXREVERB_MAX_MODULATION_DEPTH))
|
||||
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb modulation depth out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "EAX Reverb modulation depth out of range");
|
||||
props.ModulationDepth = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_EAXREVERB_AIR_ABSORPTION_GAINHF:
|
||||
if(!(val >= AL_EAXREVERB_MIN_AIR_ABSORPTION_GAINHF && val <= AL_EAXREVERB_MAX_AIR_ABSORPTION_GAINHF))
|
||||
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb air absorption gainhf out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "EAX Reverb air absorption gainhf out of range");
|
||||
props.AirAbsorptionGainHF = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_EAXREVERB_HFREFERENCE:
|
||||
if(!(val >= AL_EAXREVERB_MIN_HFREFERENCE && val <= AL_EAXREVERB_MAX_HFREFERENCE))
|
||||
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb hfreference out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "EAX Reverb hfreference out of range");
|
||||
props.HFReference = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_EAXREVERB_LFREFERENCE:
|
||||
if(!(val >= AL_EAXREVERB_MIN_LFREFERENCE && val <= AL_EAXREVERB_MAX_LFREFERENCE))
|
||||
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb lfreference out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "EAX Reverb lfreference out of range");
|
||||
props.LFReference = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR:
|
||||
if(!(val >= AL_EAXREVERB_MIN_ROOM_ROLLOFF_FACTOR && val <= AL_EAXREVERB_MAX_ROOM_ROLLOFF_FACTOR))
|
||||
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb room rolloff factor out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "EAX Reverb room rolloff factor out of range");
|
||||
props.RoomRolloffFactor = val;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid EAX reverb float property 0x%04x", param};
|
||||
return;
|
||||
}
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid EAX reverb float property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void ReverbEffectHandler::SetParamfv(ReverbProps &props, ALenum param, const float *vals)
|
||||
void ReverbEffectHandler::SetParamfv(ALCcontext *context, ReverbProps &props, ALenum param, const float *vals)
|
||||
{
|
||||
static constexpr auto finite_checker = [](float f) -> bool { return std::isfinite(f); };
|
||||
al::span<const float> values;
|
||||
|
|
@ -246,64 +247,60 @@ void ReverbEffectHandler::SetParamfv(ReverbProps &props, ALenum param, const flo
|
|||
case AL_EAXREVERB_REFLECTIONS_PAN:
|
||||
values = {vals, 3_uz};
|
||||
if(!std::all_of(values.cbegin(), values.cend(), finite_checker))
|
||||
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb reflections pan out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "EAX Reverb reflections pan out of range");
|
||||
std::copy(values.cbegin(), values.cend(), props.ReflectionsPan.begin());
|
||||
break;
|
||||
return;
|
||||
case AL_EAXREVERB_LATE_REVERB_PAN:
|
||||
values = {vals, 3_uz};
|
||||
if(!std::all_of(values.cbegin(), values.cend(), finite_checker))
|
||||
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb late reverb pan out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "EAX Reverb late reverb pan out of range");
|
||||
std::copy(values.cbegin(), values.cend(), props.LateReverbPan.begin());
|
||||
break;
|
||||
|
||||
default:
|
||||
SetParamf(props, param, *vals);
|
||||
break;
|
||||
return;
|
||||
}
|
||||
SetParamf(context, props, param, *vals);
|
||||
}
|
||||
|
||||
void ReverbEffectHandler::GetParami(const ReverbProps &props, ALenum param, int *val)
|
||||
void ReverbEffectHandler::GetParami(ALCcontext *context, const ReverbProps &props, ALenum param, int *val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_EAXREVERB_DECAY_HFLIMIT: *val = props.DecayHFLimit; break;
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid EAX reverb integer property 0x%04x",
|
||||
param};
|
||||
case AL_EAXREVERB_DECAY_HFLIMIT: *val = props.DecayHFLimit; return;
|
||||
}
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid EAX reverb integer property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void ReverbEffectHandler::GetParamiv(const ReverbProps &props, ALenum param, int *vals)
|
||||
{ GetParami(props, param, vals); }
|
||||
void ReverbEffectHandler::GetParamf(const ReverbProps &props, ALenum param, float *val)
|
||||
void ReverbEffectHandler::GetParamiv(ALCcontext *context, const ReverbProps &props, ALenum param, int *vals)
|
||||
{ GetParami(context, props, param, vals); }
|
||||
void ReverbEffectHandler::GetParamf(ALCcontext *context, const ReverbProps &props, ALenum param, float *val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_EAXREVERB_DENSITY: *val = props.Density; break;
|
||||
case AL_EAXREVERB_DIFFUSION: *val = props.Diffusion; break;
|
||||
case AL_EAXREVERB_GAIN: *val = props.Gain; break;
|
||||
case AL_EAXREVERB_GAINHF: *val = props.GainHF; break;
|
||||
case AL_EAXREVERB_GAINLF: *val = props.GainLF; break;
|
||||
case AL_EAXREVERB_DECAY_TIME: *val = props.DecayTime; break;
|
||||
case AL_EAXREVERB_DECAY_HFRATIO: *val = props.DecayHFRatio; break;
|
||||
case AL_EAXREVERB_DECAY_LFRATIO: *val = props.DecayLFRatio; break;
|
||||
case AL_EAXREVERB_REFLECTIONS_GAIN: *val = props.ReflectionsGain; break;
|
||||
case AL_EAXREVERB_REFLECTIONS_DELAY: *val = props.ReflectionsDelay; break;
|
||||
case AL_EAXREVERB_LATE_REVERB_GAIN: *val = props.LateReverbGain; break;
|
||||
case AL_EAXREVERB_LATE_REVERB_DELAY: *val = props.LateReverbDelay; break;
|
||||
case AL_EAXREVERB_ECHO_TIME: *val = props.EchoTime; break;
|
||||
case AL_EAXREVERB_ECHO_DEPTH: *val = props.EchoDepth; break;
|
||||
case AL_EAXREVERB_MODULATION_TIME: *val = props.ModulationTime; break;
|
||||
case AL_EAXREVERB_MODULATION_DEPTH: *val = props.ModulationDepth; break;
|
||||
case AL_EAXREVERB_AIR_ABSORPTION_GAINHF: *val = props.AirAbsorptionGainHF; break;
|
||||
case AL_EAXREVERB_HFREFERENCE: *val = props.HFReference; break;
|
||||
case AL_EAXREVERB_LFREFERENCE: *val = props.LFReference; break;
|
||||
case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR: *val = props.RoomRolloffFactor; break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid EAX reverb float property 0x%04x", param};
|
||||
case AL_EAXREVERB_DENSITY: *val = props.Density; return;
|
||||
case AL_EAXREVERB_DIFFUSION: *val = props.Diffusion; return;
|
||||
case AL_EAXREVERB_GAIN: *val = props.Gain; return;
|
||||
case AL_EAXREVERB_GAINHF: *val = props.GainHF; return;
|
||||
case AL_EAXREVERB_GAINLF: *val = props.GainLF; return;
|
||||
case AL_EAXREVERB_DECAY_TIME: *val = props.DecayTime; return;
|
||||
case AL_EAXREVERB_DECAY_HFRATIO: *val = props.DecayHFRatio; return;
|
||||
case AL_EAXREVERB_DECAY_LFRATIO: *val = props.DecayLFRatio; return;
|
||||
case AL_EAXREVERB_REFLECTIONS_GAIN: *val = props.ReflectionsGain; return;
|
||||
case AL_EAXREVERB_REFLECTIONS_DELAY: *val = props.ReflectionsDelay; return;
|
||||
case AL_EAXREVERB_LATE_REVERB_GAIN: *val = props.LateReverbGain; return;
|
||||
case AL_EAXREVERB_LATE_REVERB_DELAY: *val = props.LateReverbDelay; return;
|
||||
case AL_EAXREVERB_ECHO_TIME: *val = props.EchoTime; return;
|
||||
case AL_EAXREVERB_ECHO_DEPTH: *val = props.EchoDepth; return;
|
||||
case AL_EAXREVERB_MODULATION_TIME: *val = props.ModulationTime; return;
|
||||
case AL_EAXREVERB_MODULATION_DEPTH: *val = props.ModulationDepth; return;
|
||||
case AL_EAXREVERB_AIR_ABSORPTION_GAINHF: *val = props.AirAbsorptionGainHF; return;
|
||||
case AL_EAXREVERB_HFREFERENCE: *val = props.HFReference; return;
|
||||
case AL_EAXREVERB_LFREFERENCE: *val = props.LFReference; return;
|
||||
case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR: *val = props.RoomRolloffFactor; return;
|
||||
}
|
||||
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid EAX reverb float property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void ReverbEffectHandler::GetParamfv(const ReverbProps &props, ALenum param, float *vals)
|
||||
void ReverbEffectHandler::GetParamfv(ALCcontext *context, const ReverbProps &props, ALenum param, float *vals)
|
||||
{
|
||||
al::span<float> values;
|
||||
switch(param)
|
||||
|
|
@ -311,159 +308,155 @@ void ReverbEffectHandler::GetParamfv(const ReverbProps &props, ALenum param, flo
|
|||
case AL_EAXREVERB_REFLECTIONS_PAN:
|
||||
values = {vals, 3_uz};
|
||||
std::copy(props.ReflectionsPan.cbegin(), props.ReflectionsPan.cend(), values.begin());
|
||||
break;
|
||||
return;
|
||||
case AL_EAXREVERB_LATE_REVERB_PAN:
|
||||
values = {vals, 3_uz};
|
||||
std::copy(props.LateReverbPan.cbegin(), props.LateReverbPan.cend(), values.begin());
|
||||
break;
|
||||
|
||||
default:
|
||||
GetParamf(props, param, vals);
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
GetParamf(context, props, param, vals);
|
||||
}
|
||||
|
||||
|
||||
const EffectProps StdReverbEffectProps{genDefaultStdProps()};
|
||||
|
||||
void StdReverbEffectHandler::SetParami(ReverbProps &props, ALenum param, int val)
|
||||
void StdReverbEffectHandler::SetParami(ALCcontext *context, ReverbProps &props, ALenum param, int val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_REVERB_DECAY_HFLIMIT:
|
||||
if(!(val >= AL_REVERB_MIN_DECAY_HFLIMIT && val <= AL_REVERB_MAX_DECAY_HFLIMIT))
|
||||
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb decay hflimit out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "EAX Reverb decay hflimit out of range");
|
||||
props.DecayHFLimit = val != AL_FALSE;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid EAX reverb integer property 0x%04x",
|
||||
param};
|
||||
return;
|
||||
}
|
||||
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid EAX reverb integer property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void StdReverbEffectHandler::SetParamiv(ReverbProps &props, ALenum param, const int *vals)
|
||||
{ SetParami(props, param, *vals); }
|
||||
void StdReverbEffectHandler::SetParamf(ReverbProps &props, ALenum param, float val)
|
||||
void StdReverbEffectHandler::SetParamiv(ALCcontext *context, ReverbProps &props, ALenum param, const int *vals)
|
||||
{ SetParami(context, props, param, *vals); }
|
||||
void StdReverbEffectHandler::SetParamf(ALCcontext *context, ReverbProps &props, ALenum param, float val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_REVERB_DENSITY:
|
||||
if(!(val >= AL_REVERB_MIN_DENSITY && val <= AL_REVERB_MAX_DENSITY))
|
||||
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb density out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "EAX Reverb density out of range");
|
||||
props.Density = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_REVERB_DIFFUSION:
|
||||
if(!(val >= AL_REVERB_MIN_DIFFUSION && val <= AL_REVERB_MAX_DIFFUSION))
|
||||
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb diffusion out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "EAX Reverb diffusion out of range");
|
||||
props.Diffusion = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_REVERB_GAIN:
|
||||
if(!(val >= AL_REVERB_MIN_GAIN && val <= AL_REVERB_MAX_GAIN))
|
||||
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb gain out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "EAX Reverb gain out of range");
|
||||
props.Gain = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_REVERB_GAINHF:
|
||||
if(!(val >= AL_REVERB_MIN_GAINHF && val <= AL_REVERB_MAX_GAINHF))
|
||||
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb gainhf out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "EAX Reverb gainhf out of range");
|
||||
props.GainHF = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_REVERB_DECAY_TIME:
|
||||
if(!(val >= AL_REVERB_MIN_DECAY_TIME && val <= AL_REVERB_MAX_DECAY_TIME))
|
||||
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb decay time out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "EAX Reverb decay time out of range");
|
||||
props.DecayTime = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_REVERB_DECAY_HFRATIO:
|
||||
if(!(val >= AL_REVERB_MIN_DECAY_HFRATIO && val <= AL_REVERB_MAX_DECAY_HFRATIO))
|
||||
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb decay hfratio out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "EAX Reverb decay hfratio out of range");
|
||||
props.DecayHFRatio = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_REVERB_REFLECTIONS_GAIN:
|
||||
if(!(val >= AL_REVERB_MIN_REFLECTIONS_GAIN && val <= AL_REVERB_MAX_REFLECTIONS_GAIN))
|
||||
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb reflections gain out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "EAX Reverb reflections gain out of range");
|
||||
props.ReflectionsGain = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_REVERB_REFLECTIONS_DELAY:
|
||||
if(!(val >= AL_REVERB_MIN_REFLECTIONS_DELAY && val <= AL_REVERB_MAX_REFLECTIONS_DELAY))
|
||||
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb reflections delay out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "EAX Reverb reflections delay out of range");
|
||||
props.ReflectionsDelay = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_REVERB_LATE_REVERB_GAIN:
|
||||
if(!(val >= AL_REVERB_MIN_LATE_REVERB_GAIN && val <= AL_REVERB_MAX_LATE_REVERB_GAIN))
|
||||
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb late reverb gain out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "EAX Reverb late reverb gain out of range");
|
||||
props.LateReverbGain = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_REVERB_LATE_REVERB_DELAY:
|
||||
if(!(val >= AL_REVERB_MIN_LATE_REVERB_DELAY && val <= AL_REVERB_MAX_LATE_REVERB_DELAY))
|
||||
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb late reverb delay out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "EAX Reverb late reverb delay out of range");
|
||||
props.LateReverbDelay = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_REVERB_AIR_ABSORPTION_GAINHF:
|
||||
if(!(val >= AL_REVERB_MIN_AIR_ABSORPTION_GAINHF && val <= AL_REVERB_MAX_AIR_ABSORPTION_GAINHF))
|
||||
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb air absorption gainhf out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "EAX Reverb air absorption gainhf out of range");
|
||||
props.AirAbsorptionGainHF = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_REVERB_ROOM_ROLLOFF_FACTOR:
|
||||
if(!(val >= AL_REVERB_MIN_ROOM_ROLLOFF_FACTOR && val <= AL_REVERB_MAX_ROOM_ROLLOFF_FACTOR))
|
||||
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb room rolloff factor out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "EAX Reverb room rolloff factor out of range");
|
||||
props.RoomRolloffFactor = val;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid EAX reverb float property 0x%04x", param};
|
||||
return;
|
||||
}
|
||||
}
|
||||
void StdReverbEffectHandler::SetParamfv(ReverbProps &props, ALenum param, const float *vals)
|
||||
{ SetParamf(props, param, *vals); }
|
||||
|
||||
void StdReverbEffectHandler::GetParami(const ReverbProps &props, ALenum param, int *val)
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid EAX reverb float property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void StdReverbEffectHandler::SetParamfv(ALCcontext *context, ReverbProps &props, ALenum param, const float *vals)
|
||||
{ SetParamf(context, props, param, *vals); }
|
||||
|
||||
void StdReverbEffectHandler::GetParami(ALCcontext *context, const ReverbProps &props, ALenum param, int *val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_REVERB_DECAY_HFLIMIT: *val = props.DecayHFLimit; break;
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid EAX reverb integer property 0x%04x",
|
||||
param};
|
||||
case AL_REVERB_DECAY_HFLIMIT: *val = props.DecayHFLimit; return;
|
||||
}
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid EAX reverb integer property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void StdReverbEffectHandler::GetParamiv(const ReverbProps &props, ALenum param, int *vals)
|
||||
{ GetParami(props, param, vals); }
|
||||
void StdReverbEffectHandler::GetParamf(const ReverbProps &props, ALenum param, float *val)
|
||||
void StdReverbEffectHandler::GetParamiv(ALCcontext *context, const ReverbProps &props, ALenum param, int *vals)
|
||||
{ GetParami(context, props, param, vals); }
|
||||
void StdReverbEffectHandler::GetParamf(ALCcontext *context, const ReverbProps &props, ALenum param, float *val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_REVERB_DENSITY: *val = props.Density; break;
|
||||
case AL_REVERB_DIFFUSION: *val = props.Diffusion; break;
|
||||
case AL_REVERB_GAIN: *val = props.Gain; break;
|
||||
case AL_REVERB_GAINHF: *val = props.GainHF; break;
|
||||
case AL_REVERB_DECAY_TIME: *val = props.DecayTime; break;
|
||||
case AL_REVERB_DECAY_HFRATIO: *val = props.DecayHFRatio; break;
|
||||
case AL_REVERB_REFLECTIONS_GAIN: *val = props.ReflectionsGain; break;
|
||||
case AL_REVERB_REFLECTIONS_DELAY: *val = props.ReflectionsDelay; break;
|
||||
case AL_REVERB_LATE_REVERB_GAIN: *val = props.LateReverbGain; break;
|
||||
case AL_REVERB_LATE_REVERB_DELAY: *val = props.LateReverbDelay; break;
|
||||
case AL_REVERB_AIR_ABSORPTION_GAINHF: *val = props.AirAbsorptionGainHF; break;
|
||||
case AL_REVERB_ROOM_ROLLOFF_FACTOR: *val = props.RoomRolloffFactor; break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid EAX reverb float property 0x%04x", param};
|
||||
case AL_REVERB_DENSITY: *val = props.Density; return;
|
||||
case AL_REVERB_DIFFUSION: *val = props.Diffusion; return;
|
||||
case AL_REVERB_GAIN: *val = props.Gain; return;
|
||||
case AL_REVERB_GAINHF: *val = props.GainHF; return;
|
||||
case AL_REVERB_DECAY_TIME: *val = props.DecayTime; return;
|
||||
case AL_REVERB_DECAY_HFRATIO: *val = props.DecayHFRatio; return;
|
||||
case AL_REVERB_REFLECTIONS_GAIN: *val = props.ReflectionsGain; return;
|
||||
case AL_REVERB_REFLECTIONS_DELAY: *val = props.ReflectionsDelay; return;
|
||||
case AL_REVERB_LATE_REVERB_GAIN: *val = props.LateReverbGain; return;
|
||||
case AL_REVERB_LATE_REVERB_DELAY: *val = props.LateReverbDelay; return;
|
||||
case AL_REVERB_AIR_ABSORPTION_GAINHF: *val = props.AirAbsorptionGainHF; return;
|
||||
case AL_REVERB_ROOM_ROLLOFF_FACTOR: *val = props.RoomRolloffFactor; return;
|
||||
}
|
||||
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid EAX reverb float property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void StdReverbEffectHandler::GetParamfv(const ReverbProps &props, ALenum param, float *vals)
|
||||
{ GetParamf(props, param, vals); }
|
||||
void StdReverbEffectHandler::GetParamfv(ALCcontext *context, const ReverbProps &props, ALenum param, float *vals)
|
||||
{ GetParamf(context, props, param, vals); }
|
||||
|
||||
|
||||
#ifdef ALSOFT_EAX
|
||||
#if ALSOFT_EAX
|
||||
namespace {
|
||||
|
||||
class EaxReverbEffectException : public EaxException
|
||||
|
|
@ -1064,6 +1057,38 @@ bool EaxReverbCommitter::commit(const EAXREVERBPROPERTIES &props)
|
|||
ret.LFReference = props.flLFReference;
|
||||
ret.RoomRolloffFactor = props.flRoomRolloffFactor;
|
||||
ret.DecayHFLimit = ((props.ulFlags & EAXREVERBFLAGS_DECAYHFLIMIT) != 0);
|
||||
if(EaxTraceCommits) UNLIKELY
|
||||
{
|
||||
TRACE("Reverb commit:\n"
|
||||
" Density: {:f}\n"
|
||||
" Diffusion: {:f}\n"
|
||||
" Gain: {:f}\n"
|
||||
" GainHF: {:f}\n"
|
||||
" GainLF: {:f}\n"
|
||||
" DecayTime: {:f}\n"
|
||||
" DecayHFRatio: {:f}\n"
|
||||
" DecayLFRatio: {:f}\n"
|
||||
" ReflectionsGain: {:f}\n"
|
||||
" ReflectionsDelay: {:f}\n"
|
||||
" ReflectionsPan: {}\n"
|
||||
" LateReverbGain: {:f}\n"
|
||||
" LateReverbDelay: {:f}\n"
|
||||
" LateRevernPan: {}\n"
|
||||
" EchoTime: {:f}\n"
|
||||
" EchoDepth: {:f}\n"
|
||||
" ModulationTime: {:f}\n"
|
||||
" ModulationDepth: {:f}\n"
|
||||
" AirAbsorptionGainHF: {:f}\n"
|
||||
" HFReference: {:f}\n"
|
||||
" LFReference: {:f}\n"
|
||||
" RoomRolloffFactor: {:f}\n"
|
||||
" DecayHFLimit: {}", ret.Density, ret.Diffusion, ret.Gain, ret.GainHF, ret.GainLF,
|
||||
ret.DecayTime, ret.DecayHFRatio, ret.DecayLFRatio, ret.ReflectionsGain,
|
||||
ret.ReflectionsDelay, ret.ReflectionsPan, ret.LateReverbGain, ret.LateReverbDelay,
|
||||
ret.LateReverbPan, ret.EchoTime, ret.EchoDepth, ret.ModulationTime,
|
||||
ret.ModulationDepth, ret.AirAbsorptionGainHF, ret.HFReference, ret.LFReference,
|
||||
ret.RoomRolloffFactor, ret.DecayHFLimit ? "true" : "false");
|
||||
}
|
||||
return ret;
|
||||
}();
|
||||
|
||||
|
|
|
|||
|
|
@ -7,10 +7,11 @@
|
|||
#include "AL/al.h"
|
||||
#include "AL/efx.h"
|
||||
|
||||
#include "core/effects/base.h"
|
||||
#include "alc/context.h"
|
||||
#include "alnumeric.h"
|
||||
#include "effects.h"
|
||||
|
||||
#ifdef ALSOFT_EAX
|
||||
#if ALSOFT_EAX
|
||||
#include <cassert>
|
||||
#include "al/eax/effect.h"
|
||||
#include "al/eax/exception.h"
|
||||
|
|
@ -96,7 +97,7 @@ constexpr ALenum EnumFromPhenome(VMorpherPhenome phenome)
|
|||
HANDLE_PHENOME(V);
|
||||
HANDLE_PHENOME(Z);
|
||||
}
|
||||
throw std::runtime_error{"Invalid phenome: "+std::to_string(static_cast<int>(phenome))};
|
||||
throw std::runtime_error{fmt::format("Invalid phenome: {}", int{al::to_underlying(phenome)})};
|
||||
#undef HANDLE_PHENOME
|
||||
}
|
||||
|
||||
|
|
@ -118,8 +119,8 @@ constexpr ALenum EnumFromWaveform(VMorpherWaveform type)
|
|||
case VMorpherWaveform::Triangle: return AL_VOCAL_MORPHER_WAVEFORM_TRIANGLE;
|
||||
case VMorpherWaveform::Sawtooth: return AL_VOCAL_MORPHER_WAVEFORM_SAWTOOTH;
|
||||
}
|
||||
throw std::runtime_error{"Invalid vocal morpher waveform: " +
|
||||
std::to_string(static_cast<int>(type))};
|
||||
throw std::runtime_error{fmt::format("Invalid vocal morpher waveform: {}",
|
||||
int{al::to_underlying(type)})};
|
||||
}
|
||||
|
||||
constexpr EffectProps genDefaultProps() noexcept
|
||||
|
|
@ -138,7 +139,7 @@ constexpr EffectProps genDefaultProps() noexcept
|
|||
|
||||
const EffectProps VmorpherEffectProps{genDefaultProps()};
|
||||
|
||||
void VmorpherEffectHandler::SetParami(VmorpherProps &props, ALenum param, int val)
|
||||
void VmorpherEffectHandler::SetParami(ALCcontext *context, VmorpherProps &props, ALenum param, int val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
|
|
@ -146,101 +147,94 @@ void VmorpherEffectHandler::SetParami(VmorpherProps &props, ALenum param, int va
|
|||
if(auto phenomeopt = PhenomeFromEnum(val))
|
||||
props.PhonemeA = *phenomeopt;
|
||||
else
|
||||
throw effect_exception{AL_INVALID_VALUE, "Vocal morpher phoneme-a out of range: 0x%04x", val};
|
||||
break;
|
||||
context->throw_error(AL_INVALID_VALUE,
|
||||
"Vocal morpher phoneme-a out of range: {:#04x}", as_unsigned(val));
|
||||
return;
|
||||
|
||||
case AL_VOCAL_MORPHER_PHONEMEA_COARSE_TUNING:
|
||||
if(!(val >= AL_VOCAL_MORPHER_MIN_PHONEMEA_COARSE_TUNING && val <= AL_VOCAL_MORPHER_MAX_PHONEMEA_COARSE_TUNING))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Vocal morpher phoneme-a coarse tuning out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE,
|
||||
"Vocal morpher phoneme-a coarse tuning out of range");
|
||||
props.PhonemeACoarseTuning = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_VOCAL_MORPHER_PHONEMEB:
|
||||
if(auto phenomeopt = PhenomeFromEnum(val))
|
||||
props.PhonemeB = *phenomeopt;
|
||||
else
|
||||
throw effect_exception{AL_INVALID_VALUE, "Vocal morpher phoneme-b out of range: 0x%04x", val};
|
||||
break;
|
||||
context->throw_error(AL_INVALID_VALUE,
|
||||
"Vocal morpher phoneme-b out of range: {:#04x}", as_unsigned(val));
|
||||
return;
|
||||
|
||||
case AL_VOCAL_MORPHER_PHONEMEB_COARSE_TUNING:
|
||||
if(!(val >= AL_VOCAL_MORPHER_MIN_PHONEMEB_COARSE_TUNING && val <= AL_VOCAL_MORPHER_MAX_PHONEMEB_COARSE_TUNING))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Vocal morpher phoneme-b coarse tuning out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE,
|
||||
"Vocal morpher phoneme-b coarse tuning out of range");
|
||||
props.PhonemeBCoarseTuning = val;
|
||||
break;
|
||||
return;
|
||||
|
||||
case AL_VOCAL_MORPHER_WAVEFORM:
|
||||
if(auto formopt = WaveformFromEmum(val))
|
||||
props.Waveform = *formopt;
|
||||
else
|
||||
throw effect_exception{AL_INVALID_VALUE, "Vocal morpher waveform out of range: 0x%04x", val};
|
||||
break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid vocal morpher integer property 0x%04x",
|
||||
param};
|
||||
context->throw_error(AL_INVALID_VALUE, "Vocal morpher waveform out of range: {:#04x}",
|
||||
as_unsigned(val));
|
||||
return;
|
||||
}
|
||||
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid vocal morpher integer property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void VmorpherEffectHandler::SetParamiv(VmorpherProps&, ALenum param, const int*)
|
||||
{
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid vocal morpher integer-vector property 0x%04x",
|
||||
param};
|
||||
}
|
||||
void VmorpherEffectHandler::SetParamf(VmorpherProps &props, ALenum param, float val)
|
||||
void VmorpherEffectHandler::SetParamiv(ALCcontext *context, VmorpherProps &props, ALenum param, const int *vals)
|
||||
{ SetParami(context, props, param, *vals); }
|
||||
void VmorpherEffectHandler::SetParamf(ALCcontext *context, VmorpherProps &props, ALenum param, float val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_VOCAL_MORPHER_RATE:
|
||||
if(!(val >= AL_VOCAL_MORPHER_MIN_RATE && val <= AL_VOCAL_MORPHER_MAX_RATE))
|
||||
throw effect_exception{AL_INVALID_VALUE, "Vocal morpher rate out of range"};
|
||||
context->throw_error(AL_INVALID_VALUE, "Vocal morpher rate out of range");
|
||||
props.Rate = val;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid vocal morpher float property 0x%04x",
|
||||
param};
|
||||
return;
|
||||
}
|
||||
}
|
||||
void VmorpherEffectHandler::SetParamfv(VmorpherProps &props, ALenum param, const float *vals)
|
||||
{ SetParamf(props, param, *vals); }
|
||||
|
||||
void VmorpherEffectHandler::GetParami(const VmorpherProps &props, ALenum param, int* val)
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid vocal morpher float property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void VmorpherEffectHandler::SetParamfv(ALCcontext *context, VmorpherProps &props, ALenum param, const float *vals)
|
||||
{ SetParamf(context, props, param, *vals); }
|
||||
|
||||
void VmorpherEffectHandler::GetParami(ALCcontext *context, const VmorpherProps &props, ALenum param, int* val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_VOCAL_MORPHER_PHONEMEA: *val = EnumFromPhenome(props.PhonemeA); break;
|
||||
case AL_VOCAL_MORPHER_PHONEMEA_COARSE_TUNING: *val = props.PhonemeACoarseTuning; break;
|
||||
case AL_VOCAL_MORPHER_PHONEMEB: *val = EnumFromPhenome(props.PhonemeB); break;
|
||||
case AL_VOCAL_MORPHER_PHONEMEB_COARSE_TUNING: *val = props.PhonemeBCoarseTuning; break;
|
||||
case AL_VOCAL_MORPHER_WAVEFORM: *val = EnumFromWaveform(props.Waveform); break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid vocal morpher integer property 0x%04x",
|
||||
param};
|
||||
case AL_VOCAL_MORPHER_PHONEMEA: *val = EnumFromPhenome(props.PhonemeA); return;
|
||||
case AL_VOCAL_MORPHER_PHONEMEA_COARSE_TUNING: *val = props.PhonemeACoarseTuning; return;
|
||||
case AL_VOCAL_MORPHER_PHONEMEB: *val = EnumFromPhenome(props.PhonemeB); return;
|
||||
case AL_VOCAL_MORPHER_PHONEMEB_COARSE_TUNING: *val = props.PhonemeBCoarseTuning; return;
|
||||
case AL_VOCAL_MORPHER_WAVEFORM: *val = EnumFromWaveform(props.Waveform); return;
|
||||
}
|
||||
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid vocal morpher integer property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void VmorpherEffectHandler::GetParamiv(const VmorpherProps&, ALenum param, int*)
|
||||
{
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid vocal morpher integer-vector property 0x%04x",
|
||||
param};
|
||||
}
|
||||
void VmorpherEffectHandler::GetParamf(const VmorpherProps &props, ALenum param, float *val)
|
||||
void VmorpherEffectHandler::GetParamiv(ALCcontext *context, const VmorpherProps &props, ALenum param, int *vals)
|
||||
{ GetParami(context, props, param, vals); }
|
||||
void VmorpherEffectHandler::GetParamf(ALCcontext *context, const VmorpherProps &props, ALenum param, float *val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
case AL_VOCAL_MORPHER_RATE:
|
||||
*val = props.Rate;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw effect_exception{AL_INVALID_ENUM, "Invalid vocal morpher float property 0x%04x",
|
||||
param};
|
||||
case AL_VOCAL_MORPHER_RATE: *val = props.Rate; return;
|
||||
}
|
||||
|
||||
context->throw_error(AL_INVALID_ENUM, "Invalid vocal morpher float property {:#04x}",
|
||||
as_unsigned(param));
|
||||
}
|
||||
void VmorpherEffectHandler::GetParamfv(const VmorpherProps &props, ALenum param, float *vals)
|
||||
{ GetParamf(props, param, vals); }
|
||||
void VmorpherEffectHandler::GetParamfv(ALCcontext *context, const VmorpherProps &props, ALenum param, float *vals)
|
||||
{ GetParamf(context, props, param, vals); }
|
||||
|
||||
|
||||
#ifdef ALSOFT_EAX
|
||||
#if ALSOFT_EAX
|
||||
namespace {
|
||||
|
||||
using VocalMorpherCommitter = EaxCommitter<EaxVocalMorpherCommitter>;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue