Re: AUInstrumentBase
Re: AUInstrumentBase
- Subject: Re: AUInstrumentBase
- From: philippe wicker <email@hidden>
- Date: Sun, 5 Mar 2006 15:17:08 +0100
On Mar 5, 2006, at 12:01 AM, Michael A. Thompson wrote:
Hi,
I have been looking over the sample SinSynth code (in the debugger)
to learn the AUInstrumentBase (SynthNote, SynthElement etc..) class
implementation. I have a few stupid questions as I am new to the
synth plugin world.
1. Is anybody using this in commerical plugins yet? or is it not
ready for prime-time.
Apple always provides sample code with a license including a "use it
as is" statement. Nonetheless, this example is IMO a fairly good
starting point for a professional product. I use it myself to wrap a
sample player engine within an AU plugin. Of course I had to modify
it on some points (and this is still a work in progress). The
provided sample relates to a monotimbral music device while I need a
multitimbral AU. The stealing note algorithm implemented in the
SinSynth sample (AUInstrumentBase::GetAFreeNote and
SynthNoteList::FindMostQuietNote) appears to be broken (sorry James
if I've misunderstood your code). FindMostQuietNote may return a NULL
pointer and then GetAFreeNote crashes. Anyway, I had to change it
because my stealing algorithm includes some characteristics that
obliged me to manage it at the AU level and not at the group level.
2. While tracing the code in the the debugger for MIDI controller
64 messages (Sustain pedal) it seems that all it does is set the
mSustianIsOn flag and no sustain in render. So I can not seem to
get SynthNote to trigger a GetState() of 3 which is
kNoteState_ReleasedButSustained when sending controller 64
messages. Do I have to deal with this myself? or am just missing
something...
"sustain ON" is just a state that has no action on playing notes
until they enter in the release phase, ie until a note OFF occurs.
Then an "Attacked" note should be moved to the state
"ReleasedButSustained". It is apparently missing in the SinSynth code.
In case of a note OFF the call stack is the following:
- AUInstrumentBase::Render
- AUInstrumentBase::PerformEvents
- AUInstrumentBase:: RealTimeStopNote
- SynthGroupElement::NoteOff
In that last method, I think the 1st test in the following statements:
if (note) {
mNoteList[kNoteState_Attacked].RemoveNote(note);
note->Release(inFrame);
mNoteList[kNoteState_Released].AddNote(note);
} else if (mSostenutoIsOn) {
.......
}
should be modified as:
if (note) {
mNoteList[kNoteState_Attacked].RemoveNote(note);
note->Release(inFrame);
if (mSustainIsOn)
mNoteList[kNoteState_ReleasedButSustained].AddNote(note);
else
mNoteList[kNoteState_Released].AddNote(note);
} else if (mSostenutoIsOn) { ....
"ReleasedButSustained" notes are moved to "Released" state when the
sustain pedal is released (look at SynthGroupElement::SustainOff).
Im keen to start using it as it seems to handle a ton of stuff that
I would have to write on my own if I don't use it.
Thanks,
m
_______________________________________________
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
_______________________________________________
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