Re: Error on AUGraphInitialize
Re: Error on AUGraphInitialize
- Subject: Re: Error on AUGraphInitialize
- From: William Stewart <email@hidden>
- Date: Wed, 13 Aug 2008 12:37:40 -0700
kAudioUnitErr_FormatNotSupported = -10868,
So there is something amiss with the format that you are providing to
the AUTP unit.
Try doing a CAShow(theGraph).
I think the problem will be that you are trying to give the AUTP an
input format of mono, but it has a default output format of stereo.
So, you would really want to propogate the fileFormat num channels and
sample rate to the input of the AUTP and its output. Once you have
that format on its output, it will propagate that format to the input
format of the output unit...
Hmm... except on nice optimisation you can make here is this:
Get the sample rate of the output of the output unit.
Set that sample rate as the output sample rate of the AUTP - so the
AUTP will do a sample rate conversion for you and this saves a
possible sample rate conversion
The CAShow(theGraph) after you've done all this will show you the
different format settings as you work your way through this
Bill
On Aug 13, 2008, at 12:22 PM, Todd Stanley wrote:
Hello All,
I'm having some difficulty playing some audio files while using the
TimePitch format converter. With some files, specifically 16k, 1
channel aac files, I get the error -10868 on the call
AUGraphInitialize. When I remove the TimePitch node the audio plays
correctly. Can anyone shed some light on why I might be having a
problem with the TimePitch converter? When I model this setup in AU
Lab everything works okay. Any insights would be appreciated.
Todd
playing file: /Users/toddstan/Library/Livescribe/Library/
2594160251165/0x1878f237fa2426fc_0/sessions/PRS-1cc18fee7/audio-0.aac
format: AudioStreamBasicDescription: 1 ch, 16000 Hz, 'aac
' (0x00000000) 0 bits/channel, 0 bytes/packet, 1024 frames/packet, 0
bytes/frame
error -10868: AUGraphInitialize
//------------------------------------------------------------------------------------------------------------------------
void MakeSimpleGraph (AUGraph &theGraph, CAAudioUnit &fileCAAU,
CAStreamBasicDescription &fileFormat, AudioFileID audioFile)
{
AUNode outputNode, timePitchNode, fileNode;
AudioUnit outputAU, timePitchAU, fileAU;
CAComponentDescription cd;
printf ("format: "); fileFormat.Print();
XThrowIfError (NewAUGraph (&theGraph), "NewAUGraph");
//--------------OutputNode--------------
cd = CAComponentDescription(kAudioUnitType_Output,
kAudioUnitSubType_HALOutput, kAudioUnitManufacturer_Apple);
XThrowIfError (AUGraphAddNode (theGraph, &cd, &outputNode),
"AUGraphAddNode");
XThrowIfError(AUGraphNodeInfo(theGraph, outputNode, NULL,
&outputAU), "AUGraphNodeInfo");
//--------------TimePitch--------------
cd = CAComponentDescription(kAudioUnitType_FormatConverter,
kAudioUnitSubType_TimePitch, kAudioUnitManufacturer_Apple);
XThrowIfError(AUGraphAddNode(theGraph, &cd, &timePitchNode),
"AUGraphAddNode");
XThrowIfError(AUGraphNodeInfo(theGraph, timePitchNode, NULL,
&timePitchAU), "AUGraphNodeInfo");
//--------------FileNode--------------
cd = CAComponentDescription(kAudioUnitType_Generator,
kAudioUnitSubType_AudioFilePlayer, kAudioUnitManufacturer_Apple);
XThrowIfError (AUGraphAddNode (theGraph, &cd, &fileNode),
"AUGraphAddNode");
XThrowIfError (AUGraphOpen (theGraph), "AUGraphOpen");
XThrowIfError (AUGraphNodeInfo(theGraph, fileNode, NULL,
&fileAU), "AUGraphNodeInfo");
fileCAAU = CAAudioUnit (fileNode, fileAU);
XThrowIfError (fileCAAU.SetNumberChannels
(kAudioUnitScope_Output, 0, fileFormat.NumberChannels()),
"SetNumberChannels");
XThrowIfError (fileCAAU.SetSampleRate (kAudioUnitScope_Output,
0, fileFormat.mSampleRate), "SetSampleRate");
XThrowIfError
(fileCAAU.SetProperty(kAudioUnitProperty_ScheduledFileIDs,
kAudioUnitScope_Global, 0, &audioFile, sizeof(audioFile)),
"SetScheduleFile");
//--------------Connect the graph--------------
XThrowIfError (AUGraphConnectNodeInput (theGraph,
fileNode, 0,
timePitchNode, 0), "AUGraphConnectNodeInput");
XThrowIfError (AUGraphConnectNodeInput (theGraph,
timePitchNode, 0,
outputNode, 0), "AUGraphConnectNodeInput");
XThrowIfError(AUGraphInitialize(theGraph), "AUGraphInitialize");
}
_______________________________________________
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