aboutsummaryrefslogtreecommitdiffstats
path: root/src/jalv.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2015-02-14 02:04:59 +0000
committerDavid Robillard <d@drobilla.net>2015-02-14 02:04:59 +0000
commit98d0093e0124e377669e717d621c4feeffc9ba09 (patch)
treec5e19a5b133409125ff6cf5f535138e622f08468 /src/jalv.c
parentcebeaf23baa346201e76658139caa68d7d33d42f (diff)
downloadjalv-98d0093e0124e377669e717d621c4feeffc9ba09.tar.gz
jalv-98d0093e0124e377669e717d621c4feeffc9ba09.tar.bz2
jalv-98d0093e0124e377669e717d621c4feeffc9ba09.zip
Exit GUI versions on interrupt.
git-svn-id: http://svn.drobilla.net/lad/trunk/jalv@5558 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/jalv.c')
-rw-r--r--src/jalv.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/jalv.c b/src/jalv.c
index c523e98..a40c7f6 100644
--- a/src/jalv.c
+++ b/src/jalv.c
@@ -850,25 +850,32 @@ jalv_ui_port_index(SuilController controller, const char* symbol)
}
bool
-jalv_emit_ui_events(Jalv* jalv)
+jalv_update(Jalv* jalv)
{
+ /* Check quit flag and close if set. */
+ if (zix_sem_try_wait(&exit_sem)) {
+ jalv_close_ui(jalv);
+ return false;
+ }
+
+ /* Emit UI events. */
ControlChange ev;
const size_t space = jack_ringbuffer_read_space(jalv->plugin_events);
for (size_t i = 0;
i + sizeof(ev) + sizeof(float) <= space;
i += sizeof(ev) + ev.size) {
- // Read event header to get the size
+ /* Read event header to get the size */
jack_ringbuffer_read(jalv->plugin_events, (char*)&ev, sizeof(ev));
- // Resize read buffer if necessary
+ /* Resize read buffer if necessary */
jalv->ui_event_buf = realloc(jalv->ui_event_buf, ev.size);
void* const buf = jalv->ui_event_buf;
- // Read event body
+ /* Read event body */
jack_ringbuffer_read(jalv->plugin_events, buf, ev.size);
if (jalv->opts.dump && ev.protocol == jalv->urids.atom_eventTransfer) {
- // Dump event in Turtle to the console
+ /* Dump event in Turtle to the console */
LV2_Atom* atom = (LV2_Atom*)buf;
char* str = sratom_to_turtle(
jalv->ui_sratom, &jalv->unmap, "jalv:", NULL, NULL,
@@ -924,8 +931,8 @@ main(int argc, char** argv)
Jalv jalv;
memset(&jalv, '\0', sizeof(Jalv));
jalv.prog_name = argv[0];
- jalv.block_length = 4096; // Should be set by jack_buffer_size_cb
- jalv.midi_buf_size = 1024; // Should be set by jack_buffer_size_cb
+ jalv.block_length = 4096; /* Should be set by jack_buffer_size_cb */
+ jalv.midi_buf_size = 1024; /* Should be set by jack_buffer_size_cb */
jalv.play_state = JALV_PAUSED;
jalv.bpm = 120.0f;
@@ -1101,7 +1108,7 @@ main(int argc, char** argv)
suil_ui_supported,
native_ui_type,
&jalv.ui_type)) {
- // TODO: Multiple UI support
+ /* TODO: Multiple UI support */
jalv.ui = this_ui;
break;
}