GenericOutput vs DefaultOutput problems...
GenericOutput vs DefaultOutput problems...
- Subject: GenericOutput vs DefaultOutput problems...
- From: Keith Hamel <email@hidden>
- Date: Sun, 31 Oct 2004 11:25:19 -0800
Dear List:
I have an application that plays audio files (which are embedded in a score) - to do this I adapted the QTSoundFilePlayer code example (from Kurt Regis). This works very well -- each soundfile is put on a separate thread and the output is directed to the DefaultAudioOutput...
Now I want to be able to write the performance of all the overlapping soundfiles to disk (i.e. Bounce To Disk), and I have looked at a bunch of the relevant example files (DiskWriterAUGraph, AudioFile Utilities, etc.... and have still not had any luck getting these two operations to work together.... (i.e. playing multiple files at different times on different threads && writing the performance as an AIFF file)
The DiskWriterAUGraph creates an AUGraph which sets up a GenericOutput which doesn't produce any sound, but allows the audio to be converted and saved as an AIFF file. If I switch it to a kAudioUnitSubType_DefaultOutput - the object longer works (a thread error occurs)
// CODE EXCERPT FROM DiskWriterAUGraph object --
ComponentDescription cd;
OSStatus result;
cd.componentType = kAudioUnitType_Output;
cd.componentSubType = kAudioUnitSubType_GenericOutput; // this was tried as kAudioUnitSubType_DefaultOutput
cd.componentManufacturer = kAudioUnitManufacturer_Apple;
cd.componentFlags = 0;
cd.componentFlagsMask = 0;
result = AUGraphNewNode (mAUGraph, &desc, 0, NULL, &mOutputNode);
THROW_RESULT("AUGraphNewNode: Output")
result = AUGraphGetNodeInfo (mAUGraph, mOutputNode, NULL, NULL, NULL, &mOutputUnit);
THROW_RESULT("AUGraphGetNodeInfo");
.....
If I try to connect my QTSoundFilePlayer objects to this AUGraph or to the Output Unit, I get errors when I try to setup the callbackProc in the QTSoundFilePlayer - it seems to need a real Output Unit (eg. DefaultOutput) not a GenericOutput...
i.e.:
inputCallbackStruct.inputProc = renderCallback;
inputCallbackStruct.inputProcRefCon = self;
err = AudioUnitSetProperty(mOutputUnit, kAudioUnitProperty_SetInputCallback, kAudioUnitScope_Input, 0, &inputCallbackStruct, sizeof(inputCallbackStruct));
generates an error...
Sorry to be so long-winded... Basically the soundfile player object needs to use a DefaultOutput and the diskwriter object needs to use a DefaultOutput...
Does anyone have any thoughts on how I might get around this. I have gone around in circles for a couple of days now and I've tried everything I can think of -- there doesn't seem to be much documentation on GenericOutput
Thanks, Keith Hamel
_______________________________________________
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