aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWohlstand <admin@wohlnet.ru>2017-10-27 01:28:54 +0300
committerWohlstand <admin@wohlnet.ru>2017-10-27 01:28:54 +0300
commitcb647dc07631c95c0b88658796e3ddd67b5ee92c (patch)
tree4090e5eb2071d58d83ea4b4ae8d3a33f46aab3bf
parent7d94c6ac28aa9db54b60c8a3d8442cb046a1ca77 (diff)
downloadlibADLMIDI-cb647dc07631c95c0b88658796e3ddd67b5ee92c.tar.gz
libADLMIDI-cb647dc07631c95c0b88658796e3ddd67b5ee92c.tar.bz2
libADLMIDI-cb647dc07631c95c0b88658796e3ddd67b5ee92c.zip
Draft for event hooks
That will give ability to implement same ADLMIDI player as originally, but keep library be fully independent from original console tool.
-rw-r--r--src/adlmidi_private.hpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/adlmidi_private.hpp b/src/adlmidi_private.hpp
index fdd7d32..a2ec8c1 100644
--- a/src/adlmidi_private.hpp
+++ b/src/adlmidi_private.hpp
@@ -184,6 +184,31 @@ public:
void Reset(unsigned long PCM_RATE);
};
+/*
+ * TODO: Put usage of those hooks to the places where originally was UI usage.
+ * Also, provide external API to set those hooks
+ */
+
+/**
+ * @brief Hooks of the internal events
+ */
+struct MIDIEventHooks
+{
+ //! Raw MIDI event hook
+ typedef void (*RawEventHook)(void *userdata, uint8_t type, uint8_t subtype, uint8_t channel, uint8_t *data, size_t len);
+ RawEventHook onEvent;
+ void *onEvent_userData;
+
+ //! Note on/off hooks
+ typedef void (*NoteHook)(void *userdata, int adlchn, int note, int ins, int pressure, double bend);
+ NoteHook onNote;
+ void *onNote_userData;
+
+ //! Library internal debug messages
+ typedef void (*DebugMessageHook)(void *userdata, const char *fmt, ...);
+ DebugMessageHook onDebugMessage;
+ void *onDebugMessage_userData;
+};
class MIDIplay
{