Change an inline function to a class method

master
Chris Robinson 2022-08-01 13:06:14 -07:00
parent 810821a221
commit a1faa5d311
4 changed files with 15 additions and 16 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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",

View File

@ -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 */