Pass RealMixParams by reference instead of pointer

This commit is contained in:
Chris Robinson 2018-12-20 13:26:39 -08:00
parent 9fde260df9
commit 7744e4ff72
5 changed files with 19 additions and 19 deletions

View File

@ -128,8 +128,8 @@ void ProcessHrtf(ALCdevice *device, ALsizei SamplesToDo)
device->FOAOut.Buffer, SamplesToDo device->FOAOut.Buffer, SamplesToDo
); );
int lidx{GetChannelIdxByName(&device->RealOut, FrontLeft)}; int lidx{GetChannelIdxByName(device->RealOut, FrontLeft)};
int ridx{GetChannelIdxByName(&device->RealOut, FrontRight)}; int ridx{GetChannelIdxByName(device->RealOut, FrontRight)};
assert(lidx != -1 && ridx != -1); assert(lidx != -1 && ridx != -1);
DirectHrtfState *state{device->mHrtfState.get()}; DirectHrtfState *state{device->mHrtfState.get()};
@ -163,8 +163,8 @@ void ProcessAmbiUp(ALCdevice *device, ALsizei SamplesToDo)
void ProcessUhj(ALCdevice *device, ALsizei SamplesToDo) void ProcessUhj(ALCdevice *device, ALsizei SamplesToDo)
{ {
int lidx = GetChannelIdxByName(&device->RealOut, FrontLeft); int lidx = GetChannelIdxByName(device->RealOut, FrontLeft);
int ridx = GetChannelIdxByName(&device->RealOut, FrontRight); int ridx = GetChannelIdxByName(device->RealOut, FrontRight);
assert(lidx != -1 && ridx != -1); assert(lidx != -1 && ridx != -1);
/* Encode to stereo-compatible 2-channel UHJ output. */ /* Encode to stereo-compatible 2-channel UHJ output. */
@ -176,8 +176,8 @@ void ProcessUhj(ALCdevice *device, ALsizei SamplesToDo)
void ProcessBs2b(ALCdevice *device, ALsizei SamplesToDo) void ProcessBs2b(ALCdevice *device, ALsizei SamplesToDo)
{ {
int lidx = GetChannelIdxByName(&device->RealOut, FrontLeft); int lidx = GetChannelIdxByName(device->RealOut, FrontLeft);
int ridx = GetChannelIdxByName(&device->RealOut, FrontRight); int ridx = GetChannelIdxByName(device->RealOut, FrontRight);
assert(lidx != -1 && ridx != -1); assert(lidx != -1 && ridx != -1);
/* Apply binaural/crossfeed filter */ /* Apply binaural/crossfeed filter */
@ -696,7 +696,7 @@ void CalcPanningAndFilters(ALvoice *voice, const ALfloat Azi, const ALfloat Elev
for(ALsizei c{0};c < num_channels;c++) for(ALsizei c{0};c < num_channels;c++)
{ {
int idx{GetChannelIdxByName(&Device->RealOut, chans[c].channel)}; int idx{GetChannelIdxByName(Device->RealOut, chans[c].channel)};
if(idx != -1) voice->Direct.Params[c].Gains.Target[idx] = DryGain; if(idx != -1) voice->Direct.Params[c].Gains.Target[idx] = DryGain;
} }
@ -843,7 +843,7 @@ void CalcPanningAndFilters(ALvoice *voice, const ALfloat Azi, const ALfloat Elev
{ {
if(Device->Dry.Buffer == Device->RealOut.Buffer) if(Device->Dry.Buffer == Device->RealOut.Buffer)
{ {
int idx = GetChannelIdxByName(&Device->RealOut, chans[c].channel); int idx = GetChannelIdxByName(Device->RealOut, chans[c].channel);
if(idx != -1) voice->Direct.Params[c].Gains.Target[idx] = DryGain; if(idx != -1) voice->Direct.Params[c].Gains.Target[idx] = DryGain;
} }
continue; continue;
@ -894,7 +894,7 @@ void CalcPanningAndFilters(ALvoice *voice, const ALfloat Azi, const ALfloat Elev
{ {
if(Device->Dry.Buffer == Device->RealOut.Buffer) if(Device->Dry.Buffer == Device->RealOut.Buffer)
{ {
int idx = GetChannelIdxByName(&Device->RealOut, chans[c].channel); int idx = GetChannelIdxByName(Device->RealOut, chans[c].channel);
if(idx != -1) voice->Direct.Params[c].Gains.Target[idx] = DryGain; if(idx != -1) voice->Direct.Params[c].Gains.Target[idx] = DryGain;
} }
continue; continue;
@ -1683,9 +1683,9 @@ void aluMixData(ALCdevice *device, ALvoid *OutBuffer, ALsizei NumSamples)
/* Apply front image stablization for surround sound, if applicable. */ /* Apply front image stablization for surround sound, if applicable. */
if(device->Stablizer) if(device->Stablizer)
{ {
const int lidx{GetChannelIdxByName(&device->RealOut, FrontLeft)}; const int lidx{GetChannelIdxByName(device->RealOut, FrontLeft)};
const int ridx{GetChannelIdxByName(&device->RealOut, FrontRight)}; const int ridx{GetChannelIdxByName(device->RealOut, FrontRight)};
const int cidx{GetChannelIdxByName(&device->RealOut, FrontCenter)}; const int cidx{GetChannelIdxByName(device->RealOut, FrontCenter)};
assert(lidx >= 0 && ridx >= 0 && cidx >= 0); assert(lidx >= 0 && ridx >= 0 && cidx >= 0);
ApplyStablizer(device->Stablizer.get(), device->RealOut.Buffer, lidx, ridx, cidx, ApplyStablizer(device->Stablizer.get(), device->RealOut.Buffer, lidx, ridx, cidx,

View File

@ -60,7 +60,7 @@ void ALdedicatedState::update(const ALCcontext *context, const ALeffectslot *slo
if(slot->Params.EffectType == AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT) if(slot->Params.EffectType == AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT)
{ {
int idx; int idx;
if((idx=GetChannelIdxByName(&device->RealOut, LFE)) != -1) if((idx=GetChannelIdxByName(device->RealOut, LFE)) != -1)
{ {
mOutBuffer = device->RealOut.Buffer; mOutBuffer = device->RealOut.Buffer;
mOutChannels = device->RealOut.NumChannels; mOutChannels = device->RealOut.NumChannels;
@ -71,7 +71,7 @@ void ALdedicatedState::update(const ALCcontext *context, const ALeffectslot *slo
{ {
/* Dialog goes to the front-center speaker if it exists, otherwise it /* Dialog goes to the front-center speaker if it exists, otherwise it
* plays from the front-center location. */ * plays from the front-center location. */
int idx{GetChannelIdxByName(&device->RealOut, FrontCenter)}; int idx{GetChannelIdxByName(device->RealOut, FrontCenter)};
if(idx != -1) if(idx != -1)
{ {
mOutBuffer = device->RealOut.Buffer; mOutBuffer = device->RealOut.Buffer;

View File

@ -550,8 +550,8 @@ ALboolean MixSource(ALvoice *voice, ALuint SourceID, ALCcontext *Context, ALsize
} }
else else
{ {
const int lidx{GetChannelIdxByName(&Device->RealOut, FrontLeft)}; const int lidx{GetChannelIdxByName(Device->RealOut, FrontLeft)};
const int ridx{GetChannelIdxByName(&Device->RealOut, FrontRight)}; const int ridx{GetChannelIdxByName(Device->RealOut, FrontRight)};
assert(lidx != -1 && ridx != -1); assert(lidx != -1 && ridx != -1);
ALsizei fademix{0}; ALsizei fademix{0};

View File

@ -198,7 +198,7 @@ bool MakeSpeakerMap(ALCdevice *device, const AmbDecConf *conf, ALsizei (&speaker
return -1; return -1;
} }
} }
const int chidx{GetChannelIdxByName(&device->RealOut, ch)}; const int chidx{GetChannelIdxByName(device->RealOut, ch)};
if(chidx == -1) if(chidx == -1)
ERR("Failed to lookup AmbDec speaker label %s\n", speaker.Name.c_str()); ERR("Failed to lookup AmbDec speaker label %s\n", speaker.Name.c_str());
return chidx; return chidx;

View File

@ -906,8 +906,8 @@ inline ALint GetChannelIndex(const Channel (&names)[MAX_OUTPUT_CHANNELS], Channe
* Returns the index for the given channel name (e.g. FrontCenter), or -1 if it * Returns the index for the given channel name (e.g. FrontCenter), or -1 if it
* doesn't exist. * doesn't exist.
*/ */
inline ALint GetChannelIdxByName(const RealMixParams *real, enum Channel chan) inline ALint GetChannelIdxByName(const RealMixParams &real, Channel chan)
{ return GetChannelIndex(real->ChannelName, chan); } { return GetChannelIndex(real.ChannelName, chan); }
void StartEventThrd(ALCcontext *ctx); void StartEventThrd(ALCcontext *ctx);