diff options
author | Eddy Pedroni <epedroni@pm.me> | 2025-07-22 22:00:00 +0200 |
---|---|---|
committer | Eddy Pedroni <epedroni@pm.me> | 2025-07-22 22:00:00 +0200 |
commit | 6da14e1590935710055ebc81ba55017b457ca1ad (patch) | |
tree | 799daf6f75331183ea48ece00d62ec92f0fc7a51 /daemon/src/message.h | |
parent | f0835be9ffcae8e5c74c8fc6a0da2f7bc49343ac (diff) |
Initial daemon implementation, no routing yet
Diffstat (limited to 'daemon/src/message.h')
-rw-r--r-- | daemon/src/message.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/daemon/src/message.h b/daemon/src/message.h new file mode 100644 index 0000000..9339118 --- /dev/null +++ b/daemon/src/message.h @@ -0,0 +1,42 @@ +#pragma once + +#include "types.h" + +#include <string> +#include <cstdint> +#include <array> + +namespace midi_router +{ + +struct Message +{ + enum class Type + { + NOTE_OFF = 0x8u, + NOTE_ON = 0x9u, + POLY_AT = 0xAu, + CONTROL_CHANGE = 0xBu, + PROGRAM_CHANGE = 0xCu, + CHANNEL_AT = 0xDu, + PITCH_WHEEL = 0xEu, + + CLOCK = 0xF8u, + MEAS_END = 0xF9u, + START = 0xFAu, + CONTINUE = 0xFBu, + STOP = 0xFCu, + }; + + Device_Id const & source_id; + std::array<std::uint8_t, 3> const bytes; + + Type + type() const + { + if (bytes[0] & 0xF0 == 0xF0) return static_cast<Type>(bytes[0]); + else return static_cast<Type>(bytes[0] >> 4); + } +}; + +} // namespace midi_router |