Re: AUInstrumentBase
Re: AUInstrumentBase
- Subject: Re: AUInstrumentBase
- From: James McCartney <email@hidden>
- Date: Wed, 8 Mar 2006 19:36:20 -0800
Thank you for bringing these to my attention. I'll be having a look.
On Mar 5, 2006, at 6:17 AM, philippe wicker wrote:
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).
--- james mccartney -- apple coreaudio
_______________________________________________
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