123456789101112131415161718192021222324252627282930313233343536373839404142 |
- #pragma once
- #include <vector>
- #include <ostream>
- #include <stdexcept>
- #include "MessageList.h"
- namespace midi {
- class BeatSequence : public std::vector<MessageList>
- {
- typedef std::vector<MessageList> parent;
- public:
- typedef unsigned int BeatIndex;
- typedef void (*ReductionConflictCallback)(BeatSequence& sequence, BeatIndex factor, BeatIndex beatIndex, void* data);
- BeatSequence();
- BeatSequence(BeatIndex size);
- void expand(BeatIndex factor);
- void reduce(BeatIndex factor);
- void reduce(BeatIndex factor, ReductionConflictCallback conflictCallback, void* conflictCallbackData);
- void reduceToNeighbour(BeatIndex factor);
- void reduceErasingConflicts(BeatIndex factor);
- void print(std::ostream& stream) const;
- private:
- static void eraseReductionConflict(BeatSequence& sequence, BeatIndex factor, BeatIndex beatIndex, void* data);
- static void moveReductionConflictToNextNeighbour(BeatSequence& sequence, BeatIndex factor, BeatIndex beatIndex, void* data);
- };
- class UnresolvedBeatSequenceReductionConflict : public std::runtime_error
- {
- typedef std::runtime_error parent;
- BeatSequence::BeatIndex beatIndex;
- public:
- UnresolvedBeatSequenceReductionConflict(BeatSequence::BeatIndex beatIndex);
- virtual const char* what() const throw();
- BeatSequence::BeatIndex getBeatIndex() const;
- };
- } // namespace
|