aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Hanspeter Portner <dev@open-music-kontrollers.ch>2019-03-14 22:29:23 +0100
committerGravatar Hanspeter Portner <dev@open-music-kontrollers.ch>2019-03-14 22:29:23 +0100
commit725d883b70cf2a0ecb2e401fc3c43af1f4f35068 (patch)
tree902c81da41e5d48a336eb7f6b467d25889e0ba4d
parent6dec13b009e6bba83d69d177d665aacbaf6f40fd (diff)
parent620310de7bf78eccee78f29de4969659d02861d2 (diff)
downloadsynthpod-725d883b70cf2a0ecb2e401fc3c43af1f4f35068.tar.xz
Merge commit '620310de7bf78eccee78f29de4969659d02861d2'
-rw-r--r--xpress.lv2/VERSION2
-rw-r--r--xpress.lv2/meson.build18
-rw-r--r--xpress.lv2/test/xpress.c2
-rw-r--r--xpress.lv2/xpress.lv2/xpress.h53
4 files changed, 64 insertions, 11 deletions
diff --git a/xpress.lv2/VERSION b/xpress.lv2/VERSION
index 962d1c1..ef2f8c8 100644
--- a/xpress.lv2/VERSION
+++ b/xpress.lv2/VERSION
@@ -1 +1 @@
-0.1.81
+0.1.87
diff --git a/xpress.lv2/meson.build b/xpress.lv2/meson.build
index 8eca8a3..46d6276 100644
--- a/xpress.lv2/meson.build
+++ b/xpress.lv2/meson.build
@@ -11,6 +11,8 @@ conf_data = configuration_data()
cc = meson.get_compiler('c')
cp = find_program('cp')
+lv2_validate = find_program('lv2_validate', native : true, required : false)
+lv2lint = find_program('lv2lint', required : false)
clone = [cp, '@INPUT@', '@OUTPUT@']
lv2_dep = dependency('lv2', version : '>=1.14.0')
@@ -46,13 +48,25 @@ conf_data.set('MICRO_VERSION', version[2])
suffix = mod.full_path().strip().split('.')[-1]
conf_data.set('MODULE_SUFFIX', '.' + suffix)
-configure_file(input : join_paths('test', 'manifest.ttl.in'), output : 'manifest.ttl',
+manifest_ttl = configure_file(input : join_paths('test', 'manifest.ttl.in'),
+ output : 'manifest.ttl',
configuration : conf_data,
install : true,
install_dir : inst_dir)
-custom_target('xpress_ttl',
+dsp_ttl = custom_target('xpress_ttl',
input : join_paths('test', 'xpress.ttl'),
output : 'xpress.ttl',
command : clone,
install : true,
install_dir : inst_dir)
+
+if lv2_validate.found()
+ test('LV2 validate', lv2_validate,
+ args : [manifest_ttl, dsp_ttl])
+endif
+
+if lv2lint.found()
+ test('LV2 lint', lv2lint,
+ args : ['-Ewarn',
+ 'http://open-music-kontrollers.ch/lv2/xpress#test'])
+endif
diff --git a/xpress.lv2/test/xpress.c b/xpress.lv2/test/xpress.c
index 461448c..e1054ac 100644
--- a/xpress.lv2/test/xpress.c
+++ b/xpress.lv2/test/xpress.c
@@ -61,8 +61,6 @@ _dump(plughandle_t *handle)
{
XPRESS_VOICE_FOREACH(&handle->xpressI, voice)
{
- if(!voice->uuid) continue;
-
lv2_log_trace(&handle->logger, "\t%"PRIu32" (%"PRIu32")", voice->uuid, voice->source);
}
}
diff --git a/xpress.lv2/xpress.lv2/xpress.h b/xpress.lv2/xpress.lv2/xpress.h
index 84595bb..618f197 100644
--- a/xpress.lv2/xpress.lv2/xpress.h
+++ b/xpress.lv2/xpress.lv2/xpress.h
@@ -175,15 +175,56 @@ struct _xpress_t {
xpress_t (XPRESS); \
xpress_voice_t XPRESS_CONCAT(_voices, __COUNTER__) [(MAX_NVOICES - 1)]
+// rt-safe
+static inline bool
+_xpress_voice_not_end(xpress_t *xpress, xpress_voice_t *voice)
+{
+ return (unsigned)(voice - xpress->voices) < xpress->max_nvoices;
+}
+
+// rt-safe
+static inline xpress_voice_t *
+xpress_voice_begin(xpress_t *xpress)
+{
+ for(xpress_voice_t *voice = xpress->voices;
+ _xpress_voice_not_end(xpress, voice);
+ voice = voice + 1)
+ {
+ if(voice->uuid)
+ {
+ return voice;
+ }
+ }
+
+ return NULL;
+}
+
+// rt-safe
+static inline xpress_voice_t *
+xpress_voice_next(xpress_t *xpress, xpress_voice_t *voice)
+{
+ for( ;
+ _xpress_voice_not_end(xpress, voice);
+ voice = voice + 1)
+ {
+ if(voice->uuid)
+ {
+ return voice;
+ }
+ }
+
+ return NULL;
+}
+
#define XPRESS_VOICE_FOREACH(XPRESS, VOICE) \
- for(xpress_voice_t *(VOICE) = &(XPRESS)->voices[(int)(XPRESS)->max_nvoices - 1]; \
- (VOICE) >= (XPRESS)->voices; \
- (VOICE)--)
+ for(xpress_voice_t *(VOICE) = xpress_voice_begin((XPRESS)); \
+ (VOICE); \
+ (VOICE) = xpress_voice_next((XPRESS), (VOICE)))
#define XPRESS_VOICE_FREE(XPRESS, VOICE) \
- for(xpress_voice_t *(VOICE) = &(XPRESS)->voices[(int)(XPRESS)->max_nvoices - 1]; \
- (VOICE) >= (XPRESS)->voices; \
- (VOICE)->uuid = 0, (VOICE)--)
+ for(xpress_voice_t *(VOICE) = xpress_voice_begin((XPRESS)); \
+ (VOICE); \
+ (VOICE)->uuid = 0, (VOICE) = xpress_voice_next((XPRESS), (VOICE)))
// non rt-safe
static inline int