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 <unistd.h>
15
16typedef enum midi_cmd {
17 Note_Off = 0x8,
18 Note_On = 0x9,
19 Aftertouch = 0xA,
20 Continous_Controller = 0xB,
21 Patch_Change = 0xC,
22 Channel_Pressure = 0xD,
23 Pitch_Bend = 0xE,
24 Sys = 0xF,
25} midi_cmd;
26
27typedef enum midi_sys_cmd {
28 Exclusive = 0x0,
29 Song_Position = 0x2,
30 Song_Select = 0x3,
31 Bus_Select = 0x5,
32 Tune_Request = 0x6,
33 End_Exclusive = 0x7,
34 Timming_Tick = 0x8,
35 Start_Song = 0xA,
36 Continue_Song = 0xB,
37 Stop_Song = 0xC,
38 Active_Sensing = 0xE,
39 Reset = 0xF
40} midi_sys_cmd;
41
42typedef struct midi_decoder {
43 bool expect_data;
44 int count;
45 uint32_t msg;
46 int index;
48
54
61uint32_t midi_decoder_push(midi_decoder *dec, uint8_t byte);
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:42