Page 2 of 2

Re: lv2 midi input

Posted: Sat Jun 23, 2018 7:33 pm
by skei
i looked at the example from here:
and came up with something like the below.. i don't fully understand what everyting is doing yet, so i absolutely need to look at some docs :-)

but, same result.. works in qtractor, didn't test in ardour, doesn't work in carla..

the little led/light on the plugin in the carla rack view lights up when i press a midi key.. does that mean carla is sending the midi to the plugin?


Code: Select all

@prefix doap:      <> .
@prefix lv2:      <> .
@prefix rdf:      <> .
@prefix rdfs:      <> .
@prefix atom:      <> .
@prefix midi:      <> .
@prefix urid:      <> .

   a lv2:Plugin , lv2:InstrumentPlugin ;
   doap:name         "kode_debug" ;
   lv2:optionalFeature   lv2:hardRTCapable ;
   lv2:requiredFeature   urid:map ;
   lv2:port [
   ] , [
      a lv2:InputPort , atom:AtomPort ;
      atom:bufferType      atom:Sequence ;
      atom:supports      midi:MidiEvent ;
      lv2:designation      lv2:control ;
      lv2:index         6 ;
      lv2:symbol         "midi_in" ;
      lv2:name         "Midi in"
   ] .

Code: Select all


plugin instance class:

   const LV2_Atom_Sequence*   MLV2AtomSequence   = KODE_NULL;
   LV2_URID_Map*            MLV2Map            = KODE_NULL;
   KODE_uint32               MMidiEventType      = 0;
   LV2_URID*                MLV2URIS         = KODE_NULL;
plugin class.

   // for some reason, i thought it could be smart to prepare for multiple uri's..

   LV2_URID_Map* map = NULL;
   for (int i=0; features[i]; ++i) {
      if (!strcmp(features[i]->URI, LV2_URID__map)) {
         map = (LV2_URID_Map*)features[i]->data;
   if (!map) return KODE_NULL;
   MLV2URIS[0] = map->map(map->handle, LV2_MIDI__MidiEvent);
   instance->MLV2URIS = MLV2URIS;   


   MLV2AtomSequence = (const LV2_Atom_Sequence*)data_location;


   uint32_t offset = 0;
   LV2_ATOM_SEQUENCE_FOREACH(MLV2AtomSequence, ev) {
      if (ev->body.type == MLV2URIS[0]) {
         const uint8_t* const msg = (const uint8_t*)(ev + 1);
         offset = (uint32_t)ev->time.frames;

Re: lv2 midi input

Posted: Sat Jun 23, 2018 9:16 pm
by skei
falkTX wrote:are you trying to send MIDI CCs by any chance?
those are disabled by default.

btw, when plugins have midi input, you can use the built-in keyboard widget to send some notes to the plugin.
test that too, to see if something gets received or not.

no, i'm sending/playing notes..
and, nothing happens if i click on the on-screen keyboard..
it looks like everything is ok on the carla side, but no reaction from my plugin..
so, i just tested with jalv (
the plugin loads and everything, but just like carla, nothing is printed out..
(and it looks ok in catia, with a red midi_in port)

maybe that indicates that it's the handling of events insinde my plugin that is the problem?

i just watched a video about the atom stuff, and read some docs, or specs?.. something are a little bit clearer (atom, uri/urid, at least the principles, the 'what' part).. but something are maybe a bit more confusing (the 'how') part)..

it wouldn't hurt if there were more 'how to get started with..' or 'introduction to..' tutorials.. :-)

Re: lv2 midi input

Posted: Sun Jun 24, 2018 6:42 am
by skei
i feel so stupid! my connect_port function was buggy! :oops:
after fixing this, i have midi input in carla too!!
sorry for taking up everybody's time with my stupidity!

Re: lv2 midi input

Posted: Sun Jun 24, 2018 10:49 am
by skei
yeah.. but at least i got rid of the deprecated stuff.. :)