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
975B

  1. #pragma once
  2. #include "common.hpp"
  3. #include "midi.hpp"
  4. #include <map>
  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. namespace rack {
  12. struct RtMidiInputDevice : midi::InputDevice {
  13. RtMidiIn *rtMidiIn;
  14. RtMidiInputDevice(int driverId, int deviceId);
  15. ~RtMidiInputDevice();
  16. };
  17. struct RtMidiDriver : midi::Driver {
  18. int driverId;
  19. /** Just for querying MIDI driver information */
  20. RtMidiIn *rtMidiIn;
  21. RtMidiOut *rtMidiOut;
  22. std::map<int, RtMidiInputDevice*> devices;
  23. RtMidiDriver(int driverId);
  24. ~RtMidiDriver();
  25. std::string getName() override;
  26. std::vector<int> getInputDeviceIds() override;
  27. std::string getInputDeviceName(int deviceId) override;
  28. midi::InputDevice *subscribeInputDevice(int deviceId, midi::Input *input) override;
  29. void unsubscribeInputDevice(int deviceId, midi::Input *input) override;
  30. };
  31. void rtmidiInit();
  32. } // namespace rack