resonance 1.0.1
Loading...
Searching...
No Matches
voxer.h
Go to the documentation of this file.
1#pragma once
2
3#include <bitset>
4
5#include "gs/pitcher.h"
6#include "msg/message.h"
7
8class EraseMsg;
10class Phrase;
11class PhraseMgr;
12class PitchRiffMsg;
13class Player;
14class Quantizer;
15class StopRiffMsg;
16class TrackData;
17class TrackSelectMsg;
18
19namespace Sch {
20class TickClock;
21} // namespace Sch
22
41class Voxer : public Pitcher {
42public:
52 Voxer(PhraseMgr *pPhraseMgr,
53 Quantizer *pQuantizer,
54 Sch::TickClock *pClock,
55 const TrackData *pTrackData);
56
63 virtual ~Voxer();
64
79 virtual int Tick(int nElapsedTicks);
80
81protected:
93
105
119
134 void OnErase(int nBar, int bWholeStep, int bAnnounce);
135
143 void OnInvalidateSeeker(int nBar);
144
154 virtual void DispatchPriv(Message *pMsg);
155
156private:
163 void OnEraseMsg(EraseMsg *pMsg);
164
171 void OnInvalidateSeekerMsg(InvalidateSeekerMsg *pMsg);
172
181 int QueryBar(int nBar);
182
192 void UpdateSustain(int nTick);
193
203 void StartPhrase(int nTick);
204
215 void FinishPhrase(int nBar);
216
217 static constexpr int kLevelBits = 64;
218
219 PhraseMgr *mPhraseMgr; // +0x38
220 Quantizer *mQuantizer; // +0x3c
221 const TrackData *mTrackData; // +0x40
222 // Matched against an EraseMsg's `+0x0c` and an InvalidateSeekerMsg's `+0x08`, so it identifies
223 // the track this Voxer serves.
224 int mTrack; // +0x44 copied from the track description's `+0x04`
225 // Divisor that turns an elapsed tick count into a bar index.
226 int mBarTicks; // +0x48 copied from the phrase manager's `+0x34`
227 unsigned char mChannel; // +0x4c copied from the track description's `+0x08`
228 // Matched against an EraseMsg's `+0x04`, and defaulted to NullPlayer::sInstance, which Mixer
229 // also defaults its own selection to.
230 Player *mPlayer; // +0x50
231 // Non-zero while the sustain controller is down, which is while any level is held.
232 int mSustaining; // +0x54
233 Phrase *mPhrase; // +0x58, the phrase being recorded, or null
234 int mPhraseBar; // +0x5c, the bar mPhrase records, -1 at first
235 int mUnreadSentinel; // +0x60 set to -1 on construction and never read
236 int mReserved; // +0x64 never read or written by the class's routines
237 // One bit per PitchRiffMsg level held down. The constructor clears it as one doubleword.
238 std::bitset<kLevelBits> mHeldLevels; // +0x68
239};
Event the game passes between a MsgSource and a MsgSink.
Definition erasemsg.h:28
Event the game passes between a MsgSource and a MsgSink.
Definition invalidateseekermsg.h:19
Base of every event the game passes between a MsgSource and a MsgSink.
Definition message.h:41
Owner of the gem phrases on one track, and the seam between the network and the gems.
Definition phrasemgr.h:51
One phrase of a track, with its gems, its player, and the messages and values scheduled across it.
Definition phrase.h:38
Event the game passes between a MsgSource and a MsgSink.
Definition pitchriffmsg.h:26
Pitcher(Sch::TickClock *pClock)
Construct the three bases, the TickTask one to run every bar.
Definition pitcher.h:44
One participant in a session, local or remote.
Definition player.h:39
Holder of the track description the beat-quantising paths consult.
Definition quantizer.h:14
Pausable view of scheduler time, together with the tempo that maps it to a song position.
Definition tickclock.h:40
Event the game passes between a MsgSource and a MsgSink.
Definition stopriffmsg.h:27
Converted events of one track of a level.
Definition trackdata.h:52
Event the game passes between a MsgSource and a MsgSink.
Definition trackselectmsg.h:24
void OnStopRiff(StopRiffMsg *pMsg)
Release a level for this track and player.
virtual ~Voxer()
Destroy the voxer.
void OnTrackSelect(TrackSelectMsg *pMsg)
Install the player a TrackSelectMsg for this track selects.
void OnPitchRiff(PitchRiffMsg *pMsg)
Hold a level for this track and player.
void OnInvalidateSeeker(int nBar)
Turn mPlayer's seeker off, unless mPlayer is the stand-in.
virtual void DispatchPriv(Message *pMsg)
Act on a message.
virtual int Tick(int nElapsedTicks)
Close the previous bar and keep the sustain in step with the song.
void OnErase(int nBar, int bWholeStep, int bAnnounce)
Erase mPlayer's phrases around a bar.
Voxer(PhraseMgr *pPhraseMgr, Quantizer *pQuantizer, Sch::TickClock *pClock, const TrackData *pTrackData)
Scheduling of timed commands.
Definition activefilter.h:9