diff options
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | backend.c | 10 | ||||
-rw-r--r-- | backend.h | 10 | ||||
-rw-r--r-- | backends/Makefile | 10 | ||||
-rw-r--r-- | backends/midi.c | 6 | ||||
-rw-r--r-- | midimonster.c | 16 | ||||
-rw-r--r-- | midimonster.h | 23 |
7 files changed, 34 insertions, 46 deletions
@@ -26,6 +26,7 @@ all: midimonster backends full: midimonster backends-full windows: midimonster.exe + $(MAKE) -C backends windows backends: $(MAKE) -C backends @@ -38,15 +39,11 @@ midimonster: midimonster.c portability.h $(OBJS) $(CC) $(CFLAGS) $(LDFLAGS) $< $(OBJS) $(LDLIBS) -o $@ midimonster.exe: export CC = x86_64-w64-mingw32-gcc -#midimonster.exe: CFLAGS += -Wno-format midimonster.exe: CFLAGS += -DPLUGINS=$(PLUGINDIR_W32) -Wno-format midimonster.exe: LDLIBS = -lws2_32 midimonster.exe: LDFLAGS += -Wl,--out-implib,libmmapi.a midimonster.exe: midimonster.c portability.h $(OBJS) $(CC) $(CFLAGS) $(LDFLAGS) $< $(OBJS) $(LDLIBS) -o $@ - # The windows build for backends requires the import library generated with the build, - # so the backends can't be a prerequisite for the executable... - $(MAKE) -C backends windows clean: $(RM) midimonster @@ -71,7 +71,7 @@ int backends_notify(size_t nev, channel** c, channel_value* v){ return 0; } -channel* MM_API mm_channel(instance* inst, uint64_t ident, uint8_t create){ +MM_API channel* mm_channel(instance* inst, uint64_t ident, uint8_t create){ size_t u; for(u = 0; u < nchannels; u++){ if(channels[u]->instance == inst && channels[u]->ident == ident){ @@ -105,7 +105,7 @@ channel* MM_API mm_channel(instance* inst, uint64_t ident, uint8_t create){ return channels[nchannels++]; } -instance* MM_API mm_instance(){ +MM_API instance* mm_instance(){ instance** new_inst = realloc(instances, (ninstances + 1) * sizeof(instance*)); if(!new_inst){ //TODO free @@ -123,7 +123,7 @@ instance* MM_API mm_instance(){ return instances[ninstances++]; } -instance* MM_API mm_instance_find(char* name, uint64_t ident){ +MM_API instance* mm_instance_find(char* name, uint64_t ident){ size_t u; backend* b = backend_match(name); if(!b){ @@ -139,7 +139,7 @@ instance* MM_API mm_instance_find(char* name, uint64_t ident){ return NULL; } -int MM_API mm_backend_instances(char* name, size_t* ninst, instance*** inst){ +MM_API 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 @@ -237,7 +237,7 @@ struct timeval backend_timeout(){ return tv; } -int MM_API mm_backend_register(backend b){ +MM_API int mm_backend_register(backend b){ if(!backend_match(b.name)){ backends = realloc(backends, (nbackends + 1) * sizeof(backend)); if(!backends){ @@ -12,8 +12,8 @@ void instances_free(); void channels_free(); /* Backend API */ -channel* MM_API mm_channel(instance* inst, uint64_t ident, uint8_t create); -instance* MM_API mm_instance(); -instance* MM_API mm_instance_find(char* name, uint64_t ident); -int MM_API mm_backend_instances(char* name, size_t* ninst, instance*** inst); -int MM_API mm_backend_register(backend b); +MM_API channel* mm_channel(instance* inst, uint64_t ident, uint8_t create); +MM_API instance* mm_instance(); +MM_API instance* mm_instance_find(char* name, uint64_t ident); +MM_API int mm_backend_instances(char* name, size_t* ninst, instance*** inst); +MM_API int mm_backend_register(backend b); diff --git a/backends/Makefile b/backends/Makefile index 2374df0..3308ef0 100644 --- a/backends/Makefile +++ b/backends/Makefile @@ -1,8 +1,8 @@ .PHONY: all clean full -OPTIONAL_BACKENDS = ola.so -WINDOWS_BACKENDS = loopback.dll artnet.dll osc.dll sacn.dll LINUX_BACKENDS = midi.so evdev.so -BACKENDS = artnet.so osc.so loopback.so sacn.so lua.so +WINDOWS_BACKENDS = artnet.dll osc.dll loopback.dll sacn.dll maweb.dll +BACKENDS = artnet.so osc.so loopback.so sacn.so lua.so maweb.so +OPTIONAL_BACKENDS = ola.so BACKEND_LIB = libmmbackend.o SYSTEM := $(shell uname -s) @@ -32,6 +32,10 @@ sacn.so: ADDITIONAL_OBJS += $(BACKEND_LIB) sacn.dll: ADDITIONAL_OBJS += $(BACKEND_LIB) sacn.dll: LDLIBS += -lws2_32 +maweb.so: ADDITIONAL_OBJS += $(BACKEND_LIB) +maweb.dll: ADDITIONAL_OBJS += $(BACKEND_LIB) +maweb.dll: LDLIBS += -lws2_32 + midi.so: LDLIBS = -lasound evdev.so: CFLAGS += $(shell pkg-config --cflags libevdev) evdev.so: LDLIBS = $(shell pkg-config --libs libevdev) diff --git a/backends/midi.c b/backends/midi.c index c1480c0..9c6ba80 100644 --- a/backends/midi.c +++ b/backends/midi.c @@ -14,12 +14,6 @@ typedef union { uint64_t label; } midi_channel_ident; -/* - * TODO - * Optionally send note-off messages - * Optionally send updates as after-touch - */ - enum /*_midi_channel_type*/ { none = 0, note, diff --git a/midimonster.c b/midimonster.c index df27ca3..1e47698 100644 --- a/midimonster.c +++ b/midimonster.c @@ -40,7 +40,7 @@ static void signal_handler(int signum){ shutdown_requested = 1; } -uint64_t MM_API mm_timestamp(){ +MM_API uint64_t mm_timestamp(){ return global_timestamp; } @@ -98,7 +98,7 @@ int mm_map_channel(channel* from, channel* to){ return 0; } -void map_free(){ +static void map_free(){ size_t u; for(u = 0; u < mappings; u++){ free(map[u].to); @@ -108,7 +108,7 @@ void map_free(){ map = NULL; } -int MM_API mm_manage_fd(int new_fd, char* back, int manage, void* impl){ +MM_API int mm_manage_fd(int new_fd, char* back, int manage, void* impl){ backend* b = backend_match(back); size_t u; @@ -158,7 +158,7 @@ int MM_API mm_manage_fd(int new_fd, char* back, int manage, void* impl){ return 0; } -void fds_free(){ +static void fds_free(){ size_t u; for(u = 0; u < fds; u++){ //TODO free impl @@ -172,7 +172,7 @@ void fds_free(){ fd = NULL; } -int MM_API mm_channel_event(channel* c, channel_value v){ +MM_API int mm_channel_event(channel* c, channel_value v){ size_t u, p; //find mapped channels @@ -213,7 +213,7 @@ int MM_API mm_channel_event(channel* c, channel_value v){ return 0; } -void event_free(){ +static void event_free(){ size_t u; for(u = 0; u < sizeof(event_pool) / sizeof(event_collection); u++){ @@ -223,7 +223,7 @@ void event_free(){ } } -int usage(char* fn){ +static int usage(char* fn){ fprintf(stderr, "MIDIMonster v0.1\n"); fprintf(stderr, "Usage:\n"); fprintf(stderr, "\t%s <configfile>\n", fn); @@ -252,7 +252,7 @@ static fd_set fds_collect(int* max_fd){ return rv_fds; } -int platform_initialize(){ +static int platform_initialize(){ #ifdef _WIN32 WSADATA wsa; WORD version = MAKEWORD(2, 2); diff --git a/midimonster.h b/midimonster.h index eb118c6..270a61f 100644 --- a/midimonster.h +++ b/midimonster.h @@ -12,13 +12,6 @@ #endif #endif -/* GCC ignores the visibility attributes on some API functions, so override visibility */ -#if !defined(_WIN32) && defined(__GNUC__) && !defined(__clang__) - #undef MM_API - #define MM_API - #pragma GCC visibility push(default) -#endif - /* Straight-forward min / max macros */ #define max(a,b) (((a) > (b)) ? (a) : (b)) #define min(a,b) (((a) < (b)) ? (a) : (b)) @@ -202,7 +195,7 @@ typedef struct /*_mm_channel_mapping*/ { /* * Register a new backend. */ -int MM_API mm_backend_register(backend b); +MM_API int mm_backend_register(backend b); /* * Provides a pointer to a newly (zero-)allocated instance. @@ -216,7 +209,7 @@ int MM_API mm_backend_register(backend b); * mmbackend_shutdown procedure of the backend, eg. by querying * all instances for the backend. */ -instance* MM_API mm_instance(); +MM_API instance* mm_instance(); /* * Finds an instance matching the specified backend and identifier. @@ -225,7 +218,7 @@ instance* MM_API mm_instance(); * Instance identifiers may for example be set in the backends * mmbackend_start call. */ -instance* MM_API mm_instance_find(char* backend, uint64_t ident); +MM_API instance* mm_instance_find(char* backend, uint64_t ident); /* * Provides a pointer to a channel structure, pre-filled with @@ -241,7 +234,7 @@ instance* MM_API mm_instance_find(char* backend, uint64_t ident); * this function, the backend will receive a call to its channel_free * function. */ -channel* MM_API mm_channel(instance* i, uint64_t ident, uint8_t create); +MM_API channel* mm_channel(instance* i, uint64_t ident, uint8_t create); //TODO channel* mm_channel_find() /* @@ -249,26 +242,26 @@ channel* MM_API mm_channel(instance* i, uint64_t ident, uint8_t create); * to be selected on. The backend will be notified when the descriptor * becomes ready to read via its registered mmbackend_process_fd call. */ -int MM_API mm_manage_fd(int fd, char* backend, int manage, void* impl); +MM_API int mm_manage_fd(int fd, char* backend, int manage, void* impl); /* * Notifies the core of a channel event. Called by backends to * inject events gathered from their backing implementation. */ -int MM_API mm_channel_event(channel* c, channel_value v); +MM_API int mm_channel_event(channel* c, channel_value v); /* * Query all active instances for a given backend. * *i will need to be freed by the caller. */ -int MM_API mm_backend_instances(char* backend, size_t* n, instance*** i); +MM_API int mm_backend_instances(char* backend, size_t* n, instance*** i); /* * Query an internal timestamp, which is updated every core iteration. * This timestamp should not be used as a performance counter, but can be * used for timeouting. Resolution is milliseconds. */ -uint64_t MM_API mm_timestamp(); +MM_API uint64_t mm_timestamp(); /* * Create a channel-to-channel mapping. This API should not |