mirror of https://github.com/AxioDL/boo.git
Changes to AudioQueueServices backend to capture 7.1 surround with SoundFlower
This commit is contained in:
parent
bf4b3f7382
commit
71b8893dde
|
@ -130,6 +130,9 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hwChannels > 8)
|
||||||
|
return AudioChannelSet::Surround71;
|
||||||
|
|
||||||
return AudioChannelSet::Unknown;
|
return AudioChannelSet::Unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -632,67 +635,100 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine
|
||||||
UInt32 layoutSz = sizeof(layout);
|
UInt32 layoutSz = sizeof(layout);
|
||||||
if (AudioQueueGetProperty(m_queue, kAudioQueueProperty_ChannelLayout, &layout, &layoutSz))
|
if (AudioQueueGetProperty(m_queue, kAudioQueueProperty_ChannelLayout, &layout, &layoutSz))
|
||||||
{
|
{
|
||||||
Log.report(logvisor::Fatal, "unable to get channel layout from audio queue");
|
Log.report(logvisor::Warning, "unable to get channel layout from audio queue; using count's default");
|
||||||
return;
|
switch (m_mixInfo.m_channels)
|
||||||
}
|
|
||||||
|
|
||||||
switch (layout.mChannelLayoutTag)
|
|
||||||
{
|
|
||||||
case kAudioChannelLayoutTag_UseChannelDescriptions:
|
|
||||||
chMapOut.m_channelCount = layout.mNumberChannelDescriptions;
|
|
||||||
for (int i=0 ; i<layout.mNumberChannelDescriptions ; ++i)
|
|
||||||
{
|
{
|
||||||
AudioChannel ch = AQSChannelToBooChannel(layout.mChannelDescriptions[i].mChannelLabel);
|
case AudioChannelSet::Stereo:
|
||||||
chMapOut.m_channels[i] = ch;
|
default:
|
||||||
}
|
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::FrontLeft;
|
||||||
break;
|
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::FrontRight;
|
||||||
case kAudioChannelLayoutTag_UseChannelBitmap:
|
break;
|
||||||
if ((layout.mChannelBitmap & kAudioChannelBit_Left) != 0)
|
case AudioChannelSet::Quad:
|
||||||
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::FrontLeft;
|
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::FrontLeft;
|
||||||
if ((layout.mChannelBitmap & kAudioChannelBit_Right) != 0)
|
|
||||||
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::FrontRight;
|
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::FrontRight;
|
||||||
if ((layout.mChannelBitmap & kAudioChannelBit_Center) != 0)
|
|
||||||
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::FrontCenter;
|
|
||||||
if ((layout.mChannelBitmap & kAudioChannelBit_LFEScreen) != 0)
|
|
||||||
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::LFE;
|
|
||||||
if ((layout.mChannelBitmap & kAudioChannelBit_LeftSurround) != 0)
|
|
||||||
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::RearLeft;
|
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::RearLeft;
|
||||||
if ((layout.mChannelBitmap & kAudioChannelBit_RightSurround) != 0)
|
|
||||||
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::RearRight;
|
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::RearRight;
|
||||||
if ((layout.mChannelBitmap & kAudioChannelBit_LeftSurroundDirect) != 0)
|
break;
|
||||||
|
case AudioChannelSet::Surround51:
|
||||||
|
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::FrontLeft;
|
||||||
|
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::FrontRight;
|
||||||
|
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::FrontCenter;
|
||||||
|
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::LFE;
|
||||||
|
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::RearLeft;
|
||||||
|
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::RearRight;
|
||||||
|
break;
|
||||||
|
case AudioChannelSet::Surround71:
|
||||||
|
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::FrontLeft;
|
||||||
|
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::FrontRight;
|
||||||
|
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::FrontCenter;
|
||||||
|
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::LFE;
|
||||||
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::SideLeft;
|
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::SideLeft;
|
||||||
if ((layout.mChannelBitmap & kAudioChannelBit_RightSurroundDirect) != 0)
|
|
||||||
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::SideRight;
|
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::SideRight;
|
||||||
break;
|
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::RearLeft;
|
||||||
case kAudioChannelLayoutTag_Stereo:
|
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::RearRight;
|
||||||
case kAudioChannelLayoutTag_StereoHeadphones:
|
break;
|
||||||
chMapOut.m_channelCount = 2;
|
}
|
||||||
chMapOut.m_channels[0] = AudioChannel::FrontLeft;
|
}
|
||||||
chMapOut.m_channels[1] = AudioChannel::FrontRight;
|
else
|
||||||
break;
|
{
|
||||||
case kAudioChannelLayoutTag_Quadraphonic:
|
switch (layout.mChannelLayoutTag)
|
||||||
chMapOut.m_channelCount = 4;
|
{
|
||||||
chMapOut.m_channels[0] = AudioChannel::FrontLeft;
|
case kAudioChannelLayoutTag_UseChannelDescriptions:
|
||||||
chMapOut.m_channels[1] = AudioChannel::FrontRight;
|
chMapOut.m_channelCount = layout.mNumberChannelDescriptions;
|
||||||
chMapOut.m_channels[2] = AudioChannel::RearLeft;
|
for (int i = 0; i < layout.mNumberChannelDescriptions; ++i)
|
||||||
chMapOut.m_channels[3] = AudioChannel::RearRight;
|
{
|
||||||
break;
|
AudioChannel ch = AQSChannelToBooChannel(layout.mChannelDescriptions[i].mChannelLabel);
|
||||||
case kAudioChannelLayoutTag_Pentagonal:
|
chMapOut.m_channels[i] = ch;
|
||||||
chMapOut.m_channelCount = 5;
|
}
|
||||||
chMapOut.m_channels[0] = AudioChannel::FrontLeft;
|
break;
|
||||||
chMapOut.m_channels[1] = AudioChannel::FrontRight;
|
case kAudioChannelLayoutTag_UseChannelBitmap:
|
||||||
chMapOut.m_channels[2] = AudioChannel::RearLeft;
|
if ((layout.mChannelBitmap & kAudioChannelBit_Left) != 0)
|
||||||
chMapOut.m_channels[3] = AudioChannel::RearRight;
|
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::FrontLeft;
|
||||||
chMapOut.m_channels[4] = AudioChannel::FrontCenter;
|
if ((layout.mChannelBitmap & kAudioChannelBit_Right) != 0)
|
||||||
break;
|
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::FrontRight;
|
||||||
default:
|
if ((layout.mChannelBitmap & kAudioChannelBit_Center) != 0)
|
||||||
Log.report(logvisor::Fatal,
|
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::FrontCenter;
|
||||||
"unknown channel layout %u; using stereo",
|
if ((layout.mChannelBitmap & kAudioChannelBit_LFEScreen) != 0)
|
||||||
layout.mChannelLayoutTag);
|
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::LFE;
|
||||||
chMapOut.m_channelCount = 2;
|
if ((layout.mChannelBitmap & kAudioChannelBit_LeftSurround) != 0)
|
||||||
chMapOut.m_channels[0] = AudioChannel::FrontLeft;
|
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::RearLeft;
|
||||||
chMapOut.m_channels[1] = AudioChannel::FrontRight;
|
if ((layout.mChannelBitmap & kAudioChannelBit_RightSurround) != 0)
|
||||||
break;
|
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::RearRight;
|
||||||
|
if ((layout.mChannelBitmap & kAudioChannelBit_LeftSurroundDirect) != 0)
|
||||||
|
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::SideLeft;
|
||||||
|
if ((layout.mChannelBitmap & kAudioChannelBit_RightSurroundDirect) != 0)
|
||||||
|
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::SideRight;
|
||||||
|
break;
|
||||||
|
case kAudioChannelLayoutTag_Stereo:
|
||||||
|
case kAudioChannelLayoutTag_StereoHeadphones:
|
||||||
|
chMapOut.m_channelCount = 2;
|
||||||
|
chMapOut.m_channels[0] = AudioChannel::FrontLeft;
|
||||||
|
chMapOut.m_channels[1] = AudioChannel::FrontRight;
|
||||||
|
break;
|
||||||
|
case kAudioChannelLayoutTag_Quadraphonic:
|
||||||
|
chMapOut.m_channelCount = 4;
|
||||||
|
chMapOut.m_channels[0] = AudioChannel::FrontLeft;
|
||||||
|
chMapOut.m_channels[1] = AudioChannel::FrontRight;
|
||||||
|
chMapOut.m_channels[2] = AudioChannel::RearLeft;
|
||||||
|
chMapOut.m_channels[3] = AudioChannel::RearRight;
|
||||||
|
break;
|
||||||
|
case kAudioChannelLayoutTag_Pentagonal:
|
||||||
|
chMapOut.m_channelCount = 5;
|
||||||
|
chMapOut.m_channels[0] = AudioChannel::FrontLeft;
|
||||||
|
chMapOut.m_channels[1] = AudioChannel::FrontRight;
|
||||||
|
chMapOut.m_channels[2] = AudioChannel::RearLeft;
|
||||||
|
chMapOut.m_channels[3] = AudioChannel::RearRight;
|
||||||
|
chMapOut.m_channels[4] = AudioChannel::FrontCenter;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Log.report(logvisor::Warning,
|
||||||
|
"unknown channel layout %u; using stereo",
|
||||||
|
layout.mChannelLayoutTag);
|
||||||
|
chMapOut.m_channelCount = 2;
|
||||||
|
chMapOut.m_channels[0] = AudioChannel::FrontLeft;
|
||||||
|
chMapOut.m_channels[1] = AudioChannel::FrontRight;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue