aboutsummaryrefslogtreecommitdiffhomepage
path: root/midimonster.c
diff options
context:
space:
mode:
Diffstat (limited to 'midimonster.c')
-rw-r--r--midimonster.c69
1 files changed, 7 insertions, 62 deletions
diff --git a/midimonster.c b/midimonster.c
index 765c1ce..e59b7f9 100644
--- a/midimonster.c
+++ b/midimonster.c
@@ -8,67 +8,6 @@ int artnet_init();
int midi_init();
int osc_init();
-static size_t ninstances = 0;
-static instance** instances = NULL;
-
-instance* mm_instance(){
- instance** new_inst = realloc(instances, (ninstances + 1) * sizeof(instance*));
- if(!new_inst){
- //TODO free
- fprintf(stderr, "Failed to allocate memory\n");
- ninstances = 0;
- return NULL;
- }
- instances = new_inst;
- instances[ninstances] = calloc(1, sizeof(instance));
- if(!instances[ninstances]){
- fprintf(stderr, "Failed to allocate memory\n");
- return NULL;
- }
-
- return instances[ninstances++];
-}
-
-int mm_backend_instances(char* name, size_t* ninst, instance*** inst){
- backend* b = backend_match(name);
- size_t n = 0, u;
- //count number of affected instances
- for(u = 0; u < ninstances; u++){
- if(instances[u]->backend == b){
- n++;
- }
- }
-
- *ninst = n;
- *inst = calloc(n, sizeof(instance*));
- if(!*inst){
- fprintf(stderr, "Failed to allocate memory\n");
- return 1;
- }
-
- n = 0;
- for(u = 0; u < ninstances; u++){
- if(instances[u]->backend == b){
- (*inst)[n] = instances[u];
- n++;
- }
- }
- return 0;
-}
-
-static void instances_free(){
- size_t u;
- for(u = 0; u < ninstances; u++){
- free(instances[u]->name);
- instances[u]->name = NULL;
- instances[u]->backend = NULL;
- free(instances[u]);
- instances[u] = NULL;
- }
- free(instances);
- ninstances = 0;
-}
-
int usage(char* fn){
fprintf(stderr, "MIDIMonster v0.1\n");
fprintf(stderr, "Usage:\n");
@@ -98,7 +37,13 @@ int main(int argc, char** argv){
return usage(argv[0]);
}
- //wait for events
+ //start backends
+ if(backends_start()){
+ fprintf(stderr, "Failed to start backends\n");
+ goto bail;
+ }
+
+ //TODO wait for & translate events
rv = EXIT_SUCCESS;
bail: