Ticket #27 (closed enhancement: fixed)
Provide channel mask for CoreAudio like ASIO has
| Reported by: | rossb | Owned by: | bjornroche |
|---|---|---|---|
| Priority: | minor | Milestone: | V19-RC1 |
| Component: | host-api-coreaudio | Version: | 2.0 |
| Keywords: | Cc: |
Description (last modified by bjornroche) (diff)
PaAsio provides an extension to only open a subset of channels on a multichannel device (leaving other channels available to other applications for example). A similar feature has been requested for PaCore.
For now, if users want to open channels n to m on a given device, them must open channels 0 to m on that device and pass zeros to channels 0 to (n-1). It has been suggested that apple provides an API for doing this more efficiently (channel mapping) and that API should be available. A simmilar API is available for ASIO, and that API should be mimicked if possible. This feature is often requested.
As suggested by Olivar Tristan, the following code may also be used for getting the channel names:
Hi,
I use this in my code.
struct PaUtilHostApiRepresentation? *hostApi; PaError? err; err = PaUtil?_GetHostApiRepresentation( &hostApi, (PaHostApiTypeId?)m_APIId); assert(err == paNoError); PaMacCoreHostApiRepresentation? *macCoreHostApi = (PaMacCoreHostApiRepresentation?*)hostApi; AudioDeviceID hostApiDevice = macCoreHostApi->devIds[m_Id]; char channelName[256]; UInt32 dataSize = sizeof(channelName); OSStatus error = AudioDeviceGetProperty?( hostApiDevice, index + 1, false, kAudioDevicePropertyChannelName, &dataSize, &channelName ); if (error == noErr) {
return String(channelName);
}
Where index is the channel id (zero based) and APIId the API id (only 1 on mac)
Also, see
http://lists.apple.com/archives/coreaudio-api/2006/Nov/msg00162.html
to figure out whether that is the right property or if instead you have to use kAudioDevicePropertyChannelNameCFString. I only skimmed the thread, but it looks to me like you might have to try both for best compatibility.
See:
