wavelength 1.0.0
Loading...
Searching...
No Matches
musefactory.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4#include <vector>
5
7#include "gs/multimuse.h"
8#include "gs/muse.h"
9
18public:
20 struct TickMuse {
21 int mTick;
22 unsigned char mStatus;
23 unsigned char mData1;
24 unsigned char mData2;
26 };
27
35
43
56 void AddMidi(int nTick, unsigned char nStatus, unsigned char nData1, unsigned char nData2);
57
65 unsigned char GetChannel() const;
66
78 int CountMessages(int nStart, int nEnd);
79
88
99 MultiMuse *Extract(int nStart, int nEnd);
100
101private:
112 void AddNoteOn(int nTick, unsigned char nStatus, unsigned char nData1, unsigned char nData2);
113
124 void AddNoteOff(int nTick, unsigned char nStatus, unsigned char nData1, unsigned char nData2);
125
136 void AddOther(int nTick, unsigned char nStatus, unsigned char nData1, unsigned char nData2);
137
146 Muse *MakeMuse(const TickMuse &message);
147
148 std::vector<TickMuse> mMessages;
149 std::vector<int> mOpenNotes;
150 int mChannel;
151 std::unique_ptr<MidiChannelState> mState;
152 int mResumeIndex;
153};
Muse that plays other muses, each at a tick of its own.
Definition multimuse.h:20
MuseFactory()
Construct an empty collector.
MultiMuse * ExtractAll()
Build a piece from every collected message.
unsigned char GetChannel() const
Report the MIDI channel of the collected messages.
~MuseFactory()
Release the collector.
void AddMidi(int nTick, unsigned char nStatus, unsigned char nData1, unsigned char nData2)
Collect a channel message.
int CountMessages(int nStart, int nEnd)
Count the collected messages in a span of ticks.
MultiMuse * Extract(int nStart, int nEnd)
Build a piece from the messages in a span of ticks, starting at the first note on of the span.
Piece of MIDI performance that a Scheduler plays.
Definition muse.h:12
One collected channel message.
Definition musefactory.h:20
int mDuration
Definition musefactory.h:25
int mTick
Definition musefactory.h:21
unsigned char mStatus
Definition musefactory.h:22
unsigned char mData1
Definition musefactory.h:23
unsigned char mData2
Definition musefactory.h:24