143 void AddBank(
const char *pszFile,
int nStartBar);
209 int GetBank(
int nBar)
const {
210 return mBankOfBar[nBar + mLeadBars];
221 void SetBank(
int nBar,
int nBank) {
222 mBankOfBar[nBar + mLeadBars] = nBank;
241 unsigned short GetLoadSlot()
const;
250 void LoadBank(
int nBank);
253 static constexpr int kNumSlots = 2;
255 unsigned short mBaseSlot;
256 const char *mLoaded[kNumSlots];
261 std::vector<SwapBank> mBanks;
262 std::vector<int> mBankOfBar;
265 Ptr<Command> mAdvanceCmd;
381 void PartitionSlots();
384 unsigned short mFirstSlot;
389 std::vector<std::unique_ptr<PermBankLoader>> mPermBanks;
390 std::unique_ptr<SwapBankLoader> mSwapBanks;
bool IsLoaded() const
Report whether the bank finished loading.
~PermBankLoader()
Unload the bank when Load() was called.
int GetBlockCount() const
Definition bankloader.h:77
PermBankLoader(unsigned short nSlot, const char *pszFile)
Construct a loader and query the size of the bank from the synthesiser.
unsigned short GetSlot() const
Definition bankloader.h:72
void Load()
Start loading the bank into its slot.
~SwapBankLoader()
Unload the banks.
bool PollLoad()
Report whether the first bank is loaded.
void Load()
Start loading the first bank.
void AddBank(const char *pszFile, int nStartBar)
Add a bank that plays from a bar to the end of the song.
int GetMaxBankSize() const
Report the size of the largest bank.
void Unload()
Withdraw the scheduled load and unload the slots.
SwapBankLoader(unsigned short nBaseSlot, PlayMap *pPlayMap, int nLeadBars, int nNumBars, int nTicksPerBar)
Construct a loader with no banks.
void Restart()
Withdraw the scheduled load and load the bank the song needs next.
void Start()
Load the bank the song needs next.
unsigned short GetBaseSlot() const
Definition bankloader.h:196
State
Values of mState.
Definition bankloader.h:104
@ kStateLoading
Definition bankloader.h:106
@ kStateIdle
Definition bankloader.h:105
@ kStateLoaded
Definition bankloader.h:107
State
Values of mState.
Definition bankloader.h:22
@ kStateLoaded
Definition bankloader.h:25
@ kStateIdle
Definition bankloader.h:23
@ kStatePlaying
Definition bankloader.h:26
@ kStateLoading
Definition bankloader.h:24
void Stop()
Stop a load or the swapping that is under way.
BankLoader(unsigned short nFirstSlot, PlayMap *pPlayMap, int nIntroBars, int nNumBars, int nTicksPerBar)
Construct a loader with no bank.
unsigned short GetEndBankSlot()
Report the first synthesiser bank slot after the slots the banks fill.
void AddSwapBank(const char *pszFile, int nBar)
Add a swapped bank that plays from a bar on.
~BankLoader()
Stop a load and release the loaders.
void Start()
Enter the playing state and start swapping the banks.
void Load()
Start loading the sound banks.
void AddPermBank(const char *pszFile)
Add a permanent bank in the next free slot.
void Restart()
Swap the banks for the song position again.
bool PollLoad()
Advance the load and report whether it finished.
int GetNumSlots()
Report the number of slots the banks fill.
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
Growable text buffer that is also a PrnStream.
Definition string.h:19
One bank file and its size.
Definition bankloader.h:98
int mSize
Definition bankloader.h:100
String mFile
Definition bankloader.h:99