• 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: AudioUnitKernal constructor called twice...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AudioUnitKernal constructor called twice...


  • Subject: Re: AudioUnitKernal constructor called twice...
  • From: Brian Willoughby <email@hidden>
  • Date: Fri, 19 Aug 2011 01:06:43 -0700

On Aug 19, 2011, at 00:34, email@hidden wrote:
For processing audio on two channels in the same function (stereo panning, for example), it seems overriding ProcessBufferLists() is the way to go.

Simon,

The most important thing you can do if you want stereo processing is to either work within the kernel system defined by AUEffectBase, or simply avoid that class and use AUBase instead. In other words, if you're considering overriding ProcessBufferLists(), then you should really consider using RenderBus() in a subclass of AUBase.

Note that it isn't so difficult to work with kernels, even if you want to process each channel differently. Stereo panning is nothing more than simple gain processing where one channel's volume is inverted with respect to the other. There are a couple of potential solutions:

A) You can handle this by storing the pan position in the master object and then use the kernel index to decide whether to use the pan directly or inversely to set the gain. Off the top of my head, though, I'm not sure how easy it is for a kernel object to determine it's own index, but I seem to recall doing so in the past. The bulk of your kernel code would be generic, except for the initial determination of gain based on channel index.

B) A totally different solution would be to have a gain parameter in the kernel objects, such that each channel has an independent gain. Then, when your master object receives a pan position change, your code can calculate two gains (or any number of gains) and store each independent gain value in the appropriate kernel object. Thus, when the kernel executes, it simply applies the local gain to an individual channel.

The advantage of working within the kernel system is that you maintain all of the carefully designed behavior that Apple's CoreAudio team has developed within the AUEffectBase class. Do not underestimate the advantages of having your plugin automatically work with quad, 5.1 and other surround formats beyond stereo. You also avoid bucking the standard of non-interleaved audio data, i.e., you're not trying to go back to the deprecated interleaved data scheme.

There are certainly multi-channel effects where kernel coding might prove too difficult, thus tipping the scale towards working under AUBase directly. However, with careful placement of state variables in the global objects and kernels objects, as appropriate, I suspect that you'd be hard pressed to come up with an example that would not work.

Brian Willoughby
Sound Consulting

_______________________________________________
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


  • Follow-Ups:
    • Re: AudioUnitKernal constructor called twice...
      • From: "email@hidden" <email@hidden>
References: 
 >AudioUnitKernal constructor called twice... (From: "email@hidden" <email@hidden>)
 >Re: AudioUnitKernal constructor called twice... (From: tahome izwah <email@hidden>)
 >Re: AudioUnitKernal constructor called twice... (From: Brian Willoughby <email@hidden>)
 >Re: AudioUnitKernal constructor called twice... (From: "email@hidden" <email@hidden>)

  • Prev by Date: Re: AudioUnitKernal constructor called twice...
  • Next by Date: Re: How long do render callbacks have to execute?
  • Previous by thread: Re: AudioUnitKernal constructor called twice...
  • Next by thread: Re: AudioUnitKernal constructor called twice...
  • Index(es):
    • Date
    • Thread