[LV2] midi out example
Robin Gareus
robin at gareus.org
Mon Mar 28 05:39:44 PDT 2016
On 03/28/2016 02:57 AM, Alex Norman wrote:
> Does someone have a simple example plugin that demonstrates how to send midi
> from LV2?
http://lv2plug.in/book/ - The Fifths plugin for example
> I've been looking into this:
> https://github.com/x42/midifilter.lv2/blob/master/midifilter.c
>
> But honestly I find the 'atom forge', event and atom documentation to be
> relatively confusing.
>
A less computer-sciencey way to describe it:
"LV2 Atom" is a "Word".
A "LV2 Atom Message" is a "meaningful sentence" (subject + predicate +
object) constructed of words.
To construct a LV2 sentence one uses the "Atom Forge". (The forge can do
this realtime safe and ensure proper formatting)
An "Event" is a "sentence" with a timestamp. e.g.
1:47 Train leaves for Brooklyn
Last but not least, a "LV2 Event Sequence" is a sequence of Events: e.g.
1:47 Train leaves to Brooklyn
2:12 Last train [leaves] to Clarksville
LV2 provides some convenient macros and functions to handle LV2
sequences (both host and client). The two most common are:
LV2_ATOM_SEQUENCE_FOREACH()
lv2_atom_sequence_append_event()
For completeness:
LV2-Atoms are URIs which can be cumbersome to handle in C/C++ and long
strings can waste precious resources in realtime code.
So every URI is mapped to an integer. That's what the LV2 URI-MAP does
(the forge abstracts that part.
Just like a real language this can evolve. You could tell a LV2 host
http://example.org/cool http://example.org/ey!
but currently most LV2 Hosts will just frown at that message :)
ciao,
robin
More information about the Devel
mailing list