wavelength 1.0.0
Loading...
Searching...
No Matches
pitchtrack.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4#include <vector>
5
12#include "game/playmap.h"
13#include "game/remixtrack.h"
15#include "game/slotgrid.h"
16#include "os/binstream.h"
17#include "os/command.h"
18#include "os/ptr.h"
19
28class PitchTrack : public RemixTrack {
29public:
46 PitchTrack(int nTrack,
47 int nLeadInBars,
48 int nNumBars,
49 int nTicksPerBar,
50 PitchTrackRiffData *pRiffData,
51 const std::vector<std::unique_ptr<PitchTrackGems>> *pPatterns,
52 PlayMap *pPlayMap,
53 SectionBoundaries *pSections,
54 SlotGrid *pPatternGrid,
55 bool bDisplayed);
56
63 ~PitchTrack() override;
64
71 void Start() override;
72
79 void Stop() override;
80
90 void SetPlayer(Player *pPlayer) override;
91
100 void HandleInput(Player *pPlayer, const PlayNoteEvent &event) override;
101
111 void HandleInput(Player *pPlayer, const BtnEvent<8> &event) override;
112
121 void HandleInput([[maybe_unused]] Player *pPlayer,
122 [[maybe_unused]] const StickEvent<2> &event) override {
123 }
124
133 void HandleInput([[maybe_unused]] Player *pPlayer,
134 [[maybe_unused]] const StickEvent<6> &event) override {
135 }
136
145 void HandleInput([[maybe_unused]] Player *pPlayer,
146 [[maybe_unused]] const BtnEvent<10> &event) override {
147 }
148
156 void SetMuteRemote(bool bMuteRemote) override;
157
165 bool GetMuteRemote() const override;
166
175 void SkipBars(int nStartBar, int nEndBar) override;
176
183 void RebuildGems() override;
184
192 void SetActive(bool bActive) override;
193
201 bool IsActive() const override;
202
210 void Redraw(int nStartBar) override;
211
219 void Save(BinStream &stream) override;
220
228 void Load(BinStream &stream) override;
229
239 void SelectPattern(int nPattern, int nStartBar, int nEndBar);
240
248 void SetRepeat(bool bRepeat);
249
257 void SetEditing(bool bEditing);
258
270 bool ToggleGem(signed char nSlot, int nTick, bool bRepeat, signed char nOwner);
271
279 void EraseBar(int nBar);
280
288 void EraseSection(int nBar);
289
292 return &mGems;
293 }
294
295private:
302 void EndPreview();
303
311 void UpdatePhrase(bool bStyle);
312
321 void ShowPhrase(bool bPlayable, bool bStyle);
322
330 void UpdateMute();
331
332 int mTicksPerBar;
333 PlayMap *mPlayMap;
334 SectionBoundaries *mSections;
335 PitchTrackGems mGems;
336 PitchTrackPlayGems mPlayGems;
337 std::vector<std::unique_ptr<PitchTrackPlayGems>> mPatterns;
338 PitchTrackRiffs mRiffs;
339 PitchTrackMusic mMusic;
340 std::unique_ptr<PitchTrackDisplay> mDisplay;
341 int mRepeat;
342 int mEditing;
343 int mMuteRemote;
344 int mActive;
345 float mLastEraseMs;
346 int mStartBar;
347 int mPreviewPattern; // +0xb4, -1. No routine sets another value.
348 Ptr<Command> mPhraseCommand;
349};
Stream of raw bytes, the base of the memory, file, and network streams.
Definition binstream.h:22
Input event of a button press that names only the player.
Definition btnevent.h:15
The gems of a pitch track, by the bar of the song as written they lie in.
Definition pitchtrackgems.h:17
Player of the riff of each gem of a pitch track at the gem's tick.
Definition pitchtrackmusic.h:16
The gems of a pitch track, addressed by the bars and ticks the song plays.
Definition pitchtrackplaygems.h:15
The riffs a pitch track plays, one set of riffs for each tick that starts a set.
Definition pitchtrackriffdata.h:16
The riffs of a pitch track, addressed by the ticks the song plays at.
Definition pitchtrackriffs.h:12
PitchTrackGems * GetGems()
Definition pitchtrack.h:291
void Save(BinStream &stream) override
Write the gems.
void HandleInput(Player *pPlayer, const PlayNoteEvent &event) override
Place or remove the gem of a pressed gem button at the nearest sixteenth of a bar.
void SetEditing(bool bEditing)
Set whether the remix editor is open, which hides the phrase from the player.
void Load(BinStream &stream) override
Read the gems and show them again from the current bar on.
PitchTrack(int nTrack, int nLeadInBars, int nNumBars, int nTicksPerBar, PitchTrackRiffData *pRiffData, const std::vector< std::unique_ptr< PitchTrackGems > > *pPatterns, PlayMap *pPlayMap, SectionBoundaries *pSections, SlotGrid *pPatternGrid, bool bDisplayed)
Construct the track for one song track.
void SkipBars(int nStartBar, int nEndBar) override
Show a range of bars empty, and start the phrases at the end of the range.
~PitchTrack() override
Release the track.
void SetMuteRemote(bool bMuteRemote) override
Set whether the track is silent while a player on another console is on it.
bool IsActive() const override
Report whether the track is the one the song's player plays.
void SelectPattern(int nPattern, int nStartBar, int nEndBar)
Copy the gems of a pattern over a range of bars, and play them.
void HandleInput(Player *pPlayer, const StickEvent< 2 > &event) override
Ignore a stick event.
Definition pitchtrack.h:121
void Redraw(int nStartBar) override
Show the gems again from a bar on.
bool ToggleGem(signed char nSlot, int nTick, bool bRepeat, signed char nOwner)
Place or remove the gem at a tick, and show the change.
bool GetMuteRemote() const override
Report whether the track is silent while a player on another console is on it.
void EraseSection(int nBar)
Remove the gems of the section a bar lies in.
void HandleInput(Player *pPlayer, const StickEvent< 6 > &event) override
Ignore a stick event.
Definition pitchtrack.h:133
void SetActive(bool bActive) override
Set whether the track is the one the song's player plays, which silences its own riffs.
void Start() override
Start the track with the song.
void RebuildGems() override
Copy the gems of each section's pattern into the section.
void SetPlayer(Player *pPlayer) override
Give the track to the player it plays for.
void EraseBar(int nBar)
Remove the gems of a bar, and of every other bar of the section while edits repeat.
void HandleInput(Player *pPlayer, const BtnEvent< 10 > &event) override
Ignore a button event.
Definition pitchtrack.h:145
void HandleInput(Player *pPlayer, const BtnEvent< 8 > &event) override
Erase the bar at the nearest sixteenth of a bar, or its section on a second press within half a secon...
void SetRepeat(bool bRepeat)
Set whether gem edits repeat on every other bar of the section.
void Stop() override
Stop the track with the song.
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
Input event that plays a note on one of the three gem buttons.
Definition playnoteevent.h:10
One participant in a song: the track the participant plays, the score, and the streak.
Definition player.h:19
Owner of one reference to an Attachment.
Definition ptr.h:16
RemixTrack(int nIndex)
Construct a track with no player.
Definition remixtrack.h:22
Ascending list of the measures at which the sections of a song end.
Definition sectionboundaries.h:12
The pattern each section of a remixed song repeats, as the section the pattern comes from.
Definition slotgrid.h:10
Input event of an analog stick position.
Definition stickevent.h:15