Initial commit: Phase 1 skeleton
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
// midi/midi_transport.h
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <freertos/queue.h>
|
||||
|
||||
struct MidiEvent {
|
||||
enum Type {
|
||||
NOTE_ON,
|
||||
NOTE_OFF,
|
||||
CONTROL_CHANGE,
|
||||
PROGRAM_CHANGE,
|
||||
PITCH_BEND,
|
||||
AFTERTOUCH_POLY,
|
||||
AFTERTOUCH_CHAN,
|
||||
SYSEX
|
||||
} type;
|
||||
|
||||
uint8_t channel; // MIDI channel (1-16)
|
||||
uint8_t data1; // Note number or CC number
|
||||
uint8_t data2; // Velocity or CC value
|
||||
uint32_t timestamp; // Event timestamp
|
||||
};
|
||||
|
||||
class UsbMidiTransport {
|
||||
public:
|
||||
UsbMidiTransport();
|
||||
~UsbMidiTransport();
|
||||
|
||||
bool begin();
|
||||
void task();
|
||||
|
||||
// Event queue for communication with controller task
|
||||
QueueHandle_t get_event_queue() const { return event_queue; }
|
||||
|
||||
// Diagnostic logging
|
||||
void log_incoming(const char* source, const MidiEvent& event);
|
||||
|
||||
private:
|
||||
QueueHandle_t event_queue;
|
||||
bool initialized;
|
||||
};
|
||||
|
||||
// Forward declaration for USB callback
|
||||
void usb_midi_callback(const uint8_t* event, uint32_t size);
|
||||
Reference in New Issue
Block a user