diff options
author | David Robillard <d@drobilla.net> | 2022-08-10 03:59:10 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-08-17 13:50:52 -0400 |
commit | d362d151889f929ee6d339c788d1052b5a28b10e (patch) | |
tree | 30a7c3c86dc76422a30ab057719a6b46971e79d0 /src | |
parent | ee2e5da44af30ace6fdbc488f5275557ee3442b5 (diff) | |
download | jalv-d362d151889f929ee6d339c788d1052b5a28b10e.tar.gz jalv-d362d151889f929ee6d339c788d1052b5a28b10e.tar.bz2 jalv-d362d151889f929ee6d339c788d1052b5a28b10e.zip |
Use clearer names for communication rings
Diffstat (limited to 'src')
-rw-r--r-- | src/jack.c | 2 | ||||
-rw-r--r-- | src/jalv.c | 32 | ||||
-rw-r--r-- | src/jalv_internal.h | 62 | ||||
-rw-r--r-- | src/portaudio.c | 2 | ||||
-rw-r--r-- | src/state.c | 2 |
5 files changed, 50 insertions, 50 deletions
@@ -273,7 +273,7 @@ jack_process_cb(jack_nframes_t nframes, void* data) ev->protocol = 0; ev->size = sizeof(float); *(float*)(ev + 1) = port->control; - if (zix_ring_write(jalv->plugin_events, buf, sizeof(buf)) < sizeof(buf)) { + if (zix_ring_write(jalv->plugin_to_ui, buf, sizeof(buf)) < sizeof(buf)) { jalv_log(JALV_LOG_ERR, "Plugin => UI buffer overflow!\n"); } } @@ -527,7 +527,7 @@ jalv_ui_write(void* const jalv_handle, ev->protocol = protocol; ev->size = buffer_size; memcpy(ev + 1, buffer, buffer_size); - zix_ring_write(jalv->ui_events, buf, sizeof(ControlChange) + buffer_size); + zix_ring_write(jalv->ui_to_plugin, buf, sizeof(ControlChange) + buffer_size); } void @@ -538,12 +538,12 @@ jalv_apply_ui_events(Jalv* jalv, uint32_t nframes) } ControlChange ev; - const size_t space = zix_ring_read_space(jalv->ui_events); + const size_t space = zix_ring_read_space(jalv->ui_to_plugin); for (size_t i = 0; i < space; i += sizeof(ev) + ev.size) { - zix_ring_read(jalv->ui_events, (char*)&ev, sizeof(ev)); + zix_ring_read(jalv->ui_to_plugin, (char*)&ev, sizeof(ev)); char body[MSG_BUFFER_SIZE]; - if (zix_ring_read(jalv->ui_events, body, ev.size) != ev.size) { + if (zix_ring_read(jalv->ui_to_plugin, body, ev.size) != ev.size) { jalv_log(JALV_LOG_ERR, "Failed to read from UI ring buffer\n"); break; } @@ -624,9 +624,9 @@ jalv_send_to_ui(Jalv* jalv, atom->type = type; atom->size = size; - if (zix_ring_write_space(jalv->plugin_events) >= sizeof(evbuf) + size) { - zix_ring_write(jalv->plugin_events, evbuf, sizeof(evbuf)); - zix_ring_write(jalv->plugin_events, (const char*)body, size); + if (zix_ring_write_space(jalv->plugin_to_ui) >= sizeof(evbuf) + size) { + zix_ring_write(jalv->plugin_to_ui, evbuf, sizeof(evbuf)); + zix_ring_write(jalv->plugin_to_ui, (const char*)body, size); return true; } @@ -675,17 +675,17 @@ jalv_update(Jalv* jalv) // Emit UI events ControlChange ev; - const size_t space = zix_ring_read_space(jalv->plugin_events); + const size_t space = zix_ring_read_space(jalv->plugin_to_ui); for (size_t i = 0; i + sizeof(ev) < space; i += sizeof(ev) + ev.size) { // Read event header to get the size - zix_ring_read(jalv->plugin_events, (char*)&ev, sizeof(ev)); + zix_ring_read(jalv->plugin_to_ui, (char*)&ev, sizeof(ev)); // 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 - zix_ring_read(jalv->plugin_events, (char*)buf, ev.size); + zix_ring_read(jalv->plugin_to_ui, (char*)buf, ev.size); if (jalv->opts.dump && ev.protocol == jalv->urids.atom_eventTransfer) { // Dump event in Turtle to the console @@ -1207,10 +1207,10 @@ jalv_open(Jalv* const jalv, int* argc, char*** argv) &jalv->features.safe_restore_feature, LV2_STATE__threadSafeRestore, NULL); // Create Plugin <=> UI communication buffers - jalv->ui_events = zix_ring_new(jalv->opts.buffer_size); - jalv->plugin_events = zix_ring_new(jalv->opts.buffer_size); - zix_ring_mlock(jalv->ui_events); - zix_ring_mlock(jalv->plugin_events); + jalv->ui_to_plugin = zix_ring_new(jalv->opts.buffer_size); + jalv->plugin_to_ui = zix_ring_new(jalv->opts.buffer_size); + zix_ring_mlock(jalv->ui_to_plugin); + zix_ring_mlock(jalv->plugin_to_ui); // Build feature list for passing to plugins const LV2_Feature* const features[] = {&jalv->features.map_feature, @@ -1356,8 +1356,8 @@ jalv_close(Jalv* const jalv) // Clean up free(jalv->ports); - zix_ring_free(jalv->ui_events); - zix_ring_free(jalv->plugin_events); + zix_ring_free(jalv->ui_to_plugin); + zix_ring_free(jalv->plugin_to_ui); for (LilvNode** n = (LilvNode**)&jalv->nodes; *n; ++n) { lilv_node_free(*n); } diff --git a/src/jalv_internal.h b/src/jalv_internal.h index 4a2e74c..13fe704 100644 --- a/src/jalv_internal.h +++ b/src/jalv_internal.h @@ -62,37 +62,37 @@ typedef struct { } JalvFeatures; struct JalvImpl { - JalvOptions opts; ///< Command-line options - JalvURIDs urids; ///< URIDs - JalvNodes nodes; ///< Nodes - JalvLog log; ///< Log for error/warning/debug messages - LV2_Atom_Forge forge; ///< Atom forge - LilvWorld* world; ///< Lilv World - LV2_URID_Map map; ///< URI => Int map - LV2_URID_Unmap unmap; ///< Int => URI map - SerdEnv* env; ///< Environment for RDF printing - Sratom* sratom; ///< Atom serialiser - Sratom* ui_sratom; ///< Atom serialiser for UI thread - Symap* symap; ///< URI map - ZixSem symap_lock; ///< Lock for URI map - JalvBackend* backend; ///< Audio system backend - ZixRing* ui_events; ///< Port events from UI - ZixRing* plugin_events; ///< Port events from plugin - void* ui_event_buf; ///< Buffer for reading UI port events - JalvWorker worker; ///< Worker thread implementation - JalvWorker state_worker; ///< Synchronous worker for state restore - ZixSem work_lock; ///< Lock for plugin work() method - ZixSem done; ///< Exit semaphore - ZixSem paused; ///< Paused signal from process thread - JalvPlayState play_state; ///< Current play state - char* temp_dir; ///< Temporary plugin state directory - char* save_dir; ///< Plugin save directory - const LilvPlugin* plugin; ///< Plugin class (RDF data) - LilvState* preset; ///< Current preset - LilvUIs* uis; ///< All plugin UIs (RDF data) - const LilvUI* ui; ///< Plugin UI (RDF data) - const LilvNode* ui_type; ///< Plugin UI type (unwrapped) - LilvInstance* instance; ///< Plugin instance (shared library) + JalvOptions opts; ///< Command-line options + JalvURIDs urids; ///< URIDs + JalvNodes nodes; ///< Nodes + JalvLog log; ///< Log for error/warning/debug messages + LV2_Atom_Forge forge; ///< Atom forge + LilvWorld* world; ///< Lilv World + LV2_URID_Map map; ///< URI => Int map + LV2_URID_Unmap unmap; ///< Int => URI map + SerdEnv* env; ///< Environment for RDF printing + Sratom* sratom; ///< Atom serialiser + Sratom* ui_sratom; ///< Atom serialiser for UI thread + Symap* symap; ///< URI map + ZixSem symap_lock; ///< Lock for URI map + JalvBackend* backend; ///< Audio system backend + ZixRing* ui_to_plugin; ///< Port events from UI + ZixRing* plugin_to_ui; ///< Port events from plugin + void* ui_event_buf; ///< Buffer for reading UI port events + JalvWorker worker; ///< Worker thread implementation + JalvWorker state_worker; ///< Synchronous worker for state restore + ZixSem work_lock; ///< Lock for plugin work() method + ZixSem done; ///< Exit semaphore + ZixSem paused; ///< Paused signal from process thread + JalvPlayState play_state; ///< Current play state + char* temp_dir; ///< Temporary plugin state directory + char* save_dir; ///< Plugin save directory + const LilvPlugin* plugin; ///< Plugin class (RDF data) + LilvState* preset; ///< Current preset + LilvUIs* uis; ///< All plugin UIs (RDF data) + const LilvUI* ui; ///< Plugin UI (RDF data) + const LilvNode* ui_type; ///< Plugin UI type (unwrapped) + LilvInstance* instance; ///< Plugin instance (shared library) #if USE_SUIL SuilHost* ui_host; ///< Plugin UI host support SuilInstance* ui_instance; ///< Plugin UI instance (shared library) diff --git a/src/portaudio.c b/src/portaudio.c index 2d2ccfc..7178e76 100644 --- a/src/portaudio.c +++ b/src/portaudio.c @@ -90,7 +90,7 @@ pa_process_cb(const void* inputs, ev->protocol = 0; ev->size = sizeof(float); *(float*)(ev + 1) = port->control; - if (zix_ring_write(jalv->plugin_events, buf, sizeof(buf)) < sizeof(buf)) { + if (zix_ring_write(jalv->plugin_to_ui, buf, sizeof(buf)) < sizeof(buf)) { jalv_log(JALV_LOG_ERR, "Plugin => UI buffer overflow\n"); } } diff --git a/src/state.c b/src/state.c index 6c00f86..c6037f3 100644 --- a/src/state.c +++ b/src/state.c @@ -166,7 +166,7 @@ set_port_value(const char* port_symbol, ev->protocol = 0; ev->size = sizeof(fvalue); *(float*)(ev + 1) = fvalue; - zix_ring_write(jalv->plugin_events, buf, sizeof(buf)); + zix_ring_write(jalv->plugin_to_ui, buf, sizeof(buf)); } } |