b0a75e98db
вайбкод потому что мне в моменте стало понятно. что проще было сразу писать на фреймворке JUCE, чем адаптировать консольное приложение на MiniAudio. обновляться данный репозиторий не будет. СmakeLists адаптирован онли под linux.
35 lines
585 B
C++
35 lines
585 B
C++
#ifndef MIDIINPUT
|
|
#define MIDIINPUT
|
|
|
|
#include <rtmidi/RtMidi.h>
|
|
#include <iostream>
|
|
#include <stdexcept>
|
|
#include <cstring>
|
|
#include <array>
|
|
|
|
#include "../include/synth.hpp"
|
|
|
|
class MidiInput{
|
|
|
|
|
|
public:
|
|
MidiInput(Synth& synth, Synth& synth2) : synths{&synth, &synth2} {
|
|
pitch = 8192;
|
|
mod_wheel = 0;
|
|
}
|
|
|
|
void list_ports();
|
|
void open_port(unsigned int port);
|
|
void read_message();
|
|
|
|
private:
|
|
RtMidiIn midiIn;
|
|
std::array<Synth*, 2> synths;
|
|
|
|
uint16_t pitch;
|
|
uint8_t mod_wheel;
|
|
|
|
};
|
|
|
|
#endif
|