AudioDevice AudioChannelLayout
AudioDevice AudioChannelLayout
- Subject: AudioDevice AudioChannelLayout
- From: Tommy Braas <email@hidden>
- Date: Wed, 22 Oct 2003 11:04:11 -0700
Hi all,
I have a little problem regarding channel layouts in general, and for
the M-Audio Revolution 7.1 card in particular.
I am using the code attached below to get an AudioChannelLayout from an
audio device. In the case if the Revolution card, it reports that it
has 8 channels and that I should look at the AudioChannelDescription
(kAudioChannelLayoutTag_UseChannelDescriptions) for each channel to
determine what type of channel it is (the channel bitmap is empty).
When I then proceed to examine each AudioChannelDescription, their
label tags are all set to kAudioChannelLabel_Unknown. It is
bewildering...
I need to be able to mix stereo audio into an n-channel buffer and I
want to be able to do it the right way. I am not using AudioUnits
currently as there is no time to implement that functionality right
now, but ultimately it is in that direction we're looking to take CD
Spin Doctor.
I am doing something wrong here, or is it common that audio devices
misrepresent themselves?
Hoping for a quick fix.
Kind regards,
Tommy Braas
Sr. Software Engineer
Deep Sea Software
The Makers of CD Spin Doctor. 2
Code snippets (in Objective-C, full implementations can be provided if
needed):
From DSSAudioDevice, getting the
kAudioDevicePropertyPreferredChannelLayout property value
- (DSSAudioChannelLayout*)channelLayout:(BOOL)isInput
{
AudioChannelLayout *retVal;
UInt32 theSize;
Boolean ignored;
// kAudioDevicePropertyPreferredChannelLayout
OSStatus status = AudioDeviceGetPropertyInfo(deviceID,
0,
isInput,
kAudioDevicePropertyPreferredChannelLayout,
&theSize,
&ignored);
if( status )
{
return nil;
}
retVal = malloc(theSize);
status = AudioDeviceGetProperty(deviceID,
0,
isInput,
kAudioDevicePropertyPreferredChannelLayout,
&theSize,
retVal);
if( status )
{
return nil;
}
else
{
return [[[DSSAudioChannelLayout alloc]
initWithAudioChannelLayout:retVal] autorelease];
}
}
Copying the information from the result of the previous method
- (id)initWithAudioChannelLayout:(AudioChannelLayout*)desc
{
if( desc && (self = [super init]) )
{
UInt32 totalSize = sizeof(AudioChannelLayout);
totalSize += (desc->mNumberChannelDescriptions - 1) *
sizeof(AudioChannelDescription);
audioChannelLayout = calloc(1, totalSize);
memmove(audioChannelLayout, desc, totalSize);
}
return self;
}
Copying the information from an AudioChannelDescription
- (id)initWithAudioChannelDescription:(AudioChannelDescription*)desc
{
if( desc && (self = [super init]) )
{
audioChannelDescription = calloc(1, sizeof(AudioChannelDescription));
memmove(audioChannelDescription, desc,
sizeof(AudioChannelDescription));
}
return self;
}
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.