--- libgig/trunk/src/gig.h 2007/10/14 12:06:32 1416 +++ libgig/trunk/src/gig.h 2010/01/10 12:58:51 2044 @@ -2,7 +2,7 @@ * * * libgig - C++ cross-platform Gigasampler format file access library * * * - * Copyright (C) 2003-2007 by Christian Schoenebeck * + * Copyright (C) 2003-2010 by Christian Schoenebeck * * * * * * This library is free software; you can redistribute it and/or modify * @@ -31,7 +31,6 @@ # define LIST_TYPE_3EWL 0x3365776C # define LIST_TYPE_3GRI 0x33677269 # define LIST_TYPE_3GNL 0x33676E6C -# define CHUNK_ID_SMPL 0x736D706C # define CHUNK_ID_3GIX 0x33676978 # define CHUNK_ID_3EWA 0x33657761 # define CHUNK_ID_3LNK 0x336C6E6B @@ -45,7 +44,6 @@ # define LIST_TYPE_3EWL 0x6C776533 # define LIST_TYPE_3GRI 0x69726733 # define LIST_TYPE_3GNL 0x6C6E6733 -# define CHUNK_ID_SMPL 0x6C706D73 # define CHUNK_ID_3GIX 0x78696733 # define CHUNK_ID_3EWA 0x61776533 # define CHUNK_ID_3LNK 0x6B6E6C33 @@ -639,6 +637,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: @@ -671,6 +695,7 @@ virtual void UpdateChunks(); // own methods Region* GetRegion(unsigned int Key); + MidiRule* GetMidiRule(int i); protected: Region* RegionKeyTable[128]; ///< fast lookup for the corresponding Region of a MIDI key @@ -679,6 +704,8 @@ void UpdateRegionKeyTable(); friend class File; friend class Region; // so Region can call UpdateRegionKeyTable() + private: + MidiRule** pMidiRules; }; /** @brief Group of Gigasampler objects @@ -749,6 +776,8 @@ Group* AddGroup(); void DeleteGroup(Group* pGroup); void DeleteGroupOnly(Group* pGroup); + void SetAutoLoad(bool b); + bool GetAutoLoad(); virtual ~File(); virtual void UpdateChunks(); protected: @@ -766,6 +795,7 @@ private: std::list* pGroups; std::list::iterator GroupsIterator; + bool bAutoLoad; }; /**