• 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: 'pass through' audio units
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 'pass through' audio units


  • Subject: Re: 'pass through' audio units
  • From: Stephen Davis <email@hidden>
  • Date: Thu, 31 May 2007 13:45:55 -0700

On May 31, 2007, at 1:20 PM, Justin Carlson wrote:

Hi Patrick and Patrick,

Wouldn't this be essentially the same as an "amplifier" audio unit with unity gain?

Yes - here is the (unverified) code to pass the samples through. The example could be improved and is essentially the default starter AU with a few things removed. This is based on AUKernelBase's Process which is used with AUEffectBase, so you should be able to get started immediately.


void BypassAU::Process( const Float32 *inSourceP, Float32 *inDestP, UInt32 inFramesToProcess, UInt32 inNumChannels, bool &ioSilence )
{
UInt32 nSampleFrames = inFramesToProcess;
const Float32 *sourceP = inSourceP;
Float32 *destP = inDestP;
// Insert any per-buffer analysis code
while (nSampleFrames-- > 0)
{
Float32 inputSample = *sourceP;
sourceP += inNumChannels;
Float32 outputSample = inputSample;
// Insert any per-sample analysis code
*destP = outputSample;
destP += inNumChannels;
}
}


I think your approach would work fine for many applications. An AU that performs this operation and has no UI requires extremely little overhead. I tested hundreds of such instances (quite a while ago) on a PowerMac G4, the demand was surprisingly small.

Note that this is wasteful of CPU if the AU is configured for "in- place" processing which it often is. This means the input and output buffers are the same memory so you could optimize your code in this case by not doing any writing. However, you don't have access to that flag inside AUKernelBase() so you'd just have to look at the inSourcP and inDestP pointers. FYI, the function call ProcessesInPlace() in AUEffectBase is where you would normally get that state information.


hth,
stephen
_______________________________________________
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: 
 >Re:'pass through' audio units (From: Justin Carlson <email@hidden>)

  • Prev by Date: Re:'pass through' audio units
  • Next by Date: Re: Observing CurrentPlayTime in AUScheduledSoundPlayer
  • Previous by thread: Re:'pass through' audio units
  • Next by thread: Observing CurrentPlayTime in AUScheduledSoundPlayer
  • Index(es):
    • Date
    • Thread