• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: remoteIO unit not entering input callback in AUGraph
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: remoteIO unit not entering input callback in AUGraph


  • Subject: Re: remoteIO unit not entering input callback in AUGraph
  • From: Alex Wiltschko <email@hidden>
  • Date: Fri, 29 Jan 2010 01:18:02 -0500

When I was fiddling, I played with using kOutputBus and could indeed enter the callback, but I couldn't shake an AudioUnitRender -50 error, which I gather is an umbrella error for improperly-formatted input to the function. That's probably an issue with my AudioBufferList that I'm passing. Pasted my callback code in below.

A couple notes:
1) grab the audio unit from the AUGraph within the callback because I'm afraid that the audio unit instance I got when I first set up the graph might expire. I had tried passing in the remoteIO unit, and the callback would run for a couple seconds and then fail. Am I being too paranoid here?
2) I tell the remoteIO unit to allocate its own buffers, hence setting NULL for auBufferlist.mBuffers[0].mDataOne. I tell the remoteIO unit to allocate its own buffers like so:
	flag = 0;
	err = AudioUnitSetProperty(ioUnit,
								kAudioUnitProperty_ShouldAllocateBuffer,
								kAudioUnitScope_Output,
								kInputBus,
								&flag,
								sizeof(flag));


Here's my callback code:

	OSStatus err;

	continuousCallbackData *cd		= (continuousCallbackData *)inRefCon;
	ringBuffer *secondStageBuffer	= cd->ssb; // secondStageBuffer, our ringBuffer which will hold the audio samples
	AUGraph graph					= cd->gr;

	// Grab the audio unit
	AUNode ioNode;
	AUGraphGetIndNode(graph, 0, &ioNode);
	AudioUnit ioUnit;
	err = AUGraphNodeInfo(graph, ioNode, NULL, &ioUnit);

	UInt32 numChannels;
	UInt32 sizeOfNumChannels = sizeof(numChannels);
	AudioSessionGetProperty(kAudioSessionProperty_CurrentHardwareInputNumberChannels, &sizeOfNumChannels, &numChannels);

	AudioBufferList auBufferList;
	auBufferList.mNumberBuffers = numChannels;
	for (int i=0; i<numChannels; ++i) {
		auBufferList.mBuffers[i].mNumberChannels = 1;
		auBufferList.mBuffers[i].mDataByteSize= inNumberFrames * sizeof(SInt16);
		auBufferList.mBuffers[i].mData= NULL;
	}

	NSLog(@"Going to render...");
	err = AudioUnitRender(ioUnit,
						   ioActionFlags,
						   inTimeStamp,
						   inBusNumber,
						   inNumberFrames,
						   &auBufferList);
	NSLog(@"Finished rendering with error %d", err); // returns -50

	SInt16 *incomingAudio = auBufferList.mBuffers[0].mData;
	NSLog(@"Sample first value: %f", incomingAudio[0]); // EXC_BAD_ACCESS on accessing incomingAudio[0]

	return err;

Again, a very similar version of this callback worked swimmingly before switching to AUGraphs... any general principles I'm missing here?

Alex


On Jan 29, 2010, at 12:31 AM, Doug Wyatt wrote:

>
> On Jan 28, 2010, at 19:48 , Alex Wiltschko wrote:
>
>>
>> 	// Register a callback with the AUNode
>> 	err = AUGraphSetNodeInputCallback (graph,
>> 									   ioNode,
>> 									   kInputBus,
>> 									   &playbackCallbackStruct);
>
> You want to connect to kOutputBus (0). We should be generating an error either here or when you initialize a graph but we're not, sorry.
>
> Doug
>

 _______________________________________________
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

References: 
 >remoteIO unit not entering input callback in AUGraph (From: Alex Wiltschko <email@hidden>)
 >Re: remoteIO unit not entering input callback in AUGraph (From: Doug Wyatt <email@hidden>)

  • Prev by Date: Re: remoteIO unit not entering input callback in AUGraph
  • Next by Date: Assigning a callback and enabling playthru on remoteIO node
  • Previous by thread: Re: remoteIO unit not entering input callback in AUGraph
  • Next by thread: Assigning a callback and enabling playthru on remoteIO node
  • Index(es):
    • Date
    • Thread