resonance 1.0.1
Loading...
Searching...
No Matches
phrasedatabase.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4#include <iostream>
5#include <vector>
6
7#include "app/msgsource.h"
8
9class IBStream;
10class OBStream;
11class Phrase;
12class PlayMap;
13class Player;
14
29class PhraseDatabase : public MsgSource {
30public:
39 void *operator new(size_t nSize);
40
48 void operator delete(void *pBlock);
49
58
65 virtual ~PhraseDatabase();
66
74 void SetOwners(Player *pPlayer);
75
83 void Save(OBStream &stream);
84
95 void Load(IBStream &stream);
96
103 void Clear();
104
114
121 Phrase *GetPhraseAt(int nBar);
122
129 Phrase *GetPhrase(int nIndex);
130
139 void SetPhraseAt(Phrase *pPhrase, int nTick);
140
149 void SetPhrase(Phrase *pPhrase, int nIndex);
150
158 void ClearPhraseAt(int nTick);
159
167 void ClearPhrase(int nIndex);
168
177 void SetOwnerAt(Player *pPlayer, int nTick);
178
187 void SetOwner(Player *pPlayer, int nIndex);
188
195 Player *GetOwner(int nIndex);
196
205 void SetPhraseByte(int nIndex, char cValue);
206
213 unsigned char GetPhraseByte(int nIndex);
214
221 long long *GetStepValue(int nBar);
222
231 void Print(std::ostream &stream);
232
233private:
234 std::vector<Phrase *> mPhrases; // +0x14, one per step, reference counted
235 std::vector<long long> mStepEffects; // +0x20, jam effect masks, four bytes each on the wire
236 PlayMap *mMap; // +0x2c
237};
Input half of the byte stream interface.
Definition ibstream.h:36
Sender of engine messages, which stores the list of sinks that receive them.
Definition msgsource.h:26
Output half of the byte stream interface.
Definition obstream.h:25
void SetPhraseAt(Phrase *pPhrase, int nTick)
Store a phrase at the step the play map places a song position in.
void SetOwners(Player *pPlayer)
Give every step a phrase owned by one player, creating the phrases that do not exist yet.
void SetOwner(Player *pPlayer, int nIndex)
Give the phrase at a step an owner, creating the phrase when the step has none.
virtual ~PhraseDatabase()
Release every phrase.
Player * GetOwner(int nIndex)
long long * GetStepValue(int nBar)
Phrase * GetPhraseAt(int nBar)
void SetPhraseByte(int nIndex, char cValue)
Set Phrase::mScore of the phrase at a step, when the step has one.
void Clear()
Release every phrase and zero every value.
void ClearPhrase(int nIndex)
Release the phrase at a step.
PhraseDatabase(PlayMap *pMap)
Construct an empty database over a play map.
void ClearOwners()
Return every existing phrase to the stand-in player, logging entry and exit on the console.
Phrase * GetPhrase(int nIndex)
void Save(OBStream &stream)
Write the database behind a version byte of 1.
void Load(IBStream &stream)
Read the database back after releasing its contents.
void ClearPhraseAt(int nTick)
Release the phrase at the step the play map places a song position in.
void SetOwnerAt(Player *pPlayer, int nTick)
Give the phrase at the step the play map places a song position in an owner.
unsigned char GetPhraseByte(int nIndex)
void Print(std::ostream &stream)
Write every phrase to a diagnostic stream, eight to a line, with [null] for an empty step.
void SetPhrase(Phrase *pPhrase, int nIndex)
Store a phrase at a step, releasing the phrase it replaces and taking a reference.
One phrase of a track, with its gems, its player, and the messages and values scheduled across it.
Definition phrase.h:38
Traversal order over one playable sequence.
Definition playmap.h:47
One participant in a session, local or remote.
Definition player.h:39