Re: Custom Audio Units on the iPhone
Re: Custom Audio Units on the iPhone
- Subject: Re: Custom Audio Units on the iPhone
- From: Thomas Zoechling <email@hidden>
- Date: Wed, 26 Nov 2008 11:08:13 +0100
I removed all the unnecessary code and ended up with this:
OSErr err = noErr;
err = NewAUGraph(&graph);
NSAssert(err == noErr, @"Error creating graph.");
mixerDescription.componentFlags = 0;
mixerDescription.componentFlagsMask = 0;
mixerDescription.componentType = kAudioUnitType_Mixer;
mixerDescription.componentSubType = kAudioUnitSubType_AU3DMixerEmbedded;
mixerDescription.componentManufacturer = kAudioUnitManufacturer_Apple;
err = AUGraphAddNode(graph, &mixerDescription, &mixerNode);
NSAssert(err == noErr, @"Error creating mixer node.");
outputDescription.componentFlags = 0;
outputDescription.componentFlagsMask = 0;
outputDescription.componentType = kAudioUnitType_Output;
outputDescription.componentSubType = kAudioUnitSubType_GenericOutput;
outputDescription.componentManufacturer = kAudioUnitManufacturer_Apple;
err = AUGraphAddNode(graph, &outputDescription, &outputNode);
NSAssert(err == noErr, @"Error creating output node.");
err = AUGraphOpen(graph);
NSAssert(err == noErr, @"Error opening graph.");
AURenderCallbackStruct callback;
callback.inputProc = TestCallback;
callback.inputProcRefCon = NULL;
/*err = AUGraphNodeInfo(graph, mixerNode, &mixerDescription,
&mixerUnit);
NSAssert(err == noErr, @"Error obtaining mixer unit.");
err = AudioUnitSetProperty(mixerUnit,
kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, 0,
&callback, sizeof(callback)); */
err = AUGraphSetNodeInputCallback(graph, mixerNode, 0, &callback);
NSAssert(err == noErr, @"Error setting render callback.");
err = AUGraphConnectNodeInput(graph, mixerNode, 0, outputNode, 0);
NSAssert(err == noErr, @"Error connecting mixer to output.");
err = AUGraphInitialize(graph);
NSAssert(err == noErr, @"Error initializing graph.");
err = AUGraphStart(graph);
NSAssert(err == noErr, @"Error starting graph.");
CAShow(graph);
This is the TestCallback I provide:
OSStatus TestCallback(void* inRefCon, AudioUnitRenderActionFlags*
ioActionFlags, const AudioTimeStamp* inTimeStamp, UInt32 inBusNumber,
UInt32 inNumberFrames, AudioBufferList* ioData)
{
NSLog(@"called!");
return noErr;
}
CAShow displays:
AudioUnitGraph 0x104B414:
Member Nodes:
node 1: aumx 3dem appl, instance 0x57d810 O I
node 2: auou genr appl, instance 0x58f1e0 O I
Connections:
node 1 bus 0 => node 2 bus 0 [2 ch, 44100 Hz]
Input Callbacks:
{0x373b, 0x0} => node 1 bus 0 [1 ch, 44100 Hz]
CurrentState:
mLastUpdateError=0, eventsToProcess=F, isRunning=T
But still my Callback does not get called :(
--thomas
_______________________________________________
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