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.

36 lines
745B

  1. #pragma once
  2. #include "util/common.hpp"
  3. #include "midi.hpp"
  4. namespace rack {
  5. const int KEYBOARD_DRIVER = -11;
  6. struct KeyboardInputDevice : MidiInputDevice {
  7. int octave = 5;
  8. void processKey(int key, bool released);
  9. };
  10. struct KeyboardDriver : MidiDriver {
  11. KeyboardInputDevice device;
  12. std::string getName() override {return "Computer keyboard";}
  13. std::vector<int> getInputDeviceIds() override;
  14. std::string getInputDeviceName(int deviceId) override;
  15. MidiInputDevice *subscribeInputDevice(int deviceId, MidiInput *midiInput) override;
  16. void unsubscribeInputDevice(int deviceId, MidiInput *midiInput) override;
  17. };
  18. void keyboardPress(int key);
  19. void keyboardRelease(int key);
  20. KeyboardDriver *keyboardGetDriver();
  21. } // namespace rack