resonance 1.0.1
Loading...
Searching...
No Matches
levelbuilder.h
Go to the documentation of this file.
1#pragma once
2
3#include <iostream>
4#include <vector>
5
6#include "app/attachment.h"
7#include "game/leveldata.h"
8
9class HxStr;
10class Riff;
11class Harmony;
12
26
51class LevelBuilder : public LevelData {
52public:
67 explicit LevelBuilder(unsigned nTrackCount);
68
73 virtual ~LevelBuilder();
74
79 virtual int TrackCount();
80
85 virtual int BackingTrackCount();
86
91 virtual TrackData *OwnTrack();
92
101 virtual TrackData *TrackAt(int nIndex);
102
111 virtual TrackData *BackingTrackAt(int nIndex);
112
118
123 virtual PlayMap *GetPlayMap();
124
132 virtual int GetEndBar();
133
145 TrackData *GetTrack(int nIndex);
146
159 void SelectTrack(int nKind, int nIndex);
160
171 void Print(std::ostream &stream);
172
182 void SetBarCount(int nBarCount);
183
196
204 void SetChannel(unsigned char nChannel);
205
213 void SetKind(int nKind);
214
223 void SetInstrument(int nInstrument, const HxStr &name);
224
239 void AddEvent(int nTick,
240 unsigned char nStatus,
241 unsigned char nData1,
242 unsigned char nData2,
243 unsigned char nChannel);
244
256 void AddNoteMsg(int nTick,
257 unsigned char nNote,
258 unsigned char nVelocity,
259 int nLength,
260 unsigned char nChannel);
261
270 void SetQuant(int nTick, int nQuant);
271
280 void AddRiff(int nTick, Riff *pRiff);
281
291 void AddGem(int nTick, int nGem, Riff *pRiff);
292
304 void AddHarmony(int nTick, const Harmony &harmony);
305
317 void SetActive(int nTick, int bActive);
318
331 void AddTempo(int nTick, int nMicrosecondsPerQuarter);
332
343
344private:
345 // All three vectors manage their elements. The destructor clears each with a std::for_each
346 // over the deleting function at 0x001ec328.
347 std::vector<TrackData *> mTracks; // +0x04
348 std::vector<TrackData *> mBackingTracks; // +0x10
349
350public:
357 std::vector<TrackData *> mIntroTracks;
358
359private:
360 // Deleted by the destructor through TrackData's own destructor at 0x001d3900.
361 TrackData *mOwnTrack; // +0x28
362 // The track the forwarding members append to. The destructor does not release it.
363 TrackData *mCurrentTrack; // +0x2c
364 // Released by the destructor through Attachment::Release(). AddTempo() replaces it.
365 Sch::TempoMap *mTempoMap; // +0x30
366 // Deleted by the destructor through its own table slot 1.
367 PlayMap *mPlayMap; // +0x34
368};
The notes of one harmony a track plays from one song position onward.
Definition harmony.h:24
Heap-allocated NUL-terminated string.
Definition hxstr.h:41
virtual int TrackCount()
void SetKind(int nKind)
Set the TrackMode of the current track.
void AddNoteMsg(int nTick, unsigned char nNote, unsigned char nVelocity, int nLength, unsigned char nChannel)
Forward to TrackData::AddNoteMsg() on the current track.
virtual TrackData * OwnTrack()
LevelBuilder(unsigned nTrackCount)
Construct an empty builder.
virtual TrackData * TrackAt(int nIndex)
Return one track.
TrackData * GetTrack(int nIndex)
Return one gameplay track, without dispatch.
void AddRiff(int nTick, Riff *pRiff)
Forward to TrackData::AddRiff() on the current track.
virtual ~LevelBuilder()
virtual TrackData * BackingTrackAt(int nIndex)
Return one backing track.
virtual PlayMap * GetPlayMap()
void SetChannel(unsigned char nChannel)
Set the MIDI channel of the current track.
void SetActive(int nTick, int bActive)
Forward an activeness change to TrackData::SetActive() on the current track.
void AddGem(int nTick, int nGem, Riff *pRiff)
Forward to TrackData::AddGem() on the current track.
void DoneLoading()
Run TrackData::ScoreBars() on every score track.
virtual int GetEndBar()
Report the play map's extent.
virtual int BackingTrackCount()
void SetQuant(int nTick, int nQuant)
Forward to TrackData::SetQuant() on the current track.
virtual Sch::TempoMap * GetTempoMap()
void SelectTrack(int nKind, int nIndex)
Make one track the current track, creating it on first use.
void AddHarmony(int nTick, const Harmony &harmony)
Start a harmony on the current track.
void AddTempo(int nTick, int nMicrosecondsPerQuarter)
Replace the tempo map at +0x30 with one built from a tempo meta event.
TrackData * IntroTrackAt(int nIndex)
Return one intro track.
void SetBarCount(int nBarCount)
Forward a bar count to PlayMap::SetBarCount().
void AddEvent(int nTick, unsigned char nStatus, unsigned char nData1, unsigned char nData2, unsigned char nChannel)
Append one MIDI event to the current track.
void SetInstrument(int nInstrument, const HxStr &name)
Set the instrument index and the name of the current track.
void Print(std::ostream &stream)
Write every track of the three collections to a diagnostic stream.
std::vector< TrackData * > mIntroTracks
The intro tracks.
Definition levelbuilder.h:357
Read-only interface the game reads one converted level through.
Definition leveldata.h:27
Traversal order over one playable sequence.
Definition playmap.h:47
One riff of a track at one difficulty level, as a sequence of MIDI messages.
Definition riff.h:25
Affine map between a song position in MIDI ticks and scheduler time in nanoseconds.
Definition tempomap.h:43
Converted events of one track of a level.
Definition trackdata.h:52
LevelTrackKind
Collection LevelBuilder::SelectTrack() takes the current track from.
Definition levelbuilder.h:19
@ kLevelTrackNone
Definition levelbuilder.h:20
@ kLevelTrackIntro
Definition levelbuilder.h:22
@ kLevelTrackScore
Definition levelbuilder.h:23
@ kLevelTrackBacking
Definition levelbuilder.h:21
@ kLevelTrackOwn
Definition levelbuilder.h:24