@@ -54,6 +54,7 @@ typedef struct {
5454 float * gain_vals ,* pan_vals ;
5555
5656 GtkWidget * * notify_leds ;
57+ GtkWidget * velocity_checkbox , * note_off_checkbox ;
5758
5859 gchar * bundle_path ;
5960
@@ -501,8 +502,7 @@ static void build_drmr_ui(DrMrUi* ui) {
501502 GtkWidget * drmr_ui_widget ;
502503 GtkWidget * opts_hbox1 , * opts_hbox2 ,
503504 * kit_combo_box , * kit_label , * no_kit_label ,
504- * base_label , * base_spin , * position_label , * position_combo_box ,
505- * velocity_checkbox , * note_off_checkbox ;
505+ * base_label , * base_spin , * position_label , * position_combo_box ;
506506 GtkCellRenderer * cell_rend ;
507507 GtkAdjustment * base_adj ;
508508
@@ -546,8 +546,8 @@ static void build_drmr_ui(DrMrUi* ui) {
546546 position_label = gtk_label_new ("Sample Zero Position: " );
547547 position_combo_box = create_position_combo ();
548548
549- velocity_checkbox = gtk_check_button_new_with_label ("Ignore Velocity" );
550- note_off_checkbox = gtk_check_button_new_with_label ("Ignore Note Off" );
549+ ui -> velocity_checkbox = gtk_check_button_new_with_label ("Ignore Velocity" );
550+ ui -> note_off_checkbox = gtk_check_button_new_with_label ("Ignore Note Off" );
551551
552552 gtk_box_pack_start (GTK_BOX (opts_hbox1 ),kit_label ,
553553 false,false,15 );
@@ -564,9 +564,9 @@ static void build_drmr_ui(DrMrUi* ui) {
564564 false,false,15 );
565565 gtk_box_pack_start (GTK_BOX (opts_hbox2 ),position_combo_box ,
566566 false,false,0 );
567- gtk_box_pack_start (GTK_BOX (opts_hbox2 ),velocity_checkbox ,
567+ gtk_box_pack_start (GTK_BOX (opts_hbox2 ),ui -> velocity_checkbox ,
568568 true,true,15 );
569- gtk_box_pack_start (GTK_BOX (opts_hbox2 ),note_off_checkbox ,
569+ gtk_box_pack_start (GTK_BOX (opts_hbox2 ),ui -> note_off_checkbox ,
570570 true,true,15 );
571571
572572 gtk_box_pack_start (GTK_BOX (drmr_ui_widget ),GTK_WIDGET (ui -> current_kit_label ),
@@ -590,8 +590,8 @@ static void build_drmr_ui(DrMrUi* ui) {
590590 g_signal_connect (G_OBJECT (kit_combo_box ),"changed" ,G_CALLBACK (kit_combobox_changed ),ui );
591591 g_signal_connect (G_OBJECT (base_spin ),"value-changed" ,G_CALLBACK (base_changed ),ui );
592592 g_signal_connect (G_OBJECT (position_combo_box ),"changed" ,G_CALLBACK (position_combobox_changed ),ui );
593- g_signal_connect (G_OBJECT (velocity_checkbox ),"toggled" ,G_CALLBACK (ignore_velocity_toggled ),ui );
594- g_signal_connect (G_OBJECT (note_off_checkbox ),"toggled" ,G_CALLBACK (ignore_note_off_toggled ),ui );
593+ g_signal_connect (G_OBJECT (ui -> velocity_checkbox ),"toggled" ,G_CALLBACK (ignore_velocity_toggled ),ui );
594+ g_signal_connect (G_OBJECT (ui -> note_off_checkbox ),"toggled" ,G_CALLBACK (ignore_note_off_toggled ),ui );
595595
596596 gtk_widget_show_all (drmr_ui_widget );
597597 gtk_widget_hide (no_kit_label );
@@ -712,9 +712,7 @@ port_event(LV2UI_Handle handle,
712712 // both state and ui_msg are the same at the moment
713713 const LV2_Atom * path = NULL ;
714714 lv2_object_get (obj , ui -> uris .kit_path , & path , 0 );
715- if (!path )
716- fprintf (stderr ,"Got UI message without kit_path, ignoring\n" );
717- else {
715+ if (path ) {
718716 char * kitpath = LV2_ATOM_BODY (path );
719717 char * realp = realpath (kitpath ,NULL );
720718 if (!realp ) {
@@ -732,7 +730,21 @@ port_event(LV2UI_Handle handle,
732730 fprintf (stderr ,"Couldn't find kit %s\n" ,realp );
733731 free (realp );
734732 }
735- }
733+ if (obj -> body .otype == ui -> uris .get_state ) { // read out extra state info
734+ const LV2_Atom * ignvel = NULL ;
735+ const LV2_Atom * ignno = NULL ;
736+ lv2_object_get (obj ,
737+ ui -> uris .velocity_toggle , & ignvel ,
738+ ui -> uris .note_off_toggle , & ignno ,
739+ 0 );
740+ if (ignvel )
741+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ui -> velocity_checkbox ),
742+ ((const LV2_Atom_Bool * )ignvel )-> body );
743+ if (ignno )
744+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ui -> note_off_checkbox ),
745+ ((const LV2_Atom_Bool * )ignno )-> body );
746+ }
747+ }
736748 else if (obj -> body .otype == ui -> uris .midi_info ) {
737749 const LV2_Atom * midi_atom = NULL ;
738750 lv2_object_get (obj , ui -> uris .midi_event , & midi_atom , 0 );
0 commit comments