You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1021B

  1. #pragma once
  2. #include "midi.hpp"
  3. #include <map>
  4. #ifdef __GNUC__
  5. #pragma GCC diagnostic push
  6. #ifndef __clang__
  7. #pragma GCC diagnostic ignored "-Wsuggest-override"
  8. #endif
  9. #include "rtmidi/RtMidi.h"
  10. #pragma GCC diagnostic pop
  11. #else
  12. #include "rtmidi/RtMidi.h"
  13. #endif // __GNUC__
  14. namespace rack {
  15. struct RtMidiInputDevice : MidiInputDevice {
  16. RtMidiIn *rtMidiIn;
  17. RtMidiInputDevice(int driverId, int deviceId);
  18. ~RtMidiInputDevice();
  19. };
  20. struct RtMidiDriver : MidiDriver {
  21. int driverId;
  22. /** Just for querying MIDI driver information */
  23. RtMidiIn *rtMidiIn;
  24. RtMidiOut *rtMidiOut;
  25. std::map<int, RtMidiInputDevice*> devices;
  26. RtMidiDriver(int driverId);
  27. ~RtMidiDriver();
  28. std::string getName() override;
  29. std::vector<int> getInputDeviceIds() override;
  30. std::string getInputDeviceName(int deviceId) override;
  31. MidiInputDevice *subscribeInputDevice(int deviceId, MidiInput *midiInput) override;
  32. void unsubscribeInputDevice(int deviceId, MidiInput *midiInput) override;
  33. };
  34. void rtmidiInit();
  35. } // namespace rack