|
wavelength 1.0.0
|
An instrument bank: its header, programs, sample descriptors, and samples, and where its waveforms sit in SPU2 memory. More...
#include <bank.h>

Public Member Functions | |
| Bank () | |
| Construct an empty, unloaded bank. | |
| void | Init () |
| Reset the header, forget every program, descriptor, and sample, and mark the bank unloaded. | |
| void | SetProgram (BankProgram *program, int index) |
| Store a program and point it at its run of descriptors. | |
| void | SetSampleDesc (BankSampleDesc *sampleDesc, int index) |
| Store a descriptor and link it to its sample. | |
| bool | SetSample (Sample *sample, int index) |
| Store a sample. | |
| BankProgram * | GetProgram (int index) |
| Look up a program by slot. | |
| BankSampleDesc * | GetSampleDesc (BankProgram *program, int index) |
| Look up one descriptor of a program's run. | |
| void | Clear () |
| Return every program, descriptor, and sample to the pools, then Init(). | |
| Bank () | |
| Create a bank header and reset it. | |
| void | Init () |
| Reset every field to its default. | |
| int | FromStream (const unsigned char *data) |
| Read the header from its stream form. | |
| int | ToStream (unsigned char *data) const |
| Write the header in its stream form, as version 1. | |
Static Public Member Functions | |
| static void | NewProgram (BankProgram **program) |
| Take a program from the pool and Init() it. | |
| static void | NewSampleDesc (BankSampleDesc **sampleDesc) |
| Take a descriptor from the pool and Init() it. | |
| static void | NewSample (Sample **sample) |
| Take a sample from the pool and Init() it. | |
| static int | Find (unsigned short id) |
| Find the loaded bank with an identifier. | |
| static void | InitPools () |
| Allocate the shared pools. | |
| static int | ReleasePools () |
| Release the shared pools. | |
| static int | StreamSize () |
| Report the size of the stream form. | |
Public Attributes | |
| unsigned char | mLoaded |
| BankHeader | mHeader |
| BankProgram * | mPrograms [kMaxPrograms] |
| BankSampleDesc * | mSampleDescs [kMaxSampleDescs] |
| Sample * | mSamples [kMaxSamples] |
| unsigned int | mSpuAddress |
| unsigned int | mSpuSize |
| unsigned short | mId |
| unsigned char | mVolume |
| unsigned short | mNumInstruments |
Static Public Attributes | |
| static constexpr int | kMaxBanks = 7 |
| static constexpr int | kMaxPrograms = 100 |
| static constexpr int | kMaxSampleDescs = 700 |
| static constexpr int | kMaxSamples = 700 |
| static Bank | sBanks [kMaxBanks] |
An instrument bank: its header, programs, sample descriptors, and samples, and where its waveforms sit in SPU2 memory.
Header of a bank, shared with the synthesiser on the IOP.
The class has no RTTI, and its name is inferred from its role. The EE loads a bank piece by piece over RPC into one of kMaxBanks slots. Programs, descriptors, and samples come from pools every bank shares.
The class has no RTTI, and its name is inferred from its source file. The record is 6 bytes, laid out as the bank header of the IOP synthesiser. Its stream form is a version word followed by the fields, 9 bytes in all.
|
inline |
Construct an empty, unloaded bank.
| Bank::Bank | ( | ) |
Create a bank header and reset it.
| void Bank::Init | ( | ) |
Reset the header, forget every program, descriptor, and sample, and mark the bank unloaded.
The SPU2 area is retained.
| void Bank::SetProgram | ( | BankProgram * | program, |
| int | index ) |
Store a program and point it at its run of descriptors.
The run starts after the descriptors of every program before index. Those programs must already be stored.
| program | The program. |
| index | Its slot. |
| void Bank::SetSampleDesc | ( | BankSampleDesc * | sampleDesc, |
| int | index ) |
Store a descriptor and link it to its sample.
The sample must already be stored.
| sampleDesc | The descriptor. |
| index | Its slot. |
| bool Bank::SetSample | ( | Sample * | sample, |
| int | index ) |
Store a sample.
| sample | The sample. |
| index | Its slot. |
| BankProgram * Bank::GetProgram | ( | int | index | ) |
Look up a program by slot.
| index | The slot. |
index is not below the header's program count. | BankSampleDesc * Bank::GetSampleDesc | ( | BankProgram * | program, |
| int | index ) |
Look up one descriptor of a program's run.
| program | The program. |
| index | Position in the program's run. |
| void Bank::Clear | ( | ) |
Return every program, descriptor, and sample to the pools, then Init().
|
static |
Take a program from the pool and Init() it.
| program | Receives the program. |
|
static |
Take a descriptor from the pool and Init() it.
| sampleDesc | Receives the descriptor. |
|
static |
Take a sample from the pool and Init() it.
| sample | Receives the sample. |
|
static |
Find the loaded bank with an identifier.
| id | The identifier. |
|
static |
Allocate the shared pools.
|
static |
Release the shared pools.
| void Bank::Init | ( | ) |
Reset every field to its default.
| int Bank::FromStream | ( | const unsigned char * | data | ) |
Read the header from its stream form.
Only version 1 is accepted.
| data | The stream form. |
| int Bank::ToStream | ( | unsigned char * | data | ) | const |
Write the header in its stream form, as version 1.
| data | Receives StreamSize() bytes. |
|
static |
Report the size of the stream form.
|
staticconstexpr |
Bank slots.
|
staticconstexpr |
Programs per bank, and in the shared pool.
|
staticconstexpr |
Descriptors per bank and in the pool.
|
staticconstexpr |
Samples per bank and in the pool.
| unsigned char Bank::mLoaded |
One once the EE marks the bank loaded.
| BankHeader Bank::mHeader |
The bank's identity and mix settings.
| BankProgram* Bank::mPrograms[kMaxPrograms] |
Programs by slot.
| BankSampleDesc* Bank::mSampleDescs[kMaxSampleDescs] |
Descriptors, in program order.
| Sample* Bank::mSamples[kMaxSamples] |
Samples by index.
| unsigned int Bank::mSpuAddress |
Start of the bank's SPU2 area.
| unsigned int Bank::mSpuSize |
Size of the bank's SPU2 area in bytes.
| unsigned short Bank::mId |
Bank identifier a bank select requests.
| unsigned char Bank::mVolume |
Bank volume, an index into the volume curve.
| unsigned short Bank::mNumInstruments |
Instruments the bank defines.