aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--core/backend.c10
-rw-r--r--core/backend.h3
-rw-r--r--core/core.c1
3 files changed, 12 insertions, 2 deletions
diff --git a/core/backend.c b/core/backend.c
index b7c2d9e..93ac8fa 100644
--- a/core/backend.c
+++ b/core/backend.c
@@ -9,6 +9,8 @@
#include "midimonster.h"
#include "backend.h"
+static uint32_t default_interval = 1000;
+
static struct {
size_t n;
backend* backends;
@@ -272,9 +274,15 @@ instance* instance_match(char* name){
return NULL;
}
+void mm_default_interval(uint32_t interval, uint8_t force){
+ if(interval < default_interval || force){
+ default_interval = interval;
+ }
+}
+
struct timeval backend_timeout(){
size_t u;
- uint32_t res, secs = 1, msecs = 0;
+ uint32_t res, secs = default_interval / 1000, msecs = default_interval % 1000;
for(u = 0; u < registry.n; u++){
//only call interval if backend has instances
diff --git a/core/backend.h b/core/backend.h
index 1f85424..6c1fe22 100644
--- a/core/backend.h
+++ b/core/backend.h
@@ -10,6 +10,9 @@ int backends_start();
int backends_stop();
instance* mm_instance(backend* b);
+/* Frontend API */
+void mm_default_interval(uint32_t interval, uint8_t force);
+
/* Public backend API */
MM_API channel* mm_channel(instance* inst, uint64_t ident, uint8_t create);
MM_API void mm_channel_update(channel* chan, uint64_t ident);
diff --git a/core/core.c b/core/core.c
index 2f5ca40..8554f03 100644
--- a/core/core.c
+++ b/core/core.c
@@ -20,7 +20,6 @@
#include "config.h"
static struct {
- //static size_t fds = 0;
size_t n;
int max;
managed_fd* fd;