aboutsummaryrefslogtreecommitdiffstats
path: root/alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2020-04-08 06:17:04 -0700
committerChris Robinson <[email protected]>2020-04-08 06:17:04 -0700
commit55539787fb5ed6082da22dcc3b3174f79ddbf195 (patch)
tree917a8a02f7e43bbd4d63a5413241a08390856eb3 /alc
parent024112a53afeca55216f3cb7b49579419494cea6 (diff)
Avoid ALfloat in some places
Diffstat (limited to 'alc')
-rw-r--r--alc/alc.cpp26
-rw-r--r--alc/alu.cpp100
-rw-r--r--alc/panning.cpp18
-rw-r--r--alc/voice.cpp36
4 files changed, 90 insertions, 90 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp
index 31d06993..f5119c15 100644
--- a/alc/alc.cpp
+++ b/alc/alc.cpp
@@ -1311,13 +1311,13 @@ ALuint BytesFromDevFmt(DevFmtType type) noexcept
{
switch(type)
{
- case DevFmtByte: return sizeof(ALbyte);
- case DevFmtUByte: return sizeof(ALubyte);
- case DevFmtShort: return sizeof(ALshort);
- case DevFmtUShort: return sizeof(ALushort);
- case DevFmtInt: return sizeof(ALint);
- case DevFmtUInt: return sizeof(ALuint);
- case DevFmtFloat: return sizeof(ALfloat);
+ case DevFmtByte: return sizeof(ALCbyte);
+ case DevFmtUByte: return sizeof(ALCubyte);
+ case DevFmtShort: return sizeof(ALCshort);
+ case DevFmtUShort: return sizeof(ALCushort);
+ case DevFmtInt: return sizeof(ALCint);
+ case DevFmtUInt: return sizeof(ALCuint);
+ case DevFmtFloat: return sizeof(ALCfloat);
}
return 0;
}
@@ -2099,7 +2099,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
/* Initialize band-splitting filters for the front-left and front-
* right channels, with a crossover at 5khz (could be higher).
*/
- const ALfloat scale{5000.0f / static_cast<ALfloat>(device->Frequency)};
+ const float scale{5000.0f / static_cast<float>(device->Frequency)};
stablizer->LFilter.init(scale);
stablizer->RFilter = stablizer->LFilter;
@@ -2147,7 +2147,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
if(depth > 0)
{
depth = clampi(depth, 2, 24);
- device->DitherDepth = std::pow(2.0f, static_cast<ALfloat>(depth-1));
+ device->DitherDepth = std::pow(2.0f, static_cast<float>(depth-1));
}
}
if(!(device->DitherDepth > 0.0f))
@@ -2186,7 +2186,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
TRACE("Output limiter disabled\n");
else
{
- ALfloat thrshld = 1.0f;
+ float thrshld{1.0f};
switch(device->FmtType)
{
case DevFmtByte:
@@ -2366,7 +2366,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
if(device->AvgSpeakerDist > 0.0f)
{
/* Reinitialize the NFC filters for new parameters. */
- const ALfloat w1{SPEEDOFSOUNDMETRESPERSEC /
+ const float w1{SPEEDOFSOUNDMETRESPERSEC /
(device->AvgSpeakerDist * static_cast<float>(device->Frequency))};
for(auto &chandata : voice->mChans)
chandata.mDryParams.NFCtrlFilter.init(w1);
@@ -3469,12 +3469,12 @@ START_API_FUNC
if(auto volopt = ConfigValueFloat(dev->DeviceName.c_str(), nullptr, "volume-adjust"))
{
- const ALfloat valf{*volopt};
+ const float valf{*volopt};
if(!std::isfinite(valf))
ERR("volume-adjust must be finite: %f\n", valf);
else
{
- const ALfloat db{clampf(valf, -24.0f, 24.0f)};
+ const float db{clampf(valf, -24.0f, 24.0f)};
if(db != valf)
WARN("volume-adjust clamped: %f, range: +/-%f\n", valf, 24.0f);
context->mGainBoost = std::pow(10.0f, db/20.0f);
diff --git a/alc/alu.cpp b/alc/alu.cpp
index 9df3a605..af9c4ad0 100644
--- a/alc/alu.cpp
+++ b/alc/alu.cpp
@@ -357,7 +357,7 @@ inline alu::Vector aluCrossproduct(const alu::Vector &in1, const alu::Vector &in
};
}
-inline ALfloat aluDotproduct(const alu::Vector &vec1, const alu::Vector &vec2)
+inline float aluDotproduct(const alu::Vector &vec1, const alu::Vector &vec2)
{
return vec1[0]*vec2[0] + vec1[1]*vec2[1] + vec1[2]*vec2[2];
}
@@ -511,7 +511,7 @@ bool CalcEffectSlotParams(ALeffectslot *slot, ALeffectslot **sorted_slots, ALCco
*/
inline float ScaleAzimuthFront(float azimuth, float scale)
{
- const ALfloat abs_azi{std::fabs(azimuth)};
+ const float abs_azi{std::fabs(azimuth)};
if(!(abs_azi >= al::MathDefs<float>::Pi()*0.5f))
return std::copysign(minf(abs_azi*scale, al::MathDefs<float>::Pi()*0.5f), azimuth);
return azimuth;
@@ -685,8 +685,8 @@ void AmbiRotator(std::array<std::array<float,MAX_AMBI_CHANNELS>,MAX_AMBI_CHANNEL
struct GainTriplet { float Base, HF, LF; };
-void CalcPanningAndFilters(Voice *voice, const ALfloat xpos, const ALfloat ypos,
- const ALfloat zpos, const ALfloat Distance, const ALfloat Spread, const GainTriplet &DryGain,
+void CalcPanningAndFilters(Voice *voice, const float xpos, const float ypos, const float zpos,
+ const float Distance, const float Spread, const GainTriplet &DryGain,
const al::span<const GainTriplet,MAX_SENDS> WetGain, ALeffectslot *(&SendSlots)[MAX_SENDS],
const VoiceProps *props, const ALlistener &Listener, const ALCdevice *Device)
{
@@ -731,7 +731,7 @@ void CalcPanningAndFilters(Voice *voice, const ALfloat xpos, const ALfloat ypos,
{ FrontRight, Deg2Rad( 30.0f), Deg2Rad(0.0f) }
};
- const auto Frequency = static_cast<ALfloat>(Device->Frequency);
+ const auto Frequency = static_cast<float>(Device->Frequency);
const ALuint NumSends{Device->NumAuxSends};
const size_t num_channels{voice->mChans.size()};
@@ -747,7 +747,7 @@ void CalcPanningAndFilters(Voice *voice, const ALfloat xpos, const ALfloat ypos,
DirectMode DirectChannels{props->DirectChannels};
const ChanMap *chans{nullptr};
- ALfloat downmix_gain{1.0f};
+ float downmix_gain{1.0f};
switch(voice->mFmtChannels)
{
case FmtMono:
@@ -821,8 +821,8 @@ void CalcPanningAndFilters(Voice *voice, const ALfloat xpos, const ALfloat ypos,
/* Clamp the distance for really close sources, to prevent
* excessive bass.
*/
- const ALfloat mdist{maxf(Distance, Device->AvgSpeakerDist/4.0f)};
- const ALfloat w0{SPEEDOFSOUNDMETRESPERSEC / (mdist * Frequency)};
+ const float mdist{maxf(Distance, Device->AvgSpeakerDist/4.0f)};
+ const float w0{SPEEDOFSOUNDMETRESPERSEC / (mdist * Frequency)};
/* Only need to adjust the first channel of a B-Format source. */
voice->mChans[0].mDryParams.NFCtrlFilter.adjust(w0);
@@ -830,7 +830,7 @@ void CalcPanningAndFilters(Voice *voice, const ALfloat xpos, const ALfloat ypos,
voice->mFlags |= VOICE_HAS_NFC;
}
- ALfloat coeffs[MAX_AMBI_CHANNELS];
+ float coeffs[MAX_AMBI_CHANNELS];
if(Device->mRenderMode != StereoPair)
CalcDirectionCoeffs({xpos, ypos, zpos}, Spread, coeffs);
else
@@ -838,9 +838,9 @@ void CalcPanningAndFilters(Voice *voice, const ALfloat xpos, const ALfloat ypos,
/* Clamp Y, in case rounding errors caused it to end up outside
* of -1...+1.
*/
- const ALfloat ev{std::asin(clampf(ypos, -1.0f, 1.0f))};
+ const float ev{std::asin(clampf(ypos, -1.0f, 1.0f))};
/* Negate Z for right-handed coords with -Z in front. */
- const ALfloat az{std::atan2(xpos, -zpos)};
+ const float az{std::atan2(xpos, -zpos)};
/* A scalar of 1.5 for plain stereo results in +/-60 degrees
* being moved to +/-90 degrees for direct right and left
@@ -970,7 +970,7 @@ void CalcPanningAndFilters(Voice *voice, const ALfloat xpos, const ALfloat ypos,
*/
for(size_t c{0};c < num_channels;c++)
{
- ALfloat coeffs[MAX_AMBI_CHANNELS];
+ float coeffs[MAX_AMBI_CHANNELS];
CalcAngleCoeffs(chans[c].angle, chans[c].elevation, 0.0f, coeffs);
for(ALuint i{0};i < NumSends;i++)
@@ -990,8 +990,8 @@ void CalcPanningAndFilters(Voice *voice, const ALfloat xpos, const ALfloat ypos,
if(Distance > std::numeric_limits<float>::epsilon())
{
- const ALfloat ev{std::asin(clampf(ypos, -1.0f, 1.0f))};
- const ALfloat az{std::atan2(xpos, -zpos)};
+ const float ev{std::asin(clampf(ypos, -1.0f, 1.0f))};
+ const float az{std::atan2(xpos, -zpos)};
/* Get the HRIR coefficients and delays just once, for the given
* source direction.
@@ -1012,7 +1012,7 @@ void CalcPanningAndFilters(Voice *voice, const ALfloat xpos, const ALfloat ypos,
/* Calculate the directional coefficients once, which apply to all
* input channels of the source sends.
*/
- ALfloat coeffs[MAX_AMBI_CHANNELS];
+ float coeffs[MAX_AMBI_CHANNELS];
CalcDirectionCoeffs({xpos, ypos, zpos}, Spread, coeffs);
for(size_t c{0};c < num_channels;c++)
@@ -1050,7 +1050,7 @@ void CalcPanningAndFilters(Voice *voice, const ALfloat xpos, const ALfloat ypos,
voice->mChans[c].mDryParams.Hrtf.Target.Gain = DryGain.Base;
/* Normal panning for auxiliary sends. */
- ALfloat coeffs[MAX_AMBI_CHANNELS];
+ float coeffs[MAX_AMBI_CHANNELS];
CalcAngleCoeffs(chans[c].angle, chans[c].elevation, Spread, coeffs);
for(ALuint i{0};i < NumSends;i++)
@@ -1076,8 +1076,8 @@ void CalcPanningAndFilters(Voice *voice, const ALfloat xpos, const ALfloat ypos,
/* Clamp the distance for really close sources, to prevent
* excessive bass.
*/
- const ALfloat mdist{maxf(Distance, Device->AvgSpeakerDist/4.0f)};
- const ALfloat w0{SPEEDOFSOUNDMETRESPERSEC / (mdist * Frequency)};
+ const float mdist{maxf(Distance, Device->AvgSpeakerDist/4.0f)};
+ const float w0{SPEEDOFSOUNDMETRESPERSEC / (mdist * Frequency)};
/* Adjust NFC filters. */
for(size_t c{0};c < num_channels;c++)
@@ -1089,13 +1089,13 @@ void CalcPanningAndFilters(Voice *voice, const ALfloat xpos, const ALfloat ypos,
/* Calculate the directional coefficients once, which apply to all
* input channels.
*/
- ALfloat coeffs[MAX_AMBI_CHANNELS];
+ float coeffs[MAX_AMBI_CHANNELS];
if(Device->mRenderMode != StereoPair)
CalcDirectionCoeffs({xpos, ypos, zpos}, Spread, coeffs);
else
{
- const ALfloat ev{std::asin(clampf(ypos, -1.0f, 1.0f))};
- const ALfloat az{std::atan2(xpos, -zpos)};
+ const float ev{std::asin(clampf(ypos, -1.0f, 1.0f))};
+ const float az{std::atan2(xpos, -zpos)};
CalcAngleCoeffs(ScaleAzimuthFront(az, 1.5f), ev, Spread, coeffs);
}
@@ -1151,7 +1151,7 @@ void CalcPanningAndFilters(Voice *voice, const ALfloat xpos, const ALfloat ypos,
continue;
}
- ALfloat coeffs[MAX_AMBI_CHANNELS];
+ float coeffs[MAX_AMBI_CHANNELS];
CalcAngleCoeffs(
(Device->mRenderMode==StereoPair) ? ScaleAzimuthFront(chans[c].angle, 3.0f)
: chans[c].angle,
@@ -1230,8 +1230,8 @@ void CalcNonAttnSourceParams(Voice *voice, const VoiceProps *props, const ALCcon
}
/* Calculate the stepping value */
- const auto Pitch = static_cast<ALfloat>(voice->mFrequency) /
- static_cast<ALfloat>(Device->Frequency) * props->Pitch;
+ const auto Pitch = static_cast<float>(voice->mFrequency) /
+ static_cast<float>(Device->Frequency) * props->Pitch;
if(Pitch > float{MAX_PITCH})
voice->mStep = MAX_PITCH<<FRACTIONBITS;
else
@@ -1267,7 +1267,7 @@ void CalcAttnSourceParams(Voice *voice, const VoiceProps *props, const ALCcontex
/* Set mixing buffers and get send parameters. */
voice->mDirect.Buffer = Device->Dry.Buffer;
ALeffectslot *SendSlots[MAX_SENDS];
- ALfloat RoomRolloff[MAX_SENDS];
+ float RoomRolloff[MAX_SENDS];
GainTriplet DecayDistance[MAX_SENDS];
for(ALuint i{0};i < NumSends;i++)
{
@@ -1342,7 +1342,7 @@ void CalcAttnSourceParams(Voice *voice, const VoiceProps *props, const ALCcontex
const bool directional{Direction.normalize() > 0.0f};
alu::Vector ToSource{Position[0], Position[1], Position[2], 0.0f};
- const ALfloat Distance{ToSource.normalize()};
+ const float Distance{ToSource.normalize()};
/* Initial source gain */
GainTriplet DryGain{props->Gain, 1.0f, 1.0f};
@@ -1507,17 +1507,17 @@ void CalcAttnSourceParams(Voice *voice, const VoiceProps *props, const ALCcontex
/* Initial source pitch */
- ALfloat Pitch{props->Pitch};
+ float Pitch{props->Pitch};
/* Calculate velocity-based doppler effect */
- ALfloat DopplerFactor{props->DopplerFactor * Listener.Params.DopplerFactor};
+ float DopplerFactor{props->DopplerFactor * Listener.Params.DopplerFactor};
if(DopplerFactor > 0.0f)
{
const alu::Vector &lvelocity = Listener.Params.Velocity;
- ALfloat vss{aluDotproduct(Velocity, ToSource) * -DopplerFactor};
- ALfloat vls{aluDotproduct(lvelocity, ToSource) * -DopplerFactor};
+ float vss{aluDotproduct(Velocity, ToSource) * -DopplerFactor};
+ float vls{aluDotproduct(lvelocity, ToSource) * -DopplerFactor};
- const ALfloat SpeedOfSound{Listener.Params.SpeedOfSound};
+ const float SpeedOfSound{Listener.Params.SpeedOfSound};
if(!(vls < SpeedOfSound))
{
/* Listener moving away from the source at the speed of sound.
@@ -1544,14 +1544,14 @@ void CalcAttnSourceParams(Voice *voice, const VoiceProps *props, const ALCcontex
/* Adjust pitch based on the buffer and output frequencies, and calculate
* fixed-point stepping value.
*/
- Pitch *= static_cast<ALfloat>(voice->mFrequency)/static_cast<ALfloat>(Device->Frequency);
+ Pitch *= static_cast<float>(voice->mFrequency) / static_cast<float>(Device->Frequency);
if(Pitch > float{MAX_PITCH})
voice->mStep = MAX_PITCH<<FRACTIONBITS;
else
voice->mStep = maxu(fastf2u(Pitch * FRACTIONONE), 1);
voice->mResampler = PrepareResampler(props->mResampler, voice->mStep, &voice->mResampleState);
- ALfloat spread{0.0f};
+ float spread{0.0f};
if(props->Radius > Distance)
spread = al::MathDefs<float>::Tau() - Distance/props->Radius*al::MathDefs<float>::Pi();
else if(Distance > 0.0f)
@@ -1831,8 +1831,8 @@ void ApplyStablizer(FrontStablizer *Stablizer, const al::span<FloatBufferLine> B
}
}
- ALfloat (&lsplit)[2][BUFFERSIZE] = Stablizer->LSplit;
- ALfloat (&rsplit)[2][BUFFERSIZE] = Stablizer->RSplit;
+ float (&lsplit)[2][BUFFERSIZE] = Stablizer->LSplit;
+ float (&rsplit)[2][BUFFERSIZE] = Stablizer->RSplit;
const al::span<float> tmpbuf{Stablizer->TempBuf, SamplesToDo+FrontStablizer::DelayLength};
/* This applies the band-splitter, preserving phase at the cost of some
@@ -1840,7 +1840,7 @@ void ApplyStablizer(FrontStablizer *Stablizer, const al::span<FloatBufferLine> B
*/
auto apply_splitter = [tmpbuf,SamplesToDo](const FloatBufferLine &InBuf,
const al::span<float,FrontStablizer::DelayLength> DelayBuf, BandSplitter &Filter,
- ALfloat (&splitbuf)[2][BUFFERSIZE]) -> void
+ float (&splitbuf)[2][BUFFERSIZE]) -> void
{
/* Combine the input and delayed samples into a temp buffer in reverse,
* then copy the final samples into the delay buffer for next time.
@@ -1868,9 +1868,9 @@ void ApplyStablizer(FrontStablizer *Stablizer, const al::span<FloatBufferLine> B
for(ALuint i{0};i < SamplesToDo;i++)
{
- ALfloat lfsum{lsplit[0][i] + rsplit[0][i]};
- ALfloat hfsum{lsplit[1][i] + rsplit[1][i]};
- ALfloat s{lsplit[0][i] + lsplit[1][i] - rsplit[0][i] - rsplit[1][i]};
+ float lfsum{lsplit[0][i] + rsplit[0][i]};
+ float hfsum{lsplit[1][i] + rsplit[1][i]};
+ float s{lsplit[0][i] + lsplit[1][i] - rsplit[0][i] - rsplit[1][i]};
/* This pans the separate low- and high-frequency sums between being on
* the center channel and the left/right channels. The low-frequency
@@ -1878,9 +1878,9 @@ void ApplyStablizer(FrontStablizer *Stablizer, const al::span<FloatBufferLine> B
* frequency sum is 1/4th toward center (3/4ths on left/right). These
* values can be tweaked.
*/
- ALfloat m{lfsum*std::cos(1.0f/3.0f * (al::MathDefs<float>::Pi()*0.5f)) +
+ float m{lfsum*std::cos(1.0f/3.0f * (al::MathDefs<float>::Pi()*0.5f)) +
hfsum*std::cos(1.0f/4.0f * (al::MathDefs<float>::Pi()*0.5f))};
- ALfloat c{lfsum*std::sin(1.0f/3.0f * (al::MathDefs<float>::Pi()*0.5f)) +
+ float c{lfsum*std::sin(1.0f/3.0f * (al::MathDefs<float>::Pi()*0.5f)) +
hfsum*std::sin(1.0f/4.0f * (al::MathDefs<float>::Pi()*0.5f))};
/* The generated center channel signal adds to the existing signal,
@@ -1899,15 +1899,15 @@ void ApplyDistanceComp(const al::span<FloatBufferLine> Samples, const ALuint Sam
for(auto &chanbuffer : Samples)
{
- const ALfloat gain{distcomp->Gain};
+ const float gain{distcomp->Gain};
const ALuint base{distcomp->Length};
- ALfloat *distbuf{al::assume_aligned<16>(distcomp->Buffer)};
+ float *distbuf{al::assume_aligned<16>(distcomp->Buffer)};
++distcomp;
if(base < 1)
continue;
- ALfloat *inout{al::assume_aligned<16>(chanbuffer.data())};
+ float *inout{al::assume_aligned<16>(chanbuffer.data())};
auto inout_end = inout + SamplesToDo;
if LIKELY(SamplesToDo >= base)
{
@@ -1924,23 +1924,23 @@ void ApplyDistanceComp(const al::span<FloatBufferLine> Samples, const ALuint Sam
}
void ApplyDither(const al::span<FloatBufferLine> Samples, ALuint *dither_seed,
- const ALfloat quant_scale, const ALuint SamplesToDo)
+ const float quant_scale, const ALuint SamplesToDo)
{
/* Dithering. Generate whitenoise (uniform distribution of random values
* between -1 and +1) and add it to the sample values, after scaling up to
* the desired quantization depth amd before rounding.
*/
- const ALfloat invscale{1.0f / quant_scale};
+ const float invscale{1.0f / quant_scale};
ALuint seed{*dither_seed};
auto dither_channel = [&seed,invscale,quant_scale,SamplesToDo](FloatBufferLine &input) -> void
{
ASSUME(SamplesToDo > 0);
- auto dither_sample = [&seed,invscale,quant_scale](const ALfloat sample) noexcept -> ALfloat
+ auto dither_sample = [&seed,invscale,quant_scale](const float sample) noexcept -> float
{
- ALfloat val{sample * quant_scale};
+ float val{sample * quant_scale};
ALuint rng0{dither_rng(&seed)};
ALuint rng1{dither_rng(&seed)};
- val += static_cast<ALfloat>(rng0*(1.0/UINT_MAX) - rng1*(1.0/UINT_MAX));
+ val += static_cast<float>(rng0*(1.0/UINT_MAX) - rng1*(1.0/UINT_MAX));
return fast_roundf(val) * invscale;
};
std::transform(input.begin(), input.begin()+SamplesToDo, input.begin(), dither_sample);
@@ -2015,7 +2015,7 @@ void aluMixData(ALCdevice *device, void *OutBuffer, const ALuint NumSamples,
/* Clear main mixing buffers. */
std::for_each(device->MixBuffer.begin(), device->MixBuffer.end(),
- [SamplesToDo](std::array<ALfloat,BUFFERSIZE> &buffer) -> void
+ [SamplesToDo](FloatBufferLine &buffer) -> void
{ std::fill_n(buffer.begin(), SamplesToDo, 0.0f); }
);
diff --git a/alc/panning.cpp b/alc/panning.cpp
index 13fdac6d..10aa9138 100644
--- a/alc/panning.cpp
+++ b/alc/panning.cpp
@@ -147,7 +147,7 @@ void AllocChannels(ALCdevice *device, const ALuint main_chans, const ALuint real
struct ChannelMap {
Channel ChanName;
- ALfloat Config[MAX_AMBI2D_CHANNELS];
+ float Config[MAX_AMBI2D_CHANNELS];
};
bool MakeSpeakerMap(ALCdevice *device, const AmbDecConf *conf, ALuint (&speakermap)[MAX_OUTPUT_CHANNELS])
@@ -272,7 +272,7 @@ constexpr ChannelMap MonoCfg[1] = {
{ BackRight, { 2.04124145e-1f, -1.08880247e-1f, -1.88586120e-1f, 1.29099444e-1f, 7.45355993e-2f, -3.73460789e-2f, 0.00000000e+0f } },
};
-void InitNearFieldCtrl(ALCdevice *device, ALfloat ctrl_dist, ALuint order, bool is3d)
+void InitNearFieldCtrl(ALCdevice *device, float ctrl_dist, ALuint order, bool is3d)
{
/* NFC is only used when AvgSpeakerDist is greater than 0. */
const char *devname{device->DeviceName.c_str()};
@@ -297,14 +297,14 @@ void InitDistanceComp(ALCdevice *device, const AmbDecConf *conf,
{
auto get_max = std::bind(maxf, _1,
std::bind(std::mem_fn(&AmbDecConf::SpeakerConf::Distance), _2));
- const ALfloat maxdist{
- std::accumulate(conf->Speakers.begin(), conf->Speakers.end(), float{0.0f}, get_max)};
+ const float maxdist{std::accumulate(conf->Speakers.begin(), conf->Speakers.end(), 0.0f,
+ get_max)};
const char *devname{device->DeviceName.c_str()};
if(!GetConfigValueBool(devname, "decoder", "distance-comp", 1) || !(maxdist > 0.0f))
return;
- const auto distSampleScale = static_cast<ALfloat>(device->Frequency)/SPEEDOFSOUNDMETRESPERSEC;
+ const auto distSampleScale = static_cast<float>(device->Frequency) / SPEEDOFSOUNDMETRESPERSEC;
const auto ChanDelay = device->ChannelDelay.as_span();
size_t total{0u};
for(size_t i{0u};i < conf->Speakers.size();i++)
@@ -318,12 +318,12 @@ void InitDistanceComp(ALCdevice *device, const AmbDecConf *conf,
* phase offsets. This means at 48khz, for instance, the distance delay
* will be in steps of about 7 millimeters.
*/
- ALfloat delay{std::floor((maxdist - speaker.Distance)*distSampleScale + 0.5f)};
- if(delay > ALfloat{MAX_DELAY_LENGTH-1})
+ float delay{std::floor((maxdist - speaker.Distance)*distSampleScale + 0.5f)};
+ if(delay > float{MAX_DELAY_LENGTH-1})
{
ERR("Delay for speaker \"%s\" exceeds buffer length (%f > %d)\n",
speaker.Name.c_str(), delay, MAX_DELAY_LENGTH-1);
- delay = ALfloat{MAX_DELAY_LENGTH-1};
+ delay = float{MAX_DELAY_LENGTH-1};
}
ChanDelay[chan].Length = static_cast<ALuint>(delay);
@@ -426,7 +426,7 @@ void InitPanning(ALCdevice *device)
);
AllocChannels(device, static_cast<ALuint>(count), 0);
- ALfloat nfc_delay{ConfigValueFloat(devname, "decoder", "nfc-ref-delay").value_or(0.0f)};
+ float nfc_delay{ConfigValueFloat(devname, "decoder", "nfc-ref-delay").value_or(0.0f)};
if(nfc_delay > 0.0f)
InitNearFieldCtrl(device, nfc_delay * SPEEDOFSOUNDMETRESPERSEC, device->mAmbiOrder,
true);
diff --git a/alc/voice.cpp b/alc/voice.cpp
index 493687ae..1f8523c5 100644
--- a/alc/voice.cpp
+++ b/alc/voice.cpp
@@ -85,9 +85,9 @@ RowMixerFunc MixRowSamples{MixRow_<CTag>};
namespace {
-using HrtfMixerFunc = void(*)(const ALfloat *InSamples, float2 *AccumSamples, const ALuint IrSize,
+using HrtfMixerFunc = void(*)(const float *InSamples, float2 *AccumSamples, const ALuint IrSize,
const MixHrtfFilter *hrtfparams, const size_t BufferSize);
-using HrtfMixerBlendFunc = void(*)(const ALfloat *InSamples, float2 *AccumSamples,
+using HrtfMixerBlendFunc = void(*)(const float *InSamples, float2 *AccumSamples,
const ALuint IrSize, const HrtfFilter *oldparams, const MixHrtfFilter *newparams,
const size_t BufferSize);
@@ -294,7 +294,7 @@ template<>
struct FmtTypeTraits<FmtDouble> {
using Type = ALdouble;
static constexpr inline float to_float(const Type val) noexcept
- { return static_cast<ALfloat>(val); }
+ { return static_cast<float>(val); }
};
template<>
struct FmtTypeTraits<FmtMulaw> {
@@ -353,7 +353,7 @@ const float *DoFilters(BiquadFilter *lpfilter, BiquadFilter *hpfilter, float *ds
template<FmtType T>
-inline void LoadSampleArray(ALfloat *RESTRICT dst, const al::byte *src, const size_t srcstep,
+inline void LoadSampleArray(float *RESTRICT dst, const al::byte *src, const size_t srcstep,
const size_t samples) noexcept
{
using SampleType = typename FmtTypeTraits<T>::Type;
@@ -363,7 +363,7 @@ inline void LoadSampleArray(ALfloat *RESTRICT dst, const al::byte *src, const si
dst[i] = FmtTypeTraits<T>::to_float(ssrc[i*srcstep]);
}
-void LoadSamples(ALfloat *RESTRICT dst, const al::byte *src, const size_t srcstep, FmtType srctype,
+void LoadSamples(float *RESTRICT dst, const al::byte *src, const size_t srcstep, FmtType srctype,
const size_t samples) noexcept
{
#define HANDLE_FMT(T) case T: LoadSampleArray<T>(dst, src, srcstep, samples); break
@@ -379,9 +379,9 @@ void LoadSamples(ALfloat *RESTRICT dst, const al::byte *src, const size_t srcste
#undef HANDLE_FMT
}
-ALfloat *LoadBufferStatic(ALbufferlistitem *BufferListItem, ALbufferlistitem *&BufferLoopItem,
+float *LoadBufferStatic(ALbufferlistitem *BufferListItem, ALbufferlistitem *&BufferLoopItem,
const size_t NumChannels, const size_t SampleSize, const size_t chan, size_t DataPosInt,
- al::span<ALfloat> SrcBuffer)
+ al::span<float> SrcBuffer)
{
const ALbuffer *Buffer{BufferListItem->mBuffer};
const ALuint LoopStart{Buffer->LoopStart};
@@ -428,9 +428,9 @@ ALfloat *LoadBufferStatic(ALbufferlistitem *BufferListItem, ALbufferlistitem *&B
return SrcBuffer.begin();
}
-ALfloat *LoadBufferCallback(ALbufferlistitem *BufferListItem, const size_t NumChannels,
+float *LoadBufferCallback(ALbufferlistitem *BufferListItem, const size_t NumChannels,
const size_t SampleSize, const size_t chan, size_t NumCallbackSamples,
- al::span<ALfloat> SrcBuffer)
+ al::span<float> SrcBuffer)
{
const ALbuffer *Buffer{BufferListItem->mBuffer};
@@ -445,9 +445,9 @@ ALfloat *LoadBufferCallback(ALbufferlistitem *BufferListItem, const size_t NumCh
return SrcBuffer.begin();
}
-ALfloat *LoadBufferQueue(ALbufferlistitem *BufferListItem, ALbufferlistitem *BufferLoopItem,
+float *LoadBufferQueue(ALbufferlistitem *BufferListItem, ALbufferlistitem *BufferLoopItem,
const size_t NumChannels, const size_t SampleSize, const size_t chan, size_t DataPosInt,
- al::span<ALfloat> SrcBuffer)
+ al::span<float> SrcBuffer)
{
/* Crawl the buffer queue to fill in the temp buffer */
while(BufferListItem && !SrcBuffer.empty())
@@ -511,7 +511,7 @@ void DoHrtfMix(const float *samples, const ALuint DstBufferSize, DirectParams &p
*/
if LIKELY(Counter > fademix)
{
- const ALfloat a{static_cast<float>(fademix) / static_cast<float>(Counter)};
+ const float a{static_cast<float>(fademix) / static_cast<float>(Counter)};
gain = lerp(parms.Hrtf.Old.Gain, TargetGain, a);
}
MixHrtfFilter hrtfparams;
@@ -751,7 +751,7 @@ void Voice::mix(const State vstate, ALCcontext *Context, const ALuint SamplesToD
* silence, but if not the gain fading should help avoid clicks
* from sudden amplitude changes.
*/
- const ALfloat sample{*(srciter-1)};
+ const float sample{*(srciter-1)};
std::fill(srciter, SrcData.end(), sample);
}
@@ -760,7 +760,7 @@ void Voice::mix(const State vstate, ALCcontext *Context, const ALuint SamplesToD
chandata.mPrevSamples.size(), chandata.mPrevSamples.begin());
/* Resample, then apply ambisonic upsampling as needed. */
- const ALfloat *ResampledData{Resample(&mResampleState,
+ const float *ResampledData{Resample(&mResampleState,
&SrcData[MAX_RESAMPLER_PADDING>>1], DataPosFrac, increment,
{Device->ResampledData, DstBufferSize})};
if((mFlags&VOICE_IS_AMBISONIC))
@@ -777,15 +777,15 @@ void Voice::mix(const State vstate, ALCcontext *Context, const ALuint SamplesToD
}
/* Now filter and mix to the appropriate outputs. */
- ALfloat (&FilterBuf)[BUFFERSIZE] = Device->FilteredData;
+ float (&FilterBuf)[BUFFERSIZE] = Device->FilteredData;
{
DirectParams &parms = chandata.mDryParams;
- const ALfloat *samples{DoFilters(&parms.LowPass, &parms.HighPass, FilterBuf,
+ const float *samples{DoFilters(&parms.LowPass, &parms.HighPass, FilterBuf,
{ResampledData, DstBufferSize}, mDirect.FilterType)};
if((mFlags&VOICE_HAS_HRTF))
{
- const ALfloat TargetGain{UNLIKELY(vstate == Stopping) ? 0.0f :
+ const float TargetGain{UNLIKELY(vstate == Stopping) ? 0.0f :
parms.Hrtf.Target.Gain};
DoHrtfMix(samples, DstBufferSize, parms, TargetGain, Counter, OutPos, IrSize,
Device);
@@ -812,7 +812,7 @@ void Voice::mix(const State vstate, ALCcontext *Context, const ALuint SamplesToD
continue;
SendParams &parms = chandata.mWetParams[send];
- const ALfloat *samples{DoFilters(&parms.LowPass, &parms.HighPass, FilterBuf,
+ const float *samples{DoFilters(&parms.LowPass, &parms.HighPass, FilterBuf,
{ResampledData, DstBufferSize}, mSend[send].FilterType)};
const float *TargetGains{UNLIKELY(vstate == Stopping) ? SilentTarget.data()