BeatSequence.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #pragma once
  2. #include <vector>
  3. #include <ostream>
  4. #include <stdexcept>
  5. #include "MessageList.h"
  6. namespace midi {
  7. class BeatSequence : public std::vector<MessageList>
  8. {
  9. typedef std::vector<MessageList> parent;
  10. public:
  11. typedef unsigned int BeatIndex;
  12. typedef void (*ReducationConflictCallback)(BeatSequence& sequence, BeatIndex factor, BeatIndex beatIndex, void* data);
  13. BeatSequence();
  14. BeatSequence(BeatIndex size);
  15. void expand(BeatIndex factor);
  16. void reduce(BeatIndex factor);
  17. void reduce(BeatIndex factor, ReducationConflictCallback conflictCallback, void* conflictCallbackData);
  18. void print(std::ostream& stream) const;
  19. };
  20. class UnresolvedBeatSequenceReducationConflict : public std::runtime_error
  21. {
  22. typedef std::runtime_error parent;
  23. BeatSequence::BeatIndex beatIndex;
  24. public:
  25. UnresolvedBeatSequenceReducationConflict(BeatSequence::BeatIndex beatIndex);
  26. virtual const char* what() const throw();
  27. BeatSequence::BeatIndex getBeatIndex() const;
  28. };
  29. } // namespace