wavelength 1.0.0
Loading...
Searching...
No Matches
BankWin Class Reference

Editor view of one bank: its instruments, its samples, and the files it is stored in. More...

#include <BankWin.h>

Public Member Functions

 BankWin (const String &filename, unsigned short bankID, bool promptForMissingFiles)
 Create a bank, loading it when a file is given.
 ~BankWin ()
 Delete the instruments and samples.
bool HasDuplicateProgramIds ()
 Report whether two instruments share a program number.
int Save (const String &filename, bool forceAudioData)
 Write the bank file, and the audio data file when the samples changed or it is requested.
int Load ()
 Replace the contents with those of the bank file.
int NewInstrument (unsigned short program)
 Add an instrument.
int DeleteInstrument (int instrumentID, std::vector< int > &sampleIDs)
 Delete an instrument.
String GetSampleInfo (unsigned short sampleID)
 Describe a sample: its name, its file, its format, and the instruments that play it.
int NewSample (const String &filename, bool *alreadyExists)
 Add a sample made from a WAV file, unless one is already made from it.
int DeleteSample (int sampleID, std::map< int, int > &removed)
 Delete a sample and every sample description that plays it.
void GetSampleUsers (std::vector< String > &names, std::vector< int > &sampleDescIDs, int sampleID)
 List the sample descriptions that play a sample.
int GetID () const
 Report the identifier.
String & GetName ()
 Report the name.
void SetName (const String &name)
 Rename the bank, unless the new name is empty.
String & GetFilename ()
 Report the path of the bank file.
Bank & GetBank ()
 Report the header.
std::map< int, InstrumentWin * > & GetInstruments ()
 Report the instruments.
std::map< int, SampleWin * > & GetSamples ()
 Report the samples.

Friends

class CSyntheditCtrl

Detailed Description

Editor view of one bank: its instruments, its samples, and the files it is stored in.

The class has no RTTI, and its name comes from the assert text of its users. The object is 0x50 bytes. It deletes its instruments and samples. Its routines are in BankManager.cpp.

Constructor & Destructor Documentation

◆ BankWin()

BankWin::BankWin ( const String & filename,
unsigned short bankID,
bool promptForMissingFiles )

Create a bank, loading it when a file is given.

Parameters
filenameThe path of the bank file, or an empty string for a new bank.
bankIDThe bank identifier.
promptForMissingFilesWhether loading offers to find a replacement for a missing WAV file.
Ghidra address:
0x1001c2da

◆ ~BankWin()

BankWin::~BankWin ( )

Delete the instruments and samples.

Ghidra address:
0x1001c3c7

Member Function Documentation

◆ HasDuplicateProgramIds()

bool BankWin::HasDuplicateProgramIds ( )

Report whether two instruments share a program number.

Returns
Whether a program number is used twice.
Ghidra address:
0x1001c4ec

◆ Save()

int BankWin::Save ( const String & filename,
bool forceAudioData )

Write the bank file, and the audio data file when the samples changed or it is requested.

The write is refused, with a notice, when the bank breaks a limit of the console.

Parameters
filenameThe path to write, or an empty string for the path the bank was loaded from.
forceAudioDataWhether to write the audio data file even when no sample changed.
Returns
Zero, or -1 when the write was refused.
Ghidra address:
0x1001c5f0

◆ Load()

int BankWin::Load ( )

Replace the contents with those of the bank file.

Returns
The identifier of the bank.
Ghidra address:
0x1001daf0

◆ NewInstrument()

int BankWin::NewInstrument ( unsigned short program)

Add an instrument.

A program number already in use, or below 1, becomes the one after the highest in use.

Parameters
programThe program number.
Returns
The identifier of the new InstrumentWin.
Ghidra address:
0x1001f3e2

◆ DeleteInstrument()

int BankWin::DeleteInstrument ( int instrumentID,
std::vector< int > & sampleIDs )

Delete an instrument.

Parameters
instrumentIDThe identifier of the InstrumentWin.
sampleIDsReceives samples the instrument played. Only a sample found at the start of the list is added.
Returns
Zero.
Ghidra address:
0x1001f5a0

◆ GetSampleInfo()

String BankWin::GetSampleInfo ( unsigned short sampleID)

Describe a sample: its name, its file, its format, and the instruments that play it.

Parameters
sampleIDThe identifier of the SampleWin.
Returns
The description.
Ghidra address:
0x1001f66b

◆ NewSample()

int BankWin::NewSample ( const String & filename,
bool * alreadyExists )

Add a sample made from a WAV file, unless one is already made from it.

Parameters
filenameThe path of the WAV file.
alreadyExistsReceives whether a sample already used the file.
Returns
The identifier of the SampleWin, or -1 when the file was unusable.
Ghidra address:
0x1001f86d

◆ DeleteSample()

int BankWin::DeleteSample ( int sampleID,
std::map< int, int > & removed )

Delete a sample and every sample description that plays it.

Parameters
sampleIDThe identifier of the SampleWin.
removedReceives the identifier of the instrument under the identifier of each removed SampleDescWin.
Returns
Zero.
Ghidra address:
0x1001fa8e

◆ GetSampleUsers()

void BankWin::GetSampleUsers ( std::vector< String > & names,
std::vector< int > & sampleDescIDs,
int sampleID )

List the sample descriptions that play a sample.

Parameters
namesReceives the name of each SampleDescWin.
sampleDescIDsReceives the identifier of each SampleDescWin.
sampleIDThe identifier of the SampleWin.
Ghidra address:
0x1001fd98

◆ GetID()

int BankWin::GetID ( ) const
inline

Report the identifier.

Returns
The identifier.
Ghidra address:
0x10020430

◆ GetName()

String & BankWin::GetName ( )
inline

Report the name.

Returns
The name.

◆ SetName()

void BankWin::SetName ( const String & name)
inline

Rename the bank, unless the new name is empty.

Parameters
nameThe new name.

◆ GetFilename()

String & BankWin::GetFilename ( )
inline

Report the path of the bank file.

Returns
The path, empty for a bank never saved.

◆ GetBank()

Bank & BankWin::GetBank ( )
inline

Report the header.

Returns
The header.

◆ GetInstruments()

std::map< int, InstrumentWin * > & BankWin::GetInstruments ( )
inline

Report the instruments.

Returns
The instruments by identifier.

◆ GetSamples()

std::map< int, SampleWin * > & BankWin::GetSamples ( )
inline

Report the samples.

Returns
The samples by identifier.

◆ CSyntheditCtrl

friend class CSyntheditCtrl
friend

The documentation for this class was generated from the following file: