wavelength 1.0.0
Loading...
Searching...
No Matches
playmap.h
Go to the documentation of this file.
1#pragma once
2
3#include <vector>
4
11class PlayMap {
12public:
14 class Loop {
15 public:
16 Loop() = default;
17
25 Loop(int nStartBar, int nNumBars, int nPlayBar)
26 : mStartBar(nStartBar), mNumBars(nNumBars), mPlayBar(nPlayBar) {
27 }
28
37 bool operator<(const Loop &other) const {
38 return mPlayBar < other.mPlayBar;
39 }
40
42 int GetStartBar() const {
43 return mStartBar;
44 }
45
47 int GetPlayBar() const {
48 return mPlayBar;
49 }
50
52 int GetNumBars() const {
53 return mNumBars;
54 }
55
56 private:
57 int mStartBar;
58 int mNumBars;
59 int mPlayBar;
60 };
61
70 PlayMap(int nTicksPerBar, int nEndBar);
71
83 void AddLoop(int nStartBar, int nNumBars, int nPlayBar);
84
93 int MapBar(int nBar) const;
94
103 int MapTick(int nTick) const;
104
121 int nTick, int *pChangeTick, int *pEnd, int *pNextStart, int *pNextLength, int *pIsLast);
122
130 int GetEndBar() const;
131
141
143 int GetLooping() const {
144 return mLooping;
145 }
146
147private:
148 int mTicksPerBar;
149 std::vector<Loop> mLoops;
150 int mEndBar;
151 int mLooping;
152};
int GetStartBar() const
Definition playmap.h:42
Loop(int nStartBar, int nNumBars, int nPlayBar)
Construct a stretch.
Definition playmap.h:25
int GetPlayBar() const
Definition playmap.h:47
int GetNumBars() const
Definition playmap.h:52
Loop()=default
bool operator<(const Loop &other) const
Order loops by the bar they play from.
Definition playmap.h:37
void AddLoop(int nStartBar, int nNumBars, int nPlayBar)
Play a range of bars of the song as written from a bar on, repeating without end.
void GetSegment(int nTick, int *pChangeTick, int *pEnd, int *pNextStart, int *pNextLength, int *pIsLast)
Report the stretch of the song as written that plays at a tick, and the stretch after it.
int MapBar(int nBar) const
Map a bar the song plays to the bar of the song as written.
void ClearLoops()
Remove every loop, and play the song as written again.
PlayMap(int nTicksPerBar, int nEndBar)
Construct a map that plays the song as written, from bar 0 without end.
int GetEndBar() const
Report the bar the song ends at.
int GetLooping() const
Definition playmap.h:143
int MapTick(int nTick) const
Map a tick the song plays at to the tick of the song as written.