Re: Why Does Mono File Play as Stereo?
Re: Why Does Mono File Play as Stereo?
- Subject: Re: Why Does Mono File Play as Stereo?
- From: Bob Ingraham <email@hidden>
- Date: Tue, 24 Feb 2009 22:13:35 -0700 (MST)
But, but, but, when I was playing around with the Audio Queue Services example, I was able to get mono channel playback to work by using the Audio Queue's Channel Layout property (using a bitmap layout and the "Mono" flag.)
So, that led me to believe that I had two problems to solve with Audio Units:
1. Achieve single-channel playback using the Audio Unit's Channel Layout Property, and then,
2. Achieve alternate channel playback using the Audio Unit's Channel Map property (which was the subject of your previous e-mail.)
So, what you're saying is that I can achieve both goals with just the Channel Map property alone? If so, I'm a believer (No arguments here!)
I am, however, still confused on a couple of points with regards to setting the Channel Map property:
1. IF:
(a) I have an audio file (say, mp3,) that has 1 channel (mono) @ 44.1kHz, AND
(b) I have an audio output device with 16 discrete/physical output channels, AND
(c) I wish to play audio file channel 0 (because it only has one channel) on physical output device channel 4, THEN
(d) I have to create a channel map array that contains 16 elements (i.e., one array element per output device channel.) (Correct?) AND
(e) I have to set all channel map array elements to -1 (unused) EXCEPT channel map element [4], which should be set to 0 (because I want physical output device channel 4 to play audio file channel 0, ergo, channelMap[4] = 0) (Correct?) AND
(f) I have to set the ChannelMap property of Element 0 of the INPUT-side (Scope_Input) of the Output Unit. (Correct?) THEN
(g) Everything should be honky-dory: We laugh, we cry, we all go home happy.
2. Why do I set ChannelMap property on the Input_Scope side of the Output Unit? Why not the Output_Scope side of the Output Unit? I don't understand the reasoning behind this choice of scope/element.
3. Why Element zero of the Input_Scope?
4. If I am using the AUHAL as the output unit in an AudioGraph, then when is the best time to set the Channel Map property of the output unit? After AUGraphOpen(), AUGraphInitialize(), or somewhere else?
Bob
----- Original Message -----
From: "William Stewart" <email@hidden>
To: "Bob Ingraham" <email@hidden>
Cc: "CoreAudio API" <email@hidden>
Sent: Tuesday, February 24, 2009 7:07:40 PM GMT -07:00 US/Canada Mountain
Subject: Re: Why Does Mono File Play as Stereo?
you need to set the channel map - see my previous email on exactly
this topic
On Feb 24, 2009, at 4:23 PM, Bob Ingraham wrote:
> I have an mp3 file that was recorded mono (1 channel), 44.1kHz.
>
> When I play it with the SimpleSDK/PlayFile demo, it plays on both
> left/right channels of the output device.
>
> I tried modifying the PlayFile SimpleGraph() routine to modify the
> AUHAL output unit using the kAudioFilePropertyChannelLayout
> property, but it says that I am evil and I returns error -10851
> (kAudioUnitErr_InvalidPropertyValue).
>
> What am I doing wrong?
>
> AudioChannelLayout chanLayout;
> AUNode outputNode;
> AudioUnit auOutput;
>
> AUGraphAddNode (theGraph, &cd, &outputNode);
> AUGraphOpen (theGraph);
> AUGraphNodeInfo(theGraph, outputNode, &myCd, &auOutput);
>
> // Set channel layout
> memset(&chanLayout, 0, sizeof(chanLayout));
> chanLayout.mChannelLayoutTag =
> kAudioChannelLayoutTag_UseChannelBitmap | kAudioChannelLayoutTag_Mono;
> chanLayout.mChannelBitmap = kAudioChannelBit_Left;
>
> err = AudioUnitSetProperty(auOutput,
> kAudioUnitProperty_AudioChannelLayout, kAudioUnitScope_Output, 1,
> &chanLayout, sizeof(chanLayout));
> if (err != noErr)
> {
> printf("Failed to set Audio Channel Layout: %d\n", err);
> }
>
> Thanks,
> Bob
> _______________________________________________
> 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
_______________________________________________
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