Re: Host callback
Re: Host callback
- Subject: Re: Host callback
- From: email@hidden
- Date: Fri, 04 Mar 2005 15:17:04 +0000
Thank you kindly!
Ralph
On Friday, March 04, 2005, at 02:03PM, Marc Poirier <email@hidden> wrote:
>IsTransportStateProcSafe() isn't in the CoreAudio SDK. I have put it
>in my DFX AU Utilities library:
>
>http://destroyfx.org/dfx-au-utilities.html
>
>Ummm, however, I see now that I haven't posted updated
>source/library/docs there since that and a few other changes. You can
>get the latest source from our cvs repository (linked from the page),
>and dfx-au-utilities.c will have that function. I'll try and update
>the documentation and post a new download of the library as soon as I
>can...
>
>Marc
>
>
>
>On Mar 3, 2005, at 10:56 AM, email@hidden wrote:
>
>> Thank you Guys for your help. I could not make it compile though.
>> First I added a declaration in the header file:
>>
>> HostCallbackInfo mHostCallbackInfo;
>>
>> then I put example code within Process function but compiler says:
>>
>> error: 'IsTransportStateProcSafe' undeclared (first use this function).
>> Do excuse me for (probable) newbie cpp issues.
>> Code is as follows on both files, help much appreciated.
>>
>> Ralph
>>
>> //////////////////////////////////////////////////////////////////////
>> ///////////////////////////////////////////////////
>>
>> mAU.h
>>
>> protected:
>> class FAUKernel : public AUKernelBase // most of the real work
>> happens here
>> {
>> public:
>> mAUKernel(AUEffectBase *inAudioUnit )
>> : AUKernelBase(inAudioUnit)
>> {
>>
>> }
>>
>> // *Required* overides for the process method for this effect
>> // processes one channel of interleaved samples
>> virtual void Process( const Float32 *inSourceP,
>> Float32 *inDestP,
>> UInt32 inFramesToProcess,
>> UInt32 inNumChannels,
>> bool &ioSilence);
>>
>> virtual void Reset();
>>
>> //private: //state variables...
>> HostCallbackInfo mHostCallbackInfo;
>> };
>> };
>>
>> //////////////////////////////////////////////////////////////////////
>> ///////////////////////////////////////////////////
>>
>> mAU.cpp
>>
>> void mAU::mAUKernel::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 );
>>
>> bool haveSamplePos = false;
>> Float64 outCurrentSampleInTimeLine;
>>
>> if ( IsTransportStateProcSafe() &&
>> mHostCallbackInfo.transportStateProc )
>> {
>> OSStatus result =
>> mHostCallbackInfo.transportStateProc(mHostCallbackInfo.hostUserData,
>> NULL, NULL, &outCurrentSampleInTimeLine, NULL, NULL, NULL);
>> if ( result == noErr )
>> {
>> haveSamplePos = true;
>> }
>> }
>>
>> 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
>>
>> // here's where you do your DSP work
>> 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