wavelength 1.0.0
Loading...
Searching...
No Matches
catchtrackmusic.h
Go to the documentation of this file.
1#pragma once
2
3#include <vector>
4
6#include "game/playmap.h"
7#include "gs/multimuse.h"
8#include "gs/muse.h"
9#include "os/command.h"
10#include "os/ptr.h"
11#include "os/scheduler.h"
12
22public:
28 class PlayBarCmd : public Command {
29 public:
35 explicit PlayBarCmd(CatchTrackMusic *pMusic) : mMusic(pMusic) {
36 }
37
44 ~PlayBarCmd() override {
45 }
46
53 void Execute() override {
54 mMusic->PlayBar();
55 TheSongScheduler.PostIn(this, mMusic->mTicksPerBar, false);
56 }
57
58 private:
59 CatchTrackMusic *mMusic;
60 };
61
74 int nTicksPerBar,
75 int nNumBars,
76 PlayMap *pPlayMap,
77 int nStopPrevious);
78
85 ~CatchTrackMusic() override;
86
93 void Start();
94
101 void Stop();
102
112 void Refresh();
113
122 void OnNote(unsigned char nNote, int nDuration) override;
123
124private:
134 void BuildBars(int nNumBars);
135
145 void PlayBar();
146
147 CatchTrackState *mState;
148 Ptr<Command> mPlayBarCommand;
149 std::vector<Ptr<MultiMuse>> mBars;
150 int mTicksPerBar;
151 PlayMap *mPlayMap;
152 int mStopPrevious;
153 Muse *mCurrent;
154 Muse *mPrevious;
155};
void Execute() override
Play the bar the song arrives at, and run again a bar later.
Definition catchtrackmusic.h:53
PlayBarCmd(CatchTrackMusic *pMusic)
Construct the command of a player.
Definition catchtrackmusic.h:35
~PlayBarCmd() override
Release the command.
Definition catchtrackmusic.h:44
void Start()
Stop the music and schedule the bars from the next bar boundary on.
void Refresh()
Play the rest of the current bar once its phrase is captured, or stop it while the phrase is not capt...
CatchTrackMusic(CatchTrackState *pState, int nTicksPerBar, int nNumBars, PlayMap *pPlayMap, int nStopPrevious)
Construct the player and collect the music of the gems bar by bar.
void Stop()
Withdraw the scheduled command and stop every bar.
void OnNote(unsigned char nNote, int nDuration) override
Stop the bar that played before the current one.
~CatchTrackMusic() override
Stop the music and release the bars.
Per-bar state of one catch track during a song.
Definition catchtrackstate.h:17
Unit of work a Scheduler runs at a set time.
Definition command.h:13
Receiver of each note a muse starts.
Definition muse.h:20
Piece of MIDI performance that a Scheduler plays.
Definition muse.h:12
Map from the bars a song plays to the bars of the song as written, with the loops that repeat stretch...
Definition playmap.h:11
Owner of one reference to an Attachment.
Definition ptr.h:16
Scheduler TheSongScheduler
The scheduler of the song clock.