Re: Not Setting Format results in multichannel playback success
Re: Not Setting Format results in multichannel playback success
- Subject: Re: Not Setting Format results in multichannel playback success
- From: Mike Hanna <email@hidden>
- Date: Sat, 8 Jul 2006 09:17:24 -0700
inline...
On 7-Jul-06, at 1:26 PM, Doug Wyatt wrote:
On Jul 6, 2006, at 23:24 , Mike Hanna wrote:
I finally have playback of multichannel audio with code based on
PlayFile.cpp.
Using AudioFileGetProperty(), I load a file into a buffer:
XThrowIfError (AudioFileGetProperty(fAudioFile,
kAudioFilePropertyDataFormat, &propsize, &fFileFormat),
"AudioFileGetProperty");
I could not get sound when playing a multichannel file; I thought
it was because I wasn't using SetFormat(), but it apparently it
causes an exception, of which kind I don't know:
http://paste.lisp.org/display/22194
/*** using SetFormat seems to cause an exception, any idea why? ***/
I finally decided to comment-out any code that calls
SetNumberChannels() or SetSampleRate(). Removing these results in
successful playback of multichannel audio, any idea why?
/*** commenting-out these lines results in successful playback of
multichannel audio, why? ***/
XThrowIfError( fFileAU.SetFormat( kAudioUnitScope_Input, 0,
fFileFormat ), "SetFormat" );
// printf ("makeGraph file in: ");
// XThrowIfError( fFileAU.SetFormat
( kAudioUnitScope_Output, 0, fFileFormat ), "SetFormat" );
// printf ("makeGraph file out: ");
These probably fail because fFileFormat is something other than
deinterleaved Float32.
I see, how do I convert the stream to deinterleaved Float32?
// prepare the file AU for playback
// set its output channels
// XThrowIfError (fFileAU.SetNumberChannels
(kAudioUnitScope_Output, 0, fFileFormat.NumberChannels()),
"SetNumberChannels");
// set the output sample rate of the file AU to be the
same as the file:
// XThrowIfError (fFileAU.SetSampleRate
(kAudioUnitScope_Output, 0, fFileFormat.mSampleRate),
"SetSampleRate");
It's not clear why these should fail before connecting and
initialization. What's the error?
There is no error. If I leave these lines in, anything above 2-
channel audio plays silent.
regards, Mike
Doug
--
Doug Wyatt
Core Audio, Apple
_______________________________________________
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