wavelength 1.0.0
Loading...
Searching...
No Matches
BankWin.h
Go to the documentation of this file.
1#pragma once
2
3#include <map>
4#include <vector>
5
7#include "synth/SampleWin.h"
8#include "utl/Str.h"
9#include "synth/common/Bank.h"
10
17class BankWin {
18public:
28 BankWin(const String &filename, unsigned short bankID, bool promptForMissingFiles);
29
36
44
54 int Save(const String &filename, bool forceAudioData);
55
62 int Load();
63
72 int NewInstrument(unsigned short program);
73
83 int DeleteInstrument(int instrumentID, std::vector<int> &sampleIDs);
84
92 String GetSampleInfo(unsigned short sampleID);
93
102 int NewSample(const String &filename, bool *alreadyExists);
103
113 int DeleteSample(int sampleID, std::map<int, int> &removed);
114
123 void GetSampleUsers(std::vector<String> &names, std::vector<int> &sampleDescIDs, int sampleID);
124
131 int GetID() const {
132 return mID;
133 }
134
141 return mName;
142 }
143
149 void SetName(const String &name) {
150 if (name.size() > 0) {
151 mName = name;
152 }
153 }
154
161 return mFilename;
162 }
163
170 return mBank;
171 }
172
178 std::map<int, InstrumentWin *> &GetInstruments() {
179 return mInstruments;
180 }
181
187 std::map<int, SampleWin *> &GetSamples() {
188 return mSamples;
189 }
190
191private:
192 friend class CSyntheditCtrl;
193
194 bool mAudioDataDirty;
195 String mName;
196 int mID;
197 String mFilename;
198 bool mPromptForMissingFiles;
199 Bank mBank;
200 std::map<int, InstrumentWin *> mInstruments;
201 std::map<int, SampleWin *> mSamples;
202};
~BankWin()
Delete the instruments and samples.
int DeleteSample(int sampleID, std::map< int, int > &removed)
Delete a sample and every sample description that plays it.
std::map< int, SampleWin * > & GetSamples()
Report the samples.
Definition BankWin.h:187
std::map< int, InstrumentWin * > & GetInstruments()
Report the instruments.
Definition BankWin.h:178
int NewSample(const String &filename, bool *alreadyExists)
Add a sample made from a WAV file, unless one is already made from it.
String GetSampleInfo(unsigned short sampleID)
Describe a sample: its name, its file, its format, and the instruments that play it.
String & GetName()
Report the name.
Definition BankWin.h:140
bool HasDuplicateProgramIds()
Report whether two instruments share a program number.
BankWin(const String &filename, unsigned short bankID, bool promptForMissingFiles)
Create a bank, loading it when a file is given.
void SetName(const String &name)
Rename the bank, unless the new name is empty.
Definition BankWin.h:149
int NewInstrument(unsigned short program)
Add an instrument.
int DeleteInstrument(int instrumentID, std::vector< int > &sampleIDs)
Delete an instrument.
Bank & GetBank()
Report the header.
Definition BankWin.h:169
int Save(const String &filename, bool forceAudioData)
Write the bank file, and the audio data file when the samples changed or it is requested.
friend class CSyntheditCtrl
Definition BankWin.h:192
String & GetFilename()
Report the path of the bank file.
Definition BankWin.h:160
int GetID() const
Report the identifier.
Definition BankWin.h:131
int Load()
Replace the contents with those of the bank file.
void GetSampleUsers(std::vector< String > &names, std::vector< int > &sampleDescIDs, int sampleID)
List the sample descriptions that play a sample.
An instrument bank: its header, programs, sample descriptors, and samples, and where its waveforms si...
Definition bank.h:17
Growable text buffer that is also a PrnStream.
Definition string.h:19
unsigned int size() const
Definition Str.h:226