When an input AFSouncard is first initialized, it will pass data from all channels of a sound card to the delegate. When an output AFSouncard is first initialized, it will request data from all channels for a sound card from the delegate.
AFSoundcard provides a very easy way for you to select a subset of channels to use, so you will not need to deal with extra buffers.
- (int)channelMask ;
- (void)setChannelMask:(int)mask ;
The channel mask is a binary bit map of the channels. The least significant bit of the mask corresponds to the first channel of a sound card, the second least significant bit corresponds to the second channel, the next significant bit corresponds to the third channel, etc.
Thus, a mask of 0x01 uses only the first channel from the sound card. A mask of 0x02 also uses only one channel, but the second channel of the sound card. With an 8-channel sound card, a mask of 0x30 corresponds to 2 channels (channel 5 and channel 6).
Most stereo sound cards map the left channel to the first channel and the right channel to the second channel.
If you specify a mask bit that is outside the range of the number of channels, that bit will be ignored.
A special case is a mask of 0. This specifies the use of all channels from the sound card.