Clean up some more unnecessary uses of AL types
parent
8a5153ce0d
commit
d67cba99bd
|
@ -64,12 +64,12 @@ struct ALeffectslot {
|
|||
EffectProps mEffectProps{};
|
||||
EffectState *mEffectState{nullptr};
|
||||
|
||||
ALfloat RoomRolloff{0.0f}; /* Added to the source's room rolloff, not multiplied. */
|
||||
ALfloat DecayTime{0.0f};
|
||||
ALfloat DecayLFRatio{0.0f};
|
||||
ALfloat DecayHFRatio{0.0f};
|
||||
float RoomRolloff{0.0f}; /* Added to the source's room rolloff, not multiplied. */
|
||||
float DecayTime{0.0f};
|
||||
float DecayLFRatio{0.0f};
|
||||
float DecayHFRatio{0.0f};
|
||||
bool DecayHFLimit{false};
|
||||
ALfloat AirAbsorptionGainHF{1.0f};
|
||||
float AirAbsorptionGainHF{1.0f};
|
||||
} Params;
|
||||
|
||||
/* Self ID */
|
||||
|
|
|
@ -101,10 +101,10 @@ constexpr int MSADPCMAdaptionCoeff[7][2] = {
|
|||
};
|
||||
|
||||
|
||||
void DecodeIMA4Block(ALshort *dst, const al::byte *src, size_t numchans, size_t align)
|
||||
void DecodeIMA4Block(int16_t *dst, const al::byte *src, size_t numchans, size_t align)
|
||||
{
|
||||
ALint sample[MaxAdpcmChannels]{};
|
||||
ALint index[MaxAdpcmChannels]{};
|
||||
int sample[MaxAdpcmChannels]{};
|
||||
int index[MaxAdpcmChannels]{};
|
||||
ALuint code[MaxAdpcmChannels]{};
|
||||
|
||||
for(size_t c{0};c < numchans;c++)
|
||||
|
@ -147,11 +147,11 @@ void DecodeIMA4Block(ALshort *dst, const al::byte *src, size_t numchans, size_t
|
|||
}
|
||||
}
|
||||
|
||||
void DecodeMSADPCMBlock(ALshort *dst, const al::byte *src, size_t numchans, size_t align)
|
||||
void DecodeMSADPCMBlock(int16_t *dst, const al::byte *src, size_t numchans, size_t align)
|
||||
{
|
||||
ALubyte blockpred[MaxAdpcmChannels]{};
|
||||
ALint delta[MaxAdpcmChannels]{};
|
||||
ALshort samples[MaxAdpcmChannels][2]{};
|
||||
int delta[MaxAdpcmChannels]{};
|
||||
int16_t samples[MaxAdpcmChannels][2]{};
|
||||
|
||||
for(size_t c{0};c < numchans;c++)
|
||||
{
|
||||
|
@ -195,23 +195,23 @@ void DecodeMSADPCMBlock(ALshort *dst, const al::byte *src, size_t numchans, size
|
|||
else
|
||||
nibble = *(src++) & 0x0f;
|
||||
|
||||
ALint pred{(samples[c][0]*MSADPCMAdaptionCoeff[blockpred[c]][0] +
|
||||
int pred{(samples[c][0]*MSADPCMAdaptionCoeff[blockpred[c]][0] +
|
||||
samples[c][1]*MSADPCMAdaptionCoeff[blockpred[c]][1]) / 256};
|
||||
pred += (al::to_integer<int>(nibble^0x08) - 0x08) * delta[c];
|
||||
pred = clampi(pred, -32768, 32767);
|
||||
|
||||
samples[c][1] = samples[c][0];
|
||||
samples[c][0] = static_cast<ALshort>(pred);
|
||||
samples[c][0] = static_cast<int16_t>(pred);
|
||||
|
||||
delta[c] = (MSADPCMAdaption[al::to_integer<ALubyte>(nibble)] * delta[c]) / 256;
|
||||
delta[c] = maxi(16, delta[c]);
|
||||
|
||||
*(dst++) = static_cast<ALshort>(pred);
|
||||
*(dst++) = static_cast<int16_t>(pred);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Convert_ALshort_ALima4(ALshort *dst, const al::byte *src, size_t numchans, size_t len,
|
||||
void Convert_ALshort_ALima4(int16_t *dst, const al::byte *src, size_t numchans, size_t len,
|
||||
size_t align)
|
||||
{
|
||||
assert(numchans <= MaxAdpcmChannels);
|
||||
|
@ -226,7 +226,7 @@ void Convert_ALshort_ALima4(ALshort *dst, const al::byte *src, size_t numchans,
|
|||
}
|
||||
}
|
||||
|
||||
void Convert_ALshort_ALmsadpcm(ALshort *dst, const al::byte *src, size_t numchans, size_t len,
|
||||
void Convert_ALshort_ALmsadpcm(int16_t *dst, const al::byte *src, size_t numchans, size_t len,
|
||||
size_t align)
|
||||
{
|
||||
assert(numchans <= MaxAdpcmChannels);
|
||||
|
@ -523,7 +523,7 @@ void LoadData(ALCcontext *context, ALbuffer *ALBuf, ALsizei freq, ALuint size,
|
|||
{
|
||||
assert(DstType == FmtShort);
|
||||
if(SrcData != nullptr && !ALBuf->mData.empty())
|
||||
Convert_ALshort_ALima4(reinterpret_cast<ALshort*>(ALBuf->mData.data()),
|
||||
Convert_ALshort_ALima4(reinterpret_cast<int16_t*>(ALBuf->mData.data()),
|
||||
SrcData, NumChannels, frames, align);
|
||||
ALBuf->OriginalAlign = align;
|
||||
}
|
||||
|
@ -531,7 +531,7 @@ void LoadData(ALCcontext *context, ALbuffer *ALBuf, ALsizei freq, ALuint size,
|
|||
{
|
||||
assert(DstType == FmtShort);
|
||||
if(SrcData != nullptr && !ALBuf->mData.empty())
|
||||
Convert_ALshort_ALmsadpcm(reinterpret_cast<ALshort*>(ALBuf->mData.data()),
|
||||
Convert_ALshort_ALmsadpcm(reinterpret_cast<int16_t*>(ALBuf->mData.data()),
|
||||
SrcData, NumChannels, frames, align);
|
||||
ALBuf->OriginalAlign = align;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ enum {
|
|||
};
|
||||
extern bool DisabledEffects[MAX_EFFECTS];
|
||||
|
||||
extern ALfloat ReverbBoost;
|
||||
extern float ReverbBoost;
|
||||
|
||||
struct EffectList {
|
||||
const char name[16];
|
||||
|
|
|
@ -48,11 +48,11 @@ namespace {
|
|||
#define FILTER_MIN_GAIN 0.0f
|
||||
#define FILTER_MAX_GAIN 4.0f /* +12dB */
|
||||
|
||||
void ALlowpass_setParami(ALfilter*, ALCcontext *context, ALenum param, ALint)
|
||||
void ALlowpass_setParami(ALfilter*, ALCcontext *context, ALenum param, int)
|
||||
{ context->setError(AL_INVALID_ENUM, "Invalid low-pass integer property 0x%04x", param); }
|
||||
void ALlowpass_setParamiv(ALfilter*, ALCcontext *context, ALenum param, const ALint*)
|
||||
void ALlowpass_setParamiv(ALfilter*, ALCcontext *context, ALenum param, const int*)
|
||||
{ context->setError(AL_INVALID_ENUM, "Invalid low-pass integer-vector property 0x%04x", param); }
|
||||
void ALlowpass_setParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat val)
|
||||
void ALlowpass_setParamf(ALfilter *filter, ALCcontext *context, ALenum param, float val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
|
@ -72,14 +72,14 @@ void ALlowpass_setParamf(ALfilter *filter, ALCcontext *context, ALenum param, AL
|
|||
context->setError(AL_INVALID_ENUM, "Invalid low-pass float property 0x%04x", param);
|
||||
}
|
||||
}
|
||||
void ALlowpass_setParamfv(ALfilter *filter, ALCcontext *context, ALenum param, const ALfloat *vals)
|
||||
void ALlowpass_setParamfv(ALfilter *filter, ALCcontext *context, ALenum param, const float *vals)
|
||||
{ ALlowpass_setParamf(filter, context, param, vals[0]); }
|
||||
|
||||
void ALlowpass_getParami(const ALfilter*, ALCcontext *context, ALenum param, ALint*)
|
||||
void ALlowpass_getParami(const ALfilter*, ALCcontext *context, ALenum param, int*)
|
||||
{ context->setError(AL_INVALID_ENUM, "Invalid low-pass integer property 0x%04x", param); }
|
||||
void ALlowpass_getParamiv(const ALfilter*, ALCcontext *context, ALenum param, ALint*)
|
||||
void ALlowpass_getParamiv(const ALfilter*, ALCcontext *context, ALenum param, int*)
|
||||
{ context->setError(AL_INVALID_ENUM, "Invalid low-pass integer-vector property 0x%04x", param); }
|
||||
void ALlowpass_getParamf(const ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *val)
|
||||
void ALlowpass_getParamf(const ALfilter *filter, ALCcontext *context, ALenum param, float *val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
|
@ -95,17 +95,17 @@ void ALlowpass_getParamf(const ALfilter *filter, ALCcontext *context, ALenum par
|
|||
context->setError(AL_INVALID_ENUM, "Invalid low-pass float property 0x%04x", param);
|
||||
}
|
||||
}
|
||||
void ALlowpass_getParamfv(const ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *vals)
|
||||
void ALlowpass_getParamfv(const ALfilter *filter, ALCcontext *context, ALenum param, float *vals)
|
||||
{ ALlowpass_getParamf(filter, context, param, vals); }
|
||||
|
||||
DEFINE_ALFILTER_VTABLE(ALlowpass);
|
||||
|
||||
|
||||
void ALhighpass_setParami(ALfilter*, ALCcontext *context, ALenum param, ALint)
|
||||
void ALhighpass_setParami(ALfilter*, ALCcontext *context, ALenum param, int)
|
||||
{ context->setError(AL_INVALID_ENUM, "Invalid high-pass integer property 0x%04x", param); }
|
||||
void ALhighpass_setParamiv(ALfilter*, ALCcontext *context, ALenum param, const ALint*)
|
||||
void ALhighpass_setParamiv(ALfilter*, ALCcontext *context, ALenum param, const int*)
|
||||
{ context->setError(AL_INVALID_ENUM, "Invalid high-pass integer-vector property 0x%04x", param); }
|
||||
void ALhighpass_setParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat val)
|
||||
void ALhighpass_setParamf(ALfilter *filter, ALCcontext *context, ALenum param, float val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
|
@ -125,14 +125,14 @@ void ALhighpass_setParamf(ALfilter *filter, ALCcontext *context, ALenum param, A
|
|||
context->setError(AL_INVALID_ENUM, "Invalid high-pass float property 0x%04x", param);
|
||||
}
|
||||
}
|
||||
void ALhighpass_setParamfv(ALfilter *filter, ALCcontext *context, ALenum param, const ALfloat *vals)
|
||||
void ALhighpass_setParamfv(ALfilter *filter, ALCcontext *context, ALenum param, const float *vals)
|
||||
{ ALhighpass_setParamf(filter, context, param, vals[0]); }
|
||||
|
||||
void ALhighpass_getParami(const ALfilter*, ALCcontext *context, ALenum param, ALint*)
|
||||
void ALhighpass_getParami(const ALfilter*, ALCcontext *context, ALenum param, int*)
|
||||
{ context->setError(AL_INVALID_ENUM, "Invalid high-pass integer property 0x%04x", param); }
|
||||
void ALhighpass_getParamiv(const ALfilter*, ALCcontext *context, ALenum param, ALint*)
|
||||
void ALhighpass_getParamiv(const ALfilter*, ALCcontext *context, ALenum param, int*)
|
||||
{ context->setError(AL_INVALID_ENUM, "Invalid high-pass integer-vector property 0x%04x", param); }
|
||||
void ALhighpass_getParamf(const ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *val)
|
||||
void ALhighpass_getParamf(const ALfilter *filter, ALCcontext *context, ALenum param, float *val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
|
@ -148,17 +148,17 @@ void ALhighpass_getParamf(const ALfilter *filter, ALCcontext *context, ALenum pa
|
|||
context->setError(AL_INVALID_ENUM, "Invalid high-pass float property 0x%04x", param);
|
||||
}
|
||||
}
|
||||
void ALhighpass_getParamfv(const ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *vals)
|
||||
void ALhighpass_getParamfv(const ALfilter *filter, ALCcontext *context, ALenum param, float *vals)
|
||||
{ ALhighpass_getParamf(filter, context, param, vals); }
|
||||
|
||||
DEFINE_ALFILTER_VTABLE(ALhighpass);
|
||||
|
||||
|
||||
void ALbandpass_setParami(ALfilter*, ALCcontext *context, ALenum param, ALint)
|
||||
void ALbandpass_setParami(ALfilter*, ALCcontext *context, ALenum param, int)
|
||||
{ context->setError(AL_INVALID_ENUM, "Invalid band-pass integer property 0x%04x", param); }
|
||||
void ALbandpass_setParamiv(ALfilter*, ALCcontext *context, ALenum param, const ALint*)
|
||||
void ALbandpass_setParamiv(ALfilter*, ALCcontext *context, ALenum param, const int*)
|
||||
{ context->setError(AL_INVALID_ENUM, "Invalid band-pass integer-vector property 0x%04x", param); }
|
||||
void ALbandpass_setParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat val)
|
||||
void ALbandpass_setParamf(ALfilter *filter, ALCcontext *context, ALenum param, float val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
|
@ -184,14 +184,14 @@ void ALbandpass_setParamf(ALfilter *filter, ALCcontext *context, ALenum param, A
|
|||
context->setError(AL_INVALID_ENUM, "Invalid band-pass float property 0x%04x", param);
|
||||
}
|
||||
}
|
||||
void ALbandpass_setParamfv(ALfilter *filter, ALCcontext *context, ALenum param, const ALfloat *vals)
|
||||
void ALbandpass_setParamfv(ALfilter *filter, ALCcontext *context, ALenum param, const float *vals)
|
||||
{ ALbandpass_setParamf(filter, context, param, vals[0]); }
|
||||
|
||||
void ALbandpass_getParami(const ALfilter*, ALCcontext *context, ALenum param, ALint*)
|
||||
void ALbandpass_getParami(const ALfilter*, ALCcontext *context, ALenum param, int*)
|
||||
{ context->setError(AL_INVALID_ENUM, "Invalid band-pass integer property 0x%04x", param); }
|
||||
void ALbandpass_getParamiv(const ALfilter*, ALCcontext *context, ALenum param, ALint*)
|
||||
void ALbandpass_getParamiv(const ALfilter*, ALCcontext *context, ALenum param, int*)
|
||||
{ context->setError(AL_INVALID_ENUM, "Invalid band-pass integer-vector property 0x%04x", param); }
|
||||
void ALbandpass_getParamf(const ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *val)
|
||||
void ALbandpass_getParamf(const ALfilter *filter, ALCcontext *context, ALenum param, float *val)
|
||||
{
|
||||
switch(param)
|
||||
{
|
||||
|
@ -211,28 +211,28 @@ void ALbandpass_getParamf(const ALfilter *filter, ALCcontext *context, ALenum pa
|
|||
context->setError(AL_INVALID_ENUM, "Invalid band-pass float property 0x%04x", param);
|
||||
}
|
||||
}
|
||||
void ALbandpass_getParamfv(const ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *vals)
|
||||
void ALbandpass_getParamfv(const ALfilter *filter, ALCcontext *context, ALenum param, float *vals)
|
||||
{ ALbandpass_getParamf(filter, context, param, vals); }
|
||||
|
||||
DEFINE_ALFILTER_VTABLE(ALbandpass);
|
||||
|
||||
|
||||
void ALnullfilter_setParami(ALfilter*, ALCcontext *context, ALenum param, ALint)
|
||||
void ALnullfilter_setParami(ALfilter*, ALCcontext *context, ALenum param, int)
|
||||
{ context->setError(AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); }
|
||||
void ALnullfilter_setParamiv(ALfilter*, ALCcontext *context, ALenum param, const ALint*)
|
||||
void ALnullfilter_setParamiv(ALfilter*, ALCcontext *context, ALenum param, const int*)
|
||||
{ context->setError(AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); }
|
||||
void ALnullfilter_setParamf(ALfilter*, ALCcontext *context, ALenum param, ALfloat)
|
||||
void ALnullfilter_setParamf(ALfilter*, ALCcontext *context, ALenum param, float)
|
||||
{ context->setError(AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); }
|
||||
void ALnullfilter_setParamfv(ALfilter*, ALCcontext *context, ALenum param, const ALfloat*)
|
||||
void ALnullfilter_setParamfv(ALfilter*, ALCcontext *context, ALenum param, const float*)
|
||||
{ context->setError(AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); }
|
||||
|
||||
void ALnullfilter_getParami(const ALfilter*, ALCcontext *context, ALenum param, ALint*)
|
||||
void ALnullfilter_getParami(const ALfilter*, ALCcontext *context, ALenum param, int*)
|
||||
{ context->setError(AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); }
|
||||
void ALnullfilter_getParamiv(const ALfilter*, ALCcontext *context, ALenum param, ALint*)
|
||||
void ALnullfilter_getParamiv(const ALfilter*, ALCcontext *context, ALenum param, int*)
|
||||
{ context->setError(AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); }
|
||||
void ALnullfilter_getParamf(const ALfilter*, ALCcontext *context, ALenum param, ALfloat*)
|
||||
void ALnullfilter_getParamf(const ALfilter*, ALCcontext *context, ALenum param, float*)
|
||||
{ context->setError(AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); }
|
||||
void ALnullfilter_getParamfv(const ALfilter*, ALCcontext *context, ALenum param, ALfloat*)
|
||||
void ALnullfilter_getParamfv(const ALfilter*, ALCcontext *context, ALenum param, float*)
|
||||
{ context->setError(AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); }
|
||||
|
||||
DEFINE_ALFILTER_VTABLE(ALnullfilter);
|
||||
|
|
|
@ -15,12 +15,12 @@ enum class DistanceModel;
|
|||
|
||||
|
||||
struct ALlistenerProps {
|
||||
std::array<ALfloat,3> Position;
|
||||
std::array<ALfloat,3> Velocity;
|
||||
std::array<ALfloat,3> OrientAt;
|
||||
std::array<ALfloat,3> OrientUp;
|
||||
ALfloat Gain;
|
||||
ALfloat MetersPerUnit;
|
||||
std::array<float,3> Position;
|
||||
std::array<float,3> Velocity;
|
||||
std::array<float,3> OrientAt;
|
||||
std::array<float,3> OrientUp;
|
||||
float Gain;
|
||||
float MetersPerUnit;
|
||||
|
||||
std::atomic<ALlistenerProps*> next;
|
||||
|
||||
|
@ -28,12 +28,12 @@ struct ALlistenerProps {
|
|||
};
|
||||
|
||||
struct ALlistener {
|
||||
std::array<ALfloat,3> Position{{0.0f, 0.0f, 0.0f}};
|
||||
std::array<ALfloat,3> Velocity{{0.0f, 0.0f, 0.0f}};
|
||||
std::array<ALfloat,3> OrientAt{{0.0f, 0.0f, -1.0f}};
|
||||
std::array<ALfloat,3> OrientUp{{0.0f, 1.0f, 0.0f}};
|
||||
ALfloat Gain{1.0f};
|
||||
ALfloat mMetersPerUnit{AL_DEFAULT_METERS_PER_UNIT};
|
||||
std::array<float,3> Position{{0.0f, 0.0f, 0.0f}};
|
||||
std::array<float,3> Velocity{{0.0f, 0.0f, 0.0f}};
|
||||
std::array<float,3> OrientAt{{0.0f, 0.0f, -1.0f}};
|
||||
std::array<float,3> OrientUp{{0.0f, 1.0f, 0.0f}};
|
||||
float Gain{1.0f};
|
||||
float mMetersPerUnit{AL_DEFAULT_METERS_PER_UNIT};
|
||||
|
||||
std::atomic_flag PropsClean;
|
||||
|
||||
|
@ -46,11 +46,11 @@ struct ALlistener {
|
|||
alu::Matrix Matrix;
|
||||
alu::Vector Velocity;
|
||||
|
||||
ALfloat Gain;
|
||||
ALfloat MetersPerUnit;
|
||||
float Gain;
|
||||
float MetersPerUnit;
|
||||
|
||||
ALfloat DopplerFactor;
|
||||
ALfloat SpeedOfSound; /* in units per sec! */
|
||||
float DopplerFactor;
|
||||
float SpeedOfSound; /* in units per sec! */
|
||||
|
||||
bool SourceDistanceModel;
|
||||
DistanceModel mDistanceModel;
|
||||
|
|
29
alc/alc.cpp
29
alc/alc.cpp
|
@ -1247,7 +1247,7 @@ void ProbeCaptureDeviceList()
|
|||
} // namespace
|
||||
|
||||
/* Mixing thread piority level */
|
||||
ALint RTPrioLevel{1};
|
||||
int RTPrioLevel{1};
|
||||
|
||||
FILE *gLogFile{stderr};
|
||||
#ifdef _DEBUG
|
||||
|
@ -2123,24 +2123,23 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
|
|||
|
||||
if(GetConfigValueBool(device->DeviceName.c_str(), nullptr, "dither", 1))
|
||||
{
|
||||
ALint depth{
|
||||
ConfigValueInt(device->DeviceName.c_str(), nullptr, "dither-depth").value_or(0)};
|
||||
int depth{ConfigValueInt(device->DeviceName.c_str(), nullptr, "dither-depth").value_or(0)};
|
||||
if(depth <= 0)
|
||||
{
|
||||
switch(device->FmtType)
|
||||
{
|
||||
case DevFmtByte:
|
||||
case DevFmtUByte:
|
||||
depth = 8;
|
||||
break;
|
||||
case DevFmtShort:
|
||||
case DevFmtUShort:
|
||||
depth = 16;
|
||||
break;
|
||||
case DevFmtInt:
|
||||
case DevFmtUInt:
|
||||
case DevFmtFloat:
|
||||
break;
|
||||
case DevFmtByte:
|
||||
case DevFmtUByte:
|
||||
depth = 8;
|
||||
break;
|
||||
case DevFmtShort:
|
||||
case DevFmtUShort:
|
||||
depth = 16;
|
||||
break;
|
||||
case DevFmtInt:
|
||||
case DevFmtUInt:
|
||||
case DevFmtFloat:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -369,7 +369,7 @@ struct ALCdevice : public al::intrusive_ref<ALCdevice> {
|
|||
#define RECORD_THREAD_NAME "alsoft-record"
|
||||
|
||||
|
||||
extern ALint RTPrioLevel;
|
||||
extern int RTPrioLevel;
|
||||
void SetRTPriority(void);
|
||||
|
||||
void SetDefaultChannelOrder(ALCdevice *device);
|
||||
|
|
|
@ -75,7 +75,8 @@ void aluInitMixer(void);
|
|||
* Set up the appropriate panning method and mixing method given the device
|
||||
* properties.
|
||||
*/
|
||||
void aluInitRenderer(ALCdevice *device, ALint hrtf_id, HrtfRequestMode hrtf_appreq, HrtfRequestMode hrtf_userreq);
|
||||
void aluInitRenderer(ALCdevice *device, int hrtf_id, HrtfRequestMode hrtf_appreq,
|
||||
HrtfRequestMode hrtf_userreq);
|
||||
|
||||
void aluInitEffectPanning(ALeffectslot *slot, ALCdevice *device);
|
||||
|
||||
|
|
|
@ -254,7 +254,7 @@ int JackPlayback::process(jack_nframes_t numframes) noexcept
|
|||
if(numframes > total)
|
||||
{
|
||||
jack_nframes_t todo{numframes - total};
|
||||
auto clear_buf = [todo](ALfloat *outbuf) -> void { std::fill_n(outbuf, todo, 0.0f); };
|
||||
auto clear_buf = [todo](float *outbuf) -> void { std::fill_n(outbuf, todo, 0.0f); };
|
||||
std::for_each(out, out+numchans, clear_buf);
|
||||
}
|
||||
|
||||
|
|
|
@ -1269,7 +1269,7 @@ FORCE_ALIGN int WasapiCapture::recordProc()
|
|||
size_t dstframes;
|
||||
if(mSampleConv)
|
||||
{
|
||||
const ALvoid *srcdata{rdata};
|
||||
const void *srcdata{rdata};
|
||||
ALuint srcframes{numsamples};
|
||||
|
||||
dstframes = mSampleConv->convert(&srcdata, &srcframes, data.first.buf,
|
||||
|
|
|
@ -24,27 +24,27 @@ namespace {
|
|||
* chokes on that given the inline specializations.
|
||||
*/
|
||||
template<DevFmtType T>
|
||||
inline ALfloat LoadSample(typename DevFmtTypeTraits<T>::Type val) noexcept;
|
||||
inline float LoadSample(typename DevFmtTypeTraits<T>::Type val) noexcept;
|
||||
|
||||
template<> inline ALfloat LoadSample<DevFmtByte>(DevFmtTypeTraits<DevFmtByte>::Type val) noexcept
|
||||
template<> inline float LoadSample<DevFmtByte>(DevFmtTypeTraits<DevFmtByte>::Type val) noexcept
|
||||
{ return val * (1.0f/128.0f); }
|
||||
template<> inline ALfloat LoadSample<DevFmtShort>(DevFmtTypeTraits<DevFmtShort>::Type val) noexcept
|
||||
template<> inline float LoadSample<DevFmtShort>(DevFmtTypeTraits<DevFmtShort>::Type val) noexcept
|
||||
{ return val * (1.0f/32768.0f); }
|
||||
template<> inline ALfloat LoadSample<DevFmtInt>(DevFmtTypeTraits<DevFmtInt>::Type val) noexcept
|
||||
template<> inline float LoadSample<DevFmtInt>(DevFmtTypeTraits<DevFmtInt>::Type val) noexcept
|
||||
{ return static_cast<float>(val) * (1.0f/2147483648.0f); }
|
||||
template<> inline ALfloat LoadSample<DevFmtFloat>(DevFmtTypeTraits<DevFmtFloat>::Type val) noexcept
|
||||
template<> inline float LoadSample<DevFmtFloat>(DevFmtTypeTraits<DevFmtFloat>::Type val) noexcept
|
||||
{ return val; }
|
||||
|
||||
template<> inline ALfloat LoadSample<DevFmtUByte>(DevFmtTypeTraits<DevFmtUByte>::Type val) noexcept
|
||||
template<> inline float LoadSample<DevFmtUByte>(DevFmtTypeTraits<DevFmtUByte>::Type val) noexcept
|
||||
{ return LoadSample<DevFmtByte>(static_cast<ALbyte>(val - 128)); }
|
||||
template<> inline ALfloat LoadSample<DevFmtUShort>(DevFmtTypeTraits<DevFmtUShort>::Type val) noexcept
|
||||
template<> inline float LoadSample<DevFmtUShort>(DevFmtTypeTraits<DevFmtUShort>::Type val) noexcept
|
||||
{ return LoadSample<DevFmtShort>(static_cast<ALshort>(val - 32768)); }
|
||||
template<> inline ALfloat LoadSample<DevFmtUInt>(DevFmtTypeTraits<DevFmtUInt>::Type val) noexcept
|
||||
template<> inline float LoadSample<DevFmtUInt>(DevFmtTypeTraits<DevFmtUInt>::Type val) noexcept
|
||||
{ return LoadSample<DevFmtInt>(static_cast<ALint>(val - 2147483648u)); }
|
||||
|
||||
|
||||
template<DevFmtType T>
|
||||
inline void LoadSampleArray(ALfloat *RESTRICT dst, const void *src, const size_t srcstep,
|
||||
inline void LoadSampleArray(float *RESTRICT dst, const void *src, const size_t srcstep,
|
||||
const size_t samples) noexcept
|
||||
{
|
||||
using SampleType = typename DevFmtTypeTraits<T>::Type;
|
||||
|
@ -54,7 +54,7 @@ inline void LoadSampleArray(ALfloat *RESTRICT dst, const void *src, const size_t
|
|||
dst[i] = LoadSample<T>(ssrc[i*srcstep]);
|
||||
}
|
||||
|
||||
void LoadSamples(ALfloat *dst, const ALvoid *src, const size_t srcstep, const DevFmtType srctype,
|
||||
void LoadSamples(float *dst, const void *src, const size_t srcstep, const DevFmtType srctype,
|
||||
const size_t samples) noexcept
|
||||
{
|
||||
#define HANDLE_FMT(T) \
|
||||
|
@ -74,27 +74,27 @@ void LoadSamples(ALfloat *dst, const ALvoid *src, const size_t srcstep, const De
|
|||
|
||||
|
||||
template<DevFmtType T>
|
||||
inline typename DevFmtTypeTraits<T>::Type StoreSample(ALfloat) noexcept;
|
||||
inline typename DevFmtTypeTraits<T>::Type StoreSample(float) noexcept;
|
||||
|
||||
template<> inline ALfloat StoreSample<DevFmtFloat>(ALfloat val) noexcept
|
||||
template<> inline ALfloat StoreSample<DevFmtFloat>(float val) noexcept
|
||||
{ return val; }
|
||||
template<> inline ALint StoreSample<DevFmtInt>(ALfloat val) noexcept
|
||||
template<> inline ALint StoreSample<DevFmtInt>(float val) noexcept
|
||||
{ return fastf2i(clampf(val*2147483648.0f, -2147483648.0f, 2147483520.0f)); }
|
||||
template<> inline ALshort StoreSample<DevFmtShort>(ALfloat val) noexcept
|
||||
template<> inline ALshort StoreSample<DevFmtShort>(float val) noexcept
|
||||
{ return static_cast<ALshort>(fastf2i(clampf(val*32768.0f, -32768.0f, 32767.0f))); }
|
||||
template<> inline ALbyte StoreSample<DevFmtByte>(ALfloat val) noexcept
|
||||
template<> inline ALbyte StoreSample<DevFmtByte>(float val) noexcept
|
||||
{ return static_cast<ALbyte>(fastf2i(clampf(val*128.0f, -128.0f, 127.0f))); }
|
||||
|
||||
/* Define unsigned output variations. */
|
||||
template<> inline ALuint StoreSample<DevFmtUInt>(ALfloat val) noexcept
|
||||
template<> inline ALuint StoreSample<DevFmtUInt>(float val) noexcept
|
||||
{ return static_cast<ALuint>(StoreSample<DevFmtInt>(val)) + 2147483648u; }
|
||||
template<> inline ALushort StoreSample<DevFmtUShort>(ALfloat val) noexcept
|
||||
template<> inline ALushort StoreSample<DevFmtUShort>(float val) noexcept
|
||||
{ return static_cast<ALushort>(StoreSample<DevFmtShort>(val) + 32768); }
|
||||
template<> inline ALubyte StoreSample<DevFmtUByte>(ALfloat val) noexcept
|
||||
template<> inline ALubyte StoreSample<DevFmtUByte>(float val) noexcept
|
||||
{ return static_cast<ALubyte>(StoreSample<DevFmtByte>(val) + 128); }
|
||||
|
||||
template<DevFmtType T>
|
||||
inline void StoreSampleArray(void *dst, const ALfloat *RESTRICT src, const size_t dststep,
|
||||
inline void StoreSampleArray(void *dst, const float *RESTRICT src, const size_t dststep,
|
||||
const size_t samples) noexcept
|
||||
{
|
||||
using SampleType = typename DevFmtTypeTraits<T>::Type;
|
||||
|
@ -105,7 +105,7 @@ inline void StoreSampleArray(void *dst, const ALfloat *RESTRICT src, const size_
|
|||
}
|
||||
|
||||
|
||||
void StoreSamples(ALvoid *dst, const ALfloat *src, const size_t dststep, const DevFmtType dsttype,
|
||||
void StoreSamples(void *dst, const float *src, const size_t dststep, const DevFmtType dsttype,
|
||||
const size_t samples) noexcept
|
||||
{
|
||||
#define HANDLE_FMT(T) \
|
||||
|
@ -125,7 +125,7 @@ void StoreSamples(ALvoid *dst, const ALfloat *src, const size_t dststep, const D
|
|||
|
||||
|
||||
template<DevFmtType T>
|
||||
void Mono2Stereo(ALfloat *RESTRICT dst, const void *src, const size_t frames) noexcept
|
||||
void Mono2Stereo(float *RESTRICT dst, const void *src, const size_t frames) noexcept
|
||||
{
|
||||
using SampleType = typename DevFmtTypeTraits<T>::Type;
|
||||
|
||||
|
@ -135,7 +135,7 @@ void Mono2Stereo(ALfloat *RESTRICT dst, const void *src, const size_t frames) no
|
|||
}
|
||||
|
||||
template<DevFmtType T>
|
||||
void Stereo2Mono(ALfloat *RESTRICT dst, const void *src, const size_t frames) noexcept
|
||||
void Stereo2Mono(float *RESTRICT dst, const void *src, const size_t frames) noexcept
|
||||
{
|
||||
using SampleType = typename DevFmtTypeTraits<T>::Type;
|
||||
|
||||
|
@ -178,7 +178,7 @@ SampleConverterPtr CreateSampleConverter(DevFmtType srcType, DevFmtType dstType,
|
|||
|
||||
ALuint SampleConverter::availableOut(ALuint srcframes) const
|
||||
{
|
||||
ALint prepcount{mSrcPrepCount};
|
||||
int prepcount{mSrcPrepCount};
|
||||
if(prepcount < 0)
|
||||
{
|
||||
/* Negative prepcount means we need to skip that many input samples. */
|
||||
|
@ -211,7 +211,7 @@ ALuint SampleConverter::availableOut(ALuint srcframes) const
|
|||
return static_cast<ALuint>(clampu64((DataSize64 + mIncrement-1)/mIncrement, 1, BUFFERSIZE));
|
||||
}
|
||||
|
||||
ALuint SampleConverter::convert(const ALvoid **src, ALuint *srcframes, ALvoid *dst, ALuint dstframes)
|
||||
ALuint SampleConverter::convert(const void **src, ALuint *srcframes, void *dst, ALuint dstframes)
|
||||
{
|
||||
const ALuint SrcFrameSize{static_cast<ALuint>(mChan.size()) * mSrcTypeSize};
|
||||
const ALuint DstFrameSize{static_cast<ALuint>(mChan.size()) * mDstTypeSize};
|
||||
|
@ -223,13 +223,13 @@ ALuint SampleConverter::convert(const ALvoid **src, ALuint *srcframes, ALvoid *d
|
|||
ALuint pos{0};
|
||||
while(pos < dstframes && NumSrcSamples > 0)
|
||||
{
|
||||
ALint prepcount{mSrcPrepCount};
|
||||
int prepcount{mSrcPrepCount};
|
||||
if(prepcount < 0)
|
||||
{
|
||||
/* Negative prepcount means we need to skip that many input samples. */
|
||||
if(static_cast<ALuint>(-prepcount) >= NumSrcSamples)
|
||||
{
|
||||
mSrcPrepCount = static_cast<ALint>(NumSrcSamples) + prepcount;
|
||||
mSrcPrepCount = static_cast<int>(NumSrcSamples) + prepcount;
|
||||
NumSrcSamples = 0;
|
||||
break;
|
||||
}
|
||||
|
@ -250,13 +250,13 @@ ALuint SampleConverter::convert(const ALvoid **src, ALuint *srcframes, ALvoid *d
|
|||
LoadSamples(&mChan[chan].PrevSamples[prepcount], SamplesIn + mSrcTypeSize*chan,
|
||||
mChan.size(), mSrcType, toread);
|
||||
|
||||
mSrcPrepCount = prepcount + static_cast<ALint>(toread);
|
||||
mSrcPrepCount = prepcount + static_cast<int>(toread);
|
||||
NumSrcSamples = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
ALfloat *RESTRICT SrcData{mSrcSamples};
|
||||
ALfloat *RESTRICT DstData{mDstSamples};
|
||||
float *RESTRICT SrcData{mSrcSamples};
|
||||
float *RESTRICT DstData{mDstSamples};
|
||||
ALuint DataPosFrac{mFracOffset};
|
||||
auto DataSize64 = static_cast<uint64_t>(prepcount);
|
||||
DataSize64 += toread;
|
||||
|
@ -297,7 +297,7 @@ ALuint SampleConverter::convert(const ALvoid **src, ALuint *srcframes, ALvoid *d
|
|||
}
|
||||
|
||||
/* Now resample, and store the result in the output buffer. */
|
||||
const ALfloat *ResampledData{mResample(&mState, SrcData+(MAX_RESAMPLER_PADDING>>1),
|
||||
const float *ResampledData{mResample(&mState, SrcData+(MAX_RESAMPLER_PADDING>>1),
|
||||
DataPosFrac, increment, {DstData, DstSize})};
|
||||
|
||||
StoreSamples(DstSamples, ResampledData, mChan.size(), mDstType, DstSize);
|
||||
|
@ -307,7 +307,7 @@ ALuint SampleConverter::convert(const ALvoid **src, ALuint *srcframes, ALvoid *d
|
|||
* fractional offset.
|
||||
*/
|
||||
DataPosFrac += increment*DstSize;
|
||||
mSrcPrepCount = mini(prepcount + static_cast<ALint>(toread - (DataPosFrac>>FRACTIONBITS)),
|
||||
mSrcPrepCount = mini(prepcount + static_cast<int>(toread - (DataPosFrac>>FRACTIONBITS)),
|
||||
MAX_RESAMPLER_PADDING);
|
||||
mFracOffset = DataPosFrac & FRACTIONMASK;
|
||||
|
||||
|
@ -326,7 +326,7 @@ ALuint SampleConverter::convert(const ALvoid **src, ALuint *srcframes, ALvoid *d
|
|||
}
|
||||
|
||||
|
||||
void ChannelConverter::convert(const ALvoid *src, ALfloat *dst, ALuint frames) const
|
||||
void ChannelConverter::convert(const void *src, float *dst, ALuint frames) const
|
||||
{
|
||||
if(mSrcChans == DevFmtStereo && mDstChans == DevFmtMono)
|
||||
{
|
||||
|
|
|
@ -20,24 +20,24 @@ struct SampleConverter {
|
|||
ALuint mSrcTypeSize{};
|
||||
ALuint mDstTypeSize{};
|
||||
|
||||
ALint mSrcPrepCount{};
|
||||
int mSrcPrepCount{};
|
||||
|
||||
ALuint mFracOffset{};
|
||||
ALuint mIncrement{};
|
||||
InterpState mState{};
|
||||
ResamplerFunc mResample{};
|
||||
|
||||
alignas(16) ALfloat mSrcSamples[BUFFERSIZE]{};
|
||||
alignas(16) ALfloat mDstSamples[BUFFERSIZE]{};
|
||||
alignas(16) float mSrcSamples[BUFFERSIZE]{};
|
||||
alignas(16) float mDstSamples[BUFFERSIZE]{};
|
||||
|
||||
struct ChanSamples {
|
||||
alignas(16) ALfloat PrevSamples[MAX_RESAMPLER_PADDING];
|
||||
alignas(16) float PrevSamples[MAX_RESAMPLER_PADDING];
|
||||
};
|
||||
al::FlexArray<ChanSamples> mChan;
|
||||
|
||||
SampleConverter(size_t numchans) : mChan{numchans} { }
|
||||
|
||||
ALuint convert(const ALvoid **src, ALuint *srcframes, ALvoid *dst, ALuint dstframes);
|
||||
ALuint convert(const void **src, ALuint *srcframes, void *dst, ALuint dstframes);
|
||||
ALuint availableOut(ALuint srcframes) const;
|
||||
|
||||
DEF_FAM_NEWDEL(SampleConverter, mChan)
|
||||
|
@ -55,7 +55,7 @@ struct ChannelConverter {
|
|||
|
||||
bool is_active() const noexcept { return mSrcChans != mDstChans; }
|
||||
|
||||
void convert(const ALvoid *src, ALfloat *dst, ALuint frames) const;
|
||||
void convert(const void *src, float *dst, ALuint frames) const;
|
||||
};
|
||||
|
||||
#endif /* CONVERTER_H */
|
||||
|
|
|
@ -710,11 +710,11 @@ inline float CalcDensityGain(const float a)
|
|||
}
|
||||
|
||||
/* Calculate the scattering matrix coefficients given a diffusion factor. */
|
||||
inline ALvoid CalcMatrixCoeffs(const float diffusion, float *x, float *y)
|
||||
inline void CalcMatrixCoeffs(const float diffusion, float *x, float *y)
|
||||
{
|
||||
/* The matrix is of order 4, so n is sqrt(4 - 1). */
|
||||
float n{std::sqrt(3.0f)};
|
||||
float t{diffusion * std::atan(n)};
|
||||
const float n{std::sqrt(3.0f)};
|
||||
const float t{diffusion * std::atan(n)};
|
||||
|
||||
/* Calculate the first mixing matrix coefficient. */
|
||||
*x = std::cos(t);
|
||||
|
|
16
alc/hrtf.cpp
16
alc/hrtf.cpp
|
@ -100,7 +100,7 @@ constexpr ALchar magicMarker03[8]{'M','i','n','P','H','R','0','3'};
|
|||
|
||||
/* First value for pass-through coefficients (remaining are 0), used for omni-
|
||||
* directional sounds. */
|
||||
constexpr ALfloat PassthruCoeff{0.707106781187f/*sqrt(0.5)*/};
|
||||
constexpr float PassthruCoeff{0.707106781187f/*sqrt(0.5)*/};
|
||||
|
||||
std::mutex LoadedHrtfLock;
|
||||
al::vector<LoadedHrtf> LoadedHrtfs;
|
||||
|
@ -559,7 +559,7 @@ ALushort GetLE_ALushort(std::istream &data)
|
|||
return static_cast<ALushort>(ret);
|
||||
}
|
||||
|
||||
ALint GetLE_ALint24(std::istream &data)
|
||||
int GetLE_ALint24(std::istream &data)
|
||||
{
|
||||
int ret = data.get();
|
||||
ret |= data.get() << 8;
|
||||
|
@ -569,11 +569,11 @@ ALint GetLE_ALint24(std::istream &data)
|
|||
|
||||
ALuint GetLE_ALuint(std::istream &data)
|
||||
{
|
||||
int ret = data.get();
|
||||
ret |= data.get() << 8;
|
||||
ret |= data.get() << 16;
|
||||
ret |= data.get() << 24;
|
||||
return static_cast<ALuint>(ret);
|
||||
ALuint ret{static_cast<ALuint>(data.get())};
|
||||
ret |= static_cast<ALuint>(data.get()) << 8;
|
||||
ret |= static_cast<ALuint>(data.get()) << 16;
|
||||
ret |= static_cast<ALuint>(data.get()) << 24;
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::unique_ptr<HrtfStore> LoadHrtf00(std::istream &data, const char *filename)
|
||||
|
@ -1381,7 +1381,7 @@ HrtfStorePtr GetLoadedHrtf(const std::string &name, const char *devname, const A
|
|||
}
|
||||
|
||||
std::unique_ptr<std::istream> stream;
|
||||
ALint residx{};
|
||||
int residx{};
|
||||
char ch{};
|
||||
if(sscanf(fname.c_str(), "!%d%c", &residx, &ch) == 2 && ch == '_')
|
||||
{
|
||||
|
|
|
@ -42,7 +42,7 @@ using namespace std::placeholders;
|
|||
*
|
||||
* http://www.richardhartersworld.com/cri/2001/slidingmin.html
|
||||
*/
|
||||
ALfloat UpdateSlidingHold(SlidingHold *Hold, const ALuint i, const float in)
|
||||
float UpdateSlidingHold(SlidingHold *Hold, const ALuint i, const float in)
|
||||
{
|
||||
static constexpr ALuint mask{BUFFERSIZE - 1};
|
||||
const ALuint length{Hold->mLength};
|
||||
|
@ -170,7 +170,7 @@ void PeakHoldDetector(Compressor *Comp, const ALuint SamplesToDo)
|
|||
|
||||
SlidingHold *hold{Comp->mHold};
|
||||
ALuint i{0};
|
||||
auto detect_peak = [&i,hold](const ALfloat x_abs) -> ALfloat
|
||||
auto detect_peak = [&i,hold](const float x_abs) -> float
|
||||
{
|
||||
const float x_G{std::log(maxf(0.000001f, x_abs))};
|
||||
return UpdateSlidingHold(hold, i++, x_G);
|
||||
|
@ -293,8 +293,8 @@ void SignalDelay(Compressor *Comp, const ALuint SamplesToDo, FloatBufferLine *Ou
|
|||
|
||||
for(size_t c{0};c < numChans;c++)
|
||||
{
|
||||
ALfloat *inout{al::assume_aligned<16>(OutBuffer[c].data())};
|
||||
ALfloat *delaybuf{al::assume_aligned<16>(Comp->mDelay[c].data())};
|
||||
float *inout{al::assume_aligned<16>(OutBuffer[c].data())};
|
||||
float *delaybuf{al::assume_aligned<16>(Comp->mDelay[c].data())};
|
||||
|
||||
auto inout_end = inout + SamplesToDo;
|
||||
if LIKELY(SamplesToDo >= lookAhead)
|
||||
|
@ -428,11 +428,11 @@ void Compressor::process(const ALuint SamplesToDo, FloatBufferLine *OutBuffer)
|
|||
if(mDelay)
|
||||
SignalDelay(this, SamplesToDo, OutBuffer);
|
||||
|
||||
const ALfloat (&sideChain)[BUFFERSIZE*2] = mSideChain;
|
||||
const float (&sideChain)[BUFFERSIZE*2] = mSideChain;
|
||||
auto apply_comp = [SamplesToDo,&sideChain](FloatBufferLine &input) noexcept -> void
|
||||
{
|
||||
ALfloat *buffer{al::assume_aligned<16>(input.data())};
|
||||
const ALfloat *gains{al::assume_aligned<16>(&sideChain[0])};
|
||||
float *buffer{al::assume_aligned<16>(input.data())};
|
||||
const float *gains{al::assume_aligned<16>(&sideChain[0])};
|
||||
std::transform(gains, gains+SamplesToDo, buffer, buffer,
|
||||
std::bind(std::multiplies<float>{}, _1, _2));
|
||||
};
|
||||
|
|
|
@ -682,7 +682,8 @@ void InitUhjPanning(ALCdevice *device)
|
|||
|
||||
} // namespace
|
||||
|
||||
void aluInitRenderer(ALCdevice *device, ALint hrtf_id, HrtfRequestMode hrtf_appreq, HrtfRequestMode hrtf_userreq)
|
||||
void aluInitRenderer(ALCdevice *device, int hrtf_id, HrtfRequestMode hrtf_appreq,
|
||||
HrtfRequestMode hrtf_userreq)
|
||||
{
|
||||
/* Hold the HRTF the device last used, in case it's used again. */
|
||||
HrtfStorePtr old_hrtf{std::move(device->mHrtf)};
|
||||
|
|
|
@ -19,21 +19,21 @@ namespace {
|
|||
#define MAX_UPDATE_SAMPLES 128
|
||||
|
||||
|
||||
constexpr ALfloat Filter1CoeffSqr[4] = {
|
||||
constexpr float Filter1CoeffSqr[4] = {
|
||||
0.479400865589f, 0.876218493539f, 0.976597589508f, 0.997499255936f
|
||||
};
|
||||
constexpr ALfloat Filter2CoeffSqr[4] = {
|
||||
constexpr float Filter2CoeffSqr[4] = {
|
||||
0.161758498368f, 0.733028932341f, 0.945349700329f, 0.990599156685f
|
||||
};
|
||||
|
||||
void allpass_process(AllPassState *state, ALfloat *dst, const ALfloat *src, const ALfloat aa,
|
||||
void allpass_process(AllPassState *state, float *dst, const float *src, const float aa,
|
||||
const size_t todo)
|
||||
{
|
||||
ALfloat z1{state->z[0]};
|
||||
ALfloat z2{state->z[1]};
|
||||
auto proc_sample = [aa,&z1,&z2](const ALfloat input) noexcept -> ALfloat
|
||||
float z1{state->z[0]};
|
||||
float z2{state->z[1]};
|
||||
auto proc_sample = [aa,&z1,&z2](const float input) noexcept -> float
|
||||
{
|
||||
const ALfloat output{input*aa + z1};
|
||||
const float output{input*aa + z1};
|
||||
z1 = z2; z2 = output*aa - input;
|
||||
return output;
|
||||
};
|
||||
|
@ -68,8 +68,8 @@ void allpass_process(AllPassState *state, ALfloat *dst, const ALfloat *src, cons
|
|||
void Uhj2Encoder::encode(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
|
||||
FloatBufferLine *InSamples, const size_t SamplesToDo)
|
||||
{
|
||||
alignas(16) ALfloat D[MAX_UPDATE_SAMPLES], S[MAX_UPDATE_SAMPLES];
|
||||
alignas(16) ALfloat temp[MAX_UPDATE_SAMPLES];
|
||||
alignas(16) float D[MAX_UPDATE_SAMPLES], S[MAX_UPDATE_SAMPLES];
|
||||
alignas(16) float temp[MAX_UPDATE_SAMPLES];
|
||||
|
||||
ASSUME(SamplesToDo > 0);
|
||||
|
||||
|
@ -122,11 +122,11 @@ void Uhj2Encoder::encode(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
|
|||
mLastWX = temp[todo-1];
|
||||
|
||||
/* Left = (S + D)/2.0 */
|
||||
ALfloat *RESTRICT left = al::assume_aligned<16>(LeftOut.data()+base);
|
||||
float *RESTRICT left{al::assume_aligned<16>(LeftOut.data()+base)};
|
||||
for(size_t i{0};i < todo;i++)
|
||||
left[i] += (S[i] + D[i]) * 0.5f;
|
||||
/* Right = (S - D)/2.0 */
|
||||
ALfloat *RESTRICT right = al::assume_aligned<16>(RightOut.data()+base);
|
||||
float *RESTRICT right{al::assume_aligned<16>(RightOut.data()+base)};
|
||||
for(size_t i{0};i < todo;i++)
|
||||
right[i] += (S[i] - D[i]) * 0.5f;
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
|
||||
struct AllPassState {
|
||||
ALfloat z[2]{0.0f, 0.0f};
|
||||
float z[2]{0.0f, 0.0f};
|
||||
};
|
||||
|
||||
/* Encoding 2-channel UHJ from B-Format is done as:
|
||||
|
@ -40,7 +40,7 @@ struct Uhj2Encoder {
|
|||
AllPassState mFilter1_Y[4];
|
||||
AllPassState mFilter2_WX[4];
|
||||
AllPassState mFilter1_WX[4];
|
||||
ALfloat mLastY{0.0f}, mLastWX{0.0f};
|
||||
float mLastY{0.0f}, mLastWX{0.0f};
|
||||
|
||||
/* Encodes a 2-channel UHJ (stereo-compatible) signal from a B-Format input
|
||||
* signal. The input must use FuMa channel ordering and scaling.
|
||||
|
|
Loading…
Reference in New Issue