Don't bother with otherwise unused Aux channels

This commit is contained in:
Chris Robinson
2020-06-15 02:27:29 -07:00
parent 540315b07c
commit 401a9bacd1
4 changed files with 39 additions and 103 deletions
-25
View File
@@ -100,31 +100,6 @@ void BackendBase::setDefaultWFXChannelOrder()
mDevice->RealOut.ChannelIndex[SideRight] = 7;
break;
case DevFmtAmbi3D:
mDevice->RealOut.ChannelIndex[Aux0] = 0;
if(mDevice->mAmbiOrder > 0)
{
mDevice->RealOut.ChannelIndex[Aux1] = 1;
mDevice->RealOut.ChannelIndex[Aux2] = 2;
mDevice->RealOut.ChannelIndex[Aux3] = 3;
}
if(mDevice->mAmbiOrder > 1)
{
mDevice->RealOut.ChannelIndex[Aux4] = 4;
mDevice->RealOut.ChannelIndex[Aux5] = 5;
mDevice->RealOut.ChannelIndex[Aux6] = 6;
mDevice->RealOut.ChannelIndex[Aux7] = 7;
mDevice->RealOut.ChannelIndex[Aux8] = 8;
}
if(mDevice->mAmbiOrder > 2)
{
mDevice->RealOut.ChannelIndex[Aux9] = 9;
mDevice->RealOut.ChannelIndex[Aux10] = 10;
mDevice->RealOut.ChannelIndex[Aux11] = 11;
mDevice->RealOut.ChannelIndex[Aux12] = 12;
mDevice->RealOut.ChannelIndex[Aux13] = 13;
mDevice->RealOut.ChannelIndex[Aux14] = 14;
mDevice->RealOut.ChannelIndex[Aux15] = 15;
}
break;
}
}
+37 -33
View File
@@ -219,39 +219,39 @@ constexpr pa_channel_map MonoChanMap{
}
};
size_t ChannelFromPulse(pa_channel_position_t chan)
al::optional<Channel> ChannelFromPulse(pa_channel_position_t chan)
{
switch(chan)
{
case PA_CHANNEL_POSITION_INVALID: break;
case PA_CHANNEL_POSITION_MONO: return FrontCenter;
case PA_CHANNEL_POSITION_FRONT_LEFT: return FrontLeft;
case PA_CHANNEL_POSITION_FRONT_RIGHT: return FrontRight;
case PA_CHANNEL_POSITION_FRONT_CENTER: return FrontCenter;
case PA_CHANNEL_POSITION_REAR_CENTER: return BackCenter;
case PA_CHANNEL_POSITION_REAR_LEFT: return BackLeft;
case PA_CHANNEL_POSITION_REAR_RIGHT: return BackRight;
case PA_CHANNEL_POSITION_LFE: return LFE;
case PA_CHANNEL_POSITION_MONO: return al::make_optional(FrontCenter);
case PA_CHANNEL_POSITION_FRONT_LEFT: return al::make_optional(FrontLeft);
case PA_CHANNEL_POSITION_FRONT_RIGHT: return al::make_optional(FrontRight);
case PA_CHANNEL_POSITION_FRONT_CENTER: return al::make_optional(FrontCenter);
case PA_CHANNEL_POSITION_REAR_CENTER: return al::make_optional(BackCenter);
case PA_CHANNEL_POSITION_REAR_LEFT: return al::make_optional(BackLeft);
case PA_CHANNEL_POSITION_REAR_RIGHT: return al::make_optional(BackRight);
case PA_CHANNEL_POSITION_LFE: return al::make_optional(LFE);
case PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER: break;
case PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER: break;
case PA_CHANNEL_POSITION_SIDE_LEFT: return SideLeft;
case PA_CHANNEL_POSITION_SIDE_RIGHT: return SideRight;
case PA_CHANNEL_POSITION_AUX0: return Aux0;
case PA_CHANNEL_POSITION_AUX1: return Aux1;
case PA_CHANNEL_POSITION_AUX2: return Aux2;
case PA_CHANNEL_POSITION_AUX3: return Aux3;
case PA_CHANNEL_POSITION_AUX4: return Aux4;
case PA_CHANNEL_POSITION_AUX5: return Aux5;
case PA_CHANNEL_POSITION_AUX6: return Aux6;
case PA_CHANNEL_POSITION_AUX7: return Aux7;
case PA_CHANNEL_POSITION_AUX8: return Aux8;
case PA_CHANNEL_POSITION_AUX9: return Aux9;
case PA_CHANNEL_POSITION_AUX10: return Aux10;
case PA_CHANNEL_POSITION_AUX11: return Aux11;
case PA_CHANNEL_POSITION_AUX12: return Aux12;
case PA_CHANNEL_POSITION_AUX13: return Aux13;
case PA_CHANNEL_POSITION_AUX14: return Aux14;
case PA_CHANNEL_POSITION_AUX15: return Aux15;
case PA_CHANNEL_POSITION_SIDE_LEFT: return al::make_optional(SideLeft);
case PA_CHANNEL_POSITION_SIDE_RIGHT: return al::make_optional(SideRight);
case PA_CHANNEL_POSITION_AUX0: break;
case PA_CHANNEL_POSITION_AUX1: break;
case PA_CHANNEL_POSITION_AUX2: break;
case PA_CHANNEL_POSITION_AUX3: break;
case PA_CHANNEL_POSITION_AUX4: break;
case PA_CHANNEL_POSITION_AUX5: break;
case PA_CHANNEL_POSITION_AUX6: break;
case PA_CHANNEL_POSITION_AUX7: break;
case PA_CHANNEL_POSITION_AUX8: break;
case PA_CHANNEL_POSITION_AUX9: break;
case PA_CHANNEL_POSITION_AUX10: break;
case PA_CHANNEL_POSITION_AUX11: break;
case PA_CHANNEL_POSITION_AUX12: break;
case PA_CHANNEL_POSITION_AUX13: break;
case PA_CHANNEL_POSITION_AUX14: break;
case PA_CHANNEL_POSITION_AUX15: break;
case PA_CHANNEL_POSITION_AUX16: break;
case PA_CHANNEL_POSITION_AUX17: break;
case PA_CHANNEL_POSITION_AUX18: break;
@@ -269,22 +269,26 @@ size_t ChannelFromPulse(pa_channel_position_t chan)
case PA_CHANNEL_POSITION_AUX30: break;
case PA_CHANNEL_POSITION_AUX31: break;
case PA_CHANNEL_POSITION_TOP_CENTER: break;
case PA_CHANNEL_POSITION_TOP_FRONT_LEFT: return UpperFrontLeft;
case PA_CHANNEL_POSITION_TOP_FRONT_RIGHT: return UpperFrontRight;
case PA_CHANNEL_POSITION_TOP_FRONT_LEFT: return al::make_optional(UpperFrontLeft);
case PA_CHANNEL_POSITION_TOP_FRONT_RIGHT: return al::make_optional(UpperFrontRight);
case PA_CHANNEL_POSITION_TOP_FRONT_CENTER: break;
case PA_CHANNEL_POSITION_TOP_REAR_LEFT: return UpperBackLeft;
case PA_CHANNEL_POSITION_TOP_REAR_RIGHT: return UpperBackRight;
case PA_CHANNEL_POSITION_TOP_REAR_LEFT: return al::make_optional(UpperBackLeft);
case PA_CHANNEL_POSITION_TOP_REAR_RIGHT: return al::make_optional(UpperBackRight);
case PA_CHANNEL_POSITION_TOP_REAR_CENTER: break;
case PA_CHANNEL_POSITION_MAX: break;
}
throw al::backend_exception{ALC_INVALID_VALUE, "Unexpected channel enum %d", chan};
WARN("Unexpected channel enum %d\n", chan);
return al::nullopt;
}
void SetChannelOrderFromMap(ALCdevice *device, const pa_channel_map &chanmap)
{
device->RealOut.ChannelIndex.fill(INVALID_CHANNEL_INDEX);
for(ALuint i{0};i < chanmap.channels;++i)
device->RealOut.ChannelIndex[ChannelFromPulse(chanmap.map[i])] = i;
{
if(auto label = ChannelFromPulse(chanmap.map[i]))
device->RealOut.ChannelIndex[*label] = i;
}
}
-17
View File
@@ -29,23 +29,6 @@ enum Channel {
LowerBackLeft,
LowerBackRight,
Aux0,
Aux1,
Aux2,
Aux3,
Aux4,
Aux5,
Aux6,
Aux7,
Aux8,
Aux9,
Aux10,
Aux11,
Aux12,
Aux13,
Aux14,
Aux15,
MaxChannels
};
+2 -28
View File
@@ -99,23 +99,6 @@ inline const char *GetLabelFromChannel(Channel channel)
case LowerBackLeft: return "lower-back-left";
case LowerBackRight: return "lower-back-right";
case Aux0: return "aux-0";
case Aux1: return "aux-1";
case Aux2: return "aux-2";
case Aux3: return "aux-3";
case Aux4: return "aux-4";
case Aux5: return "aux-5";
case Aux6: return "aux-6";
case Aux7: return "aux-7";
case Aux8: return "aux-8";
case Aux9: return "aux-9";
case Aux10: return "aux-10";
case Aux11: return "aux-11";
case Aux12: return "aux-12";
case Aux13: return "aux-13";
case Aux14: return "aux-14";
case Aux15: return "aux-15";
case MaxChannels: break;
}
return "(unknown)";
@@ -228,17 +211,8 @@ bool MakeSpeakerMap(ALCdevice *device, const AmbDecConf *conf, ALuint (&speakerm
ch = BackCenter;
else
{
const char *name{speaker.Name.c_str()};
unsigned int n;
char c;
if(sscanf(name, "AUX%u%c", &n, &c) == 1 && n < 16)
ch = static_cast<Channel>(Aux0+n);
else
{
ERR("AmbDec speaker label \"%s\" not recognized\n", name);
return INVALID_CHANNEL_INDEX;
}
ERR("AmbDec speaker label \"%s\" not recognized\n", speaker.Name.c_str());
return INVALID_CHANNEL_INDEX;
}
const ALuint chidx{GetChannelIdxByName(device->RealOut, ch)};
if(chidx == INVALID_CHANNEL_INDEX)