74 |
#define CHUNK_ID_IGEN RIFF_ID("igen") |
#define CHUNK_ID_IGEN RIFF_ID("igen") |
75 |
#define CHUNK_ID_SHDR RIFF_ID("shdr") |
#define CHUNK_ID_SHDR RIFF_ID("shdr") |
76 |
|
|
|
#define NONE 0x1ffffff |
|
|
|
|
77 |
/** SoundFont specific classes and definitions */ |
/** SoundFont specific classes and definitions */ |
78 |
namespace sf2 { |
namespace sf2 { |
79 |
|
|
80 |
|
static uint NONE = 0x1ffffff; |
81 |
|
|
82 |
typedef struct _PresetBag { |
typedef struct _PresetBag { |
83 |
uint16_t GenNdx; |
uint16_t GenNdx; |
84 |
uint16_t ModNdx; |
uint16_t ModNdx; |
366 |
int startAddrsOffset, startAddrsCoarseOffset, endAddrsOffset, endAddrsCoarseOffset; |
int startAddrsOffset, startAddrsCoarseOffset, endAddrsOffset, endAddrsCoarseOffset; |
367 |
int startloopAddrsOffset, startloopAddrsCoarseOffset, endloopAddrsOffset, endloopAddrsCoarseOffset; |
int startloopAddrsOffset, startloopAddrsCoarseOffset, endloopAddrsOffset, endloopAddrsCoarseOffset; |
368 |
|
|
369 |
double EG1PreAttackDelay; |
int modEnvToPitch, modLfoToPitch, modEnvToFilterFc, modLfoToFilterFc, modLfoToVolume, freqModLfo; |
370 |
double EG1Attack; |
double delayModLfo; |
371 |
double EG1Hold; |
int vibLfoToPitch, freqVibLfo; |
372 |
double EG1Decay; |
double delayVibLfo; |
|
double EG1Sustain; // Sustain value of the sample amplitude EG (in permilles) |
|
|
double EG1Release; |
|
373 |
|
|
374 |
double EG2PreAttackDelay; |
uint exclusiveClass; // exclusive group |
|
double EG2Attack; |
|
|
double EG2Hold; |
|
|
double EG2Decay; |
|
|
double EG2Sustain; // Sustain value of the filter cutoff EG (in permilles) |
|
|
double EG2Release; |
|
375 |
|
|
376 |
Sample* pSample; |
Sample* pSample; |
377 |
bool HasLoop; |
bool HasLoop; |
385 |
|
|
386 |
int GetUnityNote(); |
int GetUnityNote(); |
387 |
|
|
388 |
|
/** |
389 |
|
* @returns The instrument to which this region belongs, or |
390 |
|
* NULL if it's preset region. |
391 |
|
*/ |
392 |
|
Instrument* GetParentInstrument() { return pParentInstrument; } |
393 |
|
|
394 |
std::vector<ModulatorItem> modulators; |
std::vector<ModulatorItem> modulators; |
395 |
|
|
396 |
|
|
397 |
|
// Instrument can be referenced by more than one presets so we need to calculate values on the fly |
398 |
|
int GetPan(Region* pPresetRegion = NULL); // -64 - +63 |
399 |
|
int GetFineTune(Region* pPresetRegion = NULL); // -99 - +99 |
400 |
|
int GetCoarseTune(Region* pPresetRegion = NULL); // -120 - +120 |
401 |
|
double GetEG1PreAttackDelay(Region* pPresetRegion = NULL); // in seconds |
402 |
|
double GetEG1Attack(Region* pPresetRegion = NULL); // in seconds |
403 |
|
double GetEG1Hold(Region* pPresetRegion = NULL); // in seconds |
404 |
|
double GetEG1Decay(Region* pPresetRegion = NULL); // in seconds |
405 |
|
double GetEG1Sustain(Region* pPresetRegion = NULL); // Sustain value of the sample amplitude EG (in permilles) |
406 |
|
double GetEG1Release(Region* pPresetRegion = NULL); // in seconds |
407 |
|
|
408 |
|
double GetEG2PreAttackDelay(Region* pPresetRegion = NULL); // in seconds |
409 |
|
double GetEG2Attack(Region* pPresetRegion = NULL); // in seconds |
410 |
|
double GetEG2Hold(Region* pPresetRegion = NULL); // in seconds |
411 |
|
double GetEG2Decay(Region* pPresetRegion = NULL); // in seconds |
412 |
|
double GetEG2Sustain(Region* pPresetRegion = NULL); // Sustain value of the filter cutoff EG (in permilles) |
413 |
|
double GetEG2Release(Region* pPresetRegion = NULL); // in seconds |
414 |
|
|
415 |
|
int GetModEnvToPitch(Region* pPresetRegion = NULL); |
416 |
|
int GetModLfoToPitch(Region* pPresetRegion = NULL); |
417 |
|
int GetModEnvToFilterFc(Region* pPresetRegion = NULL); |
418 |
|
int GetModLfoToFilterFc(Region* pPresetRegion = NULL); |
419 |
|
double GetModLfoToVolume(Region* pPresetRegion = NULL); // in permilles |
420 |
|
double GetFreqModLfo(Region* pPresetRegion = NULL); // in Hz |
421 |
|
double GetDelayModLfo(Region* pPresetRegion = NULL); // in seconds |
422 |
|
int GetVibLfoToPitch(Region* pPresetRegion = NULL); |
423 |
|
double GetFreqVibLfo(Region* pPresetRegion = NULL); // in Hz |
424 |
|
double GetDelayVibLfo(Region* pPresetRegion = NULL); // in seconds |
425 |
|
|
426 |
friend class Instrument; |
friend class Instrument; |
427 |
friend class Preset; |
friend class Preset; |
428 |
|
|
429 |
private: |
private: |
430 |
|
double EG1PreAttackDelay; // in timecents |
431 |
|
double EG1Attack; // in timecents |
432 |
|
double EG1Hold; // in timecents |
433 |
|
double EG1Decay; // in timecents |
434 |
|
double EG1Sustain; // Sustain value of the sample amplitude EG (in permilles) |
435 |
|
double EG1Release; // in timecents |
436 |
|
|
437 |
|
double EG2PreAttackDelay; // in timecents |
438 |
|
double EG2Attack; // in timecents |
439 |
|
double EG2Hold; // in timecents |
440 |
|
double EG2Decay; // in timecents |
441 |
|
double EG2Sustain; // Sustain value of the filter cutoff EG (in permilles) |
442 |
|
double EG2Release; // in timecents |
443 |
|
|
444 |
|
Instrument* pParentInstrument; |
445 |
|
|
446 |
void SetGenerator(sf2::File* pFile, GenList& Gen); |
void SetGenerator(sf2::File* pFile, GenList& Gen); |
447 |
void SetModulator(sf2::File* pFile, ModList& Mod); |
void SetModulator(sf2::File* pFile, ModList& Mod); |
448 |
}; |
}; |
504 |
* Load all regions (zones, bags) in the range idx1 - idx2 |
* Load all regions (zones, bags) in the range idx1 - idx2 |
505 |
*/ |
*/ |
506 |
void LoadRegions(int idx1, int idx2); |
void LoadRegions(int idx1, int idx2); |
507 |
|
|
508 |
|
Region* CreateRegion(); |
509 |
}; |
}; |
510 |
|
|
511 |
class File { |
class File { |