clock.cpp 489 B

123456789101112131415161718192021222324252627282930313233
  1. #include "Clock.h"
  2. #include <iostream>
  3. using namespace std;
  4. class TestClock : public midi::Clock
  5. {
  6. protected:
  7. virtual void tick()
  8. {
  9. cout << now().time_since_epoch().count() / 1000000 << " tick" << endl;
  10. }
  11. };
  12. int main()
  13. {
  14. TestClock c;
  15. c.setBpm(60);
  16. c.start();
  17. while(true) {
  18. TestClock::bpm_type bpm;
  19. cin >> bpm;
  20. if(bpm == 0) {
  21. c.stop();
  22. break;
  23. }
  24. c.setBpm(bpm);
  25. }
  26. return 0;
  27. }