31 #define _1200TH_ROOT_OF_2 1.000577789506555 32 #define _200TH_ROOT_OF_10 1.011579454259899 36 if (Timecents == NONE)
return NONE;
37 if (Timecents == 0)
return 1.0;
38 if (Timecents == -32768)
return 0.0;
43 if (Centibels == NONE)
return NONE;
44 if (Centibels == 0)
return 1.0;
49 if (cents == NONE)
return NONE;
50 if (cents == 0)
return 8.176;
56 if(ck == NULL)
throw Exception(
"Mandatory chunk in RIFF list chunk not found: " + ToString(chunkId));
61 if(ck == NULL)
return;
62 char* buf =
new char[strLength];
64 for(
int i = 0; i < strLength; i++) {
66 if(buf[i] == 0 && !len) len = i;
68 if(!len) len = strLength;
78 if (ck == NULL)
throw Exception(
"NULL chunk");
95 ModAmtSrcOper(
Modulator(mod.ModAmtSrcOper))
166 throw Exception(
"Broken SF2 file (invalid sample info)");
180 default:
throw Exception(
"Broken SF2 file (invalid sample type)");
235 unsigned long FrameCount,
240 unsigned long samplestoread = FrameCount, totalreadsamples = 0, readsamples, samplestoloopend;
241 uint8_t* pDst = (uint8_t*) pBuffer;
246 readsamples =
Read(&pDst[totalreadsamples *
GetFrameSize()], Min(samplestoread, samplestoloopend));
247 samplestoread -= readsamples;
248 totalreadsamples += readsamples;
249 if (readsamples == samplestoloopend) {
252 }
while (samplestoread && readsamples);
254 totalreadsamples =
Read(pBuffer, FrameCount);
259 return totalreadsamples;
265 pParentInstrument = NULL;
276 EG1PreAttackDelay = EG1Attack = EG1Hold = EG1Decay = EG1Release = -12000;
278 EG2PreAttackDelay = EG2Attack = EG2Hold = EG2Decay = EG2Release = -12000;
298 int CheckRange(std::string genName,
int min,
int max,
int& gen) {
299 if (gen == NONE)
return gen;
302 std::cerr <<
"sf2: " << genName;
303 std::cerr <<
" is below the minimum allowed value (min=" << min <<
"): " << gen << std::endl;
307 std::cerr <<
"sf2: " << genName;
308 std::cerr <<
" is above the maximum allowed value (max=" << max <<
"): " << gen << std::endl;
316 switch(Gen.GenOper) {
321 if (Gen.GenAmount.shAmount <= 0) {
324 std::cerr <<
"Ignoring invalid endAddrsOffset" << std::endl;
378 pan = Gen.GenAmount.shAmount;
400 EG2PreAttackDelay = Gen.GenAmount.shAmount;
401 CheckRange(
"delayModEnv", -12000, 5000, EG2PreAttackDelay);
404 EG2Attack = Gen.GenAmount.shAmount;
405 CheckRange(
"attackModEnv", -12000, 8000, EG2Attack);
408 EG2Hold = Gen.GenAmount.shAmount;
409 CheckRange(
"holdModEnv", -12000, 5000, EG2Hold);
412 EG2Decay = Gen.GenAmount.shAmount;
413 CheckRange(
"decayModEnv", -12000, 8000, EG2Decay);
416 EG2Sustain = Gen.GenAmount.shAmount;
417 CheckRange(
"sustainModEnv", 0, 1000, EG2Sustain);
420 EG2Release = Gen.GenAmount.shAmount;
421 CheckRange(
"releaseModEnv", -12000, 8000, EG2Release);
428 EG1PreAttackDelay = Gen.GenAmount.shAmount;
429 CheckRange(
"delayVolEnv", -12000, 5000, EG1PreAttackDelay);
432 EG1Attack = Gen.GenAmount.shAmount;
433 CheckRange(
"attackVolEnv", -12000, 8000, EG1Attack);
436 EG1Hold = Gen.GenAmount.shAmount;
437 CheckRange(
"holdVolEnv", -12000, 5000, EG1Hold);
440 EG1Decay = Gen.GenAmount.shAmount;
441 CheckRange(
"decayVolEnv", -12000, 8000, EG1Decay);
444 EG1Sustain = Gen.GenAmount.shAmount;
445 CheckRange(
"sustainVolEnv", 0, 1440, EG1Sustain);
448 EG1Release = Gen.GenAmount.shAmount;
449 CheckRange(
"releaseVolEnv", -12000, 8000, EG1Release);
456 uint16_t
id = Gen.GenAmount.wAmount;
457 if (
id >= pFile->Instruments.size()) {
458 throw Exception(
"Broken SF2 file (missing instruments)");
464 loKey = Gen.GenAmount.ranges.byLo;
466 hiKey = Gen.GenAmount.ranges.byHi;
470 minVel = Gen.GenAmount.ranges.byLo;
472 maxVel = Gen.GenAmount.ranges.byHi;
498 uint16_t sid = Gen.GenAmount.wAmount;
499 if (sid >= pFile->Samples.size()) {
500 throw Exception(
"Broken SF2 file (missing samples)");
509 throw Exception(
"Broken SF2 file (invalid loops)");
517 HasLoop = Gen.GenAmount.wAmount & 1;
557 if (pPresetRegion == NULL)
return pan;
558 int p = pPresetRegion->
pan +
pan;
559 if (p < -64) p = -64;
565 if (pPresetRegion == NULL)
return fineTune;
567 if (t < -99) t = -99;
575 if (t < -120) t = -120;
576 if (t > 120) t = 120;
581 int val = (pPresetRegion == NULL || pPresetRegion->EG1PreAttackDelay == NONE) ?
582 EG1PreAttackDelay : pPresetRegion->EG1PreAttackDelay + EG1PreAttackDelay;
587 int val = (pPresetRegion == NULL || pPresetRegion->EG1Attack == NONE) ?
588 EG1Attack : pPresetRegion->EG1Attack + EG1Attack;
593 int val = (pPresetRegion == NULL || pPresetRegion->EG1Hold == NONE) ?
594 EG1Hold : pPresetRegion->EG1Hold + EG1Hold;
599 int val = (pPresetRegion == NULL || pPresetRegion->EG1Decay == NONE) ?
600 EG1Decay : pPresetRegion->EG1Decay + EG1Decay;
605 int val = (pPresetRegion == NULL || pPresetRegion->EG1Sustain == NONE) ?
606 EG1Sustain : pPresetRegion->EG1Sustain + EG1Sustain;
607 return CheckRange(
"GetEG1Sustain()", 0, 1440, val);
611 int val = (pPresetRegion == NULL || pPresetRegion->EG1Release == NONE) ?
612 EG1Release : pPresetRegion->EG1Release + EG1Release;
617 int val = (pPresetRegion == NULL || pPresetRegion->EG2PreAttackDelay == NONE) ?
618 EG2PreAttackDelay : pPresetRegion->EG2PreAttackDelay + EG2PreAttackDelay;
623 int val = (pPresetRegion == NULL || pPresetRegion->EG2Attack == NONE) ?
624 EG2Attack : pPresetRegion->EG2Attack + EG2Attack;
629 int val = (pPresetRegion == NULL || pPresetRegion->EG2Hold == NONE) ?
630 EG2Hold : pPresetRegion->EG2Hold + EG2Hold;
635 int val = (pPresetRegion == NULL || pPresetRegion->EG2Decay == NONE) ?
636 EG2Decay : pPresetRegion->EG2Decay + EG2Decay;
641 int val = (pPresetRegion == NULL || pPresetRegion->EG2Sustain == NONE) ?
642 EG2Sustain : pPresetRegion->EG2Sustain + EG2Sustain;
643 return CheckRange(
"GetEG2Sustain()", 0, 1000, val);
647 int val = (pPresetRegion == NULL || pPresetRegion->EG2Release == NONE) ?
648 EG2Release : pPresetRegion->EG2Release + EG2Release;
653 int val = (pPresetRegion == NULL || pPresetRegion->
modEnvToPitch == NONE) ?
655 return CheckRange(
"GetModEnvToPitch()", -12000, 12000, val);
659 int val = (pPresetRegion == NULL || pPresetRegion->
modLfoToPitch == NONE) ?
661 return CheckRange(
"GetModLfoToPitch()", -12000, 12000, val);
665 int val = (pPresetRegion == NULL || pPresetRegion->
modEnvToFilterFc == NONE) ?
667 return CheckRange(
"GetModEnvToFilterFc()", -12000, +12000, val);
671 int val = (pPresetRegion == NULL || pPresetRegion->
modLfoToFilterFc == NONE) ?
673 return CheckRange(
"GetModLfoToFilterFc()", -12000, +12000, val);
677 int val = (pPresetRegion == NULL || pPresetRegion->
modLfoToVolume == NONE) ?
679 return CheckRange(
"GetModLfoToVolume()", -960, 960, val);
683 int val = (pPresetRegion == NULL || pPresetRegion->
freqModLfo == NONE) ?
689 int val = (pPresetRegion == NULL || pPresetRegion->
delayModLfo == NONE) ?
695 int val = (pPresetRegion == NULL || pPresetRegion->
vibLfoToPitch == NONE) ?
697 return CheckRange(
"GetVibLfoToPitch()", -12000, 12000, val);
701 int val = (pPresetRegion == NULL || pPresetRegion->
freqVibLfo == NONE) ?
707 int val = (pPresetRegion == NULL || pPresetRegion->
delayVibLfo == NONE) ?
715 return CheckRange(
"GetInitialFilterFc()", 1500, 13500, val);
719 int val = (pPresetRegion == NULL || pPresetRegion->
initialFilterQ == NONE) ?
721 return CheckRange(
"GetInitialFilterQ()", 0, 960, val);
731 for (
int i =
regions.size() - 1; i >= 0; i--) {
742 throw Exception(
"Region index out of bounds");
755 if (((r->
loKey == NONE && r->
hiKey == NONE) || (
key >= r->
loKey && key <= r->hiKey)) &&
774 r->pParentInstrument =
this;
832 for (
int i = 0; i <
regions.size(); i++) {
840 std::cerr <<
"Can't remove unknown Region" << std::endl;
844 for (
int i = idx1; i < idx2; i++) {
848 if (gIdx1 < 0 || gIdx2 < 0 || gIdx1 > gIdx2 || gIdx2 >=
pFile->
InstGenLists.size()) {
849 throw Exception(
"Broken SF2 file (invalid InstGenNdx)");
855 if (mIdx1 < 0 || mIdx2 < 0 || mIdx1 > mIdx2 || mIdx2 >=
pFile->
InstModLists.size()) {
856 throw Exception(
"Broken SF2 file (invalid InstModNdx)");
861 for (
int j = gIdx1; j < gIdx2; j++) {
866 for (
int j = mIdx1; j < mIdx2; j++) {
871 if (i == idx1 && idx2 - idx1 > 1) {
874 std::cerr <<
"Ignoring instrument's region without sample" << std::endl;
900 r->EG1PreAttackDelay = r->EG1Attack = r->EG1Hold = r->EG1Decay = r->EG1Sustain = r->EG1Release = NONE;
901 r->EG2PreAttackDelay = r->EG2Attack = r->EG2Hold = r->EG2Decay = r->EG2Sustain = r->EG2Release = NONE;
942 for (
int i = idx1; i < idx2; i++) {
947 throw Exception(
"Broken SF2 file (invalid PresetGenNdx)");
952 for (
int j = gIdx1; j < gIdx2; j++) {
956 if (i == idx1 && idx2 - idx1 > 1) {
959 std::cerr <<
"Ignoring preset's region without instrument" << std::endl;
978 if (!
pRIFF)
throw Exception(
"NULL pointer reference to RIFF::File object.");
991 if (lstSDTA == NULL) {
992 throw Exception(
"Broken SF2 file (missing sdta)");
997 if (pCkSmpl != NULL && pCkSm24 != NULL) {
998 long l = pCkSmpl->
GetSize() / 2;
1000 if (pCkSm24->
GetSize() != l) {
1006 if (lstPDTA == NULL) {
1007 throw Exception(
"Broken SF2 file (missing pdta)");
1012 throw Exception(
"Broken SF2 file (broken phdr)");
1015 int count = ck->
GetSize() / 38;
1016 for (
int i = 0; i < count; i++) {
1017 Presets.push_back(
new Preset(
this, ck));
1022 throw Exception(
"Broken SF2 file (broken pbag)");
1026 for (
int i = 0; i < count; i++) {
1036 throw Exception(
"Broken SF2 file (broken pmod)");
1040 for (
int i = 0; i < count; i++) {
1053 throw Exception(
"Broken SF2 file (broken pgen)");
1057 for (
int i = 0; i < count; i++) {
1067 throw Exception(
"Broken SF2 file (broken inst)");
1070 for (
int i = 0; i < count; i++) {
1071 Instruments.push_back(
new Instrument(
this, ck));
1076 throw Exception(
"Broken SF2 file (broken ibag)");
1080 for (
int i = 0; i < count; i++) {
1090 throw Exception(
"Broken SF2 file (broken imod)");
1094 for (
int i = 0; i < count; i++) {
1107 throw Exception(
"Broken SF2 file (broken igen)");
1111 for (
int i = 0; i < count; i++) {
1121 throw Exception(
"Broken SF2 file (broken shdr)");
1124 for (
int i = 0; i < count; i++) {
1125 Samples.push_back(
new Sample(ck, pCkSmpl, pCkSm24));
1129 for (
int i = 0; i < Instruments.size() - 1; i++) {
1132 int x2 = Instruments[i + 1]->InstBagNdx;
1133 if (x1 < 0 || x2 < 0 || x1 > x2 || x2 >=
InstBags.size()) {
1134 throw Exception(
"Broken SF2 file (invalid InstBagNdx)");
1141 for (
int i = 0; i < Presets.size() - 1; i++) {
1142 Preset* preset = Presets[i];
1144 int x2 = Presets[i + 1]->PresetBagNdx;
1145 if (x1 < 0 || x2 < 0 || x1 > x2 || x2 >=
PresetBags.size()) {
1146 throw Exception(
"Broken SF2 file (invalid PresetBagNdx)");
1155 for (
int i = Presets.size() - 1; i >= 0; i--) {
1156 if (Presets[i])
delete (Presets[i]);
1158 for (
int i = Instruments.size() - 1; i >= 0; i--) {
1159 if (Instruments[i])
delete (Instruments[i]);
1161 for (
int i = Samples.size() - 1; i >= 0; i--) {
1162 if (Samples[i])
delete (Samples[i]);
1167 return Presets.size() - 1;
1172 throw Exception(
"Preset index out of bounds");
1175 return Presets[idx];
1179 return Instruments.size() - 1;
1184 throw Exception(
"Instrument index out of bounds");
1187 return Instruments[idx];
1193 if (p == NULL)
continue;
1203 Instruments[i] = NULL;
1210 return Samples.size() - 1;
1215 throw Exception(
"Sample index out of bounds");
1218 return Samples[idx];
1225 if (pInstr == NULL)
continue;
1229 std::cerr <<
"Deleting sample which is still in use" << std::endl;
1236 if (Samples[i] == pSample) {
1248 if (Samples[i] != NULL)
return true;
1343 unsigned long allocationsize = (SampleCount + NullSamplesCount) *
GetFrameSize();
1408 template<
bool CLEAR>
1411 if (SampleCount == 0)
return 0;
1412 long pos = pSample->
GetPos();
1416 if (tempBuffer->Size < SampleCount * pSample->
GetFrameSize()) {
1417 std::cerr <<
"sf2::Sample error: tempBuffer too small. This is a BUG!" << std::endl;
1423 uint8_t*
const pTmpBuf = (uint8_t*) ((CLEAR) ? pBuffer : tempBuffer->pStart);
1424 uint8_t*
const pBuf = (uint8_t*)pBuffer;
1427 pSample->
pCkSm24->
Read(pTmpBuf + SampleCount * 2, SampleCount, 1);
1428 for (
int i = SampleCount - 1; i >= 0; i--) {
1429 pBuf[i*3] = pTmpBuf[(SampleCount * 2) + i];
1430 pBuf[i*3 + 2] = pTmpBuf[i*2 + 1];
1431 pBuf[i*3 + 1] = pTmpBuf[i*2];
1435 pSample->
pCkSm24->
Read(pTmpBuf + SampleCount * 2, SampleCount, 1);
1436 for (
int i = SampleCount - 1; i >= 0; i--) {
1437 pBuf[i*6] = pTmpBuf[(SampleCount * 2) + i];
1438 pBuf[i*6 + 2] = pTmpBuf[i*2 + 1];
1439 pBuf[i*6 + 1] = pTmpBuf[i*2];
1441 pBuf[i*6 + 3] = pBuf[i*6 + 4] = pBuf[i*6 + 5] = 0;
1445 pSample->
pCkSm24->
Read(pTmpBuf + SampleCount * 2, SampleCount, 1);
1446 for (
int i = SampleCount - 1; i >= 0; i--) {
1447 pBuf[i*6 + 3] = pTmpBuf[(SampleCount * 2) + i];
1448 pBuf[i*6 + 5] = pTmpBuf[i*2 + 1];
1449 pBuf[i*6 + 4] = pTmpBuf[i*2];
1451 pBuf[i*6] = pBuf[i*6 + 1] = pBuf[i*6 + 2] = 0;
1456 return pSample->
pCkSmpl->
Read(pBuffer, SampleCount, 2);
1459 int16_t*
const pTmpBuf = (int16_t*) ((CLEAR) ? pBuffer : tempBuffer->pStart);
1460 int16_t*
const pBuf = (int16_t*) pBuffer;
1463 for (
int i = SampleCount - 1; i >= 0; i--) {
1464 pBuf[i*2] = pTmpBuf[i];
1470 for (
int i = SampleCount - 1; i >= 0; i--) {
1473 pBuf[i*2 + 1] = pTmpBuf[i];
1479 std::cerr <<
"Read after the sample end. This is a BUG!" << std::endl;
1480 std::cerr <<
"Current position: " << pSample->
GetPos() << std::endl;
1481 std::cerr <<
"Total number of frames: " << pSample->
GetTotalFrameCount() << std::endl << std::endl;
1510 return ReadSample<true>(
this, pBuffer, SampleCount);
1544 return ReadSample<false>(
this, pBuffer, SampleCount, &tempBuffer);
double GetEG1Release(Region *pPresetRegion=NULL)
int GetVibLfoToPitch(Region *pPresetRegion=NULL)
int GetInitialFilterFc(Region *pPresetRegion)
String Software
[<ISFT-ck>] ; The SoundFont tools used to create and alter the bank
double GetEG1Attack(Region *pPresetRegion=NULL)
unsigned long Read(void *pData, unsigned long WordCount, unsigned long WordSize)
Reads WordCount number of data words with given WordSize and copies it into a buffer pointed by pData...
double GetFreqVibLfo(Region *pPresetRegion=NULL)
void DeleteSample(Sample *pSample)
unsigned long SetPos(unsigned long SampleCount)
Sets the position within the sample (in sample points, not in bytes).
uint32_t GetChunkID()
Chunk ID in unsigned integer representation.
void DeleteRegion(Region *pRegion)
int GetEG2Sustain(Region *pPresetRegion=NULL)
String RomName
[<irom-ck>] ; Refers to the Sound ROM Name
double GetEG2Decay(Region *pPresetRegion=NULL)
String libraryVersion()
Returns version of this C++ library.
double ToRatio(int Centibels)
int startloopAddrsCoarseOffset
Sample(RIFF::Chunk *ck, RIFF::Chunk *pCkSmpl, RIFF::Chunk *pCkSm24)
int GetCoarseTune(Region *pPresetRegion=NULL)
String libraryName()
Returns the name of this C++ library.
unsigned long SetPos(unsigned long Where, stream_whence_t Whence=stream_start)
Sets the position within the chunk body, thus within the data portion of the chunk (in bytes)...
int startAddrsCoarseOffset
int GetModLfoToPitch(Region *pPresetRegion=NULL)
unsigned long position
Current position within the sample.
Modulator(SFModulator mod)
void VerifySize(RIFF::Chunk *ck, int size)
Throws an error if the chunk is NULL or the chunk data size is less than size (in bytes)...
struct sf2::_ModList ModList
List * GetSubList(uint32_t ListType)
Returns sublist chunk with list type ListType within this chunk list.
String Copyright
[<ICOP-ck>] ; Contains any Copyright message
void LoadString(RIFF::Chunk *ck, std::string &s, int strLength)
Query(InstrumentBase &instrument)
String Comments
[<ICMT-ck>] ; Contains any Comments on the Bank
SoundFont specific classes and definitions.
String Product
[<IPRD-ck>] ; Product for which the Bank was intended
unsigned long NullExtensionSize
The buffer might be bigger than the actual data, if that's the case that unused space at the end of t...
buffer_t GetCache()
Returns current cached sample points.
double GetDelayModLfo(Region *pPresetRegion=NULL)
double GetEG2Release(Region *pPresetRegion=NULL)
unsigned long GetPos()
Position within the chunk data body.
std::vector< Region * > regions
Reflects the current playback state for a sample.
RIFF::Chunk * GetMandatoryChunk(RIFF::List *list, uint32_t chunkId)
double GetEG2PreAttackDelay(Region *pPresetRegion=NULL)
double GetModLfoToVolume(Region *pPresetRegion=NULL)
double GetDelayVibLfo(Region *pPresetRegion=NULL)
Version * pRomVer
[<iver-ck>] ; Refers to the Sound ROM Version
double GetEG1Hold(Region *pPresetRegion=NULL)
unsigned long ReadInt32(int32_t *pData, unsigned long WordCount=1)
Reads WordCount number of 32 Bit signed integer words and copies it into the buffer pointed by pData...
void DeleteInstrument(Instrument *pInstrument)
void LoadRegions(int idx1, int idx2)
Load all regions (zones, bags) in the range idx1 - idx2.
Chunk * GetSubChunk(uint32_t ChunkID)
Returns subchunk with chunk ID ChunkID within this chunk list.
void LoadRegions(int idx1, int idx2)
Load all regions (zones, bags) in the range idx1 - idx2.
std::vector< GenList > PresetGenLists
std::vector< InstBag > InstBags
std::vector< ModulatorItem > modulators
buffer_t LoadSampleData()
Loads the whole sample wave into RAM.
Preset * GetPreset(int idx)
unsigned long Read(void *pBuffer, unsigned long SampleCount)
Reads SampleCount number of sample points from the current position into the buffer pointed by pBuffe...
uint32_t GetListType()
Returns unsigned integer representation of the list's ID.
std::vector< ModList > PresetModLists
int endloopAddrsCoarseOffset
double GetEG2Hold(Region *pPresetRegion=NULL)
Preset(sf2::File *pFile, RIFF::Chunk *ck)
#define _200TH_ROOT_OF_10
ModulatorItem(ModList &mod)
unsigned long ReadInt16(int16_t *pData, unsigned long WordCount=1)
Reads WordCount number of 16 Bit signed integer words and copies it into the buffer pointed by pData...
unsigned long GetPos()
Returns the current position in the sample (in sample points).
void * pStart
Points to the beginning of the buffer.
Instrument(sf2::File *pFile, RIFF::Chunk *ck)
std::vector< ModList > InstModLists
buffer_t LoadSampleDataWithNullSamplesExtension(uint NullSamplesCount)
Loads the whole sample wave into RAM.
int GetPan(Region *pPresetRegion=NULL)
int GetFineTune(Region *pPresetRegion=NULL)
Instrument * GetInstrument(int idx)
#define _1200TH_ROOT_OF_2
Version * pVer
<ifil-ck> ; Refers to the version of the Sound Font RIFF file
File(RIFF::File *pRIFF)
Constructor.
double GetEG1PreAttackDelay(Region *pPresetRegion=NULL)
buffer_t RAMCache
Buffers samples (already uncompressed) in RAM.
Pointer address and size of a buffer.
virtual ~InstrumentBase()
String CreationDate
[<ICRD-ck>] ; Refers to the Date of Creation of the Bank
struct sf2::_GenList GenList
int GetInitialFilterQ(Region *pPresetRegion)
unsigned long GetSize() const
Chunk size in bytes (without header, thus the chunk data body)
int GetEG1Sustain(Region *pPresetRegion=NULL)
long GetTotalFrameCount()
double GetEG1Decay(Region *pPresetRegion=NULL)
double ToSeconds(int Timecents)
unsigned long ReadNoClear(void *pBuffer, unsigned long SampleCount, buffer_t &tempBuffer)
Reads SampleCount number of sample points from the current position into the buffer pointed by pBuffe...
SFModulator ModAmtSrcOper
InstrumentBase(sf2::File *pFile)
unsigned long ReadUint16(uint16_t *pData, unsigned long WordCount=1)
Reads WordCount number of 16 Bit unsigned integer words and copies it into the buffer pointed by pDat...
String SoundEngine
<isng-ck> ; Refers to the target Sound Engine
String Engineers
[<IENG-ck>] ; Sound Designers and Engineers for the Bank
std::vector< PresetBag > PresetBags
double GetFreqModLfo(Region *pPresetRegion=NULL)
double GetEG2Attack(Region *pPresetRegion=NULL)
unsigned long Size
Size of the actual data in the buffer in bytes.
Region * GetRegion(int idx)
int GetModEnvToPitch(Region *pPresetRegion=NULL)
int GetModLfoToFilterFc(Region *pPresetRegion=NULL)
unsigned long ReadAndLoop(void *pBuffer, unsigned long FrameCount, PlaybackState *pPlaybackState, Region *pRegion)
Reads SampleCount number of sample points from the position stored in pPlaybackState into the buffer ...
unsigned long ReadSample(Sample *pSample, void *pBuffer, unsigned long SampleCount, Sample::buffer_t *tempBuffer=NULL)
std::vector< GenList > InstGenLists
String BankName
<INAM-ck> ; Refers to the Sound Font Bank Name
Info(RIFF::List *list)
Constructor.
void ReleaseSampleData()
Frees the cached sample from RAM if loaded with LoadSampleData() previously.
int GetModEnvToFilterFc(Region *pPresetRegion=NULL)
Sample * GetSample(int idx)
unsigned long ReadInt8(int8_t *pData, unsigned long WordCount=1)
Reads WordCount number of 8 Bit signed integer words and copies it into the buffer pointed by pData...
int CheckRange(std::string genName, int min, int max, int &gen)