From 2a5bc1ca7aee36cd763ac10c894b84eef347fe25 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 21 Nov 2024 14:08:02 -0500 Subject: Factor out "settings" that affect the execution process --- src/jack.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/jack.c') diff --git a/src/jack.c b/src/jack.c index a5f26c6..f848476 100644 --- a/src/jack.c +++ b/src/jack.c @@ -12,6 +12,7 @@ #include "lv2_evbuf.h" #include "port.h" #include "process.h" +#include "settings.h" #include "string_utils.h" #include "types.h" #include "urids.h" @@ -50,11 +51,13 @@ static const float max_latency = 16777216.0f; static int jack_buffer_size_cb(jack_nframes_t nframes, void* data) { - Jalv* const jalv = (Jalv*)data; - jalv->block_length = nframes; + Jalv* const jalv = (Jalv*)data; + JalvSettings* const settings = &jalv->settings; + + settings->block_length = nframes; #if USE_JACK_PORT_TYPE_GET_BUFFER_SIZE - jalv->midi_buf_size = jack_port_type_get_buffer_size(jalv->backend->client, - JACK_DEFAULT_MIDI_TYPE); + settings->midi_buf_size = jack_port_type_get_buffer_size( + jalv->backend->client, JACK_DEFAULT_MIDI_TYPE); #endif if (jalv->run_state == JALV_RUNNING) { jalv_allocate_port_buffers(jalv); @@ -355,11 +358,12 @@ jalv_backend_open(Jalv* jalv) jalv_log(JALV_LOG_INFO, "JACK name: %s\n", jack_get_client_name(client)); // Set audio engine properties - jalv->sample_rate = (float)jack_get_sample_rate(client); - jalv->block_length = jack_get_buffer_size(client); - jalv->midi_buf_size = 4096; + JalvSettings* const settings = &jalv->settings; + settings->sample_rate = (float)jack_get_sample_rate(client); + settings->block_length = jack_get_buffer_size(client); + settings->midi_buf_size = 4096; #if USE_JACK_PORT_TYPE_GET_BUFFER_SIZE - jalv->midi_buf_size = + settings->midi_buf_size = jack_port_type_get_buffer_size(client, JACK_DEFAULT_MIDI_TYPE); #endif -- cgit v1.2.1