• 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: AUGraph with a single node
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AUGraph with a single node


  • Subject: Re: AUGraph with a single node
  • From: Beinan Li <email@hidden>
  • Date: Thu, 30 May 2013 15:17:38 -0400

Thanks Chris. 

I noticed another difference between using a single AU directly and within a graph.

I tried to assign two separate callbacks (a recording one and a render one) to the AU, but this only works without a graph. Where I use 

AURenderCallbackStruct callbackDescriptor;

callbackDescriptor.inputProc = RecordingCallback;

callbackDescriptor.inputProcRefCon = this;

AudioUnitSetProperty(myOutputUnit,
kAudioOutputUnitProperty_SetInputCallback,
kAudioUnitScope_Global,
InputBus,
&callbackDescriptor,
sizeof(callbackDescriptor));

// and 

callbackDescriptor.inputProc = RenderCallback;

callbackDescriptor.inputProcRefCon = this;

AudioUnitSetProperty(myOutputUnit,

kAudioUnitProperty_SetRenderCallback,
kAudioUnitScope_Global,
OutputBus,
&callbackDescriptor,
sizeof(callbackDescriptor));
// where InputBus = 1, OutputBus = 0.

The above works fine once I call AudioOutputUnitStart(myOutputUnit); The callbacks start working right away.

However, with a graph, I tried

callbackDescriptor.inputProc = RecordingCallback;

callbackDescriptor.inputProcRefCon = this;

AUGraphSetNodeInputCallback(myGraph, myOutputNode, InputBus, &callbackDescriptor );


callbackDescriptor.inputProc = RenderCallback;

callbackDescriptor.inputProcRefCon = this;

AUGraphSetNodeInputCallback(myGraph, myOutputNode, OutputBus, &callbackDescriptor );

and also tried

callbackDescriptor.inputProc = RecordingCallback;

callbackDescriptor.inputProcRefCon = this;

AudioUnitSetProperty(myOutputUnit,
kAudioOutputUnitProperty_SetInputCallback,
kAudioUnitScope_Global,
InputBus,
&callbackDescriptor,
sizeof(callbackDescriptor));

callbackDescriptor.inputProc = RenderCallback;

callbackDescriptor.inputProcRefCon = this;

AUGraphSetNodeInputCallback(myGraph, myOutputNode, OutputBus, &callbackDescriptor );


// myOutputNode was where I place myOutputUnit in the graph.

Neither graph attempts worked after I called AUGraphStart(myGraph), i.e., my RecordingCallback was never called.

Am I doing wrong or is this expected?

Thanks,
Beinan



On Thu, May 30, 2013 at 8:30 AM, Chris Adamson <email@hidden> wrote:
Yeah, I think when there's only one unit, a graph can seem like overkill, but I don't think there's any significant cost to it, and creating an AUNode from the AudioComponentDescription is slightly less baroque than doing the AudioComponentFindNext(NULL, inDesc) dance. IMO, it's an arbitrary matter of taste/style; either's fine.

Possible you've also seen less use of AUGraphs on iOS because prior to iOS 5's introduction of effect units, there weren't that many particularly interesting audio units on iOS.

--Chris

On May 29, 2013, at 10:59 PM, Beinan Li <email@hidden> wrote:

Sorry, I accidentally replied to Chris himself and forgot to "reply to all" . Here is a repost.

Hi Chris,

First of all, kudos to your book (Learning CoreAudio: A Hand on Guide...) which has served as my very first CoreAudio learning resource (and still one of the main references)!

In fact the examples I talked about include the Ch10_iOSPlayThrough example of your book where only one AU is used, no graph. I'm not sure if my copy is up to date though. I got the book and code in 2011.

The Xcode iOS example aurioTouch2, which does input play through, and waveform/spectrum/spectrogram visualization, also uses a single AU, no graph.

Hence my question. I do realize that my original question was a little rushed up. AUGraph is of course needed when multiple AUs are required to form a processing chain. My concern at hand is a specific case: I have really just one AU in a graph.

Thanks!


On Wed, May 29, 2013 at 6:29 PM, Chris Adamson <email@hidden> wrote:
Almost all the iOS sample code from my blog, conference talks, and the book uses graphs. I'm unaware of any iOS-specific reason to not use AUGraphs.

Where are you seeing these examples? Stack Overflow?

--Chris

On May 29, 2013, at 3:04 PM, Beinan Li <email@hidden> wrote:

Also, from searching online, I rarely see any iOS examples using AUGraph. So I suspect that using a graph might not be the preferred way. Is that so? I know that custom AU is not supported on iOS and the number of built-in AUs is small. So could I say due to those reasons, AUGraph is not very practical?



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)

This email sent to email@hidden


 _______________________________________________
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: 
 >AUGraph with a single node (From: Beinan Li <email@hidden>)
 >Re: AUGraph with a single node (From: Chris Adamson <email@hidden>)
 >Re: AUGraph with a single node (From: Beinan Li <email@hidden>)
 >Re: AUGraph with a single node (From: Chris Adamson <email@hidden>)

  • Prev by Date: Re: Adjust the volume of individual airplay devices
  • Previous by thread: Re: AUGraph with a single node
  • Next by thread: Adjust the volume of individual airplay devices
  • Index(es):
    • Date
    • Thread