# Channel selection / deselection is broken with CoreAudio

**URL:** <https://forum.juce.com/t/channel-selection-deselection-is-broken-with-coreaudio/53807>\
**Category:** MacOSX and iOS\
**Created:** [November 19, 2022, 6:23pm UTC](https://forum.juce.com/t/channel-selection-deselection-is-broken-with-coreaudio/53807 "2022-11-19T18:23:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jpo](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/jpo/32/503_2.png) [@jpo](https://forum.juce.com/u/jpo)\
**Post date:** [November 19, 2022, 6:23pm UTC](https://forum.juce.com/t/channel-selection-deselection-is-broken-with-coreaudio/53807/1 "2022-11-19T18:23:16Z")

</div>

Hi, the commit [CoreAudio: More code modernisation and clean-up · juce-framework/JUCE@9a62775 · GitHub](https://github.com/juce-framework/JUCE/commit/9a627758093baebd07243dd13a5fb844cfd4542c) broke channel selection (only the last channel can be toggled on/off) . This part of the change is the issue:

```auto
       const auto activeIns = BigInteger().setRange (0, jmin (ins .getHighestBit() + 1, getNumChannelNames (inStream)), true);
        const auto activeOuts = BigInteger().setRange (0, jmin (outs.getHighestBit() + 1, getNumChannelNames (outStream)), true);

```

It is just filling all bits of activeIns and activeOuts to one. The old code that was replaced by this was working.

This issue is still here in the tip of develop, but the setRange(…) is now done in the Stream constructor.

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [December 8, 2022, 5:57pm UTC](https://forum.juce.com/t/channel-selection-deselection-is-broken-with-coreaudio/53807/2 "2022-12-08T17:57:18Z")

</div>

It looks to me like this issue was fixed here:

> <https://github.com/juce-framework/juce/commit/51627932>
>
> Prior to this commit it was not possible to deactivate the first few
> channels of… an audio device. If say channel 5 was active in the
> requested configuration then all channels up to 5 would be active as
> well regardless of the provided activation pattern.

Please let me know if the issue is still present on develop.
