323 |
progress_t(); |
progress_t(); |
324 |
}; |
}; |
325 |
|
|
|
/** @brief CRC-32 checksum implementation |
|
|
* |
|
|
* This class is used to calculate checksums of the sample data in |
|
|
* a gig file. The checksums are stored in the 3crc chunk of the |
|
|
* gig file and automatically updated when a sample is written |
|
|
* with Sample::Write(). |
|
|
*/ |
|
|
class CRC { |
|
|
private: |
|
|
uint32_t value; |
|
|
static const uint32_t* table; |
|
|
static uint32_t* initTable(); |
|
|
public: |
|
|
CRC() { |
|
|
reset(); |
|
|
} |
|
|
void reset() { |
|
|
value = 0xffffffff; |
|
|
} |
|
|
void update(unsigned char* buf, int len) { |
|
|
for (int i = 0 ; i < len ; i++) { |
|
|
value = table[(value ^ buf[i]) & 0xff] ^ (value >> 8); |
|
|
} |
|
|
} |
|
|
uint32_t getValue() { |
|
|
return value ^ 0xffffffff; |
|
|
} |
|
|
}; |
|
|
|
|
326 |
// just symbol prototyping |
// just symbol prototyping |
327 |
class File; |
class File; |
328 |
class Instrument; |
class Instrument; |
578 |
unsigned long FileNo; ///< File number (> 0 when sample is stored in an extension file, 0 when it's in the gig) |
unsigned long FileNo; ///< File number (> 0 when sample is stored in an extension file, 0 when it's in the gig) |
579 |
RIFF::Chunk* pCk3gix; |
RIFF::Chunk* pCk3gix; |
580 |
RIFF::Chunk* pCkSmpl; |
RIFF::Chunk* pCkSmpl; |
581 |
CRC crc; ///< CRC-32 checksum of the raw sample data |
uint32_t crc; ///< CRC-32 checksum of the raw sample data |
582 |
|
|
583 |
Sample(File* pFile, RIFF::List* waveList, unsigned long WavePoolOffset, unsigned long fileNo = 0); |
Sample(File* pFile, RIFF::List* waveList, unsigned long WavePoolOffset, unsigned long fileNo = 0); |
584 |
~Sample(); |
~Sample(); |
639 |
friend class Instrument; |
friend class Instrument; |
640 |
}; |
}; |
641 |
|
|
642 |
|
/** Abstract base class for all MIDI rules. */ |
643 |
|
class MidiRule { |
644 |
|
public: |
645 |
|
virtual ~MidiRule() { } |
646 |
|
}; |
647 |
|
|
648 |
|
/** MIDI rule for triggering notes by control change events. */ |
649 |
|
class MidiRuleCtrlTrigger : public MidiRule { |
650 |
|
public: |
651 |
|
uint8_t ControllerNumber; ///< MIDI controller number. |
652 |
|
uint8_t Triggers; ///< Number of triggers. |
653 |
|
struct trigger_t { |
654 |
|
uint8_t TriggerPoint; ///< The CC value to pass for the note to be triggered. |
655 |
|
bool Descending; ///< If the change in CC value should be downwards. |
656 |
|
uint8_t VelSensitivity; ///< How sensitive the velocity should be to the speed of the controller change. |
657 |
|
uint8_t Key; ///< Key to trigger. |
658 |
|
bool NoteOff; ///< If a note off should be triggered instead of a note on. |
659 |
|
uint8_t Velocity; ///< Velocity of the note to trigger. 255 means that velocity should depend on the speed of the controller change. |
660 |
|
bool OverridePedal; ///< If a note off should be triggered even if the sustain pedal is down. |
661 |
|
} pTriggers[32]; |
662 |
|
|
663 |
|
protected: |
664 |
|
MidiRuleCtrlTrigger(RIFF::Chunk* _3ewg); |
665 |
|
friend class Instrument; |
666 |
|
}; |
667 |
|
|
668 |
/** Provides all neccessary information for the synthesis of an <i>Instrument</i>. */ |
/** Provides all neccessary information for the synthesis of an <i>Instrument</i>. */ |
669 |
class Instrument : protected DLS::Instrument { |
class Instrument : protected DLS::Instrument { |
670 |
public: |
public: |
697 |
virtual void UpdateChunks(); |
virtual void UpdateChunks(); |
698 |
// own methods |
// own methods |
699 |
Region* GetRegion(unsigned int Key); |
Region* GetRegion(unsigned int Key); |
700 |
|
MidiRule* GetMidiRule(int i); |
701 |
protected: |
protected: |
702 |
Region* RegionKeyTable[128]; ///< fast lookup for the corresponding Region of a MIDI key |
Region* RegionKeyTable[128]; ///< fast lookup for the corresponding Region of a MIDI key |
703 |
|
|
706 |
void UpdateRegionKeyTable(); |
void UpdateRegionKeyTable(); |
707 |
friend class File; |
friend class File; |
708 |
friend class Region; // so Region can call UpdateRegionKeyTable() |
friend class Region; // so Region can call UpdateRegionKeyTable() |
709 |
|
private: |
710 |
|
MidiRule** pMidiRules; |
711 |
}; |
}; |
712 |
|
|
713 |
/** @brief Group of Gigasampler objects |
/** @brief Group of Gigasampler objects |
778 |
Group* AddGroup(); |
Group* AddGroup(); |
779 |
void DeleteGroup(Group* pGroup); |
void DeleteGroup(Group* pGroup); |
780 |
void DeleteGroupOnly(Group* pGroup); |
void DeleteGroupOnly(Group* pGroup); |
781 |
|
void SetAutoLoad(bool b); |
782 |
|
bool GetAutoLoad(); |
783 |
virtual ~File(); |
virtual ~File(); |
784 |
virtual void UpdateChunks(); |
virtual void UpdateChunks(); |
785 |
protected: |
protected: |
795 |
friend class Sample; |
friend class Sample; |
796 |
friend class Group; // so Group can access protected member pRIFF |
friend class Group; // so Group can access protected member pRIFF |
797 |
private: |
private: |
|
static const DLS::Info::FixedStringLength FixedStringLengths[]; |
|
798 |
std::list<Group*>* pGroups; |
std::list<Group*>* pGroups; |
799 |
std::list<Group*>::iterator GroupsIterator; |
std::list<Group*>::iterator GroupsIterator; |
800 |
|
bool bAutoLoad; |
801 |
}; |
}; |
802 |
|
|
803 |
/** |
/** |