aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--alc/alu.cpp8
-rw-r--r--alc/effects/dedicated.cpp7
-rw-r--r--alc/panning.cpp2
-rw-r--r--core/device.h14
4 files changed, 15 insertions, 16 deletions
diff --git a/alc/alu.cpp b/alc/alu.cpp
index f5504b5a..ef311395 100644
--- a/alc/alu.cpp
+++ b/alc/alu.cpp
@@ -916,7 +916,7 @@ void CalcPanningAndFilters(Voice *voice, const float xpos, const float ypos, con
for(size_t c{0};c < num_channels;c++)
{
- uint idx{GetChannelIdxByName(Device->RealOut, chans[c].channel)};
+ uint idx{Device->channelIdxByName(chans[c].channel)};
if(idx != INVALID_CHANNEL_INDEX)
voice->mChans[c].mDryParams.Gains.Target[idx] = DryGain.Base;
else if(DirectChannels == DirectMode::RemixMismatch)
@@ -929,7 +929,7 @@ void CalcPanningAndFilters(Voice *voice, const float xpos, const float ypos, con
{
for(const auto &target : remap->targets)
{
- idx = GetChannelIdxByName(Device->RealOut, target.channel);
+ idx = Device->channelIdxByName(target.channel);
if(idx != INVALID_CHANNEL_INDEX)
voice->mChans[c].mDryParams.Gains.Target[idx] = DryGain.Base *
target.mix;
@@ -1076,7 +1076,7 @@ void CalcPanningAndFilters(Voice *voice, const float xpos, const float ypos, con
{
if(Device->Dry.Buffer.data() == Device->RealOut.Buffer.data())
{
- const uint idx{GetChannelIdxByName(Device->RealOut, chans[c].channel)};
+ const uint idx{Device->channelIdxByName(chans[c].channel)};
if(idx != INVALID_CHANNEL_INDEX)
voice->mChans[c].mDryParams.Gains.Target[idx] = DryGain.Base;
}
@@ -1114,7 +1114,7 @@ void CalcPanningAndFilters(Voice *voice, const float xpos, const float ypos, con
{
if(Device->Dry.Buffer.data() == Device->RealOut.Buffer.data())
{
- const uint idx{GetChannelIdxByName(Device->RealOut, chans[c].channel)};
+ const uint idx{Device->channelIdxByName(chans[c].channel)};
if(idx != INVALID_CHANNEL_INDEX)
voice->mChans[c].mDryParams.Gains.Target[idx] = DryGain.Base;
}
diff --git a/alc/effects/dedicated.cpp b/alc/effects/dedicated.cpp
index 671eb5ec..434dfc69 100644
--- a/alc/effects/dedicated.cpp
+++ b/alc/effects/dedicated.cpp
@@ -70,8 +70,7 @@ void DedicatedState::update(const ContextBase*, const EffectSlot *slot,
if(slot->EffectType == EffectSlotType::DedicatedLFE)
{
- const uint idx{!target.RealOut ? INVALID_CHANNEL_INDEX :
- GetChannelIdxByName(*target.RealOut, LFE)};
+ const uint idx{target.RealOut ? target.RealOut->ChannelIndex[LFE] : INVALID_CHANNEL_INDEX};
if(idx != INVALID_CHANNEL_INDEX)
{
mOutTarget = target.RealOut->Buffer;
@@ -82,8 +81,8 @@ void DedicatedState::update(const ContextBase*, const EffectSlot *slot,
{
/* Dialog goes to the front-center speaker if it exists, otherwise it
* plays from the front-center location. */
- const uint idx{!target.RealOut ? INVALID_CHANNEL_INDEX :
- GetChannelIdxByName(*target.RealOut, FrontCenter)};
+ const uint idx{target.RealOut ? target.RealOut->ChannelIndex[FrontCenter]
+ : INVALID_CHANNEL_INDEX};
if(idx != INVALID_CHANNEL_INDEX)
{
mOutTarget = target.RealOut->Buffer;
diff --git a/alc/panning.cpp b/alc/panning.cpp
index 847c7391..113ea280 100644
--- a/alc/panning.cpp
+++ b/alc/panning.cpp
@@ -629,7 +629,7 @@ void InitPanning(ALCdevice *device, const bool hqdec=false, const bool stablize=
al::vector<ChannelDec> chancoeffs, chancoeffslf;
for(size_t i{0u};i < decoder.mChannels.size();++i)
{
- const uint idx{GetChannelIdxByName(device->RealOut, decoder.mChannels[i])};
+ const uint idx{device->channelIdxByName(decoder.mChannels[i])};
if(idx == INVALID_CHANNEL_INDEX)
{
ERR("Failed to find %s channel in device\n",
diff --git a/core/device.h b/core/device.h
index 4b303579..0af7b0e9 100644
--- a/core/device.h
+++ b/core/device.h
@@ -285,6 +285,13 @@ struct DeviceBase {
#endif
void handleDisconnect(const char *msg, ...);
+ /**
+ * Returns the index for the given channel name (e.g. FrontCenter), or
+ * INVALID_CHANNEL_INDEX if it doesn't exist.
+ */
+ uint channelIdxByName(Channel chan) const noexcept
+ { return RealOut.ChannelIndex[chan]; }
+
DISABLE_ALLOC()
private:
@@ -298,13 +305,6 @@ private:
#define RECORD_THREAD_NAME "alsoft-record"
-
-/**
- * Returns the index for the given channel name (e.g. FrontCenter), or
- * INVALID_CHANNEL_INDEX if it doesn't exist.
- */
-inline uint GetChannelIdxByName(const RealMixParams &real, Channel chan) noexcept
-{ return real.ChannelIndex[chan]; }
#define INVALID_CHANNEL_INDEX ~0u
#endif /* CORE_DEVICE_H */