--- libgig/trunk/src/gig.h 2007/09/30 18:13:33 1358
+++ libgig/trunk/src/gig.h 2008/01/06 10:53:53 1627
@@ -323,35 +323,6 @@
progress_t();
};
- /** @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;
- }
- };
-
// just symbol prototyping
class File;
class Instrument;
@@ -607,7 +578,7 @@
unsigned long FileNo; ///< File number (> 0 when sample is stored in an extension file, 0 when it's in the gig)
RIFF::Chunk* pCk3gix;
RIFF::Chunk* pCkSmpl;
- CRC crc; ///< CRC-32 checksum of the raw sample data
+ uint32_t crc; ///< CRC-32 checksum of the raw sample data
Sample(File* pFile, RIFF::List* waveList, unsigned long WavePoolOffset, unsigned long fileNo = 0);
~Sample();
@@ -668,6 +639,32 @@
friend class Instrument;
};
+ /** Abstract base class for all MIDI rules. */
+ class MidiRule {
+ public:
+ virtual ~MidiRule() { }
+ };
+
+ /** MIDI rule for triggering notes by control change events. */
+ class MidiRuleCtrlTrigger : public MidiRule {
+ public:
+ uint8_t ControllerNumber; ///< MIDI controller number.
+ uint8_t Triggers; ///< Number of triggers.
+ struct trigger_t {
+ uint8_t TriggerPoint; ///< The CC value to pass for the note to be triggered.
+ bool Descending; ///< If the change in CC value should be downwards.
+ uint8_t VelSensitivity; ///< How sensitive the velocity should be to the speed of the controller change.
+ uint8_t Key; ///< Key to trigger.
+ bool NoteOff; ///< If a note off should be triggered instead of a note on.
+ uint8_t Velocity; ///< Velocity of the note to trigger. 255 means that velocity should depend on the speed of the controller change.
+ bool OverridePedal; ///< If a note off should be triggered even if the sustain pedal is down.
+ } pTriggers[32];
+
+ protected:
+ MidiRuleCtrlTrigger(RIFF::Chunk* _3ewg);
+ friend class Instrument;
+ };
+
/** Provides all neccessary information for the synthesis of an Instrument. */
class Instrument : protected DLS::Instrument {
public:
@@ -700,6 +697,8 @@
virtual void UpdateChunks();
// own methods
Region* GetRegion(unsigned int Key);
+ MidiRule* GetFirstMidiRule();
+ MidiRule* GetNextMidiRule();
protected:
Region* RegionKeyTable[128]; ///< fast lookup for the corresponding Region of a MIDI key
@@ -708,6 +707,9 @@
void UpdateRegionKeyTable();
friend class File;
friend class Region; // so Region can call UpdateRegionKeyTable()
+ private:
+ std::list MidiRules;
+ std::list::iterator MidiRulesIterator;
};
/** @brief Group of Gigasampler objects
@@ -778,6 +780,8 @@
Group* AddGroup();
void DeleteGroup(Group* pGroup);
void DeleteGroupOnly(Group* pGroup);
+ void SetAutoLoad(bool b);
+ bool GetAutoLoad();
virtual ~File();
virtual void UpdateChunks();
protected:
@@ -793,9 +797,9 @@
friend class Sample;
friend class Group; // so Group can access protected member pRIFF
private:
- static const DLS::Info::FixedStringLength FixedStringLengths[];
std::list* pGroups;
std::list::iterator GroupsIterator;
+ bool bAutoLoad;
};
/**