From cb647dc07631c95c0b88658796e3ddd67b5ee92c Mon Sep 17 00:00:00 2001 From: Wohlstand Date: Fri, 27 Oct 2017 01:28:54 +0300 Subject: 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. --- src/adlmidi_private.hpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src') 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 { -- cgit v1.2.3