Re: Speaker setup + possible typo in CoreAudioTypes.h label value?
Re: Speaker setup + possible typo in CoreAudioTypes.h label value?
- Subject: Re: Speaker setup + possible typo in CoreAudioTypes.h label value?
- From: Derk-Jan Hartman <email@hidden>
- Date: Thu, 24 Mar 2005 04:42:33 +0100
On 23 mrt 2005, at 22:00, Derk-Jan Hartman wrote:
On 23 mrt 2005, at 21:19, James McCartney wrote:
On Mar 23, 2005, at 11:40 AM, William Stewart wrote:
On 23/03/2005, at 8:51 AM, Derk-Jan Hartman wrote:
But to me it's sheer impossible to find out what channels should be
downmixed to. I mean how am i supposed to know what channel is LFE,
what channel is the Center speaker.
Well, that's all clearly specified either:
(1) In the bitmap
(2) In the channel descriptions
(3) Implied in the layout tag
[...]
Aaaaah, this looks like it's more what I was looking for. Thank you
for this. I knew there had to be a way under 350 lines of switch case
statements.
For ppl who didn't follow this thread. This queries the current
speakersetup for the device, it does NOT *set* a channel layout for the
data provided to the AUHAL.
So for anyone else who ever wants to do this, you'll be looking for
something like this:
/* Get the channel layout */
AudioChannelLayout layout;
/* Notice that this query is on the output scope of the AU and asks
for a Device property.
This was the only way i could get this working */
verify_noerr( AudioUnitGetPropertyInfo( p_sys->au_unit,
kAudioDevicePropertyPreferredChannelLayout,
kAudioUnitScope_Output,
0,
&i_param_size,
NULL ));
verify_noerr( AudioUnitGetProperty( p_sys->au_unit,
kAudioDevicePropertyPreferredChannelLayout,
kAudioUnitScope_Output,
0,
&layout,
&i_param_size ));
/* Lets fill out the ChannelLayout */
if( layout.mChannelLayoutTag ==
kAudioChannelLayoutTag_UseChannelBitmap)
{
msg_Dbg( p_aout, "bitmap defined channellayout" );
verify_noerr( AudioFormatGetProperty(
kAudioFormatProperty_ChannelLayoutForBitmap,
sizeof( UInt32), &layout.mChannelBitmap,
&i_param_size,
&layout ));
}
else if( layout.mChannelLayoutTag !=
kAudioChannelLayoutTag_UseChannelDescriptions )
{
msg_Dbg( p_aout, "layouttags defined channellayout" );
verify_noerr( AudioFormatGetProperty(
kAudioFormatProperty_ChannelLayoutForTag,
sizeof( AudioChannelLayoutTag ),
&layout.mChannelLayoutTag,
&i_param_size,
&layout ));
}
msg_Dbg( p_aout, "Layout of AUHAL has %d channels" ,
layout.mNumberChannelDescriptions );
p_aout->output.output.i_physical_channels = 0;
for( i = 0; i < layout.mNumberChannelDescriptions; i++ )
{
switch( layout.mChannelDescriptions[i].mChannelLabel )
{
case kAudioChannelLabel_Left:
p_aout->output.output.i_physical_channels |=
AOUT_CHAN_LEFT;
continue;
case kAudioChannelLabel_Right:
p_aout->output.output.i_physical_channels |=
AOUT_CHAN_RIGHT;
continue;
case kAudioChannelLabel_Center:
p_aout->output.output.i_physical_channels |=
AOUT_CHAN_CENTER;
continue;
case kAudioChannelLabel_LFEScreen:
p_aout->output.output.i_physical_channels |=
AOUT_CHAN_LFE;
continue;
case kAudioChannelLabel_LeftSurround:
p_aout->output.output.i_physical_channels |=
AOUT_CHAN_REARLEFT;
continue;
case kAudioChannelLabel_RightSurround:
p_aout->output.output.i_physical_channels |=
AOUT_CHAN_REARRIGHT;
continue;
case kAudioChannelLabel_LeftCenter:
p_aout->output.output.i_physical_channels |=
AOUT_CHAN_MIDDLELEFT;
continue;
case kAudioChannelLabel_RightCenter:
p_aout->output.output.i_physical_channels |=
AOUT_CHAN_MIDDLERIGHT;
continue;
case kAudioChannelLabel_CenterSurround:
p_aout->output.output.i_physical_channels |=
AOUT_CHAN_REARCENTER;
continue;
default:
msg_Warn( p_aout, "Unrecognized channel form provided
by driver: %d", layout.mChannelDescriptions[i].mChannelLabel );
}
}
---
Universiteit Twente
Derk-Jan Hartman (d.hartman at student.utwente dot nl)
http://home.student.utwente.nl/d.hartman
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden