• 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: Host callback
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Host callback


  • Subject: Re: Host callback
  • From: Marc Poirier <email@hidden>
  • Date: Fri, 4 Mar 2005 09:03:47 -0500

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
  • Follow-Ups:
    • Re: Host callback
      • From: email@hidden
References: 
 >Host callback (From: email@hidden)
 >Re: Host callback (From: Pavol Markovic <email@hidden>)
 >Re: Host callback (From: email@hidden)

  • Prev by Date: Re: AudioUnit UI Cocoa, Carbon, Compositing?
  • Next by Date: Re: Host callback
  • Previous by thread: Re: Host callback
  • Next by thread: Re: Host callback
  • Index(es):
    • Date
    • Thread