/[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 3169 by schoenebeck, Wed May 10 21:17:10 2017 UTC revision 3324 by schoenebeck, Fri Jul 21 13:05:39 2017 UTC
# Line 39  Line 39 
39  #endif  #endif
40  #if HAVE_RTTI  #if HAVE_RTTI
41  # include <typeinfo>  # include <typeinfo>
42    #else
43    # warning No RTTI available!
44  #endif  #endif
45    
46  #if WORDS_BIGENDIAN  #if WORDS_BIGENDIAN
# Line 59  Line 61 
61  # define CHUNK_ID_SCRI  0x53637269 // own gig format extension  # define CHUNK_ID_SCRI  0x53637269 // own gig format extension
62  # define CHUNK_ID_LSNM  0x4c534e4d // own gig format extension  # define CHUNK_ID_LSNM  0x4c534e4d // own gig format extension
63  # define CHUNK_ID_SCSL  0x5343534c // own gig format extension  # define CHUNK_ID_SCSL  0x5343534c // own gig format extension
64    # define CHUNK_ID_LSDE  0x4c534445 // own gig format extension
65  #else  // little endian  #else  // little endian
66  # define LIST_TYPE_3PRG 0x67727033  # define LIST_TYPE_3PRG 0x67727033
67  # define LIST_TYPE_3EWL 0x6C776533  # define LIST_TYPE_3EWL 0x6C776533
# Line 77  Line 80 
80  # define CHUNK_ID_SCRI  0x69726353 // own gig format extension  # define CHUNK_ID_SCRI  0x69726353 // own gig format extension
81  # define CHUNK_ID_LSNM  0x4d4e534c // own gig format extension  # define CHUNK_ID_LSNM  0x4d4e534c // own gig format extension
82  # define CHUNK_ID_SCSL  0x4c534353 // own gig format extension  # define CHUNK_ID_SCSL  0x4c534353 // own gig format extension
83    # define CHUNK_ID_LSDE  0x4544534c // own gig format extension
84  #endif // WORDS_BIGENDIAN  #endif // WORDS_BIGENDIAN
85    
86  #ifndef GIG_DECLARE_ENUM  #ifndef GIG_DECLARE_ENUM
# Line 113  namespace gig { Line 117  namespace gig {
117    
118      /** Standard types of sample loops.      /** Standard types of sample loops.
119       *       *
120       * @see countEnum(), enumKey(), enumKeys(), enumValue()       * @see enumCount(), enumKey(), enumKeys(), enumValue()
121       */       */
122      GIG_DECLARE_ENUM(loop_type_t,      GIG_DECLARE_ENUM(loop_type_t,
123          loop_type_normal        = 0x00000000,  ///< Loop forward (normal)          loop_type_normal        = 0x00000000,  ///< Loop forward (normal)
# Line 123  namespace gig { Line 127  namespace gig {
127    
128      /** Society of Motion Pictures and Television E time format.      /** Society of Motion Pictures and Television E time format.
129       *       *
130       * @see countEnum(), enumKey(), enumKeys(), enumValue()       * @see enumCount(), enumKey(), enumKeys(), enumValue()
131       */       */
132      GIG_DECLARE_ENUM(smpte_format_t,      GIG_DECLARE_ENUM(smpte_format_t,
133          smpte_format_no_offset          = 0x00000000,  ///< no SMPTE offset          smpte_format_no_offset          = 0x00000000,  ///< no SMPTE offset
# Line 135  namespace gig { Line 139  namespace gig {
139    
140      /** Defines the shape of a function graph.      /** Defines the shape of a function graph.
141       *       *
142       * @see countEnum(), enumKey(), enumKeys(), enumValue()       * @see enumCount(), enumKey(), enumKeys(), enumValue()
143       */       */
144      GIG_DECLARE_ENUM(curve_type_t,      GIG_DECLARE_ENUM(curve_type_t,
145          curve_type_nonlinear = 0,          curve_type_nonlinear = 0,
# Line 146  namespace gig { Line 150  namespace gig {
150    
151      /** Dimensions allow to bypass one of the following controllers.      /** Dimensions allow to bypass one of the following controllers.
152       *       *
153       * @see countEnum(), enumKey(), enumKeys(), enumValue()       * @see enumCount(), enumKey(), enumKeys(), enumValue()
154       */       */
155      GIG_DECLARE_ENUM(dim_bypass_ctrl_t,      GIG_DECLARE_ENUM(dim_bypass_ctrl_t,
156          dim_bypass_ctrl_none,          dim_bypass_ctrl_none,
# Line 156  namespace gig { Line 160  namespace gig {
160    
161      /** Defines how LFO3 is controlled by.      /** Defines how LFO3 is controlled by.
162       *       *
163       * @see countEnum(), enumKey(), enumKeys(), enumValue()       * @see enumCount(), enumKey(), enumKeys(), enumValue()
164       */       */
165      GIG_DECLARE_ENUM(lfo3_ctrl_t,      GIG_DECLARE_ENUM(lfo3_ctrl_t,
166          lfo3_ctrl_internal            = 0x00, ///< Only internally controlled.          lfo3_ctrl_internal            = 0x00, ///< Only internally controlled.
# Line 168  namespace gig { Line 172  namespace gig {
172    
173      /** Defines how LFO2 is controlled by.      /** Defines how LFO2 is controlled by.
174       *       *
175       * @see countEnum(), enumKey(), enumKeys(), enumValue()       * @see enumCount(), enumKey(), enumKeys(), enumValue()
176       */       */
177      GIG_DECLARE_ENUM(lfo2_ctrl_t,      GIG_DECLARE_ENUM(lfo2_ctrl_t,
178          lfo2_ctrl_internal            = 0x00, ///< Only internally controlled.          lfo2_ctrl_internal            = 0x00, ///< Only internally controlled.
# Line 180  namespace gig { Line 184  namespace gig {
184    
185      /** Defines how LFO1 is controlled by.      /** Defines how LFO1 is controlled by.
186       *       *
187       * @see countEnum(), enumKey(), enumKeys(), enumValue()       * @see enumCount(), enumKey(), enumKeys(), enumValue()
188       */       */
189      GIG_DECLARE_ENUM(lfo1_ctrl_t,      GIG_DECLARE_ENUM(lfo1_ctrl_t,
190          lfo1_ctrl_internal            = 0x00, ///< Only internally controlled.          lfo1_ctrl_internal            = 0x00, ///< Only internally controlled.
# Line 192  namespace gig { Line 196  namespace gig {
196    
197      /** Defines how the filter cutoff frequency is controlled by.      /** Defines how the filter cutoff frequency is controlled by.
198       *       *
199       * @see countEnum(), enumKey(), enumKeys(), enumValue()       * @see enumCount(), enumKey(), enumKeys(), enumValue()
200       */       */
201      GIG_DECLARE_ENUM(vcf_cutoff_ctrl_t,      GIG_DECLARE_ENUM(vcf_cutoff_ctrl_t,
202          vcf_cutoff_ctrl_none         = 0x00,          vcf_cutoff_ctrl_none         = 0x00,
# Line 211  namespace gig { Line 215  namespace gig {
215    
216      /** Defines how the filter resonance is controlled by.      /** Defines how the filter resonance is controlled by.
217       *       *
218       * @see countEnum(), enumKey(), enumKeys(), enumValue()       * @see enumCount(), enumKey(), enumKeys(), enumValue()
219       */       */
220      GIG_DECLARE_ENUM(vcf_res_ctrl_t,      GIG_DECLARE_ENUM(vcf_res_ctrl_t,
221          vcf_res_ctrl_none        = 0xffffffff,          vcf_res_ctrl_none        = 0xffffffff,
# Line 232  namespace gig { Line 236  namespace gig {
236      struct leverage_ctrl_t {      struct leverage_ctrl_t {
237          /** Defines possible controllers.          /** Defines possible controllers.
238           *           *
239           * @see countEnum(), enumKey(), enumKeys(), enumValue()           * @see enumCount(), enumKey(), enumKeys(), enumValue()
240           */           */
241          GIG_DECLARE_ENUM(type_t,          GIG_DECLARE_ENUM(type_t,
242              type_none              = 0x00, ///< No controller defined              type_none              = 0x00, ///< No controller defined
# Line 275  namespace gig { Line 279  namespace gig {
279       * to 32 zones (except the layer dimension with only up to 8 zones and       * to 32 zones (except the layer dimension with only up to 8 zones and
280       * the samplechannel dimension which currently allows only 2 zones).       * the samplechannel dimension which currently allows only 2 zones).
281       *       *
282       * @see countEnum(), enumKey(), enumKeys(), enumValue()       * @see enumCount(), enumKey(), enumKeys(), enumValue()
283       */       */
284      GIG_DECLARE_ENUM(dimension_t,      GIG_DECLARE_ENUM(dimension_t,
285          dimension_none              = 0x00, ///< Dimension not in use.          dimension_none              = 0x00, ///< Dimension not in use.
# Line 318  namespace gig { Line 322  namespace gig {
322       * Intended for internal usage: will be used to convert a dimension value       * Intended for internal usage: will be used to convert a dimension value
323       * into the corresponding dimension bit number.       * into the corresponding dimension bit number.
324       *       *
325       * @see countEnum(), enumKey(), enumKeys(), enumValue()       * @see enumCount(), enumKey(), enumKeys(), enumValue()
326       */       */
327      GIG_DECLARE_ENUM(split_type_t,      GIG_DECLARE_ENUM(split_type_t,
328          split_type_normal,         ///< dimension value between 0-127          split_type_normal,         ///< dimension value between 0-127
# Line 336  namespace gig { Line 340  namespace gig {
340    
341      /** Defines which frequencies are filtered by the VCF.      /** Defines which frequencies are filtered by the VCF.
342       *       *
343       * @see countEnum(), enumKey(), enumKeys(), enumValue()       * @see enumCount(), enumKey(), enumKeys(), enumValue()
344       */       */
345      GIG_DECLARE_ENUM(vcf_type_t,      GIG_DECLARE_ENUM(vcf_type_t,
346          vcf_type_lowpass      = 0x00,          vcf_type_lowpass      = 0x00,
# Line 376  namespace gig { Line 380  namespace gig {
380          file_offset_t loop_cycles_left;  ///< How many times the loop has still to be passed, this value will be decremented with each loop cycle.          file_offset_t loop_cycles_left;  ///< How many times the loop has still to be passed, this value will be decremented with each loop cycle.
381      };      };
382    
383        /**
384         * Defines behavior options for envelope generators (gig format extension).
385         *
386         * These options allow to override the precise default behavior of the
387         * envelope generators' state machines.
388         *
389         * @b Note: These EG options are an extension to the original gig file
390         * format, so these options are not available with the original
391         * Gigasampler/GigaStudio software! Currently only LinuxSampler and gigedit
392         * support these EG options!
393         *
394         * Adding these options to the original gig file format was necessary,
395         * because the precise state machine behavior of envelope generators of the
396         * gig format (and thus the default EG behavior if not explicitly overridden
397         * here) deviates from common, expected behavior of envelope generators in
398         * general, if i.e. compared with EGs of hardware synthesizers. For example
399         * with the gig format, the attack and decay stages will be aborted as soon
400         * as a note-off is received. Most other EG implementations in the industry
401         * however always run the attack and decay stages to their full duration,
402         * even if an early note-off arrives. The latter behavior is intentionally
403         * implemented in most other products, because it is required to resemble
404         * percussive sounds in a realistic manner.
405         */
406        struct eg_opt_t {
407            bool AttackCancel;     ///< Whether the "attack" stage is cancelled when receiving a note-off (default: @c true).
408            bool AttackHoldCancel; ///< Whether the "attack hold" stage is cancelled when receiving a note-off (default: @c true).
409            bool Decay1Cancel;     ///< Whether the "decay 1" stage is cancelled when receiving a note-off (default: @c true).
410            bool Decay2Cancel;     ///< Whether the "decay 2" stage is cancelled when receiving a note-off (default: @c true).
411            bool ReleaseCancel;    ///< Whether the "release" stage is cancelled when receiving a note-on (default: @c true).
412    
413            eg_opt_t();
414            void serialize(Serialization::Archive* archive);
415        };
416    
417      // just symbol prototyping      // just symbol prototyping
418      class File;      class File;
419      class Instrument;      class Instrument;
# Line 514  namespace gig { Line 552  namespace gig {
552              uint16_t           SampleStartOffset;             ///< Number of samples the sample start should be moved (0 - 2000).              uint16_t           SampleStartOffset;             ///< Number of samples the sample start should be moved (0 - 2000).
553              double             SampleAttenuation;             ///< Sample volume (calculated from DLS::Sampler::Gain)              double             SampleAttenuation;             ///< Sample volume (calculated from DLS::Sampler::Gain)
554              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).
555                eg_opt_t           EGOptions;                     ///< [gig extension]: Behavior options which should be used for all 3 envelope generators.
556    
557              // derived attributes from DLS::Sampler              // derived attributes from DLS::Sampler
558              using DLS::Sampler::UnityNote;              using DLS::Sampler::UnityNote;
# Line 1363  namespace gig { Line 1402  namespace gig {
1402       */       */
1403      class Exception : public DLS::Exception {      class Exception : public DLS::Exception {
1404          public:          public:
1405              Exception(String Message);              Exception(String format, ...);
1406                Exception(String format, va_list arg);
1407              void PrintMessage();              void PrintMessage();
1408            protected:
1409                Exception();
1410      };      };
1411    
1412  #if HAVE_RTTI  #if HAVE_RTTI
1413      size_t countEnum(const std::type_info& type);      size_t enumCount(const std::type_info& type);
     size_t countEnum(String typeName);  
1414      const char* enumKey(const std::type_info& type, size_t value);      const char* enumKey(const std::type_info& type, size_t value);
     const char* enumKey(String typeName, size_t value);  
1415      bool        enumKey(const std::type_info& type, String key);      bool        enumKey(const std::type_info& type, String key);
     bool        enumKey(String typeName, String key);  
1416      const char** enumKeys(const std::type_info& type);      const char** enumKeys(const std::type_info& type);
1417    #endif // HAVE_RTTI
1418        size_t enumCount(String typeName);
1419        const char* enumKey(String typeName, size_t value);
1420        bool        enumKey(String typeName, String key);
1421      const char** enumKeys(String typeName);      const char** enumKeys(String typeName);
1422      size_t enumValue(String key);      size_t enumValue(String key);
 #endif // HAVE_RTTI  
1423    
1424      String libraryName();      String libraryName();
1425      String libraryVersion();      String libraryVersion();

Legend:
Removed from v.3169  
changed lines
  Added in v.3324

  ViewVC Help
Powered by ViewVC