libgig  4.0.0
gig.h
Go to the documentation of this file.
1 /***************************************************************************
2  * *
3  * libgig - C++ cross-platform Gigasampler format file access library *
4  * *
5  * Copyright (C) 2003-2015 by Christian Schoenebeck *
6  * <cuse@users.sourceforge.net> *
7  * *
8  * This library is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * This library is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this library; if not, write to the Free Software *
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
21  * MA 02111-1307 USA *
22  ***************************************************************************/
23 
24 #ifndef __GIG_H__
25 #define __GIG_H__
26 
27 #include "DLS.h"
28 #include <vector>
29 
30 #if WORDS_BIGENDIAN
31 # define LIST_TYPE_3PRG 0x33707267
32 # define LIST_TYPE_3EWL 0x3365776C
33 # define LIST_TYPE_3GRI 0x33677269
34 # define LIST_TYPE_3GNL 0x33676E6C
35 # define LIST_TYPE_3LS 0x334c5320 // own gig format extension
36 # define LIST_TYPE_RTIS 0x52544953 // own gig format extension
37 # define CHUNK_ID_3GIX 0x33676978
38 # define CHUNK_ID_3EWA 0x33657761
39 # define CHUNK_ID_3LNK 0x336C6E6B
40 # define CHUNK_ID_3EWG 0x33657767
41 # define CHUNK_ID_EWAV 0x65776176
42 # define CHUNK_ID_3GNM 0x33676E6D
43 # define CHUNK_ID_EINF 0x65696E66
44 # define CHUNK_ID_3CRC 0x33637263
45 # define CHUNK_ID_SCRI 0x53637269 // own gig format extension
46 # define CHUNK_ID_LSNM 0x4c534e4d // own gig format extension
47 # define CHUNK_ID_SCSL 0x5343534c // own gig format extension
48 #else // little endian
49 # define LIST_TYPE_3PRG 0x67727033
50 # define LIST_TYPE_3EWL 0x6C776533
51 # define LIST_TYPE_3GRI 0x69726733
52 # define LIST_TYPE_3GNL 0x6C6E6733
53 # define LIST_TYPE_3LS 0x20534c33 // own gig format extension
54 # define LIST_TYPE_RTIS 0x53495452 // own gig format extension
55 # define CHUNK_ID_3GIX 0x78696733
56 # define CHUNK_ID_3EWA 0x61776533
57 # define CHUNK_ID_3LNK 0x6B6E6C33
58 # define CHUNK_ID_3EWG 0x67776533
59 # define CHUNK_ID_EWAV 0x76617765
60 # define CHUNK_ID_3GNM 0x6D6E6733
61 # define CHUNK_ID_EINF 0x666E6965
62 # define CHUNK_ID_3CRC 0x63726333
63 # define CHUNK_ID_SCRI 0x69726353 // own gig format extension
64 # define CHUNK_ID_LSNM 0x4d4e534c // own gig format extension
65 # define CHUNK_ID_SCSL 0x4c534353 // own gig format extension
66 #endif // WORDS_BIGENDIAN
67 
69 namespace gig {
70 
71  typedef std::string String;
73 
75  struct range_t {
76  uint8_t low;
77  uint8_t high;
78  };
79 
81  struct buffer_t {
82  void* pStart;
83  unsigned long Size;
84  unsigned long NullExtensionSize;
86  pStart = NULL;
87  Size = 0;
88  NullExtensionSize = 0;
89  }
90  };
91 
93  typedef enum {
94  loop_type_normal = 0x00000000,
95  loop_type_bidirectional = 0x00000001,
96  loop_type_backward = 0x00000002
97  } loop_type_t;
98 
100  typedef enum {
101  smpte_format_no_offset = 0x00000000,
102  smpte_format_24_frames = 0x00000018,
103  smpte_format_25_frames = 0x00000019,
106  } smpte_format_t;
107 
109  typedef enum {
113  curve_type_unknown = 0xffffffff
114  } curve_type_t;
115 
117  typedef enum {
122 
124  typedef enum {
130  } lfo3_ctrl_t;
131 
133  typedef enum {
136  lfo2_ctrl_foot = 0x02,
139  } lfo2_ctrl_t;
140 
142  typedef enum {
148  } lfo1_ctrl_t;
149 
151  typedef enum {
165 
167  typedef enum {
168  vcf_res_ctrl_none = 0xffffffff,
173  } vcf_res_ctrl_t;
174 
184  typedef enum {
185  type_none = 0x00,
186  type_channelaftertouch = 0x2f,
187  type_velocity = 0xff,
188  type_controlchange = 0xfe
189  } type_t;
190 
193  };
194 
201 
208 
215 
223  typedef enum {
224  dimension_none = 0x00,
237  dimension_foot = 0x04,
258  } dimension_t;
259 
264  typedef enum {
267  } split_type_t;
268 
272  uint8_t bits;
273  uint8_t zones;
274  split_type_t split_type;
275  float zone_size;
276  };
277 
279  typedef enum {
285  } vcf_type_t;
286 
294  struct crossfade_t {
295  #if WORDS_BIGENDIAN
296  uint8_t out_end;
297  uint8_t out_start;
298  uint8_t in_end;
299  uint8_t in_start;
300  #else // little endian
301  uint8_t in_start;
302  uint8_t in_end;
303  uint8_t out_start;
304  uint8_t out_end;
305  #endif // WORDS_BIGENDIAN
306  };
307 
310  unsigned long position;
311  bool reverse;
312  unsigned long loop_cycles_left;
313  };
314 
315  // just symbol prototyping
316  class File;
317  class Instrument;
318  class Sample;
319  class Region;
320  class Group;
321  class Script;
322  class ScriptGroup;
323 
366  class DimensionRegion : protected DLS::Sampler {
367  public:
370  // Sample Amplitude EG/LFO
371  uint16_t EG1PreAttack;
372  double EG1Attack;
373  double EG1Decay1;
374  double EG1Decay2;
376  uint16_t EG1Sustain;
377  double EG1Release;
378  bool EG1Hold;
379  eg1_ctrl_t EG1Controller;
384  double LFO1Frequency;
385  uint16_t LFO1InternalDepth;
386  uint16_t LFO1ControlDepth;
389  bool LFO1Sync;
390  // Filter Cutoff Frequency EG/LFO
391  uint16_t EG2PreAttack;
392  double EG2Attack;
393  double EG2Decay1;
394  double EG2Decay2;
396  uint16_t EG2Sustain;
397  double EG2Release;
398  eg2_ctrl_t EG2Controller;
403  double LFO2Frequency;
404  uint16_t LFO2InternalDepth;
405  uint16_t LFO2ControlDepth;
408  bool LFO2Sync;
409  // Sample Pitch EG/LFO
410  double EG3Attack;
411  int16_t EG3Depth;
412  double LFO3Frequency;
416  bool LFO3Sync;
417  // Filter
418  bool VCFEnabled;
422  uint8_t VCFCutoff;
426  uint8_t VCFResonance;
431  // Key Velocity Transformations
438  // Mix / Layer
440  bool PitchTrack;
441  dim_bypass_ctrl_t DimensionBypass;
442  int8_t Pan;
443  bool SelfMask;
444  attenuation_ctrl_t AttenuationController;
447  uint8_t ChannelOffset;
449  bool MSDecode;
450  uint16_t SampleStartOffset;
452  uint8_t DimensionUpperLimits[8];
453 
454  // derived attributes from DLS::Sampler
457  using DLS::Sampler::Gain;
460 
461  // own methods
462  double GetVelocityAttenuation(uint8_t MIDIKeyVelocity);
463  double GetVelocityRelease(uint8_t MIDIKeyVelocity);
464  double GetVelocityCutoff(uint8_t MIDIKeyVelocity);
465  void SetVelocityResponseCurve(curve_type_t curve);
466  void SetVelocityResponseDepth(uint8_t depth);
467  void SetVelocityResponseCurveScaling(uint8_t scaling);
468  void SetReleaseVelocityResponseCurve(curve_type_t curve);
469  void SetReleaseVelocityResponseDepth(uint8_t depth);
470  void SetVCFCutoffController(vcf_cutoff_ctrl_t controller);
471  void SetVCFVelocityCurve(curve_type_t curve);
472  void SetVCFVelocityDynamicRange(uint8_t range);
473  void SetVCFVelocityScale(uint8_t scaling);
474  Region* GetParent() const;
475  // derived methods
478  // overridden methods
479  virtual void SetGain(int32_t gain);
480  virtual void UpdateChunks(progress_t* pProgress);
481  virtual void CopyAssign(const DimensionRegion* orig);
482  protected:
483  uint8_t* VelocityTable;
484  DimensionRegion(Region* pParent, RIFF::List* _3ewl);
485  DimensionRegion(RIFF::List* _3ewl, const DimensionRegion& src);
486  ~DimensionRegion();
487  void CopyAssign(const DimensionRegion* orig, const std::map<Sample*,Sample*>* mSamples);
488  friend class Region;
489  private:
490  typedef enum {
491  // official leverage controllers as they were defined in the original Gigasampler/GigaStudio format:
492  _lev_ctrl_none = 0x00,
493  _lev_ctrl_modwheel = 0x03,
494  _lev_ctrl_breath = 0x05,
495  _lev_ctrl_foot = 0x07,
496  _lev_ctrl_effect1 = 0x0d,
497  _lev_ctrl_effect2 = 0x0f,
498  _lev_ctrl_genpurpose1 = 0x11,
499  _lev_ctrl_genpurpose2 = 0x13,
500  _lev_ctrl_genpurpose3 = 0x15,
501  _lev_ctrl_genpurpose4 = 0x17,
502  _lev_ctrl_portamentotime = 0x0b,
503  _lev_ctrl_sustainpedal = 0x01,
504  _lev_ctrl_portamento = 0x19,
505  _lev_ctrl_sostenutopedal = 0x1b,
506  _lev_ctrl_softpedal = 0x09,
507  _lev_ctrl_genpurpose5 = 0x1d,
508  _lev_ctrl_genpurpose6 = 0x1f,
509  _lev_ctrl_genpurpose7 = 0x21,
510  _lev_ctrl_genpurpose8 = 0x23,
511  _lev_ctrl_effect1depth = 0x25,
512  _lev_ctrl_effect2depth = 0x27,
513  _lev_ctrl_effect3depth = 0x29,
514  _lev_ctrl_effect4depth = 0x2b,
515  _lev_ctrl_effect5depth = 0x2d,
516  _lev_ctrl_channelaftertouch = 0x2f,
517  _lev_ctrl_velocity = 0xff,
518 
519  // format extension (these controllers are so far only supported by LinuxSampler & gigedit) they will *NOT* work with Gigasampler/GigaStudio !
520  // (the assigned values here are their official MIDI CC number plus the highest bit set):
521  _lev_ctrl_CC3_EXT = 0x83,
522 
523  _lev_ctrl_CC6_EXT = 0x86,
524  _lev_ctrl_CC7_EXT = 0x87,
525  _lev_ctrl_CC8_EXT = 0x88,
526  _lev_ctrl_CC9_EXT = 0x89,
527  _lev_ctrl_CC10_EXT = 0x8a,
528  _lev_ctrl_CC11_EXT = 0x8b,
529 
530  _lev_ctrl_CC14_EXT = 0x8e,
531  _lev_ctrl_CC15_EXT = 0x8f,
532 
533  _lev_ctrl_CC20_EXT = 0x94,
534  _lev_ctrl_CC21_EXT = 0x95,
535  _lev_ctrl_CC22_EXT = 0x96,
536  _lev_ctrl_CC23_EXT = 0x97,
537  _lev_ctrl_CC24_EXT = 0x98,
538  _lev_ctrl_CC25_EXT = 0x99,
539  _lev_ctrl_CC26_EXT = 0x9a,
540  _lev_ctrl_CC27_EXT = 0x9b,
541  _lev_ctrl_CC28_EXT = 0x9c,
542  _lev_ctrl_CC29_EXT = 0x9d,
543  _lev_ctrl_CC30_EXT = 0x9e,
544  _lev_ctrl_CC31_EXT = 0x9f,
545 
546  _lev_ctrl_CC68_EXT = 0xc4,
547  _lev_ctrl_CC69_EXT = 0xc5,
548  _lev_ctrl_CC70_EXT = 0xc6,
549  _lev_ctrl_CC71_EXT = 0xc7,
550  _lev_ctrl_CC72_EXT = 0xc8,
551  _lev_ctrl_CC73_EXT = 0xc9,
552  _lev_ctrl_CC74_EXT = 0xca,
553  _lev_ctrl_CC75_EXT = 0xcb,
554  _lev_ctrl_CC76_EXT = 0xcc,
555  _lev_ctrl_CC77_EXT = 0xcd,
556  _lev_ctrl_CC78_EXT = 0xce,
557  _lev_ctrl_CC79_EXT = 0xcf,
558 
559  _lev_ctrl_CC84_EXT = 0xd4,
560  _lev_ctrl_CC85_EXT = 0xd5,
561  _lev_ctrl_CC86_EXT = 0xd6,
562  _lev_ctrl_CC87_EXT = 0xd7,
563 
564  _lev_ctrl_CC89_EXT = 0xd9,
565  _lev_ctrl_CC90_EXT = 0xda,
566 
567  _lev_ctrl_CC96_EXT = 0xe0,
568  _lev_ctrl_CC97_EXT = 0xe1,
569 
570  _lev_ctrl_CC102_EXT = 0xe6,
571  _lev_ctrl_CC103_EXT = 0xe7,
572  _lev_ctrl_CC104_EXT = 0xe8,
573  _lev_ctrl_CC105_EXT = 0xe9,
574  _lev_ctrl_CC106_EXT = 0xea,
575  _lev_ctrl_CC107_EXT = 0xeb,
576  _lev_ctrl_CC108_EXT = 0xec,
577  _lev_ctrl_CC109_EXT = 0xed,
578  _lev_ctrl_CC110_EXT = 0xee,
579  _lev_ctrl_CC111_EXT = 0xef,
580  _lev_ctrl_CC112_EXT = 0xf0,
581  _lev_ctrl_CC113_EXT = 0xf1,
582  _lev_ctrl_CC114_EXT = 0xf2,
583  _lev_ctrl_CC115_EXT = 0xf3,
584  _lev_ctrl_CC116_EXT = 0xf4,
585  _lev_ctrl_CC117_EXT = 0xf5,
586  _lev_ctrl_CC118_EXT = 0xf6,
587  _lev_ctrl_CC119_EXT = 0xf7
588  } _lev_ctrl_t;
589  typedef std::map<uint32_t, double*> VelocityTableMap;
590 
591  static uint Instances;
592  static VelocityTableMap* pVelocityTables;
593  double* pVelocityAttenuationTable;
594  double* pVelocityReleaseTable;
595  double* pVelocityCutoffTable;
596  Region* pRegion;
597 
598  leverage_ctrl_t DecodeLeverageController(_lev_ctrl_t EncodedController);
599  _lev_ctrl_t EncodeLeverageController(leverage_ctrl_t DecodedController);
600  double* GetReleaseVelocityTable(curve_type_t releaseVelocityResponseCurve, uint8_t releaseVelocityResponseDepth);
601  double* GetCutoffVelocityTable(curve_type_t vcfVelocityCurve, uint8_t vcfVelocityDynamicRange, uint8_t vcfVelocityScale, vcf_cutoff_ctrl_t vcfCutoffController);
602  double* GetVelocityTable(curve_type_t curveType, uint8_t depth, uint8_t scaling);
603  double* CreateVelocityTable(curve_type_t curveType, uint8_t depth, uint8_t scaling);
604  };
605 
631  class Sample : public DLS::Sample {
632  public:
633  uint32_t Manufacturer;
634  uint32_t Product;
635  uint32_t SamplePeriod;
636  uint32_t MIDIUnityNote;
637  uint32_t FineTune;
639  uint32_t SMPTEOffset;
640  uint32_t Loops;
641  uint32_t LoopID;
643  uint32_t LoopStart;
644  uint32_t LoopEnd;
645  uint32_t LoopSize;
646  uint32_t LoopFraction;
647  uint32_t LoopPlayCount;
648  bool Compressed;
649  uint32_t TruncatedBits;
650  bool Dithered;
651 
652  // own methods
653  buffer_t LoadSampleData();
654  buffer_t LoadSampleData(unsigned long SampleCount);
655  buffer_t LoadSampleDataWithNullSamplesExtension(uint NullSamplesCount);
656  buffer_t LoadSampleDataWithNullSamplesExtension(unsigned long SampleCount, uint NullSamplesCount);
657  buffer_t GetCache();
658  // own static methods
659  static buffer_t CreateDecompressionBuffer(unsigned long MaxReadSize);
660  static void DestroyDecompressionBuffer(buffer_t& DecompressionBuffer);
661  // overridden methods
662  void ReleaseSampleData();
663  void Resize(int iNewSize);
664  unsigned long SetPos(unsigned long SampleCount, RIFF::stream_whence_t Whence = RIFF::stream_start);
665  unsigned long GetPos() const;
666  unsigned long Read(void* pBuffer, unsigned long SampleCount, buffer_t* pExternalDecompressionBuffer = NULL);
667  unsigned long ReadAndLoop(void* pBuffer, unsigned long SampleCount, playback_state_t* pPlaybackState, DimensionRegion* pDimRgn, buffer_t* pExternalDecompressionBuffer = NULL);
668  unsigned long Write(void* pBuffer, unsigned long SampleCount);
669  Group* GetGroup() const;
670  virtual void UpdateChunks(progress_t* pProgress);
671  void CopyAssignMeta(const Sample* orig);
672  void CopyAssignWave(const Sample* orig);
673  protected:
674  static unsigned int Instances;
677  unsigned long FrameOffset;
678  unsigned long* FrameTable;
679  unsigned long SamplePos;
680  unsigned long SamplesInLastFrame;
681  unsigned long WorstCaseFrameSize;
682  unsigned long SamplesPerFrame;
684  unsigned long FileNo;
687  uint32_t crc;
688 
689  Sample(File* pFile, RIFF::List* waveList, unsigned long WavePoolOffset, unsigned long fileNo = 0);
690  ~Sample();
691 
692  // Guess size (in bytes) of a compressed sample
693  inline unsigned long GuessSize(unsigned long samples) {
694  // 16 bit: assume all frames are compressed - 1 byte
695  // per sample and 5 bytes header per 2048 samples
696 
697  // 24 bit: assume next best compression rate - 1.5
698  // bytes per sample and 13 bytes header per 256
699  // samples
700  const unsigned long size =
701  BitDepth == 24 ? samples + (samples >> 1) + (samples >> 8) * 13
702  : samples + (samples >> 10) * 5;
703  // Double for stereo and add one worst case sample
704  // frame
705  return (Channels == 2 ? size << 1 : size) + WorstCaseFrameSize;
706  }
707 
708  // Worst case amount of sample points that can be read with the
709  // given decompression buffer.
710  inline unsigned long WorstCaseMaxSamples(buffer_t* pDecompressionBuffer) {
711  return (unsigned long) ((float)pDecompressionBuffer->Size / (float)WorstCaseFrameSize * (float)SamplesPerFrame);
712  }
713  private:
714  void ScanCompressedSample();
715  friend class File;
716  friend class Region;
717  friend class Group; // allow to modify protected member pGroup
718  };
719 
720  // TODO: <3dnl> list not used yet - not important though (just contains optional descriptions for the dimensions)
741  class Region : public DLS::Region {
742  public:
743  unsigned int Dimensions;
744  dimension_def_t pDimensionDefinitions[8];
745  uint32_t DimensionRegions;
746  DimensionRegion* pDimensionRegions[256];
747  unsigned int Layers;
748 
749  // own methods
750  DimensionRegion* GetDimensionRegionByValue(const uint DimValues[8]);
751  DimensionRegion* GetDimensionRegionByBit(const uint8_t DimBits[8]);
752  int GetDimensionRegionIndexByValue(const uint DimValues[8]);
753  Sample* GetSample();
754  void AddDimension(dimension_def_t* pDimDef);
755  void DeleteDimension(dimension_def_t* pDimDef);
756  dimension_def_t* GetDimensionDefinition(dimension_t type);
757  void DeleteDimensionZone(dimension_t type, int zone);
758  void SplitDimensionZone(dimension_t type, int zone);
759  void SetDimensionType(dimension_t oldType, dimension_t newType);
760  // overridden methods
761  virtual void SetKeyRange(uint16_t Low, uint16_t High);
762  virtual void UpdateChunks(progress_t* pProgress);
763  virtual void CopyAssign(const Region* orig);
764  protected:
765  Region(Instrument* pInstrument, RIFF::List* rgnList);
766  void LoadDimensionRegions(RIFF::List* rgn);
767  void UpdateVelocityTable();
768  Sample* GetSampleFromWavePool(unsigned int WavePoolTableIndex, progress_t* pProgress = NULL);
769  void CopyAssign(const Region* orig, const std::map<Sample*,Sample*>* mSamples);
770  DimensionRegion* GetDimensionRegionByBit(const std::map<dimension_t,int>& DimCase);
771  ~Region();
772  friend class Instrument;
773  };
774 
817  class MidiRule {
818  public:
819  virtual ~MidiRule() { }
820  protected:
821  virtual void UpdateChunks(uint8_t* pData) const = 0;
822  friend class Instrument;
823  };
824 
838  class MidiRuleCtrlTrigger : public MidiRule {
839  public:
841  uint8_t Triggers;
842  struct trigger_t {
843  uint8_t TriggerPoint;
844  bool Descending;
845  uint8_t VelSensitivity;
846  uint8_t Key;
847  bool NoteOff;
848  uint8_t Velocity;
850  } pTriggers[32];
851 
852  protected:
855  void UpdateChunks(uint8_t* pData) const;
856  friend class Instrument;
857  };
858 
879  class MidiRuleLegato : public MidiRule {
880  public:
881  uint8_t LegatoSamples;
883  uint8_t BypassKey;
885  uint16_t ThresholdTime;
886  uint16_t ReleaseTime;
889  uint8_t AltSustain1Key;
890  uint8_t AltSustain2Key;
891 
892  protected:
893  MidiRuleLegato(RIFF::Chunk* _3ewg);
894  MidiRuleLegato();
895  void UpdateChunks(uint8_t* pData) const;
896  friend class Instrument;
897  };
898 
911  class MidiRuleAlternator : public MidiRule {
912  public:
913  uint8_t Articulations;
914  String pArticulations[32];
915 
917 
918  uint8_t Patterns;
919  struct pattern_t {
920  String Name;
921  int Size;
922  const uint8_t& operator[](int i) const {
923  return data[i];
924  }
925  uint8_t& operator[](int i) {
926  return data[i];
927  }
928  private:
929  uint8_t data[32];
930  } pPatterns[32];
931 
932  typedef enum {
935  selector_controller
936  } selector_t;
937  selector_t Selector;
939  uint8_t Controller;
940 
941  bool Polyphonic;
942  bool Chained;
943 
944  protected:
947  void UpdateChunks(uint8_t* pData) const;
948  friend class Instrument;
949  };
950 
964  class MidiRuleUnknown : public MidiRule {
965  protected:
967  void UpdateChunks(uint8_t* pData) const { }
968  friend class Instrument;
969  };
970 
991  class Script {
992  public:
993  enum Encoding_t {
994  ENCODING_ASCII = 0
995  };
997  COMPRESSION_NONE = 0
998  };
999  enum Language_t {
1000  LANGUAGE_NKSP = 0
1001  };
1002 
1003  String Name;
1007  bool Bypass;
1008 
1009  String GetScriptAsText();
1010  void SetScriptAsText(const String& text);
1011  void SetGroup(ScriptGroup* pGroup);
1012  ScriptGroup* GetGroup() const;
1013  protected:
1014  Script(ScriptGroup* group, RIFF::Chunk* ckScri);
1015  virtual ~Script();
1016  void UpdateChunks(progress_t* pProgress);
1017  void RemoveAllScriptReferences();
1018  friend class ScriptGroup;
1019  friend class Instrument;
1020  private:
1021  ScriptGroup* pGroup;
1022  RIFF::Chunk* pChunk;
1023  std::vector<uint8_t> data;
1024  uint32_t crc;
1025  };
1026 
1038  class ScriptGroup {
1039  public:
1040  String Name;
1041 
1042  Script* GetScript(uint index);
1043  Script* AddScript();
1044  void DeleteScript(Script* pScript);
1045  protected:
1046  ScriptGroup(File* file, RIFF::List* lstRTIS);
1047  virtual ~ScriptGroup();
1048  void LoadScripts();
1049  void UpdateChunks(progress_t* pProgress);
1050  friend class Script;
1051  friend class File;
1052  private:
1053  File* pFile;
1054  RIFF::List* pList;
1055  std::list<Script*>* pScripts;
1056  };
1057 
1073  class Instrument : protected DLS::Instrument {
1074  public:
1075  // derived attributes from DLS::Resource
1076  using DLS::Resource::pInfo;
1077  using DLS::Resource::pDLSID;
1078  // derived attributes from DLS::Instrument
1085  // own attributes
1086  int32_t Attenuation;
1087  uint16_t EffectSend;
1088  int16_t FineTune;
1089  uint16_t PitchbendRange;
1092 
1093 
1094  // derived methods from DLS::Resource
1096  // overridden methods
1097  Region* GetFirstRegion();
1098  Region* GetNextRegion();
1099  Region* AddRegion();
1100  void DeleteRegion(Region* pRegion);
1101  void MoveTo(Instrument* dst);
1102  virtual void UpdateChunks(progress_t* pProgress);
1103  virtual void CopyAssign(const Instrument* orig);
1104  // own methods
1105  Region* GetRegion(unsigned int Key);
1106  MidiRule* GetMidiRule(int i);
1107  MidiRuleCtrlTrigger* AddMidiRuleCtrlTrigger();
1108  MidiRuleLegato* AddMidiRuleLegato();
1109  MidiRuleAlternator* AddMidiRuleAlternator();
1110  void DeleteMidiRule(int i);
1111  // real-time instrument script methods
1112  Script* GetScriptOfSlot(uint index);
1113  void AddScriptSlot(Script* pScript, bool bypass = false);
1114  void SwapScriptSlots(uint index1, uint index2);
1115  void RemoveScriptSlot(uint index);
1116  void RemoveScript(Script* pScript);
1117  uint ScriptSlotCount() const;
1118  bool IsScriptSlotBypassed(uint index);
1119  void SetScriptSlotBypassed(uint index, bool bBypass);
1120  protected:
1121  Region* RegionKeyTable[128];
1122 
1123  Instrument(File* pFile, RIFF::List* insList, progress_t* pProgress = NULL);
1124  ~Instrument();
1125  void CopyAssign(const Instrument* orig, const std::map<Sample*,Sample*>* mSamples);
1126  void UpdateRegionKeyTable();
1127  void LoadScripts();
1128  void UpdateScriptFileOffsets();
1129  friend class File;
1130  friend class Region; // so Region can call UpdateRegionKeyTable()
1131  private:
1132  struct _ScriptPooolEntry {
1133  uint32_t fileOffset;
1134  bool bypass;
1135  };
1136  struct _ScriptPooolRef {
1137  Script* script;
1138  bool bypass;
1139  };
1140  MidiRule** pMidiRules;
1141  std::vector<_ScriptPooolEntry> scriptPoolFileOffsets;
1142  std::vector<_ScriptPooolRef>* pScriptRefs;
1143  };
1144 
1156  class Group {
1157  public:
1158  String Name;
1159 
1160  Sample* GetFirstSample();
1161  Sample* GetNextSample();
1162  void AddSample(Sample* pSample);
1163  protected:
1164  Group(File* file, RIFF::Chunk* ck3gnm);
1165  virtual ~Group();
1166  virtual void UpdateChunks(progress_t* pProgress);
1167  void MoveAll();
1168  friend class File;
1169  private:
1170  File* pFile;
1171  RIFF::Chunk* pNameChunk;
1172  };
1173 
1210  class File : protected DLS::File {
1211  public:
1214 
1215  // derived attributes from DLS::Resource
1216  using DLS::Resource::pInfo;
1217  using DLS::Resource::pDLSID;
1218  // derived attributes from DLS::File
1219  using DLS::File::pVersion;
1220  using DLS::File::Instruments;
1221 
1222  // derived methods from DLS::Resource
1224  // derived methods from DLS::File
1225  using DLS::File::Save;
1226  using DLS::File::GetFileName;
1227  using DLS::File::SetFileName;
1228  // overridden methods
1229  File();
1230  File(RIFF::File* pRIFF);
1231  Sample* GetFirstSample(progress_t* pProgress = NULL);
1232  Sample* GetNextSample();
1233  Sample* GetSample(uint index);
1234  Sample* AddSample();
1235  void DeleteSample(Sample* pSample);
1236  Instrument* GetFirstInstrument();
1237  Instrument* GetNextInstrument();
1238  Instrument* GetInstrument(uint index, progress_t* pProgress = NULL);
1239  Instrument* AddInstrument();
1240  Instrument* AddDuplicateInstrument(const Instrument* orig);
1241  void DeleteInstrument(Instrument* pInstrument);
1242  Group* GetFirstGroup();
1243  Group* GetNextGroup();
1244  Group* GetGroup(uint index);
1245  Group* GetGroup(String name);
1246  Group* AddGroup();
1247  void DeleteGroup(Group* pGroup);
1248  void DeleteGroupOnly(Group* pGroup);
1249  void SetAutoLoad(bool b);
1250  bool GetAutoLoad();
1251  void AddContentOf(File* pFile);
1252  ScriptGroup* GetScriptGroup(uint index);
1253  ScriptGroup* GetScriptGroup(const String& name);
1254  ScriptGroup* AddScriptGroup();
1255  void DeleteScriptGroup(ScriptGroup* pGroup);
1256  virtual ~File();
1257  virtual void UpdateChunks(progress_t* pProgress);
1258  protected:
1259  // overridden protected methods from DLS::File
1260  virtual void LoadSamples();
1261  virtual void LoadInstruments();
1262  virtual void LoadGroups();
1263  virtual void UpdateFileOffsets();
1264  // own protected methods
1265  virtual void LoadSamples(progress_t* pProgress);
1266  virtual void LoadInstruments(progress_t* pProgress);
1267  virtual void LoadScriptGroups();
1268  void SetSampleChecksum(Sample* pSample, uint32_t crc);
1269  friend class Region;
1270  friend class Sample;
1271  friend class Instrument;
1272  friend class Group; // so Group can access protected member pRIFF
1273  friend class ScriptGroup; // so ScriptGroup can access protected member pRIFF
1274  private:
1275  std::list<Group*>* pGroups;
1276  std::list<Group*>::iterator GroupsIterator;
1277  bool bAutoLoad;
1278  std::list<ScriptGroup*>* pScriptGroups;
1279  };
1280 
1289  class Exception : public DLS::Exception {
1290  public:
1291  Exception(String Message);
1292  void PrintMessage();
1293  };
1294 
1295  String libraryName();
1296  String libraryVersion();
1297 
1298 } // namespace gig
1299 
1300 #endif // __GIG_H__
range_t KeySwitchRange
Key range for key switch selector.
Definition: gig.h:938
bool LFO2FlipPhase
Inverts phase of the filter cutoff LFO wave.
Definition: gig.h:407
General Purpose Controller 4 (Slider, MIDI Controller 19)
Definition: gig.h:244
dim_bypass_ctrl_t DimensionBypass
If defined, the MIDI controller can switch on/off the dimension in realtime.
Definition: gig.h:441
Encapsulates articulation informations of a dimension region.
Definition: gig.h:366
range_t DimensionKeyRange
0-127 (where 0 means C1 and 127 means G9)
Definition: gig.h:1091
sample_loop_t * pSampleLoops
Points to the beginning of a sample loop array, or is NULL if there are no loops defined.
Definition: DLS.h:372
uint8_t VCFVelocityScale
(0-127) Amount velocity controls VCF cutoff frequency (only if no other VCF cutoff controller is defi...
Definition: gig.h:424
unsigned long FrameOffset
Current offset (sample points) in current sample frame (for decompression only).
Definition: gig.h:677
bool reverse
If playback direction is currently backwards (in case there is a pingpong or reverse loop defined)...
Definition: gig.h:311
Only controlled by aftertouch controller.
Definition: gig.h:127
25 frames per second
Definition: gig.h:103
uint8_t AltSustain2Key
Key triggering a second set of alternate sustain samples.
Definition: gig.h:890
uint32_t Regions
Reflects the number of Region defintions this Instrument has.
Definition: DLS.h:466
Effect Controller 2 (Coarse, MIDI Controller 13)
Definition: gig.h:156
bool VCFEnabled
If filter should be used.
Definition: gig.h:418
Controlled internally and by external modulation wheel.
Definition: gig.h:128
Controlled internally and by aftertouch controller.
Definition: gig.h:129
Parses DLS Level 1 and 2 compliant files and provides abstract access to the data.
Definition: DLS.h:496
no SMPTE offset
Definition: gig.h:101
stream_whence_t
File stream position dependent to these relations.
Definition: RIFF.h:159
Soft Pedal (MIDI Controller 67)
Definition: gig.h:160
uint32_t FineTune
Specifies the fraction of a semitone up from the specified MIDI unity note field. A value of 0x800000...
Definition: gig.h:637
uint8_t BypassKey
Key to be used to bypass the sustain note.
Definition: gig.h:883
uint16_t LFO1ControlDepth
Controller depth influencing sample amplitude LFO pitch (0 - 1200 cents).
Definition: gig.h:386
lfo1_ctrl_t
Defines how LFO1 is controlled by.
Definition: gig.h:142
Group of Gigasampler samples.
Definition: gig.h:1156
uint8_t VCFVelocityDynamicRange
0x04 = lowest, 0x00 = highest .
Definition: gig.h:425
String Name
Stores the name of this Group.
Definition: gig.h:1158
Special dimension for triggering samples on releasing a key.
Definition: gig.h:229
uint16_t PitchbendRange
Number of semitones pitchbend controller can pitch (default is 2).
Definition: gig.h:1089
double EG1Release
Release time of the sample amplitude EG (0.000 - 60.000s).
Definition: gig.h:377
Only internally controlled.
Definition: gig.h:125
uint8_t Triggers
Number of triggers.
Definition: gig.h:841
vcf_type_t VCFType
Defines the general filter characteristic (lowpass, highpass, bandpass, etc.).
Definition: gig.h:419
Effect Controller 1 (Coarse, MIDI Controller 12)
Definition: gig.h:239
uint32_t LoopSize
Caution: Use the respective fields in the DimensionRegion instead of this one! (Intended purpose: Len...
Definition: gig.h:645
Controlled internally and by external modulation wheel.
Definition: gig.h:137
loop_type_t LoopType
Caution: Use the respective field in the DimensionRegion instead of this one! (Intended purpose: The ...
Definition: gig.h:642
lfo1_ctrl_t LFO1Controller
MIDI Controller which controls sample amplitude LFO.
Definition: gig.h:387
Effect 2 Depth (MIDI Controller 92)
Definition: gig.h:254
Effect Controller 1 (Coarse, MIDI Controller 12)
Definition: gig.h:155
Only internally controlled.
Definition: gig.h:134
uint8_t low
Low value of range.
Definition: gig.h:76
Modulation Wheel (MIDI Controller 1)
Definition: gig.h:235
Will be thrown whenever a DLS specific error occurs while trying to access a DLS File.
Definition: DLS.h:551
uint16_t SampleStartOffset
Number of samples the sample start should be moved (0 - 2000).
Definition: gig.h:450
MIDI rule for triggering notes by control change events.
Definition: gig.h:838
30 frames per second
Definition: gig.h:105
uint8_t Key
Key to trigger.
Definition: gig.h:846
unsigned long WorstCaseFrameSize
For compressed samples only: size (in bytes) of the largest possible sample frame.
Definition: gig.h:681
bool EG1Hold
If true, Decay1 stage should be postponed until the sample reached the sample loop start...
Definition: gig.h:378
range_t PlayRange
Key range of the playable keys in the instrument.
Definition: gig.h:916
void UpdateChunks(uint8_t *pData) const
Definition: gig.h:967
uint16_t ThresholdTime
Maximum time (ms) between two notes that should be played legato.
Definition: gig.h:885
const uint8_t & operator[](int i) const
Definition: gig.h:922
RIFF::Chunk * pCk3gix
Definition: gig.h:685
dimension values are already the sought bit number
Definition: gig.h:266
uint8_t VelocityResponseCurveScaling
0 - 127 (usually you don&#39;t have to interpret this parameter, use GetVelocityAttenuation() instead)...
Definition: gig.h:434
bool Descending
If the change in CC value should be downwards.
Definition: gig.h:844
unsigned long Size
Size of the actual data in the buffer in bytes.
Definition: gig.h:83
Effect 1 Depth (MIDI Controller 91)
Definition: gig.h:253
Breath Controller (Coarse, MIDI Controller 2)
Definition: gig.h:157
uint8_t ReleaseTriggerKey
Key triggering release samples.
Definition: gig.h:888
For MIDI tools like legato and repetition mode.
Definition: gig.h:233
bool VCFKeyboardTracking
If true: VCF cutoff frequence will be dependend to the note key position relative to the defined brea...
Definition: gig.h:429
uint8_t Velocity
Velocity of the note to trigger. 255 means that velocity should depend on the speed of the controller...
Definition: gig.h:848
uint32_t crc
CRC-32 checksum of the raw sample data.
Definition: gig.h:687
Defines a controller that has a certain contrained influence on a particular synthesis parameter (use...
Definition: gig.h:183
uint8_t Controller
CC number for controller selector.
Definition: gig.h:939
Defines Region information of a Gigasampler/GigaStudio instrument.
Definition: gig.h:741
Only controlled by external modulation wheel.
Definition: gig.h:135
unsigned long SamplesPerFrame
For compressed samples only: number of samples in a full sample frame.
Definition: gig.h:682
uint32_t LoopPlayCount
Number of times the loop should be played (a value of 0 = infinite).
Definition: gig.h:647
uint8_t ReleaseTriggerDecay
0 - 8
Definition: gig.h:437
lfo3_ctrl_t LFO3Controller
MIDI Controller which controls the sample pitch LFO.
Definition: gig.h:415
static unsigned int Instances
Number of instances of class Sample.
Definition: gig.h:674
bool Chained
If all patterns should be chained together.
Definition: gig.h:942
uint32_t MIDIUnityNote
Specifies the musical note at which the sample will be played at it&#39;s original sample rate...
Definition: gig.h:636
int16_t FineTune
Definition: DLS.h:367
uint8_t ControllerNumber
MIDI controller number.
Definition: gig.h:840
Portamento (MIDI Controller 65)
Definition: gig.h:246
uint8_t ChannelOffset
Audio output where the audio signal of the dimension region should be routed to (0 - 9)...
Definition: gig.h:447
General Purpose Controller 6 (Button, MIDI Controller 81)
Definition: gig.h:250
uint8_t VCFResonance
Firm internal filter resonance weight.
Definition: gig.h:426
bool VCFResonanceDynamic
If true: Increases the resonance Q according to changes of controllers that actually control the VCF ...
Definition: gig.h:427
Language_t Language
Programming language and dialect the script is written in.
Definition: gig.h:1006
unsigned int Dimensions
Number of defined dimensions, do not alter!
Definition: gig.h:743
Only controlled by external modulation wheel.
Definition: gig.h:126
vcf_cutoff_ctrl_t VCFCutoffController
Specifies which external controller has influence on the filter cutoff frequency. ...
Definition: gig.h:420
uint16_t MIDIBank
Reflects combination of MIDIBankCoarse and MIDIBankFine (bank 1 - bank 16384). Do not change this val...
Definition: DLS.h:462
Foot Pedal (Coarse, MIDI Controller 4)
Definition: gig.h:158
double EG1Decay1
Decay time of the sample amplitude EG (0.000 - 60.000s).
Definition: gig.h:373
lfo2_ctrl_t LFO2Controller
MIDI Controlle which controls the filter cutoff LFO.
Definition: gig.h:406
Compression_t Compression
Whether the script was/should be compressed, and if so, which compression algorithm shall be used...
Definition: gig.h:1004
Different samples triggered each time a note is played, any key advances the counter.
Definition: gig.h:234
bool Dithered
For 24-bit compressed samples only: if dithering was used during compression with bit reduction...
Definition: gig.h:650
String libraryVersion()
Returns version of this C++ library.
Definition: gig.cpp:6102
uint8_t VelocityUpperLimit
Defines the upper velocity value limit of a velocity split (only if an user defined limit was set...
Definition: gig.h:368
uint8_t ReleaseVelocityResponseDepth
Dynamic range of release velocity affecting envelope time (0 - 4).
Definition: gig.h:436
Will be thrown whenever a gig specific error occurs while trying to access a Gigasampler File...
Definition: gig.h:1289
uint8_t MIDIBankCoarse
Reflects the MIDI Bank number for MIDI Control Change 0 (bank 1 - 128).
Definition: DLS.h:463
uint8_t in_end
End position of fade in.
Definition: gig.h:302
unsigned long WorstCaseMaxSamples(buffer_t *pDecompressionBuffer)
Definition: gig.h:710
static const DLS::version_t VERSION_2
Reflects Gigasampler file format version 2.0 (1998-06-28).
Definition: gig.h:1212
Sample * pSample
Points to the Sample which is assigned to the dimension region.
Definition: gig.h:369
uint16_t ReleaseTime
Release time.
Definition: gig.h:886
smpte_format_t
Society of Motion Pictures and Television E time format.
Definition: gig.h:100
uint32_t LoopStart
Caution: Use the respective field in the DimensionRegion instead of this one! (Intended purpose: The ...
Definition: gig.h:643
Loop forward (normal)
Definition: gig.h:94
double EG2Decay1
Decay time of the filter cutoff EG (0.000 - 60.000s).
Definition: gig.h:393
uint8_t EG1ControllerAttackInfluence
Amount EG1 Controller has influence on the EG1 Attack time (0 - 3, where 0 means off).
Definition: gig.h:381
unsigned long position
Current position within the sample.
Definition: gig.h:310
Only controlled by external foot controller.
Definition: gig.h:136
crossfade_t Crossfade
Definition: gig.h:439
Compression_t
Definition: gig.h:996
void DeleteSampleLoop(sample_loop_t *pLoopDef)
Deletes an existing sample loop.
Definition: DLS.cpp:655
smpte_format_t SMPTEFormat
Specifies the Society of Motion Pictures and Television E time format used in the following SMPTEOffs...
Definition: gig.h:638
double SampleAttenuation
Sample volume (calculated from DLS::Sampler::Gain)
Definition: gig.h:451
lfo3_ctrl_t
Defines how LFO3 is controlled by.
Definition: gig.h:124
Channel Key Pressure.
Definition: gig.h:228
RIFF List Chunk.
Definition: RIFF.h:302
Sustain Pedal (MIDI Controller 64)
Definition: gig.h:159
double EG1Decay2
Only if EG1InfiniteSustain == false: 2nd decay stage time of the sample amplitude EG (0...
Definition: gig.h:374
bool PianoReleaseMode
Definition: gig.h:1090
uint8_t BypassController
Controller to be used to bypass the sustain note.
Definition: gig.h:884
attenuation_ctrl_t AttenuationController
MIDI Controller which has influence on the volume level of the sample (or entire sample group)...
Definition: gig.h:444
static buffer_t InternalDecompressionBuffer
Buffer used for decompression as well as for truncation of 24 Bit -> 16 Bit samples.
Definition: gig.h:675
Pointer address and size of a buffer.
Definition: gig.h:81
uint8_t in_start
Start position of fade in.
Definition: gig.h:301
uint8_t Patterns
Number of alternator patterns.
Definition: gig.h:918
dimension_t dimension
Specifies which source (usually a MIDI controller) is associated with the dimension.
Definition: gig.h:271
bool Bypass
Global bypass: if enabled, this script shall not be executed by the sampler for any instrument...
Definition: gig.h:1007
Abstract base class which provides mandatory informations about sample players in general...
Definition: DLS.h:364
loop_type_t
Standard types of sample loops.
Definition: gig.h:93
range_t KeyRange
Key range for legato notes.
Definition: gig.h:887
Sustain Pedal (MIDI Controller 64)
Definition: gig.h:245
unsigned long SamplesInLastFrame
For compressed samples only: length of the last sample frame.
Definition: gig.h:680
bool EG2ControllerInvert
Invert values coming from defined EG2 controller.
Definition: gig.h:399
uint8_t Articulations
Number of articulations in the instrument.
Definition: gig.h:913
buffer_t()
Definition: gig.h:85
uint8_t VelSensitivity
How sensitive the velocity should be to the speed of the controller change.
Definition: gig.h:845
String Name
Arbitrary name of the script, which may be displayed i.e. in an instrument editor.
Definition: gig.h:1003
uint32_t DimensionRegions
Total number of DimensionRegions this Region contains, do not alter!
Definition: gig.h:745
std::string String
Definition: gig.h:71
bool MSDecode
Gigastudio flag: defines if Mid Side Recordings should be decoded.
Definition: gig.h:449
Key Velocity (this is the only dimension in gig2 where the ranges can exactly be defined).
Definition: gig.h:227
bool EG1InfiniteSustain
If true, instead of going into Decay2 phase, Decay1 level will be hold until note will be released...
Definition: gig.h:375
bool Compressed
If the sample wave is compressed (probably just interesting for instrument and sample editors...
Definition: gig.h:648
void SetFileName(const String &name)
You may call this method store a future file name, so you don&#39;t have to to pass it to the Save() call...
Definition: DLS.cpp:1683
General Purpose Controller 3 (Slider, MIDI Controller 18)
Definition: gig.h:243
uint32_t SampleLoops
Reflects the number of sample loops.
Definition: DLS.h:371
More poles than normal lowpass.
Definition: gig.h:281
virtual void Save(const String &Path, progress_t *pProgress=NULL)
Save changes to another file.
Definition: DLS.cpp:1787
uint16_t LFO2InternalDepth
Firm pitch of the filter cutoff LFO (0 - 1200 cents).
Definition: gig.h:404
uint16_t LFO1InternalDepth
Firm pitch of the sample amplitude LFO (0 - 1200 cents).
Definition: gig.h:385
The difference between none and none2 is unknown.
Definition: gig.h:153
Controlled internally and by external breath controller.
Definition: gig.h:147
float zone_size
Intended for internal usage: reflects the size of each zone (128/zones) for normal split types only...
Definition: gig.h:275
Only controlled by external breath controller.
Definition: gig.h:145
bool PitchTrack
If true: sample will be pitched according to the key position (this will be disabled for drums for ex...
Definition: gig.h:440
Encoding_t
Definition: gig.h:993
bool BypassUseController
If a controller should be used to bypass the sustain note.
Definition: gig.h:882
unsigned int Layers
Amount of defined layers (1 - 32). A value of 1 actually means no layering, a value > 1 means there i...
Definition: gig.h:747
void * pStart
Points to the beginning of the buffer.
Definition: gig.h:82
bool EG2InfiniteSustain
If true, instead of going into Decay2 phase, Decay1 level will be hold until note will be released...
Definition: gig.h:395
General Purpose Controller 4 (Slider, MIDI Controller 19)
Definition: gig.h:170
unsigned long SamplePos
For compressed samples only: stores the current position (in sample points).
Definition: gig.h:679
Group * pGroup
pointer to the Group this sample belongs to (always not-NULL)
Definition: gig.h:676
virtual ~MidiRule()
Definition: gig.h:819
Effect 4 Depth (MIDI Controller 94)
Definition: gig.h:256
Breath Controller (Coarse, MIDI Controller 2)
Definition: gig.h:236
uint8_t EG2ControllerAttackInfluence
Amount EG2 Controller has influence on the EG2 Attack time (0 - 3, where 0 means off).
Definition: gig.h:400
bool SelfMask
If true: high velocity notes will stop low velocity notes at the same note, with that you can save vo...
Definition: gig.h:443
int16_t LFO3ControlDepth
Controller depth of the sample pitch LFO (-1200 - +1200 cents).
Definition: gig.h:414
RIFF::Chunk * pCkSmpl
Definition: gig.h:686
Only controlled by external modulation wheel.
Definition: gig.h:144
double EG3Attack
Attack time of the sample pitch EG (0.000 - 10.000s).
Definition: gig.h:410
uint8_t LegatoSamples
Number of legato samples per key in each direction (always 12)
Definition: gig.h:881
uint8_t out_end
End postition of fade out.
Definition: gig.h:304
double EG2Attack
Attack time of the filter cutoff EG (0.000 - 60.000s).
Definition: gig.h:392
bool InvertAttenuationController
Inverts the values coming from the defined Attenuation Controller.
Definition: gig.h:445
double LFO1Frequency
Frequency of the sample amplitude LFO (0.10 - 10.00 Hz).
Definition: gig.h:384
Ordinary RIFF Chunk.
Definition: RIFF.h:205
uint32_t LoopID
Specifies the unique ID that corresponds to one of the defined cue points in the cue point list (only...
Definition: gig.h:641
uint16_t EffectSend
Definition: gig.h:1087
bool LFO1FlipPhase
Inverts phase of the sample amplitude LFO wave.
Definition: gig.h:388
uint8_t AltSustain1Key
Key triggering alternate sustain samples.
Definition: gig.h:889
int16_t FineTune
in cents
Definition: gig.h:1088
uint8_t UnityNote
Definition: DLS.h:366
Effect 5 Depth (MIDI Controller 95)
Definition: gig.h:257
bool LFO3Sync
If set to true only one LFO should be used for all voices.
Definition: gig.h:416
uint32_t MIDIProgram
Specifies the MIDI Program Change Number this Instrument should be assigned to.
Definition: DLS.h:465
double LFO3Frequency
Frequency of the sample pitch LFO (0.10 - 10.00 Hz).
Definition: gig.h:412
static const DLS::version_t VERSION_3
Reflects Gigasampler file format version 3.0 (2003-03-31).
Definition: gig.h:1213
Soft Pedal (MIDI Controller 67)
Definition: gig.h:248
uint32_t Product
Specifies the MIDI model ID defined by the manufacturer corresponding to the Manufacturer field...
Definition: gig.h:634
bool LFO1Sync
If set to true only one LFO should be used for all voices.
Definition: gig.h:389
split_type_t
Intended for internal usage: will be used to convert a dimension value into the corresponding dimensi...
Definition: gig.h:264
Alternating loop (forward/backward, also known as Ping Pong)
Definition: gig.h:95
unsigned long loop_cycles_left
How many times the loop has still to be passed, this value will be decremented with each loop cycle...
Definition: gig.h:312
leverage_ctrl_t eg2_ctrl_t
Defines controller influencing envelope generator 2.
Definition: gig.h:214
uint8_t EG2ControllerReleaseInfluence
Amount EG2 Controller has influence on the EG2 Release time (0 - 3, where 0 means off)...
Definition: gig.h:402
Used for indicating the progress of a certain task.
Definition: RIFF.h:191
uint16_t EG2PreAttack
Preattack value of the filter cutoff EG (0 - 1000 permille).
Definition: gig.h:391
leverage_ctrl_t attenuation_ctrl_t
Defines controller influencing attenuation.
Definition: gig.h:200
uint32_t Loops
Caution: Use the respective field in the DimensionRegion instead of this one! (Intended purpose: Numb...
Definition: gig.h:640
String Name
Name of the pattern.
Definition: gig.h:920
bool LFO2Sync
If set to true only one LFO should be used for all voices.
Definition: gig.h:408
uint32_t SMPTEOffset
The SMPTE Offset value specifies the time offset to be used for the synchronization / calibration to ...
Definition: gig.h:639
unsigned long FileNo
File number (> 0 when sample is stored in an extension file, 0 when it&#39;s in the gig) ...
Definition: gig.h:684
bool EG1ControllerInvert
Invert values coming from defined EG1 controller.
Definition: gig.h:380
30 frames per second with frame dropping (30 drop)
Definition: gig.h:104
vcf_res_ctrl_t
Defines how the filter resonance is controlled by.
Definition: gig.h:167
vcf_type_t
Defines which frequencies are filtered by the VCF.
Definition: gig.h:279
General Purpose Controller 5 (Button, MIDI Controller 80)
Definition: gig.h:249
version_t * pVersion
Points to a version_t structure if the file provided a version number else is set to NULL...
Definition: DLS.h:498
uint16_t LFO2ControlDepth
Controller depth influencing filter cutoff LFO pitch (0 - 1200).
Definition: gig.h:405
String Name
Name of this script group. For example to be displayed in an instrument editor.
Definition: gig.h:1040
Loop backward (reverse)
Definition: gig.h:96
int16_t EG3Depth
Depth of the sample pitch EG (-1200 - +1200).
Definition: gig.h:411
uint8_t VCFKeyboardTrackingBreakpoint
See VCFKeyboardTracking (0 - 127).
Definition: gig.h:430
eg2_ctrl_t EG2Controller
MIDI Controller which has influence on filter cutoff EG parameters (attack, decay, release).
Definition: gig.h:398
For layering of up to 8 instruments (and eventually crossfading of 2 or 4 layers).
Definition: gig.h:226
bool VCFCutoffControllerInvert
Inverts values coming from the defined cutoff controller.
Definition: gig.h:421
General Purpose Controller 7 (Button, MIDI Controller 82)
Definition: gig.h:161
Controlled internally and by external foot controller.
Definition: gig.h:138
Different samples triggered each time a note is played, random order.
Definition: gig.h:232
double EG2Release
Release time of the filter cutoff EG (0.000 - 60.000s).
Definition: gig.h:397
uint8_t EG1ControllerReleaseInfluence
Amount EG1 Controller has influence on the EG1 Release time (0 - 3, where 0 means off)...
Definition: gig.h:383
uint8_t EG2ControllerDecayInfluence
Amount EG2 Controller has influence on the EG2 Decay time (0 - 3, where 0 means off).
Definition: gig.h:401
bool Polyphonic
If alternator should step forward only when all notes are off.
Definition: gig.h:941
Abstract base class for all MIDI rules.
Definition: gig.h:817
General Purpose Controller 2 (Slider, MIDI Controller 17)
Definition: gig.h:242
dimension_t
Defines the type of dimension, that is how the dimension zones (and thus how the dimension regions ar...
Definition: gig.h:223
uint32_t LoopEnd
Caution: Use the respective field in the DimensionRegion instead of this one! (Intended purpose: The ...
Definition: gig.h:644
Defines the envelope of a crossfade.
Definition: gig.h:294
uint8_t MIDIBankFine
Reflects the MIDI Bank number for MIDI Control Change 32 (bank 1 - 128).
Definition: DLS.h:464
curve_type_t ReleaseVelocityResponseCurve
Defines a transformation curve to the incoming release veloctiy values affecting envelope times...
Definition: gig.h:435
Different samples triggered each time a note is played, dimension regions selected in sequence...
Definition: gig.h:231
uint8_t zones
Number of zones the dimension has.
Definition: gig.h:273
Effect 5 Depth (MIDI Controller 95)
Definition: gig.h:120
General Purpose Controller 3 (Slider, MIDI Controller 18)
Definition: gig.h:169
uint8_t & operator[](int i)
Definition: gig.h:925
General Purpose Controller 8 (Button, MIDI Controller 83)
Definition: gig.h:162
uint8_t AttenuationControllerThreshold
0-127
Definition: gig.h:446
vcf_cutoff_ctrl_t
Defines how the filter cutoff frequency is controlled by.
Definition: gig.h:151
Encapsulates sample waves of Gigasampler/GigaStudio files used for playback.
Definition: gig.h:631
RIFF File.
Definition: RIFF.h:351
General Purpose Controller 8 (Button, MIDI Controller 83)
Definition: gig.h:252
unsigned long GuessSize(unsigned long samples)
Definition: gig.h:693
dimension value between 0-127
Definition: gig.h:265
24 frames per second
Definition: gig.h:102
Modulation Wheel (MIDI Controller 1)
Definition: gig.h:154
int16_t LFO3InternalDepth
Firm depth of the sample pitch LFO (-1200 - +1200 cents).
Definition: gig.h:413
General Purpose Controller 5 (Button, MIDI Controller 80)
Definition: gig.h:171
Lower and upper limit of a range.
Definition: gig.h:75
General Purpose Controller 1 (Slider, MIDI Controller 16)
Definition: gig.h:241
double EG2Decay2
Only if EG2InfiniteSustain == false: 2nd stage decay time of the filter cutoff EG (0...
Definition: gig.h:394
Portamento Time (Coarse, MIDI Controller 5)
Definition: gig.h:238
int32_t Attenuation
in dB
Definition: gig.h:1086
Encapsulates sample waves used for playback.
Definition: DLS.h:395
type_t type
Controller type.
Definition: gig.h:191
uint controller_number
MIDI controller number if this controller is a control change controller, 0 otherwise.
Definition: gig.h:192
uint8_t * VelocityTable
For velocity dimensions with custom defined zone ranges only: used for fast converting from velocity ...
Definition: gig.h:483
curve_type_t VelocityResponseCurve
Defines a transformation curve to the incoming velocity values affecting amplitude (usually you don&#39;t...
Definition: gig.h:432
Effect Controller 2 (Coarse, MIDI Controller 13)
Definition: gig.h:240
A MIDI rule not yet implemented by libgig.
Definition: gig.h:964
Foot Pedal (Coarse, MIDI Controller 4)
Definition: gig.h:237
uint16_t EG1Sustain
Sustain value of the sample amplitude EG (0 - 1000 permille).
Definition: gig.h:376
String GetFileName()
File name of this DLS file.
Definition: DLS.cpp:1675
Real-time instrument script (gig format extension).
Definition: gig.h:991
unsigned long NullExtensionSize
The buffer might be bigger than the actual data, if that&#39;s the case that unused space at the end of t...
Definition: gig.h:84
General Purpose Controller 6 (Button, MIDI Controller 81)
Definition: gig.h:172
Gigasampler/GigaStudio specific classes and definitions.
Definition: gig.h:69
uint8_t TriggerPoint
The CC value to pass for the note to be triggered.
Definition: gig.h:843
uint8_t VelocityResponseDepth
Dynamic range of velocity affecting amplitude (0 - 4) (usually you don&#39;t have to interpret this param...
Definition: gig.h:433
uint32_t LoopFraction
The fractional value specifies a fraction of a sample at which to loop. This allows a loop to be fine...
Definition: gig.h:646
RIFF::progress_t progress_t
Definition: gig.h:72
uint32_t TruncatedBits
For 24-bit compressed samples only: number of bits truncated during compression (0, 4 or 6)
Definition: gig.h:649
Resource * GetParent()
Definition: DLS.h:350
Group of instrument scripts (gig format extension).
Definition: gig.h:1038
Language_t
Definition: gig.h:999
int8_t Pan
Panorama / Balance (-64..0..63 <-> left..middle..right)
Definition: gig.h:442
Provides convenient access to Gigasampler/GigaStudio .gig files.
Definition: gig.h:1210
Only internally controlled.
Definition: gig.h:143
lfo2_ctrl_t
Defines how LFO2 is controlled by.
Definition: gig.h:133
Effect 3 Depth (MIDI Controller 93)
Definition: gig.h:255
Dimension for keyswitching.
Definition: gig.h:230
MIDI rule for instruments with legato samples.
Definition: gig.h:879
leverage_ctrl_t eg1_ctrl_t
Defines controller influencing envelope generator 1.
Definition: gig.h:207
uint16_t EG2Sustain
Sustain value of the filter cutoff EG (0 - 1000 permille).
Definition: gig.h:396
dlsid_t * pDLSID
Points to a dlsid_t structure if the file provided a DLS ID else is NULL.
Definition: DLS.h:348
uint32_t Instruments
Reflects the number of available Instrument objects.
Definition: DLS.h:499
Provides all neccessary information for the synthesis of a DLS Instrument.
Definition: DLS.h:459
Provides access to a Gigasampler/GigaStudio instrument.
Definition: gig.h:1073
bool SustainDefeat
If true: Sustain pedal will not hold a note.
Definition: gig.h:448
Encoding_t Encoding
Format the script&#39;s source code text is encoded with.
Definition: gig.h:1005
buffer_t RAMCache
Buffers samples (already uncompressed) in RAM.
Definition: gig.h:683
bool NoteOff
If a note off should be triggered instead of a note on.
Definition: gig.h:847
String libraryName()
Returns the name of this C++ library.
Definition: gig.cpp:6094
int32_t Gain
Definition: DLS.h:368
Controlled internally and by external modulation wheel.
Definition: gig.h:146
Quadtuple version number ("major.minor.release.build").
Definition: DLS.h:110
double LFO2Frequency
Frequency of the filter cutoff LFO (0.10 - 10.00 Hz).
Definition: gig.h:403
uint32_t SamplePeriod
Specifies the duration of time that passes during the playback of one sample in nanoseconds (normally...
Definition: gig.h:635
uint16_t EG1PreAttack
Preattack value of the sample amplitude EG (0 - 1000 permille).
Definition: gig.h:371
Dimension not in use.
Definition: gig.h:224
unsigned long * FrameTable
For positioning within compressed samples only: stores the offset values for each frame...
Definition: gig.h:678
curve_type_t
Defines the shape of a function graph.
Definition: gig.h:109
uint8_t bits
Number of "bits" (1 bit = 2 splits/zones, 2 bit = 4 splits/zones, 3 bit = 8 splits/zones,...).
Definition: gig.h:272
selector_t Selector
Method by which pattern is chosen.
Definition: gig.h:937
uint8_t out_start
Start position of fade out.
Definition: gig.h:303
uint8_t VCFCutoff
Max. cutoff frequency.
Definition: gig.h:422
Info * pInfo
Points (in any case) to an Info object, providing additional, optional infos and comments.
Definition: DLS.h:347
uint32_t Manufacturer
Specifies the MIDI Manufacturer&#39;s Association (MMA) Manufacturer code for the sampler intended to rec...
Definition: gig.h:633
uint8_t high
High value of range.
Definition: gig.h:77
bool OverridePedal
If a note off should be triggered even if the sustain pedal is down.
Definition: gig.h:849
MIDI rule to automatically cycle through specified sequences of different articulations.
Definition: gig.h:911
Reflects the current playback state for a sample.
Definition: gig.h:309
General dimension definition.
Definition: gig.h:270
int Size
Number of steps in the pattern.
Definition: gig.h:921
eg1_ctrl_t EG1Controller
MIDI Controller which has influence on sample amplitude EG parameters (attack, decay, release).
Definition: gig.h:379
Sostenuto Pedal (MIDI Controller 66)
Definition: gig.h:247
split_type_t split_type
Intended for internal usage: will be used to convert a dimension value into the corresponding dimensi...
Definition: gig.h:274
If used sample has more than one channel (thus is not mono).
Definition: gig.h:225
dim_bypass_ctrl_t
Dimensions allow to bypass one of the following controllers.
Definition: gig.h:117
vcf_res_ctrl_t VCFResonanceController
Specifies which external controller has influence on the filter resonance Q.
Definition: gig.h:428
curve_type_t VCFVelocityCurve
Defines a transformation curve for the incoming velocity values, affecting the VCF.
Definition: gig.h:423
uint8_t EG1ControllerDecayInfluence
Amount EG1 Controller has influence on the EG1 Decay time (0 - 3, where 0 means off).
Definition: gig.h:382
Defines Region information of an Instrument.
Definition: DLS.h:429
Effect 4 Depth (MIDI Controller 94)
Definition: gig.h:119
General Purpose Controller 7 (Button, MIDI Controller 82)
Definition: gig.h:251
double EG1Attack
Attack time of the sample amplitude EG (0.000 - 60.000s).
Definition: gig.h:372
bool IsDrum
Indicates if the Instrument is a drum type, as they differ in the synthesis model of DLS from melodic...
Definition: DLS.h:461
void AddSampleLoop(sample_loop_t *pLoopDef)
Adds a new sample loop with the provided loop definition.
Definition: DLS.cpp:633