Implement getDefaultProps for effect state factories
This commit is contained in:
@@ -33,6 +33,8 @@
|
||||
#include "filters/biquad.h"
|
||||
#include "vecmat.h"
|
||||
|
||||
namespace {
|
||||
|
||||
#define MIN_FREQ 20.0f
|
||||
#define MAX_FREQ 2500.0f
|
||||
#define Q_FACTOR 5.0f
|
||||
@@ -199,11 +201,24 @@ void ALautowahState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT sampl
|
||||
|
||||
struct AutowahStateFactory final : public EffectStateFactory {
|
||||
EffectState *create() override;
|
||||
ALeffectProps getDefaultProps() const noexcept override;
|
||||
};
|
||||
|
||||
EffectState *AutowahStateFactory::create()
|
||||
{ return new ALautowahState{}; }
|
||||
|
||||
ALeffectProps AutowahStateFactory::getDefaultProps() const noexcept
|
||||
{
|
||||
ALeffectProps props{};
|
||||
props.Autowah.AttackTime = AL_AUTOWAH_DEFAULT_ATTACK_TIME;
|
||||
props.Autowah.ReleaseTime = AL_AUTOWAH_DEFAULT_RELEASE_TIME;
|
||||
props.Autowah.Resonance = AL_AUTOWAH_DEFAULT_RESONANCE;
|
||||
props.Autowah.PeakGain = AL_AUTOWAH_DEFAULT_PEAK_GAIN;
|
||||
return props;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
EffectStateFactory *AutowahStateFactory_getFactory()
|
||||
{
|
||||
static AutowahStateFactory AutowahFactory{};
|
||||
|
||||
+42
-7
@@ -258,11 +258,47 @@ void ChorusState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesI
|
||||
|
||||
struct ChorusStateFactory final : public EffectStateFactory {
|
||||
EffectState *create() override;
|
||||
ALeffectProps getDefaultProps() const noexcept override;
|
||||
};
|
||||
|
||||
EffectState *ChorusStateFactory::create()
|
||||
{ return new ChorusState{}; }
|
||||
|
||||
ALeffectProps ChorusStateFactory::getDefaultProps() const noexcept
|
||||
{
|
||||
ALeffectProps props{};
|
||||
props.Chorus.Waveform = AL_CHORUS_DEFAULT_WAVEFORM;
|
||||
props.Chorus.Phase = AL_CHORUS_DEFAULT_PHASE;
|
||||
props.Chorus.Rate = AL_CHORUS_DEFAULT_RATE;
|
||||
props.Chorus.Depth = AL_CHORUS_DEFAULT_DEPTH;
|
||||
props.Chorus.Feedback = AL_CHORUS_DEFAULT_FEEDBACK;
|
||||
props.Chorus.Delay = AL_CHORUS_DEFAULT_DELAY;
|
||||
return props;
|
||||
}
|
||||
|
||||
/* Flanger is basically a chorus with a really short delay. They can both use
|
||||
* the same processing functions, so piggyback flanger on the chorus functions.
|
||||
*/
|
||||
struct FlangerStateFactory final : public EffectStateFactory {
|
||||
EffectState *create() override;
|
||||
ALeffectProps getDefaultProps() const noexcept override;
|
||||
};
|
||||
|
||||
EffectState *FlangerStateFactory::create()
|
||||
{ return new ChorusState{}; }
|
||||
|
||||
ALeffectProps FlangerStateFactory::getDefaultProps() const noexcept
|
||||
{
|
||||
ALeffectProps props{};
|
||||
props.Chorus.Waveform = AL_FLANGER_DEFAULT_WAVEFORM;
|
||||
props.Chorus.Phase = AL_FLANGER_DEFAULT_PHASE;
|
||||
props.Chorus.Rate = AL_FLANGER_DEFAULT_RATE;
|
||||
props.Chorus.Depth = AL_FLANGER_DEFAULT_DEPTH;
|
||||
props.Chorus.Feedback = AL_FLANGER_DEFAULT_FEEDBACK;
|
||||
props.Chorus.Delay = AL_FLANGER_DEFAULT_DELAY;
|
||||
return props;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
EffectStateFactory *ChorusStateFactory_getFactory()
|
||||
@@ -271,6 +307,12 @@ EffectStateFactory *ChorusStateFactory_getFactory()
|
||||
return &ChorusFactory;
|
||||
}
|
||||
|
||||
EffectStateFactory *FlangerStateFactory_getFactory()
|
||||
{
|
||||
static FlangerStateFactory FlangerFactory{};
|
||||
return &FlangerFactory;
|
||||
}
|
||||
|
||||
|
||||
void ALchorus_setParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val)
|
||||
{
|
||||
@@ -381,13 +423,6 @@ void ALchorus_getParamfv(const ALeffect *effect, ALCcontext *context, ALenum par
|
||||
DEFINE_ALEFFECT_VTABLE(ALchorus);
|
||||
|
||||
|
||||
/* Flanger is basically a chorus with a really short delay. They can both use
|
||||
* the same processing functions, so piggyback flanger on the chorus functions.
|
||||
*/
|
||||
EffectStateFactory *FlangerStateFactory_getFactory()
|
||||
{ return ChorusStateFactory_getFactory(); }
|
||||
|
||||
|
||||
void ALflanger_setParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val)
|
||||
{
|
||||
ALeffectProps *props = &effect->Props;
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
#include "vecmat.h"
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
#define AMP_ENVELOPE_MIN 0.5f
|
||||
#define AMP_ENVELOPE_MAX 2.0f
|
||||
|
||||
@@ -159,11 +161,21 @@ void ALcompressorState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT sa
|
||||
|
||||
struct CompressorStateFactory final : public EffectStateFactory {
|
||||
EffectState *create() override;
|
||||
ALeffectProps getDefaultProps() const noexcept override;
|
||||
};
|
||||
|
||||
EffectState *CompressorStateFactory::create()
|
||||
{ return new ALcompressorState{}; }
|
||||
|
||||
ALeffectProps CompressorStateFactory::getDefaultProps() const noexcept
|
||||
{
|
||||
ALeffectProps props{};
|
||||
props.Compressor.OnOff = AL_COMPRESSOR_DEFAULT_ONOFF;
|
||||
return props;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
EffectStateFactory *CompressorStateFactory_getFactory()
|
||||
{
|
||||
static CompressorStateFactory CompressorFactory{};
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
#include "alu.h"
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
struct ALdedicatedState final : public EffectState {
|
||||
ALfloat mCurrentGains[MAX_OUTPUT_CHANNELS];
|
||||
ALfloat mTargetGains[MAX_OUTPUT_CHANNELS];
|
||||
@@ -97,11 +99,21 @@ void ALdedicatedState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT sam
|
||||
|
||||
struct DedicatedStateFactory final : public EffectStateFactory {
|
||||
EffectState *create() override;
|
||||
ALeffectProps getDefaultProps() const noexcept override;
|
||||
};
|
||||
|
||||
EffectState *DedicatedStateFactory::create()
|
||||
{ return new ALdedicatedState{}; }
|
||||
|
||||
ALeffectProps DedicatedStateFactory::getDefaultProps() const noexcept
|
||||
{
|
||||
ALeffectProps props{};
|
||||
props.Dedicated.Gain = 1.0f;
|
||||
return props;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
EffectStateFactory *DedicatedStateFactory_getFactory()
|
||||
{
|
||||
static DedicatedStateFactory DedicatedFactory{};
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
#include "filters/biquad.h"
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
struct ALdistortionState final : public EffectState {
|
||||
/* Effect gains for each channel */
|
||||
ALfloat mGain[MAX_OUTPUT_CHANNELS]{};
|
||||
@@ -164,11 +166,25 @@ void ALdistortionState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT sa
|
||||
|
||||
struct DistortionStateFactory final : public EffectStateFactory {
|
||||
EffectState *create() override;
|
||||
ALeffectProps getDefaultProps() const noexcept override;
|
||||
};
|
||||
|
||||
EffectState *DistortionStateFactory::create()
|
||||
{ return new ALdistortionState{}; }
|
||||
|
||||
ALeffectProps DistortionStateFactory::getDefaultProps() const noexcept
|
||||
{
|
||||
ALeffectProps props{};
|
||||
props.Distortion.Edge = AL_DISTORTION_DEFAULT_EDGE;
|
||||
props.Distortion.Gain = AL_DISTORTION_DEFAULT_GAIN;
|
||||
props.Distortion.LowpassCutoff = AL_DISTORTION_DEFAULT_LOWPASS_CUTOFF;
|
||||
props.Distortion.EQCenter = AL_DISTORTION_DEFAULT_EQCENTER;
|
||||
props.Distortion.EQBandwidth = AL_DISTORTION_DEFAULT_EQBANDWIDTH;
|
||||
return props;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
EffectStateFactory *DistortionStateFactory_getFactory()
|
||||
{
|
||||
static DistortionStateFactory DistortionFactory{};
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
#include "vector.h"
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
struct ALechoState final : public EffectState {
|
||||
al::vector<ALfloat,16> mSampleBuffer;
|
||||
|
||||
@@ -175,11 +177,25 @@ void ALechoState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesI
|
||||
|
||||
struct EchoStateFactory final : public EffectStateFactory {
|
||||
EffectState *create() override;
|
||||
ALeffectProps getDefaultProps() const noexcept override;
|
||||
};
|
||||
|
||||
EffectState *EchoStateFactory::create()
|
||||
{ return new ALechoState{}; }
|
||||
|
||||
ALeffectProps EchoStateFactory::getDefaultProps() const noexcept
|
||||
{
|
||||
ALeffectProps props{};
|
||||
props.Echo.Delay = AL_ECHO_DEFAULT_DELAY;
|
||||
props.Echo.LRDelay = AL_ECHO_DEFAULT_LRDELAY;
|
||||
props.Echo.Damping = AL_ECHO_DEFAULT_DAMPING;
|
||||
props.Echo.Feedback = AL_ECHO_DEFAULT_FEEDBACK;
|
||||
props.Echo.Spread = AL_ECHO_DEFAULT_SPREAD;
|
||||
return props;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
EffectStateFactory *EchoStateFactory_getFactory()
|
||||
{
|
||||
static EchoStateFactory EchoFactory{};
|
||||
|
||||
@@ -173,15 +173,33 @@ void ALequalizerState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT sam
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
struct EqualizerStateFactory final : public EffectStateFactory {
|
||||
EffectState *create() override;
|
||||
ALeffectProps getDefaultProps() const noexcept override;
|
||||
};
|
||||
|
||||
EffectState *EqualizerStateFactory::create()
|
||||
{ return new ALequalizerState{}; }
|
||||
|
||||
ALeffectProps EqualizerStateFactory::getDefaultProps() const noexcept
|
||||
{
|
||||
ALeffectProps props{};
|
||||
props.Equalizer.LowCutoff = AL_EQUALIZER_DEFAULT_LOW_CUTOFF;
|
||||
props.Equalizer.LowGain = AL_EQUALIZER_DEFAULT_LOW_GAIN;
|
||||
props.Equalizer.Mid1Center = AL_EQUALIZER_DEFAULT_MID1_CENTER;
|
||||
props.Equalizer.Mid1Gain = AL_EQUALIZER_DEFAULT_MID1_GAIN;
|
||||
props.Equalizer.Mid1Width = AL_EQUALIZER_DEFAULT_MID1_WIDTH;
|
||||
props.Equalizer.Mid2Center = AL_EQUALIZER_DEFAULT_MID2_CENTER;
|
||||
props.Equalizer.Mid2Gain = AL_EQUALIZER_DEFAULT_MID2_GAIN;
|
||||
props.Equalizer.Mid2Width = AL_EQUALIZER_DEFAULT_MID2_WIDTH;
|
||||
props.Equalizer.HighCutoff = AL_EQUALIZER_DEFAULT_HIGH_CUTOFF;
|
||||
props.Equalizer.HighGain = AL_EQUALIZER_DEFAULT_HIGH_GAIN;
|
||||
return props;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
EffectStateFactory *EqualizerStateFactory_getFactory()
|
||||
{
|
||||
static EqualizerStateFactory EqualizerFactory{};
|
||||
|
||||
@@ -202,15 +202,26 @@ void ALfshifterState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT samp
|
||||
maxi(samplesToDo, 512), 0, samplesToDo);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
struct FshifterStateFactory final : public EffectStateFactory {
|
||||
EffectState *create() override;
|
||||
ALeffectProps getDefaultProps() const noexcept override;
|
||||
};
|
||||
|
||||
EffectState *FshifterStateFactory::create()
|
||||
{ return new ALfshifterState{}; }
|
||||
|
||||
ALeffectProps FshifterStateFactory::getDefaultProps() const noexcept
|
||||
{
|
||||
ALeffectProps props{};
|
||||
props.Fshifter.Frequency = AL_FREQUENCY_SHIFTER_DEFAULT_FREQUENCY;
|
||||
props.Fshifter.LeftDirection = AL_FREQUENCY_SHIFTER_DEFAULT_LEFT_DIRECTION;
|
||||
props.Fshifter.RightDirection = AL_FREQUENCY_SHIFTER_DEFAULT_RIGHT_DIRECTION;
|
||||
return props;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
EffectStateFactory *FshifterStateFactory_getFactory()
|
||||
{
|
||||
static FshifterStateFactory FshifterFactory{};
|
||||
|
||||
@@ -35,34 +35,36 @@
|
||||
#include "vecmat.h"
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
#define MAX_UPDATE_SAMPLES 128
|
||||
|
||||
#define WAVEFORM_FRACBITS 24
|
||||
#define WAVEFORM_FRACONE (1<<WAVEFORM_FRACBITS)
|
||||
#define WAVEFORM_FRACMASK (WAVEFORM_FRACONE-1)
|
||||
|
||||
static inline ALfloat Sin(ALsizei index)
|
||||
inline ALfloat Sin(ALsizei index)
|
||||
{
|
||||
return std::sin(static_cast<ALfloat>(index) * (al::MathDefs<float>::Tau() / static_cast<ALfloat>WAVEFORM_FRACONE));
|
||||
}
|
||||
|
||||
static inline ALfloat Saw(ALsizei index)
|
||||
inline ALfloat Saw(ALsizei index)
|
||||
{
|
||||
return static_cast<ALfloat>(index)*(2.0f/WAVEFORM_FRACONE) - 1.0f;
|
||||
}
|
||||
|
||||
static inline ALfloat Square(ALsizei index)
|
||||
inline ALfloat Square(ALsizei index)
|
||||
{
|
||||
return static_cast<ALfloat>(((index>>(WAVEFORM_FRACBITS-2))&2) - 1);
|
||||
}
|
||||
|
||||
static inline ALfloat One(ALsizei UNUSED(index))
|
||||
inline ALfloat One(ALsizei UNUSED(index))
|
||||
{
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
template<ALfloat func(ALsizei)>
|
||||
static void Modulate(ALfloat *RESTRICT dst, ALsizei index, const ALsizei step, ALsizei todo)
|
||||
void Modulate(ALfloat *RESTRICT dst, ALsizei index, const ALsizei step, ALsizei todo)
|
||||
{
|
||||
ALsizei i;
|
||||
for(i = 0;i < todo;i++)
|
||||
@@ -173,11 +175,23 @@ void ALmodulatorState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT sam
|
||||
|
||||
struct ModulatorStateFactory final : public EffectStateFactory {
|
||||
EffectState *create() override;
|
||||
ALeffectProps getDefaultProps() const noexcept override;
|
||||
};
|
||||
|
||||
EffectState *ModulatorStateFactory::create()
|
||||
{ return new ALmodulatorState{}; }
|
||||
|
||||
ALeffectProps ModulatorStateFactory::getDefaultProps() const noexcept
|
||||
{
|
||||
ALeffectProps props{};
|
||||
props.Modulator.Frequency = AL_RING_MODULATOR_DEFAULT_FREQUENCY;
|
||||
props.Modulator.HighPassCutoff = AL_RING_MODULATOR_DEFAULT_HIGHPASS_CUTOFF;
|
||||
props.Modulator.Waveform = AL_RING_MODULATOR_DEFAULT_WAVEFORM;
|
||||
return props;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
EffectStateFactory *ModulatorStateFactory_getFactory()
|
||||
{
|
||||
static ModulatorStateFactory ModulatorFactory{};
|
||||
|
||||
+13
-1
@@ -11,6 +11,8 @@
|
||||
#include "alError.h"
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
struct ALnullState final : public EffectState {
|
||||
ALnullState();
|
||||
~ALnullState() override;
|
||||
@@ -59,12 +61,22 @@ void ALnullState::process(ALsizei /*samplesToDo*/, const ALfloat (*RESTRICT /*sa
|
||||
|
||||
struct NullStateFactory final : public EffectStateFactory {
|
||||
EffectState *create() override;
|
||||
ALeffectProps getDefaultProps() const noexcept override;
|
||||
};
|
||||
|
||||
/* Creates ALeffectState objects of the appropriate type. */
|
||||
/* Creates EffectState objects of the appropriate type. */
|
||||
EffectState *NullStateFactory::create()
|
||||
{ return new ALnullState{}; }
|
||||
|
||||
/* Returns an ALeffectProps initialized with this effect's default properties. */
|
||||
ALeffectProps NullStateFactory::getDefaultProps() const noexcept
|
||||
{
|
||||
ALeffectProps props{};
|
||||
return props;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
EffectStateFactory *NullStateFactory_getFactory()
|
||||
{
|
||||
static NullStateFactory NullFactory{};
|
||||
|
||||
@@ -325,15 +325,25 @@ void ALpshifterState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT samp
|
||||
maxi(samplesToDo, 512), 0, samplesToDo);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
struct PshifterStateFactory final : public EffectStateFactory {
|
||||
EffectState *create() override;
|
||||
ALeffectProps getDefaultProps() const noexcept override;
|
||||
};
|
||||
|
||||
EffectState *PshifterStateFactory::create()
|
||||
{ return new ALpshifterState{}; }
|
||||
|
||||
ALeffectProps PshifterStateFactory::getDefaultProps() const noexcept
|
||||
{
|
||||
ALeffectProps props{};
|
||||
props.Pshifter.CoarseTune = AL_PITCH_SHIFTER_DEFAULT_COARSE_TUNE;
|
||||
props.Pshifter.FineTune = AL_PITCH_SHIFTER_DEFAULT_FINE_TUNE;
|
||||
return props;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
EffectStateFactory *PshifterStateFactory_getFactory()
|
||||
{
|
||||
static PshifterStateFactory PshifterFactory{};
|
||||
|
||||
+80
-1
@@ -1464,11 +1464,87 @@ void ReverbState::process(ALsizei samplesToDo, const ALfloat (*RESTRICT samplesI
|
||||
|
||||
struct ReverbStateFactory final : public EffectStateFactory {
|
||||
EffectState *create() override;
|
||||
ALeffectProps getDefaultProps() const noexcept override;
|
||||
};
|
||||
|
||||
EffectState *ReverbStateFactory::create()
|
||||
{ return new ReverbState{}; }
|
||||
|
||||
ALeffectProps ReverbStateFactory::getDefaultProps() const noexcept
|
||||
{
|
||||
ALeffectProps props{};
|
||||
props.Reverb.Density = AL_EAXREVERB_DEFAULT_DENSITY;
|
||||
props.Reverb.Diffusion = AL_EAXREVERB_DEFAULT_DIFFUSION;
|
||||
props.Reverb.Gain = AL_EAXREVERB_DEFAULT_GAIN;
|
||||
props.Reverb.GainHF = AL_EAXREVERB_DEFAULT_GAINHF;
|
||||
props.Reverb.GainLF = AL_EAXREVERB_DEFAULT_GAINLF;
|
||||
props.Reverb.DecayTime = AL_EAXREVERB_DEFAULT_DECAY_TIME;
|
||||
props.Reverb.DecayHFRatio = AL_EAXREVERB_DEFAULT_DECAY_HFRATIO;
|
||||
props.Reverb.DecayLFRatio = AL_EAXREVERB_DEFAULT_DECAY_LFRATIO;
|
||||
props.Reverb.ReflectionsGain = AL_EAXREVERB_DEFAULT_REFLECTIONS_GAIN;
|
||||
props.Reverb.ReflectionsDelay = AL_EAXREVERB_DEFAULT_REFLECTIONS_DELAY;
|
||||
props.Reverb.ReflectionsPan[0] = AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ;
|
||||
props.Reverb.ReflectionsPan[1] = AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ;
|
||||
props.Reverb.ReflectionsPan[2] = AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ;
|
||||
props.Reverb.LateReverbGain = AL_EAXREVERB_DEFAULT_LATE_REVERB_GAIN;
|
||||
props.Reverb.LateReverbDelay = AL_EAXREVERB_DEFAULT_LATE_REVERB_DELAY;
|
||||
props.Reverb.LateReverbPan[0] = AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ;
|
||||
props.Reverb.LateReverbPan[1] = AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ;
|
||||
props.Reverb.LateReverbPan[2] = AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ;
|
||||
props.Reverb.EchoTime = AL_EAXREVERB_DEFAULT_ECHO_TIME;
|
||||
props.Reverb.EchoDepth = AL_EAXREVERB_DEFAULT_ECHO_DEPTH;
|
||||
props.Reverb.ModulationTime = AL_EAXREVERB_DEFAULT_MODULATION_TIME;
|
||||
props.Reverb.ModulationDepth = AL_EAXREVERB_DEFAULT_MODULATION_DEPTH;
|
||||
props.Reverb.AirAbsorptionGainHF = AL_EAXREVERB_DEFAULT_AIR_ABSORPTION_GAINHF;
|
||||
props.Reverb.HFReference = AL_EAXREVERB_DEFAULT_HFREFERENCE;
|
||||
props.Reverb.LFReference = AL_EAXREVERB_DEFAULT_LFREFERENCE;
|
||||
props.Reverb.RoomRolloffFactor = AL_EAXREVERB_DEFAULT_ROOM_ROLLOFF_FACTOR;
|
||||
props.Reverb.DecayHFLimit = AL_EAXREVERB_DEFAULT_DECAY_HFLIMIT;
|
||||
return props;
|
||||
}
|
||||
|
||||
|
||||
struct StdReverbStateFactory final : public EffectStateFactory {
|
||||
EffectState *create() override;
|
||||
ALeffectProps getDefaultProps() const noexcept override;
|
||||
};
|
||||
|
||||
EffectState *StdReverbStateFactory::create()
|
||||
{ return new ReverbState{}; }
|
||||
|
||||
ALeffectProps StdReverbStateFactory::getDefaultProps() const noexcept
|
||||
{
|
||||
ALeffectProps props{};
|
||||
props.Reverb.Density = AL_REVERB_DEFAULT_DENSITY;
|
||||
props.Reverb.Diffusion = AL_REVERB_DEFAULT_DIFFUSION;
|
||||
props.Reverb.Gain = AL_REVERB_DEFAULT_GAIN;
|
||||
props.Reverb.GainHF = AL_REVERB_DEFAULT_GAINHF;
|
||||
props.Reverb.GainLF = 1.0f;
|
||||
props.Reverb.DecayTime = AL_REVERB_DEFAULT_DECAY_TIME;
|
||||
props.Reverb.DecayHFRatio = AL_REVERB_DEFAULT_DECAY_HFRATIO;
|
||||
props.Reverb.DecayLFRatio = 1.0f;
|
||||
props.Reverb.ReflectionsGain = AL_REVERB_DEFAULT_REFLECTIONS_GAIN;
|
||||
props.Reverb.ReflectionsDelay = AL_REVERB_DEFAULT_REFLECTIONS_DELAY;
|
||||
props.Reverb.ReflectionsPan[0] = 0.0f;
|
||||
props.Reverb.ReflectionsPan[1] = 0.0f;
|
||||
props.Reverb.ReflectionsPan[2] = 0.0f;
|
||||
props.Reverb.LateReverbGain = AL_REVERB_DEFAULT_LATE_REVERB_GAIN;
|
||||
props.Reverb.LateReverbDelay = AL_REVERB_DEFAULT_LATE_REVERB_DELAY;
|
||||
props.Reverb.LateReverbPan[0] = 0.0f;
|
||||
props.Reverb.LateReverbPan[1] = 0.0f;
|
||||
props.Reverb.LateReverbPan[2] = 0.0f;
|
||||
props.Reverb.EchoTime = 0.25f;
|
||||
props.Reverb.EchoDepth = 0.0f;
|
||||
props.Reverb.ModulationTime = 0.25f;
|
||||
props.Reverb.ModulationDepth = 0.0f;
|
||||
props.Reverb.AirAbsorptionGainHF = AL_REVERB_DEFAULT_AIR_ABSORPTION_GAINHF;
|
||||
props.Reverb.HFReference = 5000.0f;
|
||||
props.Reverb.LFReference = 250.0f;
|
||||
props.Reverb.RoomRolloffFactor = AL_REVERB_DEFAULT_ROOM_ROLLOFF_FACTOR;
|
||||
props.Reverb.DecayHFLimit = AL_REVERB_DEFAULT_DECAY_HFLIMIT;
|
||||
return props;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
EffectStateFactory *ReverbStateFactory_getFactory()
|
||||
@@ -1478,7 +1554,10 @@ EffectStateFactory *ReverbStateFactory_getFactory()
|
||||
}
|
||||
|
||||
EffectStateFactory *StdReverbStateFactory_getFactory()
|
||||
{ return ReverbStateFactory_getFactory(); }
|
||||
{
|
||||
static StdReverbStateFactory ReverbFactory{};
|
||||
return &ReverbFactory;
|
||||
}
|
||||
|
||||
|
||||
void ALeaxreverb_setParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val)
|
||||
|
||||
@@ -42,7 +42,7 @@ struct EffectStateFactory {
|
||||
virtual ~EffectStateFactory() { }
|
||||
|
||||
virtual EffectState *create() = 0;
|
||||
virtual ALeffectProps getDefaultProps() const;
|
||||
virtual ALeffectProps getDefaultProps() const noexcept = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ constexpr struct FactoryItem {
|
||||
{ AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT, DedicatedStateFactory_getFactory }
|
||||
};
|
||||
|
||||
inline EffectStateFactory *getFactoryByType(ALenum type)
|
||||
EffectStateFactory *getFactoryByType(ALenum type)
|
||||
{
|
||||
auto iter = std::find_if(std::begin(FactoryList), std::end(FactoryList),
|
||||
[type](const FactoryItem &item) noexcept -> bool
|
||||
@@ -690,10 +690,6 @@ ALenum InitializeEffect(ALCcontext *Context, ALeffectslot *EffectSlot, ALeffect
|
||||
}
|
||||
|
||||
|
||||
ALeffectProps EffectStateFactory::getDefaultProps() const
|
||||
{ return ALeffectProps{}; }
|
||||
|
||||
|
||||
void EffectState::IncRef() noexcept
|
||||
{
|
||||
auto ref = IncrementRef(&mRef);
|
||||
|
||||
@@ -178,7 +178,7 @@ void InitEffectParams(ALeffect *effect, ALenum type)
|
||||
effect->Props.Chorus.Delay = AL_FLANGER_DEFAULT_DELAY;
|
||||
effect->vtab = &ALflanger_vtable;
|
||||
break;
|
||||
case AL_EFFECT_FREQUENCY_SHIFTER:
|
||||
case AL_EFFECT_FREQUENCY_SHIFTER:
|
||||
effect->Props.Fshifter.Frequency = AL_FREQUENCY_SHIFTER_DEFAULT_FREQUENCY;
|
||||
effect->Props.Fshifter.LeftDirection = AL_FREQUENCY_SHIFTER_DEFAULT_LEFT_DIRECTION;
|
||||
effect->Props.Fshifter.RightDirection = AL_FREQUENCY_SHIFTER_DEFAULT_RIGHT_DIRECTION;
|
||||
|
||||
Reference in New Issue
Block a user