Changes to AudioQueueServices backend to capture 7.1 surround with SoundFlower

This commit is contained in:
Jack Andersen 2017-09-19 23:25:02 -10:00
parent bf4b3f7382
commit 71b8893dde
1 changed files with 90 additions and 54 deletions

View File

@ -130,6 +130,9 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine
default: break;
}
if (hwChannels > 8)
return AudioChannelSet::Surround71;
return AudioChannelSet::Unknown;
}
@ -632,10 +635,42 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine
UInt32 layoutSz = sizeof(layout);
if (AudioQueueGetProperty(m_queue, kAudioQueueProperty_ChannelLayout, &layout, &layoutSz))
{
Log.report(logvisor::Fatal, "unable to get channel layout from audio queue");
return;
Log.report(logvisor::Warning, "unable to get channel layout from audio queue; using count's default");
switch (m_mixInfo.m_channels)
{
case AudioChannelSet::Stereo:
default:
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::FrontLeft;
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::FrontRight;
break;
case AudioChannelSet::Quad:
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::FrontLeft;
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::FrontRight;
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::RearLeft;
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::RearRight;
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::SideRight;
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::RearLeft;
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::RearRight;
break;
}
}
else
{
switch (layout.mChannelLayoutTag)
{
case kAudioChannelLayoutTag_UseChannelDescriptions:
@ -686,7 +721,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine
chMapOut.m_channels[4] = AudioChannel::FrontCenter;
break;
default:
Log.report(logvisor::Fatal,
Log.report(logvisor::Warning,
"unknown channel layout %u; using stereo",
layout.mChannelLayoutTag);
chMapOut.m_channelCount = 2;
@ -695,6 +730,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine
break;
}
}
}
else
{
chMapOut.m_channels[chMapOut.m_channelCount++] = AudioChannel::FrontLeft;