Re: AU MIDI events scheduled beyond next rendering slice
Re: AU MIDI events scheduled beyond next rendering slice
- Subject: Re: AU MIDI events scheduled beyond next rendering slice
- From: Philippe Wicker <email@hidden>
- Date: Thu, 7 Aug 2003 08:01:22 +0200
On Thursday, August 7, 2003, at 02:11 AM, Jeremy Sagan wrote:
On Wednesday, August 6, 2003, at 06:51 PM, Urs Heckmann wrote:
And I agree with DLS, sending a NoteOff _before_ a corresponding
NoteOn is completely messy. Any NoteOff I get that is not for a
NoteOn I already have, will immediately be trashed. Otherwise I will
need a really, really long queue (capable of holding 2048 NoteOffs +
some extra for thread safety + a HUGE, really, really HUGE scanning
overhead)...
I think you are misunderstanding my initial email. I agree there is no
reason to send a note-off before a note-on but as I mentioned above
there is a perfectly valid scenario where a note-off and a note-on can
occur at the same time. In that case if the note-on appears to the DLS
AU before the note-off (remember this is even though the time stamps
are the same) it causes the DLS to not play the note-on.
This may be due to the way notes on/off are handled at AU side. A
simple way to do this is to increment a per-value-counter when a note
on is received and to decrement it when a note off is received. If you
receive the sequence ON-OFF-ON-OFF, then your counter will take the
values 1-0-1-0 (wether the middle OFF and ON have the same timestamps
or not). If the sequence is ON-ON-OFF-OFF, the counter values are
1-2-1-0. In the first case you will have two notes triggered, in the
second case only one note. A solution would be to first scan OFF then
ON events which will give a count sequence of 1-0-1-0. But the true
problem is that when ON-ON-OFF-OFF is received, it is impossible to
reconstruct without ambiguity the original note sequence. Adding
arbitrary timestamps 1, 2, 3, 4 to the events it could be either the 2
notes [ ON(1)-OFF(4) and ON(2)-OFF(3) ] or [ ON(1)-OFF(3) and
ON(2)-OFF(4) ]. I agree that such a note sequence is not realistic for
most of real instruments but it may very well happen when the
instrument is a guitar where playing the same note on two different
strings (with a slight bend on one of the string) is a common technique.
A solution could be that the AU returns a different NoteInstanceID for
each note ON and of course that the host do the necessary job to
associate the OFF event to the correct NoteInstanceID. Doing this will
break the convention stated in the AudioUnits documentation (section
MusicDeviceStartNote) which says that if the note value is an integral
value, then the note ID will be that integer. Maybe the rule should be
"the AU will return a randomly created uniqueID" which is the
convention to apply when the note value is a non integral float value.
Jeremy
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.
Philippe Wicker
email@hidden
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.