| 86 | } |
| 87 | |
| 88 | int AudioNodeInput::numberOfChannels(ContextRenderLock & r) const |
| 89 | { |
| 90 | ChannelCountMode mode = destinationNode()->channelCountMode(); |
| 91 | |
| 92 | if (mode == ChannelCountMode::Explicit) |
| 93 | { |
| 94 | return destinationNode()->channelCount(); |
| 95 | } |
| 96 | |
| 97 | // Find the number of channels of the connection with the largest number of channels. |
| 98 | int maxChannels = 1; // one channel is the minimum allowed |
| 99 | |
| 100 | int c = numberOfRenderingConnections(r); |
| 101 | for (int i = 0; i < c; ++i) |
| 102 | { |
| 103 | auto output = renderingOutput(r, i); |
| 104 | if (output) |
| 105 | { |
| 106 | int c = output->bus(r)->numberOfChannels(); |
| 107 | if (c > maxChannels) |
| 108 | maxChannels = c; |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | if (mode == ChannelCountMode::ClampedMax) |
| 113 | { |
| 114 | maxChannels = min(maxChannels, destinationNode()->channelCount()); |
| 115 | } |
| 116 | |
| 117 | return maxChannels; |
| 118 | } |
| 119 | |
| 120 | AudioBus * AudioNodeInput::bus(ContextRenderLock & r) |
| 121 | { |