aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2020-01-14 23:17:30 +0100
committerHanspeter Portner <dev@open-music-kontrollers.ch>2020-01-14 23:17:30 +0100
commit723c91bb8307e1aef43642c8c64fd81cf4235bd2 (patch)
treee9a0c723830f9a5c0d3357499573e8fb7aa4b96c
parentc78f3bcc33bba057cc85b35b51b71f78f0243602 (diff)
downloadmephisto.lv2-723c91bb8307e1aef43642c8c64fd81cf4235bd2.tar.xz
ui: add footer with props and panic button.
-rw-r--r--VERSION2
-rw-r--r--mephisto_ui.c187
-rw-r--r--meson.build6
3 files changed, 115 insertions, 80 deletions
diff --git a/VERSION b/VERSION
index 9d5eec0..cacdd2d 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.5.81
+0.5.83
diff --git a/mephisto_ui.c b/mephisto_ui.c
index 06ac448..9226da5 100644
--- a/mephisto_ui.c
+++ b/mephisto_ui.c
@@ -200,7 +200,7 @@ static const props_def_t defs [MAX_NPROPS] = {
};
static void
-_message_set_note(plughandle_t *handle, uint8_t chan, uint8_t msg, uint8_t note,
+_message_midi_note(plughandle_t *handle, uint8_t chan, uint8_t msg, uint8_t note,
uint8_t vel)
{
const struct {
@@ -223,6 +223,30 @@ _message_set_note(plughandle_t *handle, uint8_t chan, uint8_t msg, uint8_t note,
}
static void
+_message_midi_allnotesoff(plughandle_t *handle)
+{
+ for(uint8_t chan = 0x0; chan < 0x10; chan++)
+ {
+ const struct {
+ LV2_Atom atom;
+ uint8_t body [8];
+ } midi = {
+ .atom = {
+ .type = handle->midi_MidiEvent,
+ .size = 2
+ },
+ .body = {
+ [0] = chan | LV2_MIDI_MSG_CONTROLLER,
+ [1] = LV2_MIDI_CTL_ALL_NOTES_OFF
+ }
+ };
+
+ handle->writer(handle->controller, 0, lv2_atom_total_size(&midi.atom),
+ handle->atom_eventTransfer, &midi);
+ }
+}
+
+static void
_message_set_code(plughandle_t *handle, size_t len)
{
ser_atom_t ser;
@@ -340,8 +364,9 @@ _expose_header(plughandle_t *handle, const d2tk_rect_t *rect)
}
}
+#if 0
static inline void
-_expose_footer(plughandle_t *handle, const d2tk_rect_t *rect)
+_expose_vkb(plughandle_t *handle, const d2tk_rect_t *rect)
{
d2tk_pugl_t *dpugl = handle->dpugl;
d2tk_base_t *base = d2tk_pugl_get_base(dpugl);
@@ -395,13 +420,13 @@ _expose_footer(plughandle_t *handle, const d2tk_rect_t *rect)
{
const uint8_t note = x/7*12 + off_black[x%7];
- _message_set_note(handle, 0x0, LV2_MIDI_MSG_NOTE_ON, note, 0x7f);
+ _message_midi_note(handle, 0x0, LV2_MIDI_MSG_NOTE_ON, note, 0x7f);
}
if(d2tk_state_is_up(state))
{
const uint8_t note = x/7*12 + off_black[x%7];
- _message_set_note(handle, 0x0, LV2_MIDI_MSG_NOTE_OFF, note, 0x0);
+ _message_midi_note(handle, 0x0, LV2_MIDI_MSG_NOTE_OFF, note, 0x0);
}
} break;
}
@@ -414,152 +439,156 @@ _expose_footer(plughandle_t *handle, const d2tk_rect_t *rect)
{
const uint8_t note = x/7*12 + off_white[x%7];
- _message_set_note(handle, 0x0, LV2_MIDI_MSG_NOTE_ON, note, 0x7f);
+ _message_midi_note(handle, 0x0, LV2_MIDI_MSG_NOTE_ON, note, 0x7f);
}
if(d2tk_state_is_up(state))
{
const uint8_t note = x/7*12 + off_white[x%7];
- _message_set_note(handle, 0x0, LV2_MIDI_MSG_NOTE_OFF, note, 0x0);
+ _message_midi_note(handle, 0x0, LV2_MIDI_MSG_NOTE_OFF, note, 0x0);
}
} break;
}
}
}
+#endif
static inline void
-_expose_slot(plughandle_t *handle, const d2tk_rect_t *rect, unsigned k)
+_expose_xfade(plughandle_t *handle, const d2tk_rect_t *rect)
{
d2tk_pugl_t *dpugl = handle->dpugl;
d2tk_base_t *base = d2tk_pugl_get_base(dpugl);
- static const char lbl [16][9] = {
- "slot•01",
- "slot•02",
- "slot•03",
- "slot•04",
- "slot•05",
- "slot•06",
- "slot•07",
- "slot•08",
- "slot•09",
- "slot•10",
- "slot•11",
- "slot•12",
- "slot•13",
- "slot•14",
- "slot•15",
- "slot•16",
- };
+ static const char lbl [] = "crossfade•ms";
- D2TK_BASE_FRAME(base, rect, sizeof(lbl[k]), lbl[k], frm)
+ D2TK_BASE_FRAME(base, rect, sizeof(lbl), lbl, frm)
{
const d2tk_rect_t *frect = d2tk_frame_get_rect(frm);
- if(d2tk_base_dial_float_is_changed(base, D2TK_ID_IDX(k), frect,
- 0.f, &handle->state.control[k], 1.f))
+ if(d2tk_base_prop_int32_is_changed(base, D2TK_ID, frect,
+ 10, &handle->state.xfade_dur, 1000))
{
- _message_set_control(handle, k);
+ _message_set_key(handle, handle->urid_xfadeDuration);
}
}
}
static inline void
-_expose_xfade(plughandle_t *handle, const d2tk_rect_t *rect)
+_expose_release(plughandle_t *handle, const d2tk_rect_t *rect)
{
d2tk_pugl_t *dpugl = handle->dpugl;
d2tk_base_t *base = d2tk_pugl_get_base(dpugl);
- static const char lbl [] = "crossfade (ms)";
+ static const char lbl [] = "release•s";
D2TK_BASE_FRAME(base, rect, sizeof(lbl), lbl, frm)
{
const d2tk_rect_t *frect = d2tk_frame_get_rect(frm);
- if(d2tk_base_dial_int32_is_changed(base, D2TK_ID, frect,
- 10, &handle->state.xfade_dur, 1000))
+ if(d2tk_base_prop_int32_is_changed(base, D2TK_ID, frect,
+ 0, &handle->state.release_dur, 100))
{
- _message_set_key(handle, handle->urid_xfadeDuration);
+ _message_set_key(handle, handle->urid_releaseDuration);
}
}
}
static inline void
-_expose_release(plughandle_t *handle, const d2tk_rect_t *rect)
+_expose_panic(plughandle_t *handle, const d2tk_rect_t *rect)
{
d2tk_pugl_t *dpugl = handle->dpugl;
d2tk_base_t *base = d2tk_pugl_get_base(dpugl);
- static const char lbl [] = "release (s)";
+ static const char lbl [] = "panic";
+ static const char path [] = "libre-arrow-circle-right.png";
D2TK_BASE_FRAME(base, rect, sizeof(lbl), lbl, frm)
{
const d2tk_rect_t *frect = d2tk_frame_get_rect(frm);
- if(d2tk_base_dial_int32_is_changed(base, D2TK_ID, frect,
- 0, &handle->state.release_dur, 100))
+ if(d2tk_base_button_image_is_changed(base, D2TK_ID, sizeof(path), path, frect))
{
- _message_set_key(handle, handle->urid_releaseDuration);
+ _message_midi_allnotesoff(handle);
}
}
}
static inline void
-_expose_sidebar(plughandle_t *handle, const d2tk_rect_t *rect)
+_expose_footer(plughandle_t *handle, const d2tk_rect_t *rect)
{
- D2TK_BASE_TABLE(rect, 2, 9, D2TK_FLAG_TABLE_REL, tab)
+ const d2tk_coord_t frac [3] = { 1, 1, 1 };
+ D2TK_BASE_LAYOUT(rect, 3, frac, D2TK_FLAG_LAYOUT_X_REL, lay)
{
- const unsigned k = d2tk_table_get_index(tab);
- const d2tk_rect_t *trect = d2tk_table_get_rect(tab);
+ const unsigned k = d2tk_layout_get_index(lay);
+ const d2tk_rect_t *lrect = d2tk_layout_get_rect(lay);
switch(k)
{
case 0:
- // fall-through
- case 1:
- // fall-through
- case 2:
- // fall-through
- case 3:
- // fall-through
- case 4:
- // fall-through
- case 5:
- // fall-through
- case 6:
- // fall-through
- case 7:
- // fall-through
- case 8:
- // fall-through
- case 9:
- // fall-through
- case 10:
- // fall-through
- case 11:
- // fall-through
- case 12:
- // fall-through
- case 13:
- // fall-through
- case 14:
- // fall-through
- case 15:
{
- _expose_slot(handle, trect, k);
+ _expose_xfade(handle, lrect);
} break;
- case 16:
+ case 1:
{
- _expose_xfade(handle, trect);
+ _expose_release(handle, lrect);
} break;
- case 17:
+ case 2:
{
- _expose_release(handle, trect);
+ _expose_panic(handle, lrect);
} break;
}
}
}
+static inline void
+_expose_slot(plughandle_t *handle, const d2tk_rect_t *rect, unsigned k)
+{
+ d2tk_pugl_t *dpugl = handle->dpugl;
+ d2tk_base_t *base = d2tk_pugl_get_base(dpugl);
+
+ static const char lbl [16][9] = {
+ "slot•01",
+ "slot•02",
+ "slot•03",
+ "slot•04",
+ "slot•05",
+ "slot•06",
+ "slot•07",
+ "slot•08",
+ "slot•09",
+ "slot•10",
+ "slot•11",
+ "slot•12",
+ "slot•13",
+ "slot•14",
+ "slot•15",
+ "slot•16",
+ };
+
+ D2TK_BASE_FRAME(base, rect, sizeof(lbl[k]), lbl[k], frm)
+ {
+ const d2tk_rect_t *frect = d2tk_frame_get_rect(frm);
+
+ if(d2tk_base_dial_float_is_changed(base, D2TK_ID_IDX(k), frect,
+ 0.f, &handle->state.control[k], 1.f))
+ {
+ _message_set_control(handle, k);
+ }
+ }
+}
+
+static inline void
+_expose_sidebar(plughandle_t *handle, const d2tk_rect_t *rect)
+{
+ D2TK_BASE_TABLE(rect, 2, NCONTROLS/2, D2TK_FLAG_TABLE_REL, tab)
+ {
+ const unsigned k = d2tk_table_get_index(tab);
+ const d2tk_rect_t *trect = d2tk_table_get_rect(tab);
+
+ _expose_slot(handle, trect, k);
+ }
+}
+
#define FONT_HEIGHT 16 //FIXME
/* list of tested console editors:
@@ -722,7 +751,7 @@ _expose(void *data, d2tk_coord_t w, d2tk_coord_t h)
const d2tk_rect_t rect = D2TK_RECT(0, 0, w, h);
const d2tk_coord_t frac [3] = { HEADER, 0, FOOTER };
- D2TK_BASE_LAYOUT(&rect, 2, frac, D2TK_FLAG_LAYOUT_Y_ABS, lay) //FIXME
+ D2TK_BASE_LAYOUT(&rect, 3, frac, D2TK_FLAG_LAYOUT_Y_ABS, lay)
{
const unsigned k = d2tk_layout_get_index(lay);
const d2tk_rect_t *lrect = d2tk_layout_get_rect(lay);
diff --git a/meson.build b/meson.build
index ae41897..5b17074 100644
--- a/meson.build
+++ b/meson.build
@@ -152,6 +152,12 @@ configure_file(
copy : true,
install : true,
install_dir : inst_dir)
+configure_file(
+ input : 'libre-gui-exclamation-circle.png',
+ output : 'libre-gui-exclamation-circle.png',
+ copy : true,
+ install : true,
+ install_dir : inst_dir)
if lv2_validate.found() and sord_validate.found()
test('LV2 validate', lv2_validate,