PlaybackScreen.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #pragma once
  2. #include "Screen.h"
  3. #include "Sequencer.h"
  4. #include "Player.h"
  5. class PlaybackScreen : public Screen
  6. {
  7. typedef Screen parent;
  8. typedef unsigned int MessageDisplayOffset;
  9. typedef BeatSequenceNoteInformation::BeatIndexMultiset BeatIndexMultiset;
  10. const MessageDisplayOffset messageDisplayShift = midi::Launchpad::height / 2;
  11. const midi::Launchpad::KeyCoordinate beatsHeight = midi::Launchpad::height - 1;
  12. Player::BeatIndex beatDisplayOffset;
  13. MessageDisplayOffset messageDisplayOffset;
  14. public:
  15. midi::Launchpad::KeyCoordinate beatDisplayWidth = midi::Launchpad::width - 1;
  16. PlaybackScreen(Sequencer& seq);
  17. void enable();
  18. void beforeBeat(Player::BeatIndex beat);
  19. void afterBeat(Player::BeatIndex beat);
  20. protected:
  21. virtual void keyPressed(unsigned char x, unsigned char y);
  22. virtual void keyReleased(unsigned char x, unsigned char y);
  23. virtual void refresh(unsigned char x, unsigned char y);
  24. private:
  25. void toggleOnMessage(std::shared_ptr<midi::NoteOnMessage> noteOnMessage_ptr, Player::BeatIndex beatIndex);
  26. midi::LaunchpadColor getBeatColor(std::shared_ptr<midi::NoteOnMessage> noteOnMessage_ptr, BeatIndex beatIndex);
  27. static bool beatsInSequence(BeatIndex a, BeatIndex b, BeatIndex c);
  28. };