diff options
author | cbdev <cb@cbcdn.com> | 2017-11-12 16:50:03 +0100 |
---|---|---|
committer | cbdev <cb@cbcdn.com> | 2017-11-12 16:50:03 +0100 |
commit | d370095a576b2ea949ec2c169a9f081f1cb307b0 (patch) | |
tree | 4416e1bb06ad9654b0656c5983cf1f07fc72f31b | |
parent | b9e141a7ea3f52e354c2096aaa5f935556b9f734 (diff) | |
download | midimonster-d370095a576b2ea949ec2c169a9f081f1cb307b0.tar.gz midimonster-d370095a576b2ea949ec2c169a9f081f1cb307b0.tar.bz2 midimonster-d370095a576b2ea949ec2c169a9f081f1cb307b0.zip |
Clarify some documentation, add debugging macro
-rw-r--r-- | midimonster.h | 33 | ||||
-rw-r--r-- | monster.cfg | 1 |
2 files changed, 24 insertions, 10 deletions
diff --git a/midimonster.h b/midimonster.h index 3cf6771..630399a 100644 --- a/midimonster.h +++ b/midimonster.h @@ -4,6 +4,13 @@ #include <stdlib.h> #include <stdint.h> #define max(a,b) (((a) > (b)) ? (a) : (b)) +#ifdef DEBUG + #define DBGPF(format, ...) fprintf(stderr, (format), __VA_ARGS__) + #define DBG(message) fprintf(stderr, "%s", (message)) +#else + #define DBGPF(format, ...) + #define DBG(message) +#endif #define DEFAULT_CFG "monster.cfg" @@ -150,24 +157,30 @@ instance* mm_instance_find(char* backend, uint64_t ident); /* * Provides a pointer to a channel structure, pre-filled with * the provided instance reference and identifier. - * Will return previous allocations if the provided fields - * match. - * This API is just a convenience function. The array - * of channels is only used for mapping internally, - * creating and managing your own channel store is - * possible. - * For each channel with a non-NULL impl field, the backend - * will receive a call to its channel_free function. + * The `create` parameter is a boolean flag indicating whether + * a channel matching the `ident` parameter should be created if + * none exists. If the instance already registered a channel + * matching `ident`, a pointer to it is returned. + * This API is just a convenience function. The array of channels is + * only used for mapping internally, creating and managing your own + * channel store is possible. + * For each channel with a non-NULL `impl` field registered using + * this function, the backend will receive a call to its channel_free + * function. */ channel* mm_channel(instance* i, uint64_t ident, uint8_t create); //TODO channel* mm_channel_find() /* * Register a file descriptor to be selected on. The backend * will be notified via the mmbackend_process_fd call. - * This function may only be called from within the - * mmbackend_start procedure. + * This function may only be called from within the mmbackend_start + * procedure. */ int mm_manage_fd(int fd, char* backend, int manage, void* impl); +/* + * Notifies the core of a channel event. Used by backends to + * inject events gathered from their backing implementation. + */ int mm_channel_event(channel* c, channel_value v); /* * Query all active instances for a given backend. diff --git a/monster.cfg b/monster.cfg index c459262..558478e 100644 --- a/monster.cfg +++ b/monster.cfg @@ -22,3 +22,4 @@ dest = learn@8001 [map] osc1./1/xy:0 <> net1.1+2 osc1./1/xy:1 <> net1.3+4 +osc1./1/fader1 <> net1.20+21 |