MyVolumeUnit example.. does not 'pan'
MyVolumeUnit example.. does not 'pan'
- Subject: MyVolumeUnit example.. does not 'pan'
- From: Michael Hanna <email@hidden>
- Date: Sun, 6 Mar 2005 15:16:19 -0500
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?
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