Re: Audio Unit input pitch based MIDI output
Re: Audio Unit input pitch based MIDI output
- Subject: Re: Audio Unit input pitch based MIDI output
- From: Frank Schoep <email@hidden>
- Date: Thu, 28 Dec 2006 19:13:17 +0100
On Dec 28, 2006, at 2:44 PM, Camille wrote:
I have been asking myself this question too:
How to make an AU that takes an audio input, and no audio output?
I guess you have a output samples anyway, and there is no problem
as long as you forward the data with no processing, and send the
MIDI events on the side.
Hi Camille, thanks for answering so quickly. This first part was
something I initially overlooked but the best thing to do seems to be
to pass-thru the audio data as is. Another option would be to just
generate zeroed output, but that doesn't seem as nice.
Yes, create a virtual MIDI source (MIDISourceCreate).
For that you have to instantiate a MIDI client first
(MIDIClientCreate).
Your AU will act then as a MIDI source, from which other MIDI
clients can connect and receive events.
You should consider the case where multiple instances of your
plugin are running together. In MIDISourceCreate, you give a name
to the virtual source, but this name should remain the same so that
other client can reconnect to it later. At the same time if every
sources you create are named the same, then how will it be possible
to identify the right plugin? This is not very important, because
you'll have multiple copies of the same input name, but it could
confuse the user, I think.
The duplicate name conflict is indeed a slight problem, but I'll look
into this later on when I get the basics working. I think the easiest
"way out" here is to have the Audio Unit offer a drop down list of
different MIDI source names so that you can have something like eight
different sources each individually named and still recognizable.
I've seen some sample code in the Xcode examples which illustrates
the use of MIDIClientCreate and MIDISourceCreate, now I know that I
should use these functions I think that'll work out pretty well.
Here you have to use build a packet list and call MIDIReceived() in
order to tell CoreMIDI what is the data you want to send from the
virtual source. All the functions to build packet lists are
available in CoreMIDI, this is very easy to do.
I see. How is timing done in this packet list? My Audio Unit will
mostly be generating silence and only playing a few notes per second.
Do I need to keep timing information myself or is the packet list
played back as soon as I call the MIDIReceived() function?
Just clean up the objects you instantiated with CFRelease, that is
the midi client and the virtual source.
OK, thanks a lot! If anyone else has something to add to Camille's
explanation, feel free to do so.
With kind regards,
Frank
_______________________________________________
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