Merge pull request #70 from michaelmaltese/bugfix-57-truncate-number-of-soundflower-channels

coreaudio: obey MAX_CHANNELS when creating devices
This commit is contained in:
Andrew Kelley 2016-04-25 17:02:18 -07:00
commit a260961fcb

View file

@ -280,7 +280,10 @@ static int from_coreaudio_layout(const AudioChannelLayout *ca_layout, struct Sou
switch (ca_layout->mChannelLayoutTag) {
case kAudioChannelLayoutTag_UseChannelDescriptions:
{
layout->channel_count = ca_layout->mNumberChannelDescriptions;
layout->channel_count = soundio_int_min(
SOUNDIO_MAX_CHANNELS,
ca_layout->mNumberChannelDescriptions
);
for (int i = 0; i < layout->channel_count; i += 1) {
layout->channels[i] = from_channel_descr(&ca_layout->mChannelDescriptions[i]);
}