Running LV2 plugins in Carla on Windows11?

All your LV2 and LADSPA goodness and more.

Moderators: MattKingUSA, khz

tramp
Established Member
Posts: 2348
Joined: Mon Jul 01, 2013 8:13 am
Has thanked: 9 times
Been thanked: 468 times

Re: Running LV2 plugins in Carla on Windows11?

Post by tramp »

Oh f***
I've forgotten to remove that. Done now. Please update again.

On the road again.
User avatar
LinMusGuy
Established Member
Posts: 551
Joined: Wed Feb 27, 2019 9:33 pm
Has thanked: 22 times
Been thanked: 2 times

Re: Running LV2 plugins in Carla on Windows11?

Post by LinMusGuy »

Is this a problem?

Code: Select all

Build static library libxputty.lib 
 =================== DONE =======================
 Compiling miditest2.lv2 
miditest2.cpp:117: warning: ignoring #pragma warning  [-Wunknown-pragmas]
  117 |     #pragma warning (disable: 4251)
      | 
lv2.cpp: In constructor ‘MTSTuning::MTSTuning(const char*)’:
lv2.cpp:454:31: warning: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long long unsigned int’} and ‘int’ [-Wsign-compare]
lv2.cpp: In member function ‘void LV2Plugin::resume()’:
lv2.cpp:1154:21: warning: unused variable ‘j’ [-Wunused-variable]
lv2.cpp: In member function ‘void LV2Plugin::process_audio(int, float**, float**)’:
lv2.cpp:1186:27: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]
lv2.cpp:1191:27: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]
lv2.cpp:1250:19: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]
lv2.cpp:1268:25: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]
lv2.cpp:1274:27: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]
lv2.cpp: In member function ‘void LV2Plugin::change_tuning(int)’:
lv2.cpp:1587:13: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<MTSTuning>::size_type’ {aka ‘long long unsigned int’} [-Wsign-compare]
lv2.cpp: At global scope:
lv2.cpp:1803:13: warning: ‘bool is_xmlstring(const char*)’ defined but not used [-Wunused-function]
 build finish, . . . 
 =================== DONE =======================
tramp
Established Member
Posts: 2348
Joined: Mon Jul 01, 2013 8:13 am
Has thanked: 9 times
Been thanked: 468 times

Re: Running LV2 plugins in Carla on Windows11?

Post by tramp »

No. That's just warnings, they come from the code faust2lv2 have generated.

On the road again.
User avatar
LinMusGuy
Established Member
Posts: 551
Joined: Wed Feb 27, 2019 9:33 pm
Has thanked: 22 times
Been thanked: 2 times

Re: Running LV2 plugins in Carla on Windows11?

Post by LinMusGuy »

OK - only one bug left now (as far as I can see) when using the Windows LV2 plugin in Reaper: there are occasional hanging notes. After playing the hanging note again it plays and then stops. The same happens in Carla on Windows.

User avatar
LinMusGuy
Established Member
Posts: 551
Joined: Wed Feb 27, 2019 9:33 pm
Has thanked: 22 times
Been thanked: 2 times

Re: Running LV2 plugins in Carla on Windows11?

Post by LinMusGuy »

Is there a book specifically about (creating) LV2 plugins?

tramp
Established Member
Posts: 2348
Joined: Mon Jul 01, 2013 8:13 am
Has thanked: 9 times
Been thanked: 468 times

Re: Running LV2 plugins in Carla on Windows11?

Post by tramp »

LinMusGuy wrote: Wed Jan 03, 2024 4:38 pm

OK - only one bug left now (as far as I can see) when using the Windows LV2 plugin in Reaper: there are occasional hanging notes. After playing the hanging note again it plays and then stops. The same happens in Carla on Windows.

mmm, I can't reproduce that when using reaper with asio4all set to 256 samples per buffer. The default 8 x 1024 setting is un-usable at all for me.
Still, I noticed that Reaper comes with the concept of LV2i versus LV2 effect plugs. So it's a good idea to set the plugin type to InstrumentPlugin so that reaper map it under LV2i and enable midi input for it. Reaper is the only host I know of coming with this concept for LV2 plugs.
New XUiDesigner version does that now.

LinMusGuy wrote: Wed Jan 03, 2024 10:41 pm

Is there a book specifically about (creating) LV2 plugins?

Yep, it's here:
https://lv2plug.in/book/

On the road again.
User avatar
LinMusGuy
Established Member
Posts: 551
Joined: Wed Feb 27, 2019 9:33 pm
Has thanked: 22 times
Been thanked: 2 times

Re: Running LV2 plugins in Carla on Windows11?

Post by LinMusGuy »

What do I have to change here:

asio.png
asio.png (48.19 KiB) Viewed 174550 times

(The hanging notes only happen for very fast playing on the virtual MIDI keyboard, on my hardware MIDI keyboard I'm not fast enough. ;-) )


And is the book about LV2 also in paperback form, or do I have to print it when I want a paper version?

tramp
Established Member
Posts: 2348
Joined: Mon Jul 01, 2013 8:13 am
Has thanked: 9 times
Been thanked: 468 times

Re: Running LV2 plugins in Carla on Windows11?

Post by tramp »

Looks good to me.

So, when it only happen with the virtual keyboard, it may be, in case you use your pc keyboard to play with, the limited keystroke emit of the pc keyboard. There are always some key's you can't press the same time, some keypress events will then simply not be emitted. So, try for example the combination of v n and , (coma), you will see the only two of the events will be fired. There are more of this u-usable combinations on any pc keyboard.
You could check the reaper virtual MIDI keyboard if it beehive the same.

I don't know of a paper form of the lv2 book.

On the road again.
User avatar
LinMusGuy
Established Member
Posts: 551
Joined: Wed Feb 27, 2019 9:33 pm
Has thanked: 22 times
Been thanked: 2 times

Re: Running LV2 plugins in Carla on Windows11?

Post by LinMusGuy »

No - that's not how I do it. I use the mouse to quickly move over the virtual keyboard on the plugin GUI (generating a very fast string of succeeding notes). So this is not actually playing music ;-) , just testing. Don't know if plugins are generally designed to handle such a barrage of MIDI signals...?

tramp
Established Member
Posts: 2348
Joined: Mon Jul 01, 2013 8:13 am
Has thanked: 9 times
Been thanked: 468 times

Re: Running LV2 plugins in Carla on Windows11?

Post by tramp »

LinMusGuy wrote: Thu Jan 04, 2024 11:05 am

No - that's not how I do it. I use the mouse to quickly move over the virtual keyboard on the plugin GUI

Ah, okay. That's the stress test I use on Linux when I when creating the MIDI keyboard. On Windows I to just a quick confirmation check.
So, there are two parts to be analysed. First one, the hanging note, is it indicated on the keyboard, means is the key indicated to be on, or is it just the engine which play the note while the keyboard didn't show a key is pressed.
The first one means it is related to the UI system, the second means it is related to the event transfer system.

btw. The MIDI keyboard could be build as virtual MIDI keyboard LV2 plugin on it's own. Just add it to the window, enable MIDI in and out in the settings window and save it. It could then be used to indicate incoming MIDI not on/off events or to play some notes.

On the road again.
User avatar
LinMusGuy
Established Member
Posts: 551
Joined: Wed Feb 27, 2019 9:33 pm
Has thanked: 22 times
Been thanked: 2 times

Re: Running LV2 plugins in Carla on Windows11?

Post by LinMusGuy »

Did another test, and the hanging notes also appear with very fast clicking (without moving the mouse horizontally over the keyboard). You cannot see on the virtual GUI keyboard which note is hanging. Pressing a key is shown but hanging notes are shown as if they were off just like the other off notes that don't hang. This is in Reaper on Windows.

tramp
Established Member
Posts: 2348
Joined: Mon Jul 01, 2013 8:13 am
Has thanked: 9 times
Been thanked: 468 times

Re: Running LV2 plugins in Carla on Windows11?

Post by tramp »

LinMusGuy wrote: Fri Jan 05, 2024 9:31 am

You cannot see on the virtual GUI keyboard which note is hanging.

Okay, that means that the issue is not in the GUI handling but in the message system. The keyboard using a simple direct out function. That was never a problem on Linux, as it runs fast enough to deliver all messages. That seems to be not the case on Windows.
I've now implemented a queued output handler to ensure that all generated messages makes it to the output. Please update and try if you still be able to produce hanging notes.

On the road again.
User avatar
LinMusGuy
Established Member
Posts: 551
Joined: Wed Feb 27, 2019 9:33 pm
Has thanked: 22 times
Been thanked: 2 times

Re: Running LV2 plugins in Carla on Windows11?

Post by LinMusGuy »

I now tried to make the Windows LV2 plugin again starting with the Faust file but at the end while doing "./libxputty/build.sh windows" I got this:

Code: Select all

miditest2.c: In function ‘plugin_create_controller_widgets’:
miditest2.c:200:19: error: redefinition of ‘keys’
  200 |     MidiKeyboard *keys = (MidiKeyboard*)ui->widget[8]->private_struct;
      |                   ^~~~
miditest2.c:192:19: note: previous definition of ‘keys’ was here
  192 |     MidiKeyboard *keys = (MidiKeyboard*)ui->widget[7]->private_struct;
      |                   ^~~~
make[1]: *** [makefile:101: miditest2] Error 1
make: *** [makefile:15: miditest2] Error 2
tramp
Established Member
Posts: 2348
Joined: Mon Jul 01, 2013 8:13 am
Has thanked: 9 times
Been thanked: 468 times

Re: Running LV2 plugins in Carla on Windows11?

Post by tramp »

Do you've 2 midi keyboards added?
Could you post the miditest2.c file please.

On the road again.
User avatar
LinMusGuy
Established Member
Posts: 551
Joined: Wed Feb 27, 2019 9:33 pm
Has thanked: 22 times
Been thanked: 2 times

Re: Running LV2 plugins in Carla on Windows11?

Post by LinMusGuy »

Sometimes a second virtual midi-keyboard is added when I try to enlarge the first midi-keyboard, so that could accidentally have happened. Here's the requested file:

Code: Select all

#define HIDE_NAME 

#define CONTROLS 9

#define GUI_ELEMENTS 2

#define TAB_ELEMENTS 0


#define PLUGIN_UI_URI "urn:nameless:miditest2_ui"


#include "lv2_plugin.h"


#define OBJ_BUF_SIZE 1024

#include "xresources.h"

void set_costum_theme(Widget_t *w) {
    w->color_scheme->normal = (Colors) {
         /* cairo    / r  / g  / b  / a  /  */
        .fg =       { 0.850, 0.850, 0.850, 1.000},
        .bg =       { 0.098, 0.176, 0.553, 1.000},
        .base =     { 0.000, 0.000, 0.000, 1.000},
        .text =     { 0.900, 0.900, 0.900, 1.000},
        .shadow =   { 0.000, 0.000, 0.000, 0.200},
        .frame =    { 0.000, 0.000, 0.000, 1.000},
        .light =    { 0.100, 0.100, 0.100, 1.000}
    };

w->color_scheme->prelight = (Colors) {
     /* cairo    / r  / g  / b  / a  /  */
    .fg =       { 1.000, 0.000, 1.000, 1.000},
    .bg =       { 0.250, 0.250, 0.250, 1.000},
    .base =     { 0.300, 0.300, 0.300, 1.000},
    .text =     { 1.000, 1.000, 1.000, 1.000},
    .shadow =   { 0.100, 0.100, 0.100, 0.400},
    .frame =    { 0.300, 0.300, 0.300, 1.000},
    .light =    { 0.300, 0.300, 0.300, 1.000}
};

w->color_scheme->selected = (Colors) {
     /* cairo    / r  / g  / b  / a  /  */
    .fg =       { 0.900, 0.900, 0.900, 1.000},
    .bg =       { 0.200, 0.200, 0.200, 1.000},
    .base =     { 0.500, 0.180, 0.180, 1.000},
    .text =     { 1.000, 1.000, 1.000, 1.000},
    .shadow =   { 0.800, 0.180, 0.180, 0.200},
    .frame =    { 0.500, 0.180, 0.180, 1.000},
    .light =    { 0.500, 0.180, 0.180, 1.000}
};

w->color_scheme->active = (Colors) {
     /* cairo    / r  / g  / b  / a  /  */
    .fg =       { 0.000, 1.000, 1.000, 1.000},
    .bg =       { 0.000, 0.000, 0.000, 1.000},
    .base =     { 0.180, 0.380, 0.380, 1.000},
    .text =     { 0.750, 0.750, 0.750, 1.000},
    .shadow =   { 0.180, 0.380, 0.380, 0.500},
    .frame =    { 0.180, 0.380, 0.380, 1.000},
    .light =    { 0.180, 0.380, 0.380, 1.000}
};

w->color_scheme->insensitive = (Colors) {
     /* cairo    / r  / g  / b  / a  /  */
    .fg =       { 0.850, 0.850, 0.850, 0.500},
    .bg =       { 0.100, 0.100, 0.100, 0.500},
    .base =     { 0.000, 0.000, 0.000, 0.500},
    .text =     { 0.900, 0.900, 0.900, 0.500},
    .shadow =   { 0.000, 0.000, 0.000, 0.100},
    .frame =    { 0.000, 0.000, 0.000, 0.500},
    .light =    { 0.100, 0.100, 0.100, 0.500}
};
}

#include "lv2_plugin.cc"


#ifdef USE_MIDI
static void send_midi_note(Widget_t *w, const int *key, const int control) {
    X11_UI *ui = (X11_UI*) w->parent_struct;
    MidiKeyboard *keys = (MidiKeyboard*)ui->widget[8]->private_struct;
    send_midi_cc(&ui->mm, (int)control, (*key), keys->velocity, 3);
}

static void send_all_notes_off(Widget_t *w, const int *value){
    X11_UI *ui = (X11_UI*) w->parent_struct;
    MidiKeyboard *keys = (MidiKeyboard*)ui->widget[8]->private_struct;
    int key = 120;
    send_midi_cc(&ui->mm,  0xB0, key, keys->velocity, 3);
}

static void xkey_press(void *w_, void *key_, void *user_data) {
    Widget_t *w = (Widget_t*)w_;
    X11_UI *ui = (X11_UI*) w->parent_struct;
    ui->widget[8]->func.key_press_callback(ui->widget[8], key_, user_data);
}

static void xkey_release(void *w_, void *key_, void *user_data) {
    Widget_t *w = (Widget_t*)w_;
    X11_UI *ui = (X11_UI*) w->parent_struct;
    ui->widget[8]->func.key_release_callback(ui->widget[8], key_, user_data);
}

#endif

void plugin_value_changed(X11_UI *ui, Widget_t *w, PortIndex index) {
    // do special stuff when needed
}

void plugin_set_window_size(int *w,int *h,const char * plugin_uri) {
    (*w) = 600; //set initial width of main window
    (*h) = 333; //set initial height of main window
}

const char* plugin_set_name() {
    return "miditest2"; //set plugin name to display on UI
}

void plugin_create_controller_widgets(X11_UI *ui, const char * plugin_uri) {
    set_costum_theme(ui->win);
#ifdef USE_MIDI
    os_set_input_mask(ui->win);
    ui->win->flags |= NO_AUTOREPEAT | NO_PROPAGATE;
    ui->win->func.key_press_callback = xkey_press;
    ui->win->func.key_release_callback = xkey_release;
#endif

ui->elem[0] = add_lv2_frame (ui->elem[0], ui->win, -1, "Frame11", ui, 28,  24, 263, 120);
ui->elem[1] = add_lv2_frame (ui->elem[1], ui->win, -1, "Frame12", ui, 321,  28, 260, 120);
ui->widget[0] = add_lv2_knob (ui->widget[0], ui->elem[0], 0, "A", ui, 19,  28, 60, 80);
widget_get_png(ui->widget[0], LDVAR(gag_c_babframes__png));
set_adjustment(ui->widget[0]->adj, 0.01, 0.01, 0.01, 4.0, 0.04, CL_CONTINUOS);
#ifdef USE_MIDI
    ui->widget[0]->func.key_press_callback = xkey_press;
    ui->widget[0]->func.key_release_callback = xkey_release;
#endif

ui->widget[1] = add_lv2_knob (ui->widget[1], ui->elem[0], 1, "DR", ui, 100,  29, 60, 80);
widget_get_png(ui->widget[1], LDVAR(gag_c_babframes__png));
set_adjustment(ui->widget[1]->adj, 0.6, 0.6, 0.01, 8.0, 0.08, CL_CONTINUOS);
#ifdef USE_MIDI
    ui->widget[1]->func.key_press_callback = xkey_press;
    ui->widget[1]->func.key_release_callback = xkey_release;
#endif

ui->widget[2] = add_lv2_knob (ui->widget[2], ui->elem[0], 2, "S", ui, 178,  27, 60, 80);
widget_get_png(ui->widget[2], LDVAR(gag_c_babframes__png));
set_adjustment(ui->widget[2]->adj, 0.2, 0.2, 0.0, 1.0, 0.01, CL_CONTINUOS);
#ifdef USE_MIDI
    ui->widget[2]->func.key_press_callback = xkey_press;
    ui->widget[2]->func.key_release_callback = xkey_release;
#endif

ui->widget[3] = add_lv2_vslider (ui->widget[3], ui->win, 3, "bend", ui, 23,  180, 30, 120);
widget_get_png(ui->widget[3], LDVAR(hg_bender_babframes__png));
set_slider_image_frame_count(ui->widget[3], 101);
set_adjustment(ui->widget[3]->adj, 0.0, 0.0, -2.0, 2.0, 0.04, CL_CONTINUOS);
#ifdef USE_MIDI
    ui->widget[3]->func.key_press_callback = xkey_press;
    ui->widget[3]->func.key_release_callback = xkey_release;
#endif

ui->widget[4] = add_lv2_knob (ui->widget[4], ui->elem[1], 4, "feedb", ui, 16,  27, 60, 80);
widget_get_png(ui->widget[4], LDVAR(gag_c_babframes__png));
set_adjustment(ui->widget[4]->adj, 0.0, 0.0, 0.0, 1.0, 0.01, CL_CONTINUOS);
#ifdef USE_MIDI
    ui->widget[4]->func.key_press_callback = xkey_press;
    ui->widget[4]->func.key_release_callback = xkey_release;
#endif

ui->widget[5] = add_lv2_knob (ui->widget[5], ui->elem[1], 5, "ratio", ui, 90,  31, 60, 80);
widget_get_png(ui->widget[5], LDVAR(gag_c_babframes__png));
set_adjustment(ui->widget[5]->adj, 2.0, 2.0, 0.0, 20.0, 0.2, CL_CONTINUOS);
#ifdef USE_MIDI
    ui->widget[5]->func.key_press_callback = xkey_press;
    ui->widget[5]->func.key_release_callback = xkey_release;
#endif

ui->widget[6] = add_lv2_knob (ui->widget[6], ui->elem[1], 8, "polyphony", ui, 171,  22, 68, 80);
widget_get_png(ui->widget[6], LDVAR(knob_gg_blacke_baframes__png));
set_adjustment(ui->widget[6]->adj, 4.0, 4.0, 1.0, 8.0, 1.0, CL_CONTINUOS);
#ifdef USE_MIDI
    ui->widget[6]->func.key_press_callback = xkey_press;
    ui->widget[6]->func.key_release_callback = xkey_release;
#endif

ui->widget[7] = add_lv2_midikeyboard (ui->widget[7], ui->win, -1, "Midikeyboard9", ui, 74,  186, 502, 107);
#ifdef USE_MIDI
    MidiKeyboard *keys = (MidiKeyboard*)ui->widget[7]->private_struct;
    set_midi_port(ui, 7);
    keys->mk_send_note = send_midi_note;
    keys->mk_send_all_sound_off = send_all_notes_off;
#endif

ui->widget[8] = add_lv2_midikeyboard (ui->widget[8], ui->win, -1, "Midikeyboard10", ui, -223,  110, 147, 60);
#ifdef USE_MIDI
    MidiKeyboard *keys = (MidiKeyboard*)ui->widget[8]->private_struct;
    set_midi_port(ui, 7);
    keys->mk_send_note = send_midi_note;
    keys->mk_send_all_sound_off = send_all_notes_off;
#endif


set_widget_color(ui->elem[0], 0, 1,0.100, 0.100, 0.100, 1.000);

set_widget_color(ui->elem[1], 0, 1,0.100, 0.100, 0.100, 1.000);

set_widget_color(ui->widget[0], 0, 1,0.100, 0.100, 0.100, 1.000);

set_widget_color(ui->widget[1], 0, 1,0.100, 0.100, 0.100, 1.000);

set_widget_color(ui->widget[2], 0, 1,0.100, 0.100, 0.100, 1.000);

set_widget_color(ui->widget[3], 0, 1,0.100, 0.100, 0.100, 1.000);

set_widget_color(ui->widget[4], 0, 1,0.100, 0.100, 0.100, 1.000);

set_widget_color(ui->widget[5], 0, 1,0.100, 0.100, 0.100, 1.000);

set_widget_color(ui->widget[6], 0, 1,0.100, 0.100, 0.100, 1.000);

set_widget_color(ui->widget[7], 0, 1,0.100, 0.100, 0.100, 1.000);

set_widget_color(ui->widget[8], 0, 1,0.100, 0.100, 0.100, 1.000);
}

void plugin_cleanup(X11_UI *ui) {
    // clean up used sources when needed
}


void plugin_port_event(LV2UI_Handle handle, uint32_t port_index,
                        uint32_t buffer_size, uint32_t format,
                        const void * buffer) {
    // port value change message from host
    // do special stuff when needed
}
Post Reply