I will try to have a look at adding the feature to our host next week. jalv should still build, although maybe it needs a couple of paths changed. The downside with jalv is that it is a single-plugin host.

    giuliomoro i see. thanks for the heads up! the modduo version is multi plugin as well, ir they load several instances...

    4 days later

    ok i have a go at compiling jalv on current bela. i could try then the plugin and see if it does even run on BELA. if not, no need to work on the new LV2host...

    as you said some libraries are missing but i think i fixed the paths. (i had to manually include Midi_c.h in the src directory, because it was not found otherwise.) i now get this error on ./waf build:

    [ 1/11] Compiling src/bela.c
    ../src/bela.c:41:1: error: unknown type name 'Midi'
     Midi* midi;
     ^~~~
    ../src/bela.c: In function 'render':
    ../src/bela.c:110:31: warning: implicit declaration of function 'Midi_availableMessages' [-Wimplicit-function-declaration]
       if((availableMidiMessages = Midi_availableMessages(midi)) > 0)
                                   ^~~~~~~~~~~~~~~~~~~~~~
    ../src/bela.c:136:27: warning: implicit declaration of function 'Midi_getMessage' [-Wimplicit-function-declaration]
          unsigned char size = Midi_getMessage(midi, buf);
                               ^~~~~~~~~~~~~~~
    ../src/bela.c: In function 'setup':
    ../src/bela.c:227:10: warning: implicit declaration of function 'Midi_new' [-Wimplicit-function-declaration]
       midi = Midi_new(gMidiPort0);
              ^~~~~~~~
    ../src/bela.c:227:8: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
       midi = Midi_new(gMidiPort0);
            ^
    ../src/bela.c: In function 'cleanup':
    ../src/bela.c:260:3: warning: implicit declaration of function 'Midi_delete' [-Wimplicit-function-declaration]
       Midi_delete(midi);
       ^~~~~~~~~~~

      lokki that's a weird failure, as if Midi_c.h was empty. Is the #include still in place in src/bela.c ?

        giuliomoro i think so. playing a concert now, will check later. can i include a Midi_c.h from within the BELA image? i couldn't find it and included one from the bela doc wiki (found via google)

          lokki . can i include a Midi_c.h from within the BELA image? i couldn't find it and included one from the bela doc wiki (found via google)

          it's in Bela/libraries/Midi/Midi_c.h. Not sure where you find it on the wiki? You mean this one ? It' the same ...

          ok, got it too compile... as you said, it was commented, stupid me.

          when i run the plugin i get:

          root@bela:~/Bela/projects/jalv-Bela/build# ./jalv http://gareus.org/oss/lv2/fat1
          Plugin:       http://gareus.org/oss/lv2/fat1
          UI:           None
          Plugin requires 1 inputs and 1 outputs
          Sample rate:  44100 Hz
          Block length: 64 frames
          MIDI buffers: 4096 bytes
          Comm buffers: 65536 bytes
          Update rate:  25.0 Hz
          Illegal instruction

          and it aborts. not sure if the binary i installed is the reason for this. will try to compile the fat1.lv2 from source to see if it makes a difference

            lokki not sure if the binary i installed is the reason for this. will try to compile the fat1.lv2 from source to see if it makes a difference

            SIGILL (ILLEGAL INSTRUCTION) could happen if the binary was built for a different architecture, e.g.: an armv8 32bit binary will load but may fail on an instruction not present in armv7 (e.g.: NEON divide). If the binary is for armv7 then you could get a SIGILL because of some weird pointer error where you are trying to execute a portion of memory that does not contain executable data. I thought you had tried to compile the plugin yourself earlier? Where is the release from? Cannot see it on their github. You can try and run jalv inside gdb ( you'd do gdb jalv and then once you are in dorun < command line options> then when it fails you can see where (what function or even what line perhaps) it failed. You can also do disass to see the assembly and individuate the culprit instruction.

              giuliomoro got one step further. when i build the plugin without any optimisations, it runs. i get a ton of underruns, so i will now add in optimisations too see when it starts to fail :-)

              do you see a problematic one?:

              OPTIMIZATIONS="-Wall -Wno-unused-function -O3 -ffast-math -fomit-frame-pointer -fno-finite-math-only -fvisibility=hidden -fdata-sections -ffunction-sections -DNDEBUG -mfpu=neon-vfpv4 -mfloat-abi=hard -mvectorize-with-neon-quad"

              ok, with just -O3 -DNDEBUG it runs (i think)

              i get:

              root@bela:~/Bela/projects/jalv-Bela/build#  ./jalv http://gareus.org/oss/lv2/fat1
              Plugin:       http://gareus.org/oss/lv2/fat1
              UI:           None
              Plugin requires 1 inputs and 1 outputs
              Sample rate:  44100 Hz
              Block length: 64 frames
              MIDI buffers: 4096 bytes
              Comm buffers: 65536 bytes
              Update rate:  25.0 Hz
              
              Plugin requires 1 inputs and 1 outputs
              mode      = 0.000000
              channelf  = 0.000000
              tuning    = 440.000000
              bias      = 0.500000
              filter    = 0.100000
              corr      = 1.000000
              offset    = 0.000000
              bendrange = 2.000000
              fastmode  = 0.000000
              m00       = 1.000000
              m01       = 1.000000
              m02       = 1.000000
              m03       = 1.000000
              m04       = 1.000000
              m05       = 1.000000
              m06       = 1.000000
              m07       = 1.000000
              m08       = 1.000000
              m09       = 1.000000
              m10       = 1.000000
              m11       = 1.000000
              nmask     = 0.000000
              nset      = 0.000000
              bend      = 0.000000
              error     = 0.000000
              latency   = 0.000000

              i can change the settings via the prompt. :-)

                and i can hear my voice!! yes.

                lokki the > at the end is not visible in the code section somehow, i take it this is some kind of prompt for the plugin

                yeah, never understood what you can do with it, but it's there at the bottom of jalv the whole time. What's the CPU like? Note that if there is a "worker thread", that will not show up at /proc/xenomai/sched/stat (because it wouldn't be a Xenomai task, as it is managed by jalv or the plugin itself), and you will have to do

                top -p `pidof jalv` -H

                to see the CPU usage of all the Linux threads (this will be percentage where the total available is 100 minus the sum of what is returned by /proc/xenomai/sched/stat.

                the ">" is to change the settings. if i type m10 = 0 for example it changes that parameter in the plugin. so it is a primitive UI :-)

                CPU:

                top:

                top - 23:39:20 up 49 min,  2 users,  load average: 0.52, 0.66, 0.64
                Threads:   4 total,   0 running,   4 sleeping,   0 stopped,   0 zombie
                %Cpu(s):  0.0 us,  0.3 sy,  0.0 ni, 99.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
                KiB Mem :   501464 total,   233488 free,    79792 used,   188184 buff/cache
                KiB Swap:        0 total,        0 free,        0 used.   374764 avail Mem 
                
                  PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND                                                                            
                 6088 root      20   0   22532  19412   7336 S  0.3  3.9   0:00.05 jalv                                                                               
                 6090 root     -51   0   22532  19412   7336 S  0.3  3.9   0:00.14 bela-midiIn_hw:                                                                    
                 6085 root      20   0   22532  19412   7336 S  0.0  3.9   0:00.38 jalv                                                                               
                 6094 root     -96   0   22532  19412   7336 S  0.0  3.9   0:00.00 bela-audio                                                                         

                xenomai stat:

                Every 0.5s: cat /proc/xenomai/sched/stat                                                                                 bela: Tue Dec 17 23:40:32 2019
                
                CPU  PID    MSW        CSW        XSC        PF    STAT       %CPU  NAME
                  0  0      0          658918     0          0     00018000   77.6  [ROOT]
                  0  6085   3          4          13         0     000600c0    0.0  jalv
                  0  6090   2          3          4          0     000480c0    0.0  bela-midiIn_hw:0,0,0
                  0  6094   1          137640     137642     0     00048046   22.1  bela-audio
                  0  0      0          315535     0          0     00000000    0.0  [IRQ16: [timer]]
                  0  0      0          137647     0          0     00000000    0.2  [IRQ180: rtdm_pruss_irq_irq]

                  oh. so there is no worker thread, or it's doing very little (it would be the 0.3% CPU one) ...
                  great!

                  lokki primitive UI :-)

                  primitive? It's text-based, so it's very evolved, to the point where all the pointless frills have been removed.

                    giuliomoro -mfpu=neon-vfpv4 should be -mfpu=neon

                    yep, that was it. it runs with all optimisations now...

                    Great. vfpv4 is for armv8. armv7 has the vfpv3.

                    with all the optimisations in place it looks even better:

                    Every 0.5s: cat /proc/xenomai/sched/stat                                                                                 bela: Tue Dec 17 23:53:27 2019
                    
                    CPU  PID    MSW        CSW        XSC        PF    STAT       %CPU  NAME
                      0  0      0          1061315    0          0     00018000   85.3  [ROOT]
                      0  8067   3          4          13         0     000600c0    0.0  jalv
                      0  8073   2          3          4          0     000480c0    0.0  bela-midiIn_hw:0,0,0
                      0  8077   1          88810      88813      0     00048046   14.4  bela-audio
                      0  0      0          405345     0          0     00000000    0.0  [IRQ16: [timer]]
                      0  0      0          88819      0          0     00000000    0.2  [IRQ180: rtdm_pruss_irq_irq]

                    great!

                    is there a way to change the PGA gain settings from the command line when running jalv?

                    giuliomoro primitive? It's text-based, so it's very evolved

                    of course.