aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--VERSION2
-rw-r--r--manifest.ttl.in7
-rw-r--r--meson.build40
-rw-r--r--preset_work.c111
-rw-r--r--presets.ttl.in23
5 files changed, 168 insertions, 15 deletions
diff --git a/VERSION b/VERSION
index f4fdeb6..7fcea72 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.1.179
+0.1.181
diff --git a/manifest.ttl.in b/manifest.ttl.in
index 92fcef5..0d61cd1 100644
--- a/manifest.ttl.in
+++ b/manifest.ttl.in
@@ -69,6 +69,13 @@ jit:bank-c_gain
pset:bank jit:bank-c;
rdfs:label "[C] Gain" ;
rdfs:seeAlso <presets.ttl> .
+jit:bank-c_work
+ a pset:Preset ;
+ lv2:appliesTo jit:mono ,
+ jit:stereo ;
+ pset:bank jit:bank-c;
+ rdfs:label "[C] Work" ;
+ rdfs:seeAlso <presets.ttl> .
jit:bank-c_osc
a pset:Preset ;
lv2:appliesTo jit:mono ,
diff --git a/meson.build b/meson.build
index 8a47cac..8c8d9c8 100644
--- a/meson.build
+++ b/meson.build
@@ -7,6 +7,8 @@ project('jit.lv2', ['c', 'rust'], default_options : [
d2tk = subproject('d2tk')
+build_tests = get_option('build-tests')
+
if get_option('use-backend-nanovg').enabled()
d2tk_dep = d2tk.get_variable('d2tk_nanovg')
elif get_option('use-backend-cairo').enabled()
@@ -78,7 +80,15 @@ shared_module('preset_gain_c', 'preset_gain.c',
include_directories : inc_dir,
name_prefix : '',
install : false)
-
+
+pset_work_c_code = run_command('cat', 'preset_work.c').stdout()
+conf_data.set('PRESET_WORK_C', pset_work_c_code)
+shared_module('preset_work_c', 'preset_work.c',
+ c_args : c_args,
+ include_directories : inc_dir,
+ name_prefix : '',
+ install : false)
+
pset_osc_c_code = run_command('cat', 'preset_osc.c').stdout()
conf_data.set('PRESET_OSC_C', pset_osc_c_code)
shared_module('preset_osc_c', 'preset_osc.c',
@@ -147,17 +157,19 @@ configure_file(
install : true,
install_dir : inst_dir)
-if lv2_validate.found() and sord_validate.found()
- test('LV2 validate', lv2_validate,
- args : [manifest_ttl, dsp_ttl, ui_ttl, pset_ttl])
-endif
-
-if lv2lint.found()
- test('LV2 lint', lv2lint,
- args : ['-M', 'pack',
- '-E', 'warn',
- '-I', join_paths(build_root, ''),
- 'http://open-music-kontrollers.ch/lv2/jit#mono',
- 'http://open-music-kontrollers.ch/lv2/jit#stereo',
- ])
+if build_tests
+ if lv2_validate.found() and sord_validate.found()
+ test('LV2 validate', lv2_validate,
+ args : [manifest_ttl, dsp_ttl, ui_ttl, pset_ttl])
+ endif
+
+ if lv2lint.found()
+ test('LV2 lint', lv2lint,
+ args : ['-M', 'pack',
+ '-E', 'warn',
+ '-I', join_paths(build_root, ''),
+ 'http://open-music-kontrollers.ch/lv2/jit#mono',
+ 'http://open-music-kontrollers.ch/lv2/jit#stereo',
+ ])
+ endif
endif
diff --git a/preset_work.c b/preset_work.c
new file mode 100644
index 0000000..b1218b8
--- /dev/null
+++ b/preset_work.c
@@ -0,0 +1,111 @@
+#include <jit.h>
+#include <stddef.h>
+#include <stdlib.h>
+
+typedef struct _plug_t plug_t;
+
+struct _plug_t {
+ float val;
+};
+
+static void
+produce_val(jit_t *const jit)
+{
+ float *val;
+ const size_t len = sizeof(float);
+
+ if( (val= jit_work_request(jit, len)) )
+ {
+ *val = (float)rand() / RAND_MAX;
+
+ jit_work_advance(jit, len);
+ }
+}
+
+static void
+request_val(jit_t *const jit)
+{
+ uint32_t *dummy;
+ const size_t len = sizeof(uint32_t);
+
+ if( (dummy = jit_work_request(jit, len)) )
+ {
+ *dummy = 0;
+
+ jit_work_advance(jit, len);
+ }
+}
+
+static void *
+init(jit_t *const jit)
+{
+ jit_printf(jit, "[%s]", __func__);
+
+ plug_t *plug = calloc(1, sizeof(plug_t));
+ jit_assert(jit, plug);
+
+ produce_val(jit);
+
+ return plug;
+}
+
+static void
+deinit(jit_t *const jit, void *const data)
+{
+ jit_printf(jit, "[%s]", __func__);
+
+ plug_t *plug = data;
+ jit_assert(jit, plug);
+
+ free(plug);
+}
+
+static void
+run(jit_t *const jit, void *const data)
+{
+ plug_t *plug = data;
+ jit_assert(jit, plug);
+
+ request_val(jit);
+
+ for(uint32_t n = 0; n < jit->nchannels; n++)
+ {
+ for(uint32_t i = 0; i < jit->nsamples; i++)
+ {
+ jit->audio_out[n][i] = plug->val;
+ }
+ }
+}
+
+static void
+work_schedule(jit_t *const jit, void *const data JIT_UNUSED,
+ void const *const buf JIT_UNUSED, size_t len JIT_UNUSED)
+{
+ jit_printf(jit, "[%s]", __func__);
+
+ produce_val(jit);
+}
+
+static void
+work_response(jit_t *const jit, void *const data, void const *const buf,
+ size_t len JIT_UNUSED)
+{
+ jit_printf(jit, "[%s]", __func__);
+
+ plug_t *plug = data;
+ jit_assert(jit, plug);
+
+ float const *const val = buf;
+ plug->val = *val;
+}
+
+JIT_EXPORT jit_desc_t const jit_desc = {
+ .init = init,
+ .deinit = deinit,
+ .run = run,
+ .work_schedule = work_schedule,
+ .work_response = work_response
+};
+
+// vim: set syntax=c:
+// jit: gcc -std=c11 -ffast-math -fvisibility=hidden -O3 -shared -fpic -fPIC -Wall -Wextra -Wpedantic -Wl,-z,defs -I %b -o %o -xc %i -lm 2>&1:
diff --git a/presets.ttl.in b/presets.ttl.in
index fa03d5c..d3b637c 100644
--- a/presets.ttl.in
+++ b/presets.ttl.in
@@ -49,6 +49,29 @@ jit:bank-c_gain
jit:control_16 "0.0"^^xsd:float ;
] .
+jit:bank-c_work
+ a pset:Preset ;
+ doap:license lic:Artistic-2.0 ;
+ state:state [
+ jit:code """@PRESET_WORK_C@""" ;
+ jit:control_1 "0.0"^^xsd:float ;
+ jit:control_2 "0.0"^^xsd:float ;
+ jit:control_3 "0.0"^^xsd:float ;
+ jit:control_4 "0.0"^^xsd:float ;
+ jit:control_5 "0.0"^^xsd:float ;
+ jit:control_6 "0.0"^^xsd:float ;
+ jit:control_7 "0.0"^^xsd:float ;
+ jit:control_8 "0.0"^^xsd:float ;
+ jit:control_9 "0.0"^^xsd:float ;
+ jit:control_10 "0.0"^^xsd:float ;
+ jit:control_11 "0.0"^^xsd:float ;
+ jit:control_12 "0.0"^^xsd:float ;
+ jit:control_13 "0.0"^^xsd:float ;
+ jit:control_14 "0.0"^^xsd:float ;
+ jit:control_15 "0.0"^^xsd:float ;
+ jit:control_16 "0.0"^^xsd:float ;
+ ] .
+
jit:bank-c_osc
a pset:Preset ;
doap:license lic:Artistic-2.0 ;