aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2019-07-13 13:11:08 +0200
committerHanspeter Portner <dev@open-music-kontrollers.ch>2019-07-13 13:11:08 +0200
commit51a00910f03e138291d3a32c564a20cbb5a34136 (patch)
treed21c9d931d0bfdb5a13357fc0da5771c5f1c358c
parentde37b1b397d7d879817fed6a62e568239cd8e039 (diff)
downloadrouter.lv2-master.tar.gz
router.lv2-master.tar.bz2
router.lv2-master.tar.xz
router.lv2-master.zip
add rollUnderIndex parameter.HEADmaster
-rw-r--r--VERSION2
-rw-r--r--router.h1
-rw-r--r--router.ttl.in23
-rw-r--r--router_atom_bouncer.c61
-rw-r--r--router_atom_sprinkler.c37
-rw-r--r--router_audio_bouncer.c37
-rw-r--r--router_audio_sprinkler.c37
7 files changed, 169 insertions, 29 deletions
diff --git a/VERSION b/VERSION
index 9c178d3..7cd2918 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.1.95
+0.1.97
diff --git a/router.h b/router.h
index 006d318..48f8845 100644
--- a/router.h
+++ b/router.h
@@ -60,6 +60,7 @@
#define ROUTER__nextIndex ROUTER_PREFIX"nextIndex"
#define ROUTER__prevIndex ROUTER_PREFIX"prevIndex"
+#define ROUTER__rollUnderIndex ROUTER_PREFIX"rollUnderIndex"
#define ROUTER__rollOverIndex ROUTER_PREFIX"rollOverIndex"
#define ROUTER__currentIndex ROUTER_PREFIX"currentIndex"
#define ROUTER__switchPeriod ROUTER_PREFIX"switchPeriod"
diff --git a/router.ttl.in b/router.ttl.in
index 7e355a2..cb02f15 100644
--- a/router.ttl.in
+++ b/router.ttl.in
@@ -66,6 +66,13 @@ router:prevIndex
rdfs:label "Prev index" ;
rdfs:comment "set previous index" ;
rdfs:range atom:Bool .
+router:rollUnderIndex
+ a lv2:Parameter ;
+ rdfs:label "Roll under index" ;
+ rdfs:comment "set index at which to roll under" ;
+ rdfs:range atom:Int ;
+ lv2:minimum 1 ;
+ lv2:maximum 8 .
router:rollOverIndex
a lv2:Parameter ;
rdfs:label "Roll over index" ;
@@ -215,12 +222,14 @@ router:atom_sprinkler
patch:writable
router:nextIndex ,
router:prevIndex ,
+ router:rollUnderIndex ,
router:rollOverIndex ,
router:currentIndex ;
state:state [
router:nextIndex false ;
router:prevIndex false ;
+ router:rollUnderIndex 1 ;
router:rollOverIndex 8 ;
router:currentIndex 1 ;
] .
@@ -314,6 +323,7 @@ router:audio_sprinkler
patch:writable
router:nextIndex ,
router:prevIndex ,
+ router:rollUnderIndex ,
router:rollOverIndex ,
router:currentIndex ,
router:switchPeriod ;
@@ -321,6 +331,7 @@ router:audio_sprinkler
state:state [
router:nextIndex false ;
router:prevIndex false ;
+ router:rollUnderIndex 1 ;
router:rollOverIndex 8 ;
router:currentIndex 1 ;
router:switchPeriod "0.1"^^xsd:float ;
@@ -469,6 +480,7 @@ router:audio_sprinkler_2
patch:writable
router:nextIndex ,
router:prevIndex ,
+ router:rollUnderIndex ,
router:rollOverIndex ,
router:currentIndex ,
router:switchPeriod ;
@@ -476,6 +488,7 @@ router:audio_sprinkler_2
state:state [
router:nextIndex false ;
router:prevIndex false ;
+ router:rollUnderIndex 1 ;
router:rollOverIndex 8 ;
router:currentIndex 1 ;
router:switchPeriod "0.1"^^xsd:float ;
@@ -573,6 +586,7 @@ router:cv_sprinkler
patch:writable
router:nextIndex ,
router:prevIndex ,
+ router:rollUnderIndex ,
router:rollOverIndex ,
router:currentIndex ,
router:switchPeriod ;
@@ -580,6 +594,7 @@ router:cv_sprinkler
state:state [
router:nextIndex false ;
router:prevIndex false ;
+ router:rollUnderIndex 1 ;
router:rollOverIndex 8 ;
router:currentIndex 1 ;
router:switchPeriod "0.1"^^xsd:float ;
@@ -701,12 +716,14 @@ router:atom_bouncer
patch:writable
router:nextIndex ,
router:prevIndex ,
+ router:rollUnderIndex ,
router:rollOverIndex ,
router:currentIndex ;
state:state [
router:nextIndex false ;
router:prevIndex false ;
+ router:rollUnderIndex 1 ;
router:rollOverIndex 8 ;
router:currentIndex 1 ;
] .
@@ -800,6 +817,7 @@ router:audio_bouncer
patch:writable
router:nextIndex ,
router:prevIndex ,
+ router:rollUnderIndex ,
router:rollOverIndex ,
router:currentIndex ,
router:switchPeriod ;
@@ -807,6 +825,7 @@ router:audio_bouncer
state:state [
router:nextIndex false ;
router:prevIndex false ;
+ router:rollUnderIndex 1 ;
router:rollOverIndex 8 ;
router:currentIndex 1 ;
router:switchPeriod "0.1"^^xsd:float ;
@@ -955,6 +974,7 @@ router:audio_bouncer_2
patch:writable
router:nextIndex ,
router:prevIndex ,
+ router:rollUnderIndex ,
router:rollOverIndex ,
router:currentIndex ,
router:switchPeriod ;
@@ -962,6 +982,7 @@ router:audio_bouncer_2
state:state [
router:nextIndex false ;
router:prevIndex false ;
+ router:rollUnderIndex 1 ;
router:rollOverIndex 8 ;
router:currentIndex 1 ;
router:switchPeriod "0.1"^^xsd:float ;
@@ -1080,6 +1101,7 @@ router:cv_bouncer
patch:writable
router:nextIndex ,
router:prevIndex ,
+ router:rollUnderIndex ,
router:rollOverIndex ,
router:currentIndex ,
router:switchPeriod ;
@@ -1087,6 +1109,7 @@ router:cv_bouncer
state:state [
router:nextIndex false ;
router:prevIndex false ;
+ router:rollUnderIndex 1 ;
router:rollOverIndex 8 ;
router:currentIndex 1 ;
router:switchPeriod "0.1"^^xsd:float ;
diff --git a/router_atom_bouncer.c b/router_atom_bouncer.c
index 8376b0d..25b0cc6 100644
--- a/router_atom_bouncer.c
+++ b/router_atom_bouncer.c
@@ -23,7 +23,7 @@
#include <props.h>
#define MAX_NINS 8
-#define MAX_NPROPS 4
+#define MAX_NPROPS 5
typedef struct _plugstate_t plugstate_t;
typedef struct _plughandle_t plughandle_t;
@@ -31,6 +31,7 @@ typedef struct _plughandle_t plughandle_t;
struct _plugstate_t {
int32_t next_index;
int32_t prev_index;
+ int32_t roll_under_index;
int32_t roll_over_index;
int32_t current_index;
};
@@ -44,9 +45,9 @@ struct _plughandle_t {
craft_t notify;
struct {
- LV2_URID sprinkler_nextIndex;
- LV2_URID sprinkler_prevIndex;
- LV2_URID sprinkler_currentIndex;
+ LV2_URID bouncer_nextIndex;
+ LV2_URID bouncer_prevIndex;
+ LV2_URID bouncer_currentIndex;
} urid;
plugstate_t state;
@@ -67,12 +68,12 @@ _intercept_next_index(void *data, int64_t frames,
handle->state.current_index += 1;
if(handle->state.current_index > handle->state.roll_over_index)
- handle->state.current_index = 1;
+ handle->state.current_index = handle->state.roll_under_index;
props_set(&handle->props, &handle->notify.forge, frames,
- handle->urid.sprinkler_nextIndex, &handle->notify.ref);
+ handle->urid.bouncer_nextIndex, &handle->notify.ref);
props_set(&handle->props, &handle->notify.forge, frames,
- handle->urid.sprinkler_currentIndex, &handle->notify.ref);
+ handle->urid.bouncer_currentIndex, &handle->notify.ref);
}
}
@@ -87,13 +88,28 @@ _intercept_prev_index(void *data, int64_t frames,
handle->state.prev_index = false;
handle->state.current_index -= 1;
- if(handle->state.current_index < 1)
+ if(handle->state.current_index < handle->state.roll_under_index)
handle->state.current_index = handle->state.roll_over_index;
props_set(&handle->props, &handle->notify.forge, frames,
- handle->urid.sprinkler_prevIndex, &handle->notify.ref);
+ handle->urid.bouncer_prevIndex, &handle->notify.ref);
props_set(&handle->props, &handle->notify.forge, frames,
- handle->urid.sprinkler_currentIndex, &handle->notify.ref);
+ handle->urid.bouncer_currentIndex, &handle->notify.ref);
+ }
+}
+
+static void
+_intercept_roll_under_index(void *data, int64_t frames,
+ props_impl_t *impl __attribute__((unused)))
+{
+ plughandle_t *handle = data;
+
+ if(handle->state.current_index < handle->state.roll_under_index)
+ {
+ handle->state.current_index = handle->state.roll_over_index;
+
+ props_set(&handle->props, &handle->notify.forge, frames,
+ handle->urid.bouncer_currentIndex, &handle->notify.ref);
}
}
@@ -105,10 +121,10 @@ _intercept_roll_over_index(void *data, int64_t frames,
if(handle->state.current_index > handle->state.roll_over_index)
{
- handle->state.current_index = 1;
+ handle->state.current_index = handle->state.roll_under_index;
props_set(&handle->props, &handle->notify.forge, frames,
- handle->urid.sprinkler_currentIndex, &handle->notify.ref);
+ handle->urid.bouncer_currentIndex, &handle->notify.ref);
}
}
@@ -123,7 +139,14 @@ _intercept_current_index(void *data, int64_t frames,
handle->state.current_index = handle->state.roll_over_index;
props_set(&handle->props, &handle->notify.forge, frames,
- handle->urid.sprinkler_currentIndex, &handle->notify.ref);
+ handle->urid.bouncer_currentIndex, &handle->notify.ref);
+ }
+ else if(handle->state.current_index < handle->state.roll_under_index)
+ {
+ handle->state.current_index = handle->state.roll_under_index;
+
+ props_set(&handle->props, &handle->notify.forge, frames,
+ handle->urid.bouncer_currentIndex, &handle->notify.ref);
}
}
@@ -142,6 +165,12 @@ static const props_def_t defs [MAX_NPROPS] = {
},
{
.property = ROUTER__rollOverIndex,
+ .offset = offsetof(plugstate_t, roll_under_index),
+ .type = LV2_ATOM__Int,
+ .event_cb = _intercept_roll_under_index
+ },
+ {
+ .property = ROUTER__rollUnderIndex,
.offset = offsetof(plugstate_t, roll_over_index),
.type = LV2_ATOM__Int,
.event_cb = _intercept_roll_over_index
@@ -181,11 +210,11 @@ instantiate(const LV2_Descriptor* descriptor, double rate __attribute__((unused)
_craft_init(&handle->notify, handle->map);
_craft_init(&handle->event_out, handle->map);
- handle->urid.sprinkler_nextIndex = handle->map->map(handle->map->handle,
+ handle->urid.bouncer_nextIndex = handle->map->map(handle->map->handle,
ROUTER__nextIndex);
- handle->urid.sprinkler_prevIndex = handle->map->map(handle->map->handle,
+ handle->urid.bouncer_prevIndex = handle->map->map(handle->map->handle,
ROUTER__prevIndex);
- handle->urid.sprinkler_currentIndex = handle->map->map(handle->map->handle,
+ handle->urid.bouncer_currentIndex = handle->map->map(handle->map->handle,
ROUTER__currentIndex);
if(!props_init(&handle->props, descriptor->URI,
diff --git a/router_atom_sprinkler.c b/router_atom_sprinkler.c
index 0662d42..f61d494 100644
--- a/router_atom_sprinkler.c
+++ b/router_atom_sprinkler.c
@@ -23,7 +23,7 @@
#include <props.h>
#define MAX_NOUTS 8
-#define MAX_NPROPS 4
+#define MAX_NPROPS 5
typedef struct _plugstate_t plugstate_t;
typedef struct _plughandle_t plughandle_t;
@@ -31,6 +31,7 @@ typedef struct _plughandle_t plughandle_t;
struct _plugstate_t {
int32_t next_index;
int32_t prev_index;
+ int32_t roll_under_index;
int32_t roll_over_index;
int32_t current_index;
};
@@ -67,7 +68,7 @@ _intercept_next_index(void *data, int64_t frames,
handle->state.current_index += 1;
if(handle->state.current_index > handle->state.roll_over_index)
- handle->state.current_index = 1;
+ handle->state.current_index = handle->state.roll_under_index;
props_set(&handle->props, &handle->notify.forge, frames,
handle->urid.sprinkler_nextIndex, &handle->notify.ref);
@@ -87,7 +88,7 @@ _intercept_prev_index(void *data, int64_t frames,
handle->state.prev_index = false;
handle->state.current_index -= 1;
- if(handle->state.current_index < 1)
+ if(handle->state.current_index < handle->state.roll_under_index)
handle->state.current_index = handle->state.roll_over_index;
props_set(&handle->props, &handle->notify.forge, frames,
@@ -98,6 +99,21 @@ _intercept_prev_index(void *data, int64_t frames,
}
static void
+_intercept_roll_under_index(void *data, int64_t frames,
+ props_impl_t *impl __attribute__((unused)))
+{
+ plughandle_t *handle = data;
+
+ if(handle->state.current_index < handle->state.roll_under_index)
+ {
+ handle->state.current_index = handle->state.roll_over_index;
+
+ props_set(&handle->props, &handle->notify.forge, frames,
+ handle->urid.sprinkler_currentIndex, &handle->notify.ref);
+ }
+}
+
+static void
_intercept_roll_over_index(void *data, int64_t frames,
props_impl_t *impl __attribute__((unused)))
{
@@ -105,7 +121,7 @@ _intercept_roll_over_index(void *data, int64_t frames,
if(handle->state.current_index > handle->state.roll_over_index)
{
- handle->state.current_index = 1;
+ handle->state.current_index = handle->state.roll_under_index;
props_set(&handle->props, &handle->notify.forge, frames,
handle->urid.sprinkler_currentIndex, &handle->notify.ref);
@@ -125,6 +141,13 @@ _intercept_current_index(void *data, int64_t frames,
props_set(&handle->props, &handle->notify.forge, frames,
handle->urid.sprinkler_currentIndex, &handle->notify.ref);
}
+ else if(handle->state.current_index < handle->state.roll_under_index)
+ {
+ handle->state.current_index = handle->state.roll_under_index;
+
+ props_set(&handle->props, &handle->notify.forge, frames,
+ handle->urid.sprinkler_currentIndex, &handle->notify.ref);
+ }
}
static const props_def_t defs [MAX_NPROPS] = {
@@ -141,6 +164,12 @@ static const props_def_t defs [MAX_NPROPS] = {
.event_cb = _intercept_prev_index
},
{
+ .property = ROUTER__rollUnderIndex,
+ .offset = offsetof(plugstate_t, roll_under_index),
+ .type = LV2_ATOM__Int,
+ .event_cb = _intercept_roll_under_index
+ },
+ {
.property = ROUTER__rollOverIndex,
.offset = offsetof(plugstate_t, roll_over_index),
.type = LV2_ATOM__Int,
diff --git a/router_audio_bouncer.c b/router_audio_bouncer.c
index d10d90a..82e2266 100644
--- a/router_audio_bouncer.c
+++ b/router_audio_bouncer.c
@@ -24,7 +24,7 @@
#define MAX_NINS 8
#define MAX_NMULT 2
-#define MAX_NPROPS 5
+#define MAX_NPROPS 6
typedef struct _plugstate_t plugstate_t;
typedef struct _plughandle_t plughandle_t;
@@ -32,6 +32,7 @@ typedef struct _plughandle_t plughandle_t;
struct _plugstate_t {
int32_t next_index;
int32_t prev_index;
+ int32_t roll_under_index;
int32_t roll_over_index;
int32_t current_index;
float switch_period;
@@ -78,7 +79,7 @@ _intercept_next_index(void *data, int64_t frames,
handle->state.current_index += 1;
if(handle->state.current_index > handle->state.roll_over_index)
- handle->state.current_index = 1;
+ handle->state.current_index = handle->state.roll_under_index;
props_set(&handle->props, &handle->notify.forge, frames,
handle->urid.bouncer_nextIndex, &handle->notify.ref);
@@ -98,7 +99,7 @@ _intercept_prev_index(void *data, int64_t frames,
handle->state.prev_index = false;
handle->state.current_index -= 1;
- if(handle->state.current_index < 1)
+ if(handle->state.current_index < handle->state.roll_under_index)
handle->state.current_index = handle->state.roll_over_index;
props_set(&handle->props, &handle->notify.forge, frames,
@@ -109,6 +110,21 @@ _intercept_prev_index(void *data, int64_t frames,
}
static void
+_intercept_roll_under_index(void *data, int64_t frames,
+ props_impl_t *impl __attribute__((unused)))
+{
+ plughandle_t *handle = data;
+
+ if(handle->state.current_index < handle->state.roll_under_index)
+ {
+ handle->state.current_index = handle->state.roll_over_index;
+
+ props_set(&handle->props, &handle->notify.forge, frames,
+ handle->urid.bouncer_currentIndex, &handle->notify.ref);
+ }
+}
+
+static void
_intercept_roll_over_index(void *data, int64_t frames,
props_impl_t *impl __attribute__((unused)))
{
@@ -116,7 +132,7 @@ _intercept_roll_over_index(void *data, int64_t frames,
if(handle->state.current_index > handle->state.roll_over_index)
{
- handle->state.current_index = 1;
+ handle->state.current_index = handle->state.roll_under_index;
props_set(&handle->props, &handle->notify.forge, frames,
handle->urid.bouncer_currentIndex, &handle->notify.ref);
@@ -136,6 +152,13 @@ _intercept_current_index(void *data, int64_t frames,
props_set(&handle->props, &handle->notify.forge, frames,
handle->urid.bouncer_currentIndex, &handle->notify.ref);
}
+ else if(handle->state.current_index < handle->state.roll_under_index)
+ {
+ handle->state.current_index = handle->state.roll_under_index;
+
+ props_set(&handle->props, &handle->notify.forge, frames,
+ handle->urid.bouncer_currentIndex, &handle->notify.ref);
+ }
}
static void
@@ -163,6 +186,12 @@ static const props_def_t defs [MAX_NPROPS] = {
.event_cb = _intercept_prev_index
},
{
+ .property = ROUTER__rollUnderIndex,
+ .offset = offsetof(plugstate_t, roll_under_index),
+ .type = LV2_ATOM__Int,
+ .event_cb = _intercept_roll_under_index
+ },
+ {
.property = ROUTER__rollOverIndex,
.offset = offsetof(plugstate_t, roll_over_index),
.type = LV2_ATOM__Int,
diff --git a/router_audio_sprinkler.c b/router_audio_sprinkler.c
index 7558645..4c4ecf2 100644
--- a/router_audio_sprinkler.c
+++ b/router_audio_sprinkler.c
@@ -24,7 +24,7 @@
#define MAX_NOUTS 8
#define MAX_NMULT 2
-#define MAX_NPROPS 5
+#define MAX_NPROPS 6
typedef struct _plugstate_t plugstate_t;
typedef struct _plughandle_t plughandle_t;
@@ -32,6 +32,7 @@ typedef struct _plughandle_t plughandle_t;
struct _plugstate_t {
int32_t next_index;
int32_t prev_index;
+ int32_t roll_under_index;
int32_t roll_over_index;
int32_t current_index;
float switch_period;
@@ -78,7 +79,7 @@ _intercept_next_index(void *data, int64_t frames,
handle->state.current_index += 1;
if(handle->state.current_index > handle->state.roll_over_index)
- handle->state.current_index = 1;
+ handle->state.current_index = handle->state.roll_under_index;
props_set(&handle->props, &handle->notify.forge, frames,
handle->urid.sprinkler_nextIndex, &handle->notify.ref);
@@ -98,7 +99,7 @@ _intercept_prev_index(void *data, int64_t frames,
handle->state.prev_index = false;
handle->state.current_index -= 1;
- if(handle->state.current_index < 1)
+ if(handle->state.current_index < handle->state.roll_under_index)
handle->state.current_index = handle->state.roll_over_index;
props_set(&handle->props, &handle->notify.forge, frames,
@@ -109,6 +110,21 @@ _intercept_prev_index(void *data, int64_t frames,
}
static void
+_intercept_roll_under_index(void *data, int64_t frames,
+ props_impl_t *impl __attribute__((unused)))
+{
+ plughandle_t *handle = data;
+
+ if(handle->state.current_index < handle->state.roll_under_index)
+ {
+ handle->state.current_index = handle->state.roll_over_index;
+
+ props_set(&handle->props, &handle->notify.forge, frames,
+ handle->urid.sprinkler_currentIndex, &handle->notify.ref);
+ }
+}
+
+static void
_intercept_roll_over_index(void *data, int64_t frames,
props_impl_t *impl __attribute__((unused)))
{
@@ -116,7 +132,7 @@ _intercept_roll_over_index(void *data, int64_t frames,
if(handle->state.current_index > handle->state.roll_over_index)
{
- handle->state.current_index = 1;
+ handle->state.current_index = handle->state.roll_under_index;
props_set(&handle->props, &handle->notify.forge, frames,
handle->urid.sprinkler_currentIndex, &handle->notify.ref);
@@ -136,6 +152,13 @@ _intercept_current_index(void *data, int64_t frames,
props_set(&handle->props, &handle->notify.forge, frames,
handle->urid.sprinkler_currentIndex, &handle->notify.ref);
}
+ else if(handle->state.current_index < handle->state.roll_under_index)
+ {
+ handle->state.current_index = handle->state.roll_under_index;
+
+ props_set(&handle->props, &handle->notify.forge, frames,
+ handle->urid.sprinkler_currentIndex, &handle->notify.ref);
+ }
}
static void
@@ -163,6 +186,12 @@ static const props_def_t defs [MAX_NPROPS] = {
.event_cb = _intercept_prev_index
},
{
+ .property = ROUTER__rollUnderIndex,
+ .offset = offsetof(plugstate_t, roll_under_index),
+ .type = LV2_ATOM__Int,
+ .event_cb = _intercept_roll_under_index
+ },
+ {
.property = ROUTER__rollOverIndex,
.offset = offsetof(plugstate_t, roll_over_index),
.type = LV2_ATOM__Int,