aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2018-03-31 16:14:41 +0200
committerHanspeter Portner <dev@open-music-kontrollers.ch>2018-03-31 16:14:41 +0200
commit3fdfed17d0c4edb920fdf3e677c359e829bb6145 (patch)
treec1596036854b89d28143a7a971d2ff799bce81fc
parentefe0e2813a23ee5a90dfd4293ee89bb48169e407 (diff)
downloadsynthpod-3fdfed17d0c4edb920fdf3e677c359e829bb6145.tar.xz
limit idisp rendering rate to UI update rate.
-rw-r--r--VERSION2
-rw-r--r--app/synthpod_app.c2
-rw-r--r--app/synthpod_app_mod.c10
-rw-r--r--app/synthpod_app_private.h2
4 files changed, 13 insertions, 3 deletions
diff --git a/VERSION b/VERSION
index d04e76d4..55d9b050 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.1.5597
+0.1.5599
diff --git a/app/synthpod_app.c b/app/synthpod_app.c
index f8843915..fb1d1de4 100644
--- a/app/synthpod_app.c
+++ b/app/synthpod_app.c
@@ -771,6 +771,8 @@ _sp_app_process_single_post(mod_t *mod, uint32_t nsamples, bool sparse_update_ti
// handle inline display
if(mod->idisp.iface)
{
+ mod->idisp.counter += nsamples;
+
// trylock
if(!atomic_flag_test_and_set(&mod->idisp.lock))
{
diff --git a/app/synthpod_app_mod.c b/app/synthpod_app_mod.c
index 4de6c0d2..814de7b1 100644
--- a/app/synthpod_app_mod.c
+++ b/app/synthpod_app_mod.c
@@ -568,8 +568,13 @@ _sp_app_mod_queue_draw(mod_t *mod)
if(mod->idisp.iface && mod->idisp.subscribed)
{
- atomic_store(&mod->idisp.draw_queued, true);
- sem_post(&mod_worker->sem);
+ if(mod->idisp.counter >= mod->idisp.threshold)
+ {
+ mod->idisp.counter = 0;
+
+ atomic_store(&mod->idisp.draw_queued, true);
+ sem_post(&mod_worker->sem);
+ }
}
}
@@ -619,6 +624,7 @@ _sp_app_mod_add(sp_app_t *app, const char *uri, LV2_URID urn)
mod->idisp.queue_draw.queue_draw = _mod_queue_draw;
atomic_init(&mod->idisp.draw_queued, false);
mod->idisp.lock = (atomic_flag)ATOMIC_FLAG_INIT;
+ mod->idisp.threshold = app->driver->sample_rate / app->driver->update_rate;
// populate options
mod->opts.options[0].context = LV2_OPTIONS_INSTANCE;
diff --git a/app/synthpod_app_private.h b/app/synthpod_app_private.h
index 629fe5a5..f057051f 100644
--- a/app/synthpod_app_private.h
+++ b/app/synthpod_app_private.h
@@ -291,6 +291,8 @@ struct _mod_t {
atomic_bool draw_queued;
atomic_flag lock;
bool subscribed;
+ uint32_t counter;
+ uint32_t threshold;
} idisp;
// opts