AUMIDIEffectBase Howto
AUMIDIEffectBase Howto
- Subject: AUMIDIEffectBase Howto
- From: Eyal Redler <email@hidden>
- Date: Thu, 08 Jan 2009 15:40:09 +0200
Hi,
I'm working on implementing an AUMIDIEffectBase based audio unit. This
is my first venture into Audio Units (and audio programming in
general) and it seems that there are not sample projects for
AUMIDIEffectBase based AU (or maybe there is and I'm not aware of it)
so I'm a bit confused as to how to synchronize the note events with
the audio processing.
When I receive the MIDI event (HandleNoteOn) I get the timing
information in the inStartFrame parameter I understand that this is
relative to the first frame in the next AUEffectBase::Render method,
but if I'm not wrong AUEffectBase may split the buffer into several
parts (which are then passed to the kernel "Process" method) to
accommodate scheduled parameter changes.
This means that inStartFrame can be incorrect relative to the chance
I'm processing in the Kernel. For example, if the buffer size is 512 I
may have the following situation:
Frame offset Event
120 Note On
240 Parameter Change
330 Note Off
The parameter change in 240 causes the buffer to be split and then I
have two invocations of the Kernel "Process":
A. Sample 0-239
B. Sample 240-511
And this means that the 330 offset of the Note Off is no longer valid,
I either must adjust it or somehow know what is the real sample offset
I'm processing in the kernel.
Some options that I thought about were:
a. Convert the MIDI notes into parameter changes (how?) and then have
the (very convenient) assumption that each "Process" invocation is
dealing with one note at a time
b. Override AUEffectBase::Render and adjust the MIDI event offsets
c. Enable the Kernel to know what is the real sample offset (relative
to "Render"). I'm not sure how this is done
Thanks,
Eyal Redler
------------------------------------------------------------------------------------------------
"If Uri Geller bends spoons with divine powers, then he's doing it the
hard way."
--James Randi
www.eyalredler.com
_______________________________________________
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