/[svn]/libgig/trunk/src/gig.h
ViewVC logotype

Diff of /libgig/trunk/src/gig.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3399 by schoenebeck, Sat Dec 9 17:01:40 2017 UTC revision 3486 by schoenebeck, Mon Feb 25 17:10:09 2019 UTC
# Line 2  Line 2 
2   *                                                                         *   *                                                                         *
3   *   libgig - C++ cross-platform Gigasampler format file access library    *   *   libgig - C++ cross-platform Gigasampler format file access library    *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003-2017 by Christian Schoenebeck                      *   *   Copyright (C) 2003-2018 by Christian Schoenebeck                      *
6   *                              <cuse@users.sourceforge.net>               *   *                              <cuse@users.sourceforge.net>               *
7   *                                                                         *   *                                                                         *
8   *   This library is free software; you can redistribute it and/or modify  *   *   This library is free software; you can redistribute it and/or modify  *
# Line 414  namespace gig { Line 414  namespace gig {
414          void serialize(Serialization::Archive* archive);          void serialize(Serialization::Archive* archive);
415      };      };
416    
417        /** @brief Defines behaviour of release triggered sample(s) on sustain pedal up event.
418         *
419         * This option defines whether a sustain pedal up event (CC#64) would cause
420         * release triggered samples to be played (if any).
421         *
422         * @b Note: This option is an extension to the original gig file format,
423         * so this option is not available with the original Gigasampler/GigaStudio
424         * software! Currently only LinuxSampler and gigedit support this option!
425         *
426         * By default (which equals the original Gigasampler/GigaStudio behaviour)
427         * no release triggered samples are played if the sustain pedal is released.
428         * So usually in the gig format release triggered samples are only played
429         * on MIDI note-off events.
430         *
431         * @see enumCount(), enumKey(), enumKeys(), enumValue()
432         */
433        GIG_DECLARE_ENUM(sust_rel_trg_t,
434            sust_rel_trg_none        = 0x00, /**< No release triggered sample(s) are played on sustain pedal up (default). */
435            sust_rel_trg_maxvelocity = 0x01, /**< Play release trigger sample(s) on sustain pedal up, and simply use 127 as MIDI velocity for playback. */
436            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. */
437        );
438    
439      // just symbol prototyping      // just symbol prototyping
440      class File;      class File;
441      class Instrument;      class Instrument;
# Line 554  namespace gig { Line 576  namespace gig {
576              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).              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).
577              eg_opt_t           EG1Options;                    ///< [gig extension]: Behavior options which should be used for envelope generator 1 (volume amplitude EG).              eg_opt_t           EG1Options;                    ///< [gig extension]: Behavior options which should be used for envelope generator 1 (volume amplitude EG).
578              eg_opt_t           EG2Options;                    ///< [gig extension]: Behavior options which should be used for envelope generator 2 (filter cutoff EG).              eg_opt_t           EG2Options;                    ///< [gig extension]: Behavior options which should be used for envelope generator 2 (filter cutoff EG).
579                sust_rel_trg_t     SustainReleaseTrigger;         ///< [gig extension]: Whether a sustain pedal up event shall play release trigger sample.
580                bool               NoNoteOffReleaseTrigger;       ///< [gig extension]: If @c true then don't play a release trigger sample on MIDI note-off events.
581    
582              // derived attributes from DLS::Sampler              // derived attributes from DLS::Sampler
583              using DLS::Sampler::UnityNote;              using DLS::Sampler::UnityNote;
# Line 580  namespace gig { Line 604  namespace gig {
604              using DLS::Sampler::AddSampleLoop;              using DLS::Sampler::AddSampleLoop;
605              using DLS::Sampler::DeleteSampleLoop;              using DLS::Sampler::DeleteSampleLoop;
606              // overridden methods              // overridden methods
607              virtual void SetGain(int32_t gain);              virtual void SetGain(int32_t gain) OVERRIDE;
608              virtual void UpdateChunks(progress_t* pProgress);              virtual void UpdateChunks(progress_t* pProgress) OVERRIDE;
609              virtual void CopyAssign(const DimensionRegion* orig);              virtual void CopyAssign(const DimensionRegion* orig);
610          protected:          protected:
611              uint8_t* VelocityTable; ///< For velocity dimensions with custom defined zone ranges only: used for fast converting from velocity MIDI value to dimension bit number.              uint8_t* VelocityTable; ///< For velocity dimensions with custom defined zone ranges only: used for fast converting from velocity MIDI value to dimension bit number.
# Line 773  namespace gig { Line 797  namespace gig {
797              file_offset_t ReadAndLoop(void* pBuffer, file_offset_t SampleCount, playback_state_t* pPlaybackState, DimensionRegion* pDimRgn, buffer_t* pExternalDecompressionBuffer = NULL);              file_offset_t ReadAndLoop(void* pBuffer, file_offset_t SampleCount, playback_state_t* pPlaybackState, DimensionRegion* pDimRgn, buffer_t* pExternalDecompressionBuffer = NULL);
798              file_offset_t Write(void* pBuffer, file_offset_t SampleCount);              file_offset_t Write(void* pBuffer, file_offset_t SampleCount);
799              Group*        GetGroup() const;              Group*        GetGroup() const;
800              virtual void  UpdateChunks(progress_t* pProgress);              virtual void  UpdateChunks(progress_t* pProgress) OVERRIDE;
801              void CopyAssignMeta(const Sample* orig);              void CopyAssignMeta(const Sample* orig);
802              void CopyAssignWave(const Sample* orig);              void CopyAssignWave(const Sample* orig);
803              uint32_t GetWaveDataCRC32Checksum();              uint32_t GetWaveDataCRC32Checksum();
# Line 867  namespace gig { Line 891  namespace gig {
891              void             SplitDimensionZone(dimension_t type, int zone);              void             SplitDimensionZone(dimension_t type, int zone);
892              void             SetDimensionType(dimension_t oldType, dimension_t newType);              void             SetDimensionType(dimension_t oldType, dimension_t newType);
893              // overridden methods              // overridden methods
894              virtual void     SetKeyRange(uint16_t Low, uint16_t High);              virtual void     SetKeyRange(uint16_t Low, uint16_t High) OVERRIDE;
895              virtual void     UpdateChunks(progress_t* pProgress);              virtual void     UpdateChunks(progress_t* pProgress) OVERRIDE;
896              virtual void     CopyAssign(const Region* orig);              virtual void     CopyAssign(const Region* orig);
897          protected:          protected:
898              Region(Instrument* pInstrument, RIFF::List* rgnList);              Region(Instrument* pInstrument, RIFF::List* rgnList);
# Line 961  namespace gig { Line 985  namespace gig {
985          protected:          protected:
986              MidiRuleCtrlTrigger(RIFF::Chunk* _3ewg);              MidiRuleCtrlTrigger(RIFF::Chunk* _3ewg);
987              MidiRuleCtrlTrigger();              MidiRuleCtrlTrigger();
988              void UpdateChunks(uint8_t* pData) const;              void UpdateChunks(uint8_t* pData) const OVERRIDE;
989              friend class Instrument;              friend class Instrument;
990      };      };
991    
# Line 1001  namespace gig { Line 1025  namespace gig {
1025          protected:          protected:
1026              MidiRuleLegato(RIFF::Chunk* _3ewg);              MidiRuleLegato(RIFF::Chunk* _3ewg);
1027              MidiRuleLegato();              MidiRuleLegato();
1028              void UpdateChunks(uint8_t* pData) const;              void UpdateChunks(uint8_t* pData) const OVERRIDE;
1029              friend class Instrument;              friend class Instrument;
1030      };      };
1031    
# Line 1053  namespace gig { Line 1077  namespace gig {
1077          protected:          protected:
1078              MidiRuleAlternator(RIFF::Chunk* _3ewg);              MidiRuleAlternator(RIFF::Chunk* _3ewg);
1079              MidiRuleAlternator();              MidiRuleAlternator();
1080              void UpdateChunks(uint8_t* pData) const;              void UpdateChunks(uint8_t* pData) const OVERRIDE;
1081              friend class Instrument;              friend class Instrument;
1082      };      };
1083    
# Line 1073  namespace gig { Line 1097  namespace gig {
1097      class MidiRuleUnknown : public MidiRule {      class MidiRuleUnknown : public MidiRule {
1098          protected:          protected:
1099              MidiRuleUnknown() { }              MidiRuleUnknown() { }
1100              void UpdateChunks(uint8_t* pData) const { }              void UpdateChunks(uint8_t* pData) const OVERRIDE { }
1101              friend class Instrument;              friend class Instrument;
1102      };      };
1103    
# Line 1097  namespace gig { Line 1121  namespace gig {
1121       * - <a href="http://doc.linuxsampler.org/Instrument_Scripts/NKSP_Language/Reference/">NKSP Reference Manual</a>       * - <a href="http://doc.linuxsampler.org/Instrument_Scripts/NKSP_Language/Reference/">NKSP Reference Manual</a>
1122       * - <a href="http://doc.linuxsampler.org/Gigedit/Managing_Scripts">Using Instrument Scripts with Gigedit</a>       * - <a href="http://doc.linuxsampler.org/Gigedit/Managing_Scripts">Using Instrument Scripts with Gigedit</a>
1123       */       */
1124      class Script {      class Script : protected DLS::Storage {
1125          public:          public:
1126              enum Encoding_t {              enum Encoding_t {
1127                  ENCODING_ASCII = 0 ///< Standard 8 bit US ASCII character encoding (default).                  ENCODING_ASCII = 0 ///< Standard 8 bit US ASCII character encoding (default).
# Line 1123  namespace gig { Line 1147  namespace gig {
1147          protected:          protected:
1148              Script(ScriptGroup* group, RIFF::Chunk* ckScri);              Script(ScriptGroup* group, RIFF::Chunk* ckScri);
1149              virtual ~Script();              virtual ~Script();
1150              void UpdateChunks(progress_t* pProgress);              void UpdateChunks(progress_t* pProgress) OVERRIDE;
1151                void DeleteChunks() OVERRIDE;
1152              void RemoveAllScriptReferences();              void RemoveAllScriptReferences();
1153              friend class ScriptGroup;              friend class ScriptGroup;
1154              friend class Instrument;              friend class Instrument;
# Line 1145  namespace gig { Line 1170  namespace gig {
1170       * not available in the GigaStudio 4 software. It is currently only       * not available in the GigaStudio 4 software. It is currently only
1171       * supported by LinuxSampler and gigedit.       * supported by LinuxSampler and gigedit.
1172       */       */
1173      class ScriptGroup {      class ScriptGroup : protected DLS::Storage {
1174          public:          public:
1175              String   Name; ///< Name of this script group. For example to be displayed in an instrument editor.              String   Name; ///< Name of this script group. For example to be displayed in an instrument editor.
1176    
# Line 1156  namespace gig { Line 1181  namespace gig {
1181              ScriptGroup(File* file, RIFF::List* lstRTIS);              ScriptGroup(File* file, RIFF::List* lstRTIS);
1182              virtual ~ScriptGroup();              virtual ~ScriptGroup();
1183              void LoadScripts();              void LoadScripts();
1184              void UpdateChunks(progress_t* pProgress);              virtual void UpdateChunks(progress_t* pProgress) OVERRIDE;
1185                virtual void DeleteChunks() OVERRIDE;
1186              friend class Script;              friend class Script;
1187              friend class File;              friend class File;
1188          private:          private:
# Line 1209  namespace gig { Line 1235  namespace gig {
1235              Region*   AddRegion();              Region*   AddRegion();
1236              void      DeleteRegion(Region* pRegion);              void      DeleteRegion(Region* pRegion);
1237              void      MoveTo(Instrument* dst);              void      MoveTo(Instrument* dst);
1238              virtual void UpdateChunks(progress_t* pProgress);              virtual void UpdateChunks(progress_t* pProgress) OVERRIDE;
1239              virtual void CopyAssign(const Instrument* orig);              virtual void CopyAssign(const Instrument* orig);
1240              // own methods              // own methods
1241              Region*   GetRegion(unsigned int Key);              Region*   GetRegion(unsigned int Key);
# Line 1263  namespace gig { Line 1289  namespace gig {
1289       * there is always at least one Group in a .gig file, no matter if you       * there is always at least one Group in a .gig file, no matter if you
1290       * created one yet or not.       * created one yet or not.
1291       */       */
1292      class Group {      class Group : public DLS::Storage {
1293          public:          public:
1294              String Name; ///< Stores the name of this Group.              String Name; ///< Stores the name of this Group.
1295    
# Line 1273  namespace gig { Line 1299  namespace gig {
1299          protected:          protected:
1300              Group(File* file, RIFF::Chunk* ck3gnm);              Group(File* file, RIFF::Chunk* ck3gnm);
1301              virtual ~Group();              virtual ~Group();
1302              virtual void UpdateChunks(progress_t* pProgress);              virtual void UpdateChunks(progress_t* pProgress) OVERRIDE;
1303                virtual void DeleteChunks() OVERRIDE;
1304              void MoveAll();              void MoveAll();
1305              friend class File;              friend class File;
1306          private:          private:
# Line 1321  namespace gig { Line 1348  namespace gig {
1348          public:          public:
1349              static const DLS::version_t VERSION_2;              static const DLS::version_t VERSION_2;
1350              static const DLS::version_t VERSION_3;              static const DLS::version_t VERSION_3;
1351                static const DLS::version_t VERSION_4;
1352    
1353              // derived attributes from DLS::Resource              // derived attributes from DLS::Resource
1354              using DLS::Resource::pInfo;              using DLS::Resource::pInfo;
# Line 1335  namespace gig { Line 1363  namespace gig {
1363              using DLS::File::Save;              using DLS::File::Save;
1364              using DLS::File::GetFileName;              using DLS::File::GetFileName;
1365              using DLS::File::SetFileName;              using DLS::File::SetFileName;
1366                using DLS::File::GetRiffFile;
1367              // overridden  methods              // overridden  methods
1368              File();              File();
1369              File(RIFF::File* pRIFF);              File(RIFF::File* pRIFF);
# Line 1342  namespace gig { Line 1371  namespace gig {
1371              Sample*     GetNextSample();      ///< Returns a pointer to the next <i>Sample</i> object of the file, <i>NULL</i> otherwise.              Sample*     GetNextSample();      ///< Returns a pointer to the next <i>Sample</i> object of the file, <i>NULL</i> otherwise.
1372              Sample*     GetSample(uint index);              Sample*     GetSample(uint index);
1373              Sample*     AddSample();              Sample*     AddSample();
1374                size_t      CountSamples();
1375              void        DeleteSample(Sample* pSample);              void        DeleteSample(Sample* pSample);
1376              Instrument* GetFirstInstrument(); ///< Returns a pointer to the first <i>Instrument</i> object of the file, <i>NULL</i> otherwise.              Instrument* GetFirstInstrument(); ///< Returns a pointer to the first <i>Instrument</i> object of the file, <i>NULL</i> otherwise.
1377              Instrument* GetNextInstrument();  ///< Returns a pointer to the next <i>Instrument</i> object of the file, <i>NULL</i> otherwise.              Instrument* GetNextInstrument();  ///< Returns a pointer to the next <i>Instrument</i> object of the file, <i>NULL</i> otherwise.
1378              Instrument* GetInstrument(uint index, progress_t* pProgress = NULL);              Instrument* GetInstrument(uint index, progress_t* pProgress = NULL);
1379              Instrument* AddInstrument();              Instrument* AddInstrument();
1380              Instrument* AddDuplicateInstrument(const Instrument* orig);              Instrument* AddDuplicateInstrument(const Instrument* orig);
1381                size_t      CountInstruments();
1382              void        DeleteInstrument(Instrument* pInstrument);              void        DeleteInstrument(Instrument* pInstrument);
1383              Group*      GetFirstGroup(); ///< Returns a pointer to the first <i>Group</i> object of the file, <i>NULL</i> otherwise.              Group*      GetFirstGroup(); ///< Returns a pointer to the first <i>Group</i> object of the file, <i>NULL</i> otherwise.
1384              Group*      GetNextGroup();  ///< Returns a pointer to the next <i>Group</i> object of the file, <i>NULL</i> otherwise.              Group*      GetNextGroup();  ///< Returns a pointer to the next <i>Group</i> object of the file, <i>NULL</i> otherwise.
# Line 1364  namespace gig { Line 1395  namespace gig {
1395              ScriptGroup* AddScriptGroup();              ScriptGroup* AddScriptGroup();
1396              void        DeleteScriptGroup(ScriptGroup* pGroup);              void        DeleteScriptGroup(ScriptGroup* pGroup);
1397              virtual    ~File();              virtual    ~File();
1398              virtual void UpdateChunks(progress_t* pProgress);              virtual void UpdateChunks(progress_t* pProgress) OVERRIDE;
1399          protected:          protected:
1400              // overridden protected methods from DLS::File              // overridden protected methods from DLS::File
1401              virtual void LoadSamples();              virtual void LoadSamples() OVERRIDE;
1402              virtual void LoadInstruments();              virtual void LoadInstruments() OVERRIDE;
1403              virtual void LoadGroups();              virtual void LoadGroups();
1404              virtual void UpdateFileOffsets();              virtual void UpdateFileOffsets() OVERRIDE;
1405              // own protected methods              // own protected methods
1406              virtual void LoadSamples(progress_t* pProgress);              virtual void LoadSamples(progress_t* pProgress);
1407              virtual void LoadInstruments(progress_t* pProgress);              virtual void LoadInstruments(progress_t* pProgress);

Legend:
Removed from v.3399  
changed lines
  Added in v.3486

  ViewVC Help
Powered by ViewVC