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.

33 lines
694B

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