#include "midi/BeatSequence.h" #include #include #include class BeatSequenceNoteInformation { typedef std::multiset BeatIndexMultiset; public: BeatIndexMultiset onBeatIndices, offBeatIndices; void print(std::ostream& stream, std::size_t indent = 0) const; void registerMessage(midi::BeatSequence::BeatIndex beatIndex, const std::shared_ptr& noteMsg_ptr); void unregisterMessage(midi::BeatSequence::BeatIndex beatIndex, const std::shared_ptr& noteMsg_ptr); }; class BeatSequence : public midi::BeatSequence { typedef midi::BeatSequence parent; typedef midi::ChannelMessage::Channel Channel; typedef midi::NoteMessage::Pitch Pitch; typedef std::pair ChannelPitchPair; typedef std::map NoteInfoMap; NoteInfoMap noteInfos; public: const midi::MessageList& at(BeatIndex beatIndex) const; const midi::MessageList& operator[](BeatIndex beatIndex) const; void resize(BeatIndex size); void pushBackMessage(BeatIndex beatIndex, std::shared_ptr& msg_ptr); void eraseMessage(BeatIndex beatIndex, midi::MessageList::const_iterator msg_it); void expand(BeatIndex factor); void reduceToNeighbour(BeatIndex factor); void reduceErasingConflicts(BeatIndex factor); void printRegistry(std::ostream& stream) const; private: BeatSequenceNoteInformation& getNoteInfo(Channel channel, Pitch pitch); void refreshRegistry(); void registerMessage(BeatIndex beatIndex, const std::shared_ptr& msg_ptr); void unregisterMessage(BeatIndex beatIndex, const std::shared_ptr& msg_ptr); };