• 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: MyVolumeUnit example.. does not 'pan'
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MyVolumeUnit example.. does not 'pan'


  • Subject: Re: MyVolumeUnit example.. does not 'pan'
  • From: Marc Poirier <email@hidden>
  • Date: Sun, 6 Mar 2005 17:17:25 -0500

On Mar 6, 2005, at 3:16 PM, Michael Hanna wrote:

Hi all, This is from the Audio_Unit_Effect_with_Cocoa_View, the basic AU that changes the gain. I modified it so that one channel has increasing gain from 0.0 -> 1.0 and the other channel has decreasing gain from 0.0->1.0. My plan was to do output = input * (1-gain) for even samples, and output = input * gain for odd ones.

The result is that the slider has no effect on gain at all. What wrong assumptions am I making?

1) That there is "one channel" and "the other channel" (i.e. that you will be rendering stereo). I haven't looked at the source for this specific project yet, but generally an effect AU that is making use of kernels is designed to process any number of channels (unless the developer goes out of her way to make that not possible), and its up to the host to configure that, and that configuration can change during the life span of the AU, etc.


2) That a kernel-based effect AU can handle inter-channel dependencies (like panning). It can't. The idea behind using kernels is that each channel can do its DSP without knowing anything about the other channels, or how many channels there are, etc. The advantages are a simple abstraction of your DSP, the ability to handle any number of channels without doing any work to make that happen (AUEffectBase handles creating and freeing new kernels as necessary), etc.

3) That you will ever get interleaved audio. You won't. That was obsoleted with AU v2; AUs (except converter AUs) now only get non-interleaved audio. And no one makes v1 AUs, no hosts support them, etc., they are totally obsolete.

If you want to make a stereo panner, then:
1) you need to declare your SupportedNumChannels() as only stereo, and
2) you will need to override ProcessBufferLists() to do your DSP and ditch the kernels.


Marc



Michael

void MyVolumeUnit::MyVolumeUnitKernel::Process( const Float32 *inSourceP,
Float32 *inDestP,
UInt32 inFramesToProcess,
UInt32 inNumChannels,
bool &ioSilence )
{


//This code will pass-thru the audio data.
//This is where you want to process data to produce an effect.

UInt32 nSampleFrames = inFramesToProcess;
const Float32 *sourceP = inSourceP;
Float32 *destP = inDestP;
Float32 gain = GetParameter( kParam_One );
//printf("nSampleFrames %u",nSampleFrames);
while (nSampleFrames-- > 0) {
Float32 inputSample = *sourceP;
sourceP += inNumChannels; // advance to next frame (e.g. if stereo, we're advancing 2 samples);
// we're only processing one of an arbitrary number of interleaved channels
Float32 outputSample = inputSample * gain;


		if(nSampleFrames %2 == 0)
		{
			outputSample = inputSample * (1-gain);
			//printf("nSampleFrames even %u\n", nSampleFrames);
		}
		else{
			outputSample = inputSample * gain;
			//printf("nSampleFrames odd %u\n", nSampleFrames);
		}

			// here's where you do your DSP work
			//Float32 outputSample = inputSample * gain;
		//Float32 outputSample = inputSample * gain;
		*destP = outputSample;
		destP += inNumChannels;

	}
}

_______________________________________________ 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: 
 >MyVolumeUnit example.. does not 'pan' (From: Michael Hanna <email@hidden>)

  • Prev by Date: Re: MyVolumeUnit example.. does not 'pan'
  • Next by Date: Re: Newb: MultitapAU UI does not appear
  • Previous by thread: Re: MyVolumeUnit example.. does not 'pan'
  • Next by thread: Re: MyVolumeUnit example.. does not 'pan'
  • Index(es):
    • Date
    • Thread