--- libgig/trunk/src/gig.h 2018/01/30 20:17:12 3414 +++ libgig/trunk/src/gig.h 2019/02/25 17:10:09 3486 @@ -414,6 +414,28 @@ void serialize(Serialization::Archive* archive); }; + /** @brief Defines behaviour of release triggered sample(s) on sustain pedal up event. + * + * This option defines whether a sustain pedal up event (CC#64) would cause + * release triggered samples to be played (if any). + * + * @b Note: This option is an extension to the original gig file format, + * so this option is not available with the original Gigasampler/GigaStudio + * software! Currently only LinuxSampler and gigedit support this option! + * + * By default (which equals the original Gigasampler/GigaStudio behaviour) + * no release triggered samples are played if the sustain pedal is released. + * So usually in the gig format release triggered samples are only played + * on MIDI note-off events. + * + * @see enumCount(), enumKey(), enumKeys(), enumValue() + */ + GIG_DECLARE_ENUM(sust_rel_trg_t, + sust_rel_trg_none = 0x00, /**< No release triggered sample(s) are played on sustain pedal up (default). */ + sust_rel_trg_maxvelocity = 0x01, /**< Play release trigger sample(s) on sustain pedal up, and simply use 127 as MIDI velocity for playback. */ + sust_rel_trg_keyvelocity = 0x02 /**< Play release trigger sample(s) on sustain pedal up, and use the key`s last MIDI note-on velocity for playback. */ + ); + // just symbol prototyping class File; class Instrument; @@ -554,6 +576,8 @@ uint8_t DimensionUpperLimits[8]; ///< gig3: defines the upper limit of the dimension values for this dimension region. In case you wondered why this is defined on DimensionRegion level and not on Region level: the zone sizes (upper limits) of the velocity dimension can indeed differ in the individual dimension regions, depending on which zones of the other dimension types are currently selected. So this is exceptional for the velocity dimension only. All other dimension types have the same dimension zone sizes for every single DimensionRegion (of the sample Region). eg_opt_t EG1Options; ///< [gig extension]: Behavior options which should be used for envelope generator 1 (volume amplitude EG). eg_opt_t EG2Options; ///< [gig extension]: Behavior options which should be used for envelope generator 2 (filter cutoff EG). + sust_rel_trg_t SustainReleaseTrigger; ///< [gig extension]: Whether a sustain pedal up event shall play release trigger sample. + bool NoNoteOffReleaseTrigger; ///< [gig extension]: If @c true then don't play a release trigger sample on MIDI note-off events. // derived attributes from DLS::Sampler using DLS::Sampler::UnityNote; @@ -580,8 +604,8 @@ using DLS::Sampler::AddSampleLoop; using DLS::Sampler::DeleteSampleLoop; // overridden methods - virtual void SetGain(int32_t gain); - virtual void UpdateChunks(progress_t* pProgress); + virtual void SetGain(int32_t gain) OVERRIDE; + virtual void UpdateChunks(progress_t* pProgress) OVERRIDE; virtual void CopyAssign(const DimensionRegion* orig); protected: uint8_t* VelocityTable; ///< For velocity dimensions with custom defined zone ranges only: used for fast converting from velocity MIDI value to dimension bit number. @@ -773,7 +797,7 @@ file_offset_t ReadAndLoop(void* pBuffer, file_offset_t SampleCount, playback_state_t* pPlaybackState, DimensionRegion* pDimRgn, buffer_t* pExternalDecompressionBuffer = NULL); file_offset_t Write(void* pBuffer, file_offset_t SampleCount); Group* GetGroup() const; - virtual void UpdateChunks(progress_t* pProgress); + virtual void UpdateChunks(progress_t* pProgress) OVERRIDE; void CopyAssignMeta(const Sample* orig); void CopyAssignWave(const Sample* orig); uint32_t GetWaveDataCRC32Checksum(); @@ -867,8 +891,8 @@ void SplitDimensionZone(dimension_t type, int zone); void SetDimensionType(dimension_t oldType, dimension_t newType); // overridden methods - virtual void SetKeyRange(uint16_t Low, uint16_t High); - virtual void UpdateChunks(progress_t* pProgress); + virtual void SetKeyRange(uint16_t Low, uint16_t High) OVERRIDE; + virtual void UpdateChunks(progress_t* pProgress) OVERRIDE; virtual void CopyAssign(const Region* orig); protected: Region(Instrument* pInstrument, RIFF::List* rgnList); @@ -961,7 +985,7 @@ protected: MidiRuleCtrlTrigger(RIFF::Chunk* _3ewg); MidiRuleCtrlTrigger(); - void UpdateChunks(uint8_t* pData) const; + void UpdateChunks(uint8_t* pData) const OVERRIDE; friend class Instrument; }; @@ -1001,7 +1025,7 @@ protected: MidiRuleLegato(RIFF::Chunk* _3ewg); MidiRuleLegato(); - void UpdateChunks(uint8_t* pData) const; + void UpdateChunks(uint8_t* pData) const OVERRIDE; friend class Instrument; }; @@ -1053,7 +1077,7 @@ protected: MidiRuleAlternator(RIFF::Chunk* _3ewg); MidiRuleAlternator(); - void UpdateChunks(uint8_t* pData) const; + void UpdateChunks(uint8_t* pData) const OVERRIDE; friend class Instrument; }; @@ -1073,7 +1097,7 @@ class MidiRuleUnknown : public MidiRule { protected: MidiRuleUnknown() { } - void UpdateChunks(uint8_t* pData) const { } + void UpdateChunks(uint8_t* pData) const OVERRIDE { } friend class Instrument; }; @@ -1097,7 +1121,7 @@ * - NKSP Reference Manual * - Using Instrument Scripts with Gigedit */ - class Script { + class Script : protected DLS::Storage { public: enum Encoding_t { ENCODING_ASCII = 0 ///< Standard 8 bit US ASCII character encoding (default). @@ -1123,7 +1147,8 @@ protected: Script(ScriptGroup* group, RIFF::Chunk* ckScri); virtual ~Script(); - void UpdateChunks(progress_t* pProgress); + void UpdateChunks(progress_t* pProgress) OVERRIDE; + void DeleteChunks() OVERRIDE; void RemoveAllScriptReferences(); friend class ScriptGroup; friend class Instrument; @@ -1145,7 +1170,7 @@ * not available in the GigaStudio 4 software. It is currently only * supported by LinuxSampler and gigedit. */ - class ScriptGroup { + class ScriptGroup : protected DLS::Storage { public: String Name; ///< Name of this script group. For example to be displayed in an instrument editor. @@ -1156,7 +1181,8 @@ ScriptGroup(File* file, RIFF::List* lstRTIS); virtual ~ScriptGroup(); void LoadScripts(); - void UpdateChunks(progress_t* pProgress); + virtual void UpdateChunks(progress_t* pProgress) OVERRIDE; + virtual void DeleteChunks() OVERRIDE; friend class Script; friend class File; private: @@ -1209,7 +1235,7 @@ Region* AddRegion(); void DeleteRegion(Region* pRegion); void MoveTo(Instrument* dst); - virtual void UpdateChunks(progress_t* pProgress); + virtual void UpdateChunks(progress_t* pProgress) OVERRIDE; virtual void CopyAssign(const Instrument* orig); // own methods Region* GetRegion(unsigned int Key); @@ -1263,7 +1289,7 @@ * there is always at least one Group in a .gig file, no matter if you * created one yet or not. */ - class Group { + class Group : public DLS::Storage { public: String Name; ///< Stores the name of this Group. @@ -1273,7 +1299,8 @@ protected: Group(File* file, RIFF::Chunk* ck3gnm); virtual ~Group(); - virtual void UpdateChunks(progress_t* pProgress); + virtual void UpdateChunks(progress_t* pProgress) OVERRIDE; + virtual void DeleteChunks() OVERRIDE; void MoveAll(); friend class File; private: @@ -1321,6 +1348,7 @@ public: static const DLS::version_t VERSION_2; static const DLS::version_t VERSION_3; + static const DLS::version_t VERSION_4; // derived attributes from DLS::Resource using DLS::Resource::pInfo; @@ -1335,6 +1363,7 @@ using DLS::File::Save; using DLS::File::GetFileName; using DLS::File::SetFileName; + using DLS::File::GetRiffFile; // overridden methods File(); File(RIFF::File* pRIFF); @@ -1366,13 +1395,13 @@ ScriptGroup* AddScriptGroup(); void DeleteScriptGroup(ScriptGroup* pGroup); virtual ~File(); - virtual void UpdateChunks(progress_t* pProgress); + virtual void UpdateChunks(progress_t* pProgress) OVERRIDE; protected: // overridden protected methods from DLS::File - virtual void LoadSamples(); - virtual void LoadInstruments(); + virtual void LoadSamples() OVERRIDE; + virtual void LoadInstruments() OVERRIDE; virtual void LoadGroups(); - virtual void UpdateFileOffsets(); + virtual void UpdateFileOffsets() OVERRIDE; // own protected methods virtual void LoadSamples(progress_t* pProgress); virtual void LoadInstruments(progress_t* pProgress);