Noise Nugget SDK
Loading...
Searching...
No Matches
midi_utils.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 Fabien Chouteau @ Wee Noise Makers
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
12#pragma once
13#include <stdbool.h>
14#include <stdint.h>
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20typedef enum midi_cmd {
21 Note_Off = 0x8,
22 Note_On = 0x9,
23 Aftertouch = 0xA,
24 Continous_Controller = 0xB,
25 Patch_Change = 0xC,
26 Channel_Pressure = 0xD,
27 Pitch_Bend = 0xE,
28 Sys = 0xF,
29} midi_cmd;
30
31typedef enum midi_sys_cmd {
32 Exclusive = 0x0,
33 Song_Position = 0x2,
34 Song_Select = 0x3,
35 Bus_Select = 0x5,
36 Tune_Request = 0x6,
37 End_Exclusive = 0x7,
38 Timming_Tick = 0x8,
39 Start_Song = 0xA,
40 Continue_Song = 0xB,
41 Stop_Song = 0xC,
42 Active_Sensing = 0xE,
43 Reset = 0xF
44} midi_sys_cmd;
45
46typedef struct midi_decoder {
47 bool expect_data;
48 int count;
49 uint32_t msg;
50 int index;
52
58
65uint32_t midi_decoder_push(midi_decoder *dec, uint8_t byte);
66
67#ifdef __cplusplus
68}
69#endif
void midi_decoder_init(midi_decoder *dec)
Init/reset a MIDI decoder.
Definition midi_utils.c:9
uint32_t midi_decoder_push(midi_decoder *dec, uint8_t byte)
Process and incoming byte of MIDI input.
Definition midi_utils.c:16
Definition midi_utils.h:46