resonance 1.0.1
Loading...
Searching...
No Matches
scratcher.h
Go to the documentation of this file.
1#pragma once
2
3#include <vector>
4
5#include "gs/pitcher.h"
6#include "mid/tick.h"
7#include "msg/message.h"
8
10class EraseMsg;
12class PhraseMgr;
13class PitchRiffMsg;
14class Player;
15class Quantizer;
16class TrackData;
17class TrackSelectMsg;
18
19namespace Sch {
20class TickClock;
21} // namespace Sch
22
40class Scratcher : public Pitcher {
41public:
52 Scratcher(PhraseMgr *pPhraseMgr,
53 Quantizer *pQuantizer,
54 Sch::TickClock *pClock,
55 const TrackData *pTrackData);
56
61 virtual ~Scratcher();
62
75 virtual int Tick(int nElapsedTicks);
76
77protected:
90
104
116
129 void OnPitchRiff(int nGem, int nStep, int nTick);
130
138 void SendSeekerMsg(int nBar) const;
139
149 virtual void DispatchPriv(Message *pMsg);
150
151private:
158 void OnPitchRiffMsg(PitchRiffMsg *pMsg);
159
166 void OnInvalidateSeeker(InvalidateSeekerMsg *pMsg);
167
176 int QueryBar(int nBar);
177
178 PhraseMgr *mPhraseMgr; // +0x38
179 Quantizer *mQuantizer; // +0x3c
180 const TrackData *mTrackData; // +0x40, the object Tick() tests the current bar against
181 // Copied from the track description's `+0x04`. Matched against a PitchRiffMsg's `+0x10` and
182 // an InvalidateSeekerMsg's `+0x08`, so it identifies the track this Scratcher serves.
183 int mTrack; // +0x44
184 // Copied from the phrase manager's `+0x34`. Turns an elapsed tick count into a bar index.
185 int mBarDivisor; // +0x48
186 Sch::TickClock *mClock; // +0x4c
187 // An IDable identifier, kIDableUnregistered from the constructor. The class's routines do not
188 // read it.
189 int mId; // +0x50
190 // Tick() performs its second half only while this is set. The constructor derives it from two
191 // configuration queries.
192 int mSwitchesBanks; // +0x54
193 // The track description's MIDI channel byte, and the argument Tick() hands to the synthesiser
194 // slot.
195 int mChannel; // +0x58
196 // Starts at NullPlayer::sInstance. Matched against a PitchRiffMsg's `+0x08`, which
197 // msg/pitchriffmsg.h types as an int.
198 Player *mPlayer; // +0x5c
199 // The position of the last scratch, kTickInfinity at first.
200 Sch::Tick mLastScratchPosition; // +0x60
201 // The player of the last scratch, NullPlayer::sInstance at first.
202 Player *mLastScratchPlayer; // +0x64
203 // The gem of the last PitchRiffMsg. PostNowBarMsg() replays it.
204 int mLastGem; // +0x68
205 int mAnnouncedBar; // +0x6c, the bar last announced, -1 at first
206 int mScratchDirection; // +0x70, the scratch direction PostNowBarMsg() last detected
207 // The ring of past axis positions. The constructor builds three elements from an int zero
208 // through the float fill instantiation at 0x001d1f90. The fill converts each with cvt.s.w.
209 std::vector<float> mReadings; // +0x74
210 int mNewestReading; // +0x80, the newest slot of mReadings, not written by the constructor
211 Sch::Tick mLastGemEnd; // +0x84, where the last scratch gem ends
212 float mLastGemEndBlend; // +0x88, the blend the last scratch gem ends at
213 int mLastStep; // +0x8c, the step of the last scratch
214};
Event the game passes between a MsgSource and a MsgSink.
Definition axisregistermsg.h:25
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
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
Song position in MIDI ticks, printed as measure, beat, and tick.
Definition tick.h:70
void OnTrackSelect(TrackSelectMsg *pMsg)
Install the player a TrackSelectMsg for this track selects.
void EraseGemRange(EraseMsg *pMsg)
Erase a player's phrases at an EraseMsg's position for this track.
virtual int Tick(int nElapsedTicks)
Advance to the bar the elapsed tick count falls in.
void SendSeekerMsg(int nBar) const
Turn mPlayer's seeker off, unless mPlayer is the stand-in.
virtual ~Scratcher()
void OnPitchRiff(int nGem, int nStep, int nTick)
Play a gem at a pitch step.
void PostNowBarMsg(AxisRegisterMsg *pMsg)
Turn an axis reading for this track and player into scratches.
Scratcher(PhraseMgr *pPhraseMgr, Quantizer *pQuantizer, Sch::TickClock *pClock, const TrackData *pTrackData)
Construct a scratcher for one track.
virtual void DispatchPriv(Message *pMsg)
Act on a message.
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
Scheduling of timed commands.
Definition activefilter.h:9