diff options
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/alu.cpp | 13 | ||||
-rw-r--r-- | Alc/mixvoice.cpp | 12 | ||||
-rw-r--r-- | Alc/panning.cpp | 15 |
3 files changed, 13 insertions, 27 deletions
diff --git a/Alc/alu.cpp b/Alc/alu.cpp index fc8b14d8..9a1958b6 100644 --- a/Alc/alu.cpp +++ b/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; } diff --git a/Alc/mixvoice.cpp b/Alc/mixvoice.cpp index 33ea00bb..8e208ff9 100644 --- a/Alc/mixvoice.cpp +++ b/Alc/mixvoice.cpp @@ -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 { diff --git a/Alc/panning.cpp b/Alc/panning.cpp index d43f3f0f..714c3e98 100644 --- a/Alc/panning.cpp +++ b/Alc/panning.cpp @@ -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(); |