This commit is contained in:
2025-09-28 15:56:19 +02:00
parent 12cc9040d8
commit b12fb43654
9 changed files with 77 additions and 17 deletions
+36
View File
@@ -0,0 +1,36 @@
#include <GLFW/glfw3.h>
#include <alsa/asoundlib.h>
#include "log.h"
#include "types.h"
void midi_close(MidiDevice device) {
if (device.input != NULL) {
snd_rawmidi_close(device.input);
}
if (device.output != NULL) {
snd_rawmidi_close(device.input);
}
}
MidiDevice midi_open(char *name) {
MidiDevice device;
device.input = NULL;
device.output = NULL;
snd_rawmidi_open(&device.input, &device.output, name, 0);
device.error = device.input == NULL || device.output == NULL;
if (device.error) {
midi_close(device);
}
log_debug("(%s) MIDI open", name);
return device;
}
// int bytes_read = snd_rawmidi_read(input, input_buffer, sizeof(input_buffer));
// snd_rawmidi_write(output, buffer, 3);