Remove the per-voice ChannelsPerOrder field
This commit is contained in:
parent
f9da06fc6a
commit
24df52c042
13
Alc/alu.cpp
13
Alc/alu.cpp
@ -585,9 +585,6 @@ void CalcPanningAndFilters(ALvoice *voice, const ALfloat xpos, const ALfloat ypo
|
||||
/* Only need to adjust the first channel of a B-Format source. */
|
||||
voice->mChans[0].mDryParams.NFCtrlFilter.adjust(w0);
|
||||
|
||||
std::copy(std::begin(Device->NumChannelsPerOrder),
|
||||
std::end(Device->NumChannelsPerOrder),
|
||||
std::begin(voice->mDirect.ChannelsPerOrder));
|
||||
voice->mFlags |= VOICE_HAS_NFC;
|
||||
}
|
||||
|
||||
@ -631,10 +628,6 @@ void CalcPanningAndFilters(ALvoice *voice, const ALfloat xpos, const ALfloat ypo
|
||||
*/
|
||||
voice->mChans[0].mDryParams.NFCtrlFilter.adjust(0.0f);
|
||||
|
||||
voice->mDirect.ChannelsPerOrder[0] = 1;
|
||||
voice->mDirect.ChannelsPerOrder[1] = minz(voice->mDirect.Buffer.size()-1, 3);
|
||||
std::fill(std::begin(voice->mDirect.ChannelsPerOrder)+2,
|
||||
std::end(voice->mDirect.ChannelsPerOrder), 0);
|
||||
voice->mFlags |= VOICE_HAS_NFC;
|
||||
}
|
||||
|
||||
@ -816,9 +809,6 @@ void CalcPanningAndFilters(ALvoice *voice, const ALfloat xpos, const ALfloat ypo
|
||||
for(ALsizei c{0};c < num_channels;c++)
|
||||
voice->mChans[c].mDryParams.NFCtrlFilter.adjust(w0);
|
||||
|
||||
std::copy(std::begin(Device->NumChannelsPerOrder),
|
||||
std::end(Device->NumChannelsPerOrder),
|
||||
std::begin(voice->mDirect.ChannelsPerOrder));
|
||||
voice->mFlags |= VOICE_HAS_NFC;
|
||||
}
|
||||
|
||||
@ -879,9 +869,6 @@ void CalcPanningAndFilters(ALvoice *voice, const ALfloat xpos, const ALfloat ypo
|
||||
for(ALsizei c{0};c < num_channels;c++)
|
||||
voice->mChans[c].mDryParams.NFCtrlFilter.adjust(w0);
|
||||
|
||||
std::copy(std::begin(Device->NumChannelsPerOrder),
|
||||
std::end(Device->NumChannelsPerOrder),
|
||||
std::begin(voice->mDirect.ChannelsPerOrder));
|
||||
voice->mFlags |= VOICE_HAS_NFC;
|
||||
}
|
||||
|
||||
|
@ -802,17 +802,15 @@ void MixVoice(ALvoice *voice, ALvoice::State vstate, const ALuint SourceID, ALCc
|
||||
const ALfloat *TargetGains{UNLIKELY(vstate == ALvoice::Stopping) ?
|
||||
SilentTarget : parms.Gains.Target};
|
||||
|
||||
const auto outcount = static_cast<size_t>(voice->mDirect.ChannelsPerOrder[0]);
|
||||
const size_t outcount{Device->NumChannelsPerOrder[0]};
|
||||
MixSamples(samples, voice->mDirect.Buffer.first(outcount), parms.Gains.Current,
|
||||
TargetGains, Counter, OutPos, DstBufferSize);
|
||||
|
||||
ALfloat (&nfcsamples)[BUFFERSIZE] = Device->NfcSampleData;
|
||||
size_t chanoffset{outcount};
|
||||
using FilterProc = void (NfcFilter::*)(float*,const float*,int);
|
||||
auto apply_nfc = [voice,&parms,samples,TargetGains,DstBufferSize,Counter,OutPos,&chanoffset,&nfcsamples](FilterProc process, ALsizei order) -> void
|
||||
auto apply_nfc = [voice,&parms,samples,TargetGains,DstBufferSize,Counter,OutPos,&chanoffset,&nfcsamples](const FilterProc process, const size_t outcount) -> void
|
||||
{
|
||||
const auto outcount = static_cast<size_t>(
|
||||
voice->mDirect.ChannelsPerOrder[order]);
|
||||
if(outcount < 1) return;
|
||||
(parms.NFCtrlFilter.*process)(nfcsamples, samples, DstBufferSize);
|
||||
MixSamples(nfcsamples, voice->mDirect.Buffer.subspan(chanoffset, outcount),
|
||||
@ -820,9 +818,9 @@ void MixVoice(ALvoice *voice, ALvoice::State vstate, const ALuint SourceID, ALCc
|
||||
OutPos, DstBufferSize);
|
||||
chanoffset += outcount;
|
||||
};
|
||||
apply_nfc(&NfcFilter::process1, 1);
|
||||
apply_nfc(&NfcFilter::process2, 2);
|
||||
apply_nfc(&NfcFilter::process3, 3);
|
||||
apply_nfc(&NfcFilter::process1, Device->NumChannelsPerOrder[1]);
|
||||
apply_nfc(&NfcFilter::process2, Device->NumChannelsPerOrder[2]);
|
||||
apply_nfc(&NfcFilter::process3, Device->NumChannelsPerOrder[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -233,7 +233,8 @@ 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, ALsizei order, const ALsizei *RESTRICT chans_per_order)
|
||||
void InitNearFieldCtrl(ALCdevice *device, ALfloat ctrl_dist, ALsizei order,
|
||||
const ALuint *RESTRICT chans_per_order)
|
||||
{
|
||||
/* NFC is only used when AvgSpeakerDist is greater than 0. */
|
||||
const char *devname{device->DeviceName.c_str()};
|
||||
@ -245,7 +246,7 @@ void InitNearFieldCtrl(ALCdevice *device, ALfloat ctrl_dist, ALsizei order, cons
|
||||
|
||||
auto iter = std::copy(chans_per_order, chans_per_order+order+1,
|
||||
std::begin(device->NumChannelsPerOrder));
|
||||
std::fill(iter, std::end(device->NumChannelsPerOrder), 0);
|
||||
std::fill(iter, std::end(device->NumChannelsPerOrder), 0u);
|
||||
}
|
||||
|
||||
void InitDistanceComp(ALCdevice *device, const AmbDecConf *conf, const ALsizei (&speakermap)[MAX_OUTPUT_CHANNELS])
|
||||
@ -388,7 +389,7 @@ void InitPanning(ALCdevice *device)
|
||||
ALfloat nfc_delay{0.0f};
|
||||
if(ConfigValueFloat(devname, "decoder", "nfc-ref-delay", &nfc_delay) && nfc_delay > 0.0f)
|
||||
{
|
||||
static constexpr ALsizei chans_per_order[MAX_AMBI_ORDER+1]{ 1, 3, 5, 7 };
|
||||
static constexpr ALuint chans_per_order[MAX_AMBI_ORDER+1]{ 1, 3, 5, 7 };
|
||||
nfc_delay = clampf(nfc_delay, 0.001f, 1000.0f);
|
||||
InitNearFieldCtrl(device, nfc_delay * SPEEDOFSOUNDMETRESPERSEC,
|
||||
device->mAmbiOrder, chans_per_order);
|
||||
@ -439,8 +440,8 @@ void InitPanning(ALCdevice *device)
|
||||
|
||||
void InitCustomPanning(ALCdevice *device, bool hqdec, const AmbDecConf *conf, const ALsizei (&speakermap)[MAX_OUTPUT_CHANNELS])
|
||||
{
|
||||
static constexpr ALsizei chans_per_order2d[MAX_AMBI_ORDER+1] = { 1, 2, 2, 2 };
|
||||
static constexpr ALsizei chans_per_order3d[MAX_AMBI_ORDER+1] = { 1, 3, 5, 7 };
|
||||
static constexpr ALuint chans_per_order2d[MAX_AMBI_ORDER+1] = { 1, 2, 2, 2 };
|
||||
static constexpr ALuint chans_per_order3d[MAX_AMBI_ORDER+1] = { 1, 3, 5, 7 };
|
||||
|
||||
if(!hqdec && conf->FreqBands != 1)
|
||||
ERR("Basic renderer uses the high-frequency matrix as single-band (xover_freq = %.0fhz)\n",
|
||||
@ -546,7 +547,7 @@ void InitHrtfPanning(ALCdevice *device)
|
||||
}, AmbiOrderHFGain3O[MAX_AMBI_ORDER+1]{
|
||||
1.86508671e+00f, 1.60609389e+00f, 1.14205530e+00f, 5.68379553e-01f
|
||||
};
|
||||
static constexpr ALsizei ChansPerOrder[MAX_AMBI_ORDER+1]{ 1, 3, 5, 7 };
|
||||
static constexpr ALuint ChansPerOrder[MAX_AMBI_ORDER+1]{ 1, 3, 5, 7 };
|
||||
const ALfloat *AmbiOrderHFGain{AmbiOrderHFGain1O};
|
||||
|
||||
static_assert(al::size(AmbiPoints) == al::size(AmbiMatrix), "Ambisonic HRTF mismatch");
|
||||
@ -759,7 +760,7 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, HrtfRequestMode hrtf_appr
|
||||
|
||||
device->Dry.AmbiMap.fill(BFChannelConfig{});
|
||||
device->Dry.NumChannels = 0;
|
||||
std::fill(std::begin(device->NumChannelsPerOrder), std::end(device->NumChannelsPerOrder), 0);
|
||||
std::fill(std::begin(device->NumChannelsPerOrder), std::end(device->NumChannelsPerOrder), 0u);
|
||||
|
||||
device->AvgSpeakerDist = 0.0f;
|
||||
device->ChannelDelay.clear();
|
||||
|
@ -411,7 +411,7 @@ struct ALCdevice {
|
||||
|
||||
/* The "dry" path corresponds to the main output. */
|
||||
MixParams Dry;
|
||||
ALsizei NumChannelsPerOrder[MAX_AMBI_ORDER+1]{};
|
||||
ALuint NumChannelsPerOrder[MAX_AMBI_ORDER+1]{};
|
||||
|
||||
/* "Real" output, which will be written to the device buffer. May alias the
|
||||
* dry buffer.
|
||||
|
@ -256,7 +256,6 @@ struct ALvoice {
|
||||
struct DirectData {
|
||||
int FilterType;
|
||||
al::span<FloatBufferLine> Buffer;
|
||||
ALsizei ChannelsPerOrder[MAX_AMBI_ORDER+1];
|
||||
};
|
||||
DirectData mDirect;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user