1
1

drumduino.h 912 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifndef DRUMDUINO_H
  2. #define DRUMDUINO_H
  3. #include <QtWidgets/QMainWindow>
  4. #include "ui_drumduino.h"
  5. #include "midi.h"
  6. #include "serial.h"
  7. #include "qcustomplot.h"
  8. enum State {
  9. StateAwait,
  10. StateScan,
  11. StateMask,
  12. };
  13. class drumduino : public QMainWindow
  14. {
  15. Q_OBJECT
  16. public:
  17. drumduino(QWidget* parent = 0);
  18. ~drumduino();
  19. private:
  20. Ui::drumduinoClass ui;
  21. std::vector<QCustomPlot*> _plots;
  22. qint64 _lasttime;
  23. private:
  24. std::shared_ptr<Serial> _serial;
  25. std::shared_ptr<MidiOut> _midiOut;
  26. uint64_t _currentFrame;
  27. std::array<std::array<byte, 1024>, PORT_CNT* CHAN_CNT> _frameBuffer;
  28. std::array<State, PORT_CNT* CHAN_CNT> _states;
  29. std::array<uint64_t, PORT_CNT* CHAN_CNT> _triggers;
  30. std::array<byte, PORT_CNT* CHAN_CNT> _max;
  31. private:
  32. void serialRead();
  33. void updateGraph();
  34. void handleFrame(const std::array<byte, PORT_CNT* CHAN_CNT>& frame, const uint64_t currentIndex);
  35. };
  36. #endif // DRUMDUINO_H