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.

46 lines
952B

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