31 #define RIFF_ID(x) (*((uint32_t*) x)) 34 #define RIFF_TYPE_SF2 RIFF_ID("sfbk") 37 #define LIST_TYPE_SDTA RIFF_ID("sdta") 38 #define LIST_TYPE_PDTA RIFF_ID("pdta") 42 #define CHUNK_ID_IFIL RIFF_ID("ifil") 43 #define CHUNK_ID_ISNG RIFF_ID("isng") 44 #define CHUNK_ID_IROM RIFF_ID("irom") 45 #define CHUNK_ID_IVER RIFF_ID("iver") 48 #define CHUNK_ID_SM24 RIFF_ID("sm24") 51 #define CHUNK_ID_PHDR RIFF_ID("phdr") 52 #define CHUNK_ID_PBAG RIFF_ID("pbag") 53 #define CHUNK_ID_PMOD RIFF_ID("pmod") 54 #define CHUNK_ID_PGEN RIFF_ID("pgen") 55 #define CHUNK_ID_INST RIFF_ID("inst") 56 #define CHUNK_ID_IBAG RIFF_ID("ibag") 57 #define CHUNK_ID_IMOD RIFF_ID("imod") 58 #define CHUNK_ID_IGEN RIFF_ID("igen") 59 #define CHUNK_ID_SHDR RIFF_ID("shdr") 64 static uint NONE = 0x1ffffff;
68 double ToHz(
int cents);
186 NOTE_ON_VELOCITY = 2,
187 NOTE_ON_KEY_NUMBER = 3,
189 CHANNEL_PRESSURE = 13,
191 PITCH_WHEEL_SENSITIVITY = 16,
270 ROM_MONO_SAMPLE = 0x8001,
271 ROM_RIGHT_SAMPLE = 0x8002,
272 ROM_LEFT_SAMPLE = 0x8004,
273 ROM_LINKED_SAMPLE = 0x8008
292 NullExtensionSize = 0;
301 int GetChannelCount();
302 long GetTotalFrameCount();
308 buffer_t LoadSampleData(
unsigned long SampleCount);
309 buffer_t LoadSampleDataWithNullSamplesExtension(uint NullSamplesCount);
310 buffer_t LoadSampleDataWithNullSamplesExtension(
unsigned long SampleCount, uint NullSamplesCount);
312 void ReleaseSampleData();
313 unsigned long SetPos(
unsigned long SampleCount);
314 unsigned long GetPos();
315 unsigned long Read(
void* pBuffer,
unsigned long SampleCount);
316 unsigned long ReadNoClear(
void* pBuffer,
unsigned long SampleCount,
buffer_t& tempBuffer);
318 unsigned long ReadAndLoop (
320 unsigned long FrameCount,
364 int modLfoToVolume , freqModLfo ;
368 int initialFilterFc , initialFilterQ ;
394 int GetPan(
Region* pPresetRegion = NULL);
395 int GetFineTune(
Region* pPresetRegion = NULL);
396 int GetCoarseTune(
Region* pPresetRegion = NULL);
397 double GetEG1PreAttackDelay(
Region* pPresetRegion = NULL);
398 double GetEG1Attack(
Region* pPresetRegion = NULL);
399 double GetEG1Hold(
Region* pPresetRegion = NULL);
400 double GetEG1Decay(
Region* pPresetRegion = NULL);
401 int GetEG1Sustain(
Region* pPresetRegion = NULL);
402 double GetEG1Release(
Region* pPresetRegion = NULL);
404 double GetEG2PreAttackDelay(
Region* pPresetRegion = NULL);
405 double GetEG2Attack(
Region* pPresetRegion = NULL);
406 double GetEG2Hold(
Region* pPresetRegion = NULL);
407 double GetEG2Decay(
Region* pPresetRegion = NULL);
408 int GetEG2Sustain(
Region* pPresetRegion = NULL);
409 double GetEG2Release(
Region* pPresetRegion = NULL);
411 int GetModEnvToPitch(
Region* pPresetRegion = NULL);
412 int GetModLfoToPitch(
Region* pPresetRegion = NULL);
413 int GetModEnvToFilterFc(
Region* pPresetRegion = NULL);
414 int GetModLfoToFilterFc(
Region* pPresetRegion = NULL);
415 double GetModLfoToVolume(
Region* pPresetRegion = NULL);
416 double GetFreqModLfo(
Region* pPresetRegion = NULL);
417 double GetDelayModLfo(
Region* pPresetRegion = NULL);
418 int GetVibLfoToPitch(
Region* pPresetRegion = NULL);
419 double GetFreqVibLfo(
Region* pPresetRegion = NULL);
420 double GetDelayVibLfo(
Region* pPresetRegion = NULL);
421 int GetInitialFilterFc(
Region* pPresetRegion);
422 int GetInitialFilterQ(
Region* pPresetRegion);
428 int EG1PreAttackDelay;
435 int EG2PreAttackDelay;
459 int GetRegionCount();
460 Region* GetRegion(
int idx);
485 void DeleteRegion(
Region* pRegion);
492 void LoadRegions(
int idx1,
int idx2);
515 void LoadRegions(
int idx1,
int idx2);
527 int GetPresetCount();
528 Preset* GetPreset(
int idx);
529 int GetInstrumentCount();
531 void DeleteInstrument(
Instrument* pInstrument);
532 int GetSampleCount();
533 Sample* GetSample(
int idx);
534 void DeleteSample(
Sample* pSample);
551 std::vector<Preset*> Presets;
552 std::vector<Instrument*> Instruments;
553 std::vector<Sample*> Samples;
560 #endif // __SF2_SF_H__
String Software
[<ISFT-ck>] ; The SoundFont tools used to create and alter the bank
struct sf2::_RangesType RangesType
String RomName
[<irom-ck>] ; Refers to the Sound ROM Name
String libraryVersion()
Returns version of this C++ library.
struct sf2::_InstBag InstBag
double ToRatio(int Centibels)
String libraryName()
Returns the name of this C++ library.
unsigned long position
Current position within the sample.
struct sf2::_ModList ModList
String Copyright
[<ICOP-ck>] ; Contains any Copyright message
void LoadString(RIFF::Chunk *ck, std::string &s, int strLength)
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...
std::vector< Region * > regions
Reflects the current playback state for a sample.
unsigned long loop_cycles_left
How many times the loop has still to be passed, this value will be decremented with each loop cycle...
Exception(String Message)
Version * pRomVer
[<iver-ck>] ; Refers to the Sound ROM Version
union sf2::_GenAmountType GenAmountType
std::vector< GenList > PresetGenLists
std::vector< InstBag > InstBags
std::vector< ModulatorItem > modulators
std::vector< ModList > PresetModLists
void * pStart
Points to the beginning of the buffer.
std::vector< ModList > InstModLists
Version * pVer
<ifil-ck> ; Refers to the version of the Sound Font RIFF file
struct sf2::_PresetBag PresetBag
buffer_t RAMCache
Buffers samples (already uncompressed) in RAM.
Pointer address and size of a buffer.
String CreationDate
[<ICRD-ck>] ; Refers to the Date of Creation of the Bank
struct sf2::_GenList GenList
RIFF specific classes and definitions.
double ToSeconds(int Timecents)
Instrument * GetParentInstrument()
SFModulator ModAmtSrcOper
Will be thrown whenever an error occurs while handling a RIFF file.
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
unsigned long Size
Size of the actual data in the buffer in bytes.
std::vector< GenList > InstGenLists
bool reverse
If playback direction is currently backwards (in case there is a pingpong or reverse loop defined)...
String BankName
<INAM-ck> ; Refers to the Sound Font Bank Name