RE: Audio Units - newbie questions
RE: Audio Units - newbie questions
- Subject: RE: Audio Units - newbie questions
- From: "Muon Software Ltd - Dave" <email@hidden>
- Date: Tue, 11 Oct 2005 21:07:11 +0100
- Importance: Normal
> In render you are told which output bus you are rendering for.
Could you expand on that in a little more detail? does Render get called
multiple times for each output bus, or does it get called just once and I'm
supposed to check what busses I've been given and what buffers they contain?
so far my code assumes the latter.
> Not really just yet - but this something we're doing a bit of work on
> at the moment. In the meantime, feel free to ask questions.
OK
> Are you sure you are overiding this properly? Try adding a printf to
> the Init call in AUBase. What's Reset got to do with this?
My initialisation sequence does some (minimal) work in the constructor, and
the heavyweight stuff in Initialize. My Reset function can be called at any
time after the full intialisation has taken place. If it is called before
the full initialisation has taken place, it crashes - it simply wasn't
designed to work that way. The code for initialising and resetting the
plugin is common with the VST version and changing it seems like a kludge.
My Initialize protoype looks like this:
virtual ComponentResult Initialize();
The implementation looks like this:
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~
// CMuonTachyon::Initialize
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~
ComponentResult CMuonTachyon::Initialize()
{
m_fSampleRate=(double)GetOutput(0)->GetStreamFormat().mSampleRate;
m_nBlockSize=(int)GetMaxFramesPerSlice();
if (m_bInitialised==false)
{
getLock();
initprocess();
releaseLock();
m_ptrSynth->enableNonGuiIdle(false);
}
m_bInitialised=true;
return noErr;
}
initprocess is a private function that calls my synth's init and reset
functions with the samplerate and blocksize. This enables my synth class to
become fully initialised. Then it sets a flag m_bInitialised=true to show
that Initialize has been correctly called and the synth class is now ready
to use.
My Reset implementation looks like this:
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~
// CMuonTachyon::Reset
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~
ComponentResult CMuonTachyon::Reset(AudioUnitScope inScope, AudioUnitElement
inElement)
{
//auval can call reset before it calls initalise??
if (m_bInitialised==true)
{
m_fSampleRate=(double)GetOutput(0)->GetStreamFormat().mSampleRate;
m_nBlockSize=(int)GetMaxFramesPerSlice();
getLock();
m_ptrSynth->reset((int)m_fSampleRate,m_nBlockSize);
releaseLock();
}
else
{
Initialize();
}
return noErr;
}
Because auval calls this function on occasions *before* Initialize has been
called, I need that extra check to see if m_bInitialised==true. If I set a
breakpoint in Initialize and a breakpoint in Reset, the breakpoint in Reset
is hit first every time I run auval.
> /Developer/Examples/CoreAudio/Documentation
Found it, thanks.
> Another one for us to look at - the implementation is in AUBase - and
> AUEffectBase will schedule params
OK, I'll check it out.
_______________________________________________
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