/[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 2989 by schoenebeck, Sat Sep 24 14:00:46 2016 UTC revision 3181 by schoenebeck, Sun May 14 17:08:42 2017 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-2016 by Christian Schoenebeck                      *   *   Copyright (C) 2003-2017 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 27  Line 27 
27  #include "DLS.h"  #include "DLS.h"
28  #include <vector>  #include <vector>
29    
30    #ifndef __has_feature
31    # define __has_feature(x) 0
32    #endif
33    #ifndef HAVE_RTTI
34    # if __GXX_RTTI || __has_feature(cxx_rtti) || _CPPRTTI
35    #  define HAVE_RTTI 1
36    # else
37    #  define HAVE_RTTI 0
38    # endif
39    #endif
40    #if HAVE_RTTI
41    # include <typeinfo>
42    #else
43    # warning No RTTI available!
44    #endif
45    
46  #if WORDS_BIGENDIAN  #if WORDS_BIGENDIAN
47  # define LIST_TYPE_3PRG 0x33707267  # define LIST_TYPE_3PRG 0x33707267
48  # define LIST_TYPE_3EWL 0x3365776C  # define LIST_TYPE_3EWL 0x3365776C
# Line 65  Line 81 
81  # define CHUNK_ID_SCSL  0x4c534353 // own gig format extension  # define CHUNK_ID_SCSL  0x4c534353 // own gig format extension
82  #endif // WORDS_BIGENDIAN  #endif // WORDS_BIGENDIAN
83    
84    #ifndef GIG_DECLARE_ENUM
85    # define GIG_DECLARE_ENUM(type, ...) enum type { __VA_ARGS__ }
86    #endif
87    
88    // just symbol prototyping (since Serialization.h not included by default here)
89    namespace Serialization { class Archive; }
90    
91  /** Gigasampler/GigaStudio specific classes and definitions */  /** Gigasampler/GigaStudio specific classes and definitions */
92  namespace gig {  namespace gig {
93    
# Line 90  namespace gig { Line 113  namespace gig {
113          }          }
114      };      };
115    
116      /** Standard types of sample loops. */      /** Standard types of sample loops.
117      typedef enum {       *
118         * @see enumCount(), enumKey(), enumKeys(), enumValue()
119         */
120        GIG_DECLARE_ENUM(loop_type_t,
121          loop_type_normal        = 0x00000000,  ///< Loop forward (normal)          loop_type_normal        = 0x00000000,  ///< Loop forward (normal)
122          loop_type_bidirectional = 0x00000001,  ///< Alternating loop (forward/backward, also known as Ping Pong)          loop_type_bidirectional = 0x00000001,  ///< Alternating loop (forward/backward, also known as Ping Pong)
123          loop_type_backward      = 0x00000002   ///< Loop backward (reverse)          loop_type_backward      = 0x00000002   ///< Loop backward (reverse)
124      } loop_type_t;      );
125    
126      /** Society of Motion Pictures and Television E time format. */      /** Society of Motion Pictures and Television E time format.
127      typedef enum {       *
128         * @see enumCount(), enumKey(), enumKeys(), enumValue()
129         */
130        GIG_DECLARE_ENUM(smpte_format_t,
131          smpte_format_no_offset          = 0x00000000,  ///< no SMPTE offset          smpte_format_no_offset          = 0x00000000,  ///< no SMPTE offset
132          smpte_format_24_frames          = 0x00000018,  ///< 24 frames per second          smpte_format_24_frames          = 0x00000018,  ///< 24 frames per second
133          smpte_format_25_frames          = 0x00000019,  ///< 25 frames per second          smpte_format_25_frames          = 0x00000019,  ///< 25 frames per second
134          smpte_format_30_frames_dropping = 0x0000001D,  ///< 30 frames per second with frame dropping (30 drop)          smpte_format_30_frames_dropping = 0x0000001D,  ///< 30 frames per second with frame dropping (30 drop)
135          smpte_format_30_frames          = 0x0000001E   ///< 30 frames per second          smpte_format_30_frames          = 0x0000001E   ///< 30 frames per second
136      } smpte_format_t;      );
137    
138      /** Defines the shape of a function graph. */      /** Defines the shape of a function graph.
139      typedef enum {       *
140         * @see enumCount(), enumKey(), enumKeys(), enumValue()
141         */
142        GIG_DECLARE_ENUM(curve_type_t,
143          curve_type_nonlinear = 0,          curve_type_nonlinear = 0,
144          curve_type_linear    = 1,          curve_type_linear    = 1,
145          curve_type_special   = 2,          curve_type_special   = 2,
146          curve_type_unknown   = 0xffffffff          curve_type_unknown   = 0xffffffff
147      } curve_type_t;      );
148    
149      /** Dimensions allow to bypass one of the following controllers. */      /** Dimensions allow to bypass one of the following controllers.
150      typedef enum {       *
151         * @see enumCount(), enumKey(), enumKeys(), enumValue()
152         */
153        GIG_DECLARE_ENUM(dim_bypass_ctrl_t,
154          dim_bypass_ctrl_none,          dim_bypass_ctrl_none,
155          dim_bypass_ctrl_94,   ///< Effect 4 Depth (MIDI Controller 94)          dim_bypass_ctrl_94,   ///< Effect 4 Depth (MIDI Controller 94)
156          dim_bypass_ctrl_95    ///< Effect 5 Depth (MIDI Controller 95)          dim_bypass_ctrl_95    ///< Effect 5 Depth (MIDI Controller 95)
157      } dim_bypass_ctrl_t;      );
158    
159      /** Defines how LFO3 is controlled by. */      /** Defines how LFO3 is controlled by.
160      typedef enum {       *
161         * @see enumCount(), enumKey(), enumKeys(), enumValue()
162         */
163        GIG_DECLARE_ENUM(lfo3_ctrl_t,
164          lfo3_ctrl_internal            = 0x00, ///< Only internally controlled.          lfo3_ctrl_internal            = 0x00, ///< Only internally controlled.
165          lfo3_ctrl_modwheel            = 0x01, ///< Only controlled by external modulation wheel.          lfo3_ctrl_modwheel            = 0x01, ///< Only controlled by external modulation wheel.
166          lfo3_ctrl_aftertouch          = 0x02, ///< Only controlled by aftertouch controller.          lfo3_ctrl_aftertouch          = 0x02, ///< Only controlled by aftertouch controller.
167          lfo3_ctrl_internal_modwheel   = 0x03, ///< Controlled internally and by external modulation wheel.          lfo3_ctrl_internal_modwheel   = 0x03, ///< Controlled internally and by external modulation wheel.
168          lfo3_ctrl_internal_aftertouch = 0x04  ///< Controlled internally and by aftertouch controller.          lfo3_ctrl_internal_aftertouch = 0x04  ///< Controlled internally and by aftertouch controller.
169      } lfo3_ctrl_t;      );
170    
171      /** Defines how LFO2 is controlled by. */      /** Defines how LFO2 is controlled by.
172      typedef enum {       *
173         * @see enumCount(), enumKey(), enumKeys(), enumValue()
174         */
175        GIG_DECLARE_ENUM(lfo2_ctrl_t,
176          lfo2_ctrl_internal            = 0x00, ///< Only internally controlled.          lfo2_ctrl_internal            = 0x00, ///< Only internally controlled.
177          lfo2_ctrl_modwheel            = 0x01, ///< Only controlled by external modulation wheel.          lfo2_ctrl_modwheel            = 0x01, ///< Only controlled by external modulation wheel.
178          lfo2_ctrl_foot                = 0x02, ///< Only controlled by external foot controller.          lfo2_ctrl_foot                = 0x02, ///< Only controlled by external foot controller.
179          lfo2_ctrl_internal_modwheel   = 0x03, ///< Controlled internally and by external modulation wheel.          lfo2_ctrl_internal_modwheel   = 0x03, ///< Controlled internally and by external modulation wheel.
180          lfo2_ctrl_internal_foot       = 0x04  ///< Controlled internally and by external foot controller.          lfo2_ctrl_internal_foot       = 0x04  ///< Controlled internally and by external foot controller.
181      } lfo2_ctrl_t;      );
182    
183      /** Defines how LFO1 is controlled by. */      /** Defines how LFO1 is controlled by.
184      typedef enum {       *
185         * @see enumCount(), enumKey(), enumKeys(), enumValue()
186         */
187        GIG_DECLARE_ENUM(lfo1_ctrl_t,
188          lfo1_ctrl_internal            = 0x00, ///< Only internally controlled.          lfo1_ctrl_internal            = 0x00, ///< Only internally controlled.
189          lfo1_ctrl_modwheel            = 0x01, ///< Only controlled by external modulation wheel.          lfo1_ctrl_modwheel            = 0x01, ///< Only controlled by external modulation wheel.
190          lfo1_ctrl_breath              = 0x02, ///< Only controlled by external breath controller.          lfo1_ctrl_breath              = 0x02, ///< Only controlled by external breath controller.
191          lfo1_ctrl_internal_modwheel   = 0x03, ///< Controlled internally and by external modulation wheel.          lfo1_ctrl_internal_modwheel   = 0x03, ///< Controlled internally and by external modulation wheel.
192          lfo1_ctrl_internal_breath     = 0x04  ///< Controlled internally and by external breath controller.          lfo1_ctrl_internal_breath     = 0x04  ///< Controlled internally and by external breath controller.
193      } lfo1_ctrl_t;      );
194    
195      /** Defines how the filter cutoff frequency is controlled by. */      /** Defines how the filter cutoff frequency is controlled by.
196      typedef enum {       *
197         * @see enumCount(), enumKey(), enumKeys(), enumValue()
198         */
199        GIG_DECLARE_ENUM(vcf_cutoff_ctrl_t,
200          vcf_cutoff_ctrl_none         = 0x00,          vcf_cutoff_ctrl_none         = 0x00,
201          vcf_cutoff_ctrl_none2        = 0x01,  ///< The difference between none and none2 is unknown          vcf_cutoff_ctrl_none2        = 0x01,  ///< The difference between none and none2 is unknown
202          vcf_cutoff_ctrl_modwheel     = 0x81,  ///< Modulation Wheel (MIDI Controller 1)          vcf_cutoff_ctrl_modwheel     = 0x81,  ///< Modulation Wheel (MIDI Controller 1)
# Line 162  namespace gig { Line 209  namespace gig {
209          vcf_cutoff_ctrl_genpurpose7  = 0xd2,  ///< General Purpose Controller 7 (Button, MIDI Controller 82)          vcf_cutoff_ctrl_genpurpose7  = 0xd2,  ///< General Purpose Controller 7 (Button, MIDI Controller 82)
210          vcf_cutoff_ctrl_genpurpose8  = 0xd3,  ///< General Purpose Controller 8 (Button, MIDI Controller 83)          vcf_cutoff_ctrl_genpurpose8  = 0xd3,  ///< General Purpose Controller 8 (Button, MIDI Controller 83)
211          vcf_cutoff_ctrl_aftertouch   = 0x80   ///< Key Pressure          vcf_cutoff_ctrl_aftertouch   = 0x80   ///< Key Pressure
212      } vcf_cutoff_ctrl_t;      );
213    
214      /** Defines how the filter resonance is controlled by. */      /** Defines how the filter resonance is controlled by.
215      typedef enum {       *
216         * @see enumCount(), enumKey(), enumKeys(), enumValue()
217         */
218        GIG_DECLARE_ENUM(vcf_res_ctrl_t,
219          vcf_res_ctrl_none        = 0xffffffff,          vcf_res_ctrl_none        = 0xffffffff,
220          vcf_res_ctrl_genpurpose3 = 0,           ///< General Purpose Controller 3 (Slider, MIDI Controller 18)          vcf_res_ctrl_genpurpose3 = 0,           ///< General Purpose Controller 3 (Slider, MIDI Controller 18)
221          vcf_res_ctrl_genpurpose4 = 1,           ///< General Purpose Controller 4 (Slider, MIDI Controller 19)          vcf_res_ctrl_genpurpose4 = 1,           ///< General Purpose Controller 4 (Slider, MIDI Controller 19)
222          vcf_res_ctrl_genpurpose5 = 2,           ///< General Purpose Controller 5 (Button, MIDI Controller 80)          vcf_res_ctrl_genpurpose5 = 2,           ///< General Purpose Controller 5 (Button, MIDI Controller 80)
223          vcf_res_ctrl_genpurpose6 = 3            ///< General Purpose Controller 6 (Button, MIDI Controller 81)          vcf_res_ctrl_genpurpose6 = 3            ///< General Purpose Controller 6 (Button, MIDI Controller 81)
224      } vcf_res_ctrl_t;      );
225    
226      /**      /**
227       * Defines a controller that has a certain contrained influence on a       * Defines a controller that has a certain contrained influence on a
# Line 182  namespace gig { Line 232  namespace gig {
232       * attenuation_ctrl_t, eg1_ctrl_t or eg2_ctrl_t) in your code!       * attenuation_ctrl_t, eg1_ctrl_t or eg2_ctrl_t) in your code!
233       */       */
234      struct leverage_ctrl_t {      struct leverage_ctrl_t {
235          typedef enum {          /** Defines possible controllers.
236             *
237             * @see enumCount(), enumKey(), enumKeys(), enumValue()
238             */
239            GIG_DECLARE_ENUM(type_t,
240              type_none              = 0x00, ///< No controller defined              type_none              = 0x00, ///< No controller defined
241              type_channelaftertouch = 0x2f, ///< Channel Key Pressure              type_channelaftertouch = 0x2f, ///< Channel Key Pressure
242              type_velocity          = 0xff, ///< Key Velocity              type_velocity          = 0xff, ///< Key Velocity
243              type_controlchange     = 0xfe  ///< Ordinary MIDI control change controller, see field 'controller_number'              type_controlchange     = 0xfe  ///< Ordinary MIDI control change controller, see field 'controller_number'
244          } type_t;          );
245    
246          type_t type;              ///< Controller type          type_t type;              ///< Controller type
247          uint   controller_number; ///< MIDI controller number if this controller is a control change controller, 0 otherwise          uint   controller_number; ///< MIDI controller number if this controller is a control change controller, 0 otherwise
248    
249            void serialize(Serialization::Archive* archive);
250      };      };
251    
252      /**      /**
# Line 220  namespace gig { Line 276  namespace gig {
276       * dimension zones is always a power of two. All dimensions can have up       * dimension zones is always a power of two. All dimensions can have up
277       * 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
278       * the samplechannel dimension which currently allows only 2 zones).       * the samplechannel dimension which currently allows only 2 zones).
279         *
280         * @see enumCount(), enumKey(), enumKeys(), enumValue()
281       */       */
282      typedef enum {      GIG_DECLARE_ENUM(dimension_t,
283          dimension_none              = 0x00, ///< Dimension not in use.          dimension_none              = 0x00, ///< Dimension not in use.
284          dimension_samplechannel     = 0x80, ///< If used sample has more than one channel (thus is not mono).          dimension_samplechannel     = 0x80, ///< If used sample has more than one channel (thus is not mono).
285          dimension_layer             = 0x81, ///< For layering of up to 8 instruments (and eventually crossfading of 2 or 4 layers).          dimension_layer             = 0x81, ///< For layering of up to 8 instruments (and eventually crossfading of 2 or 4 layers).
# Line 256  namespace gig { Line 314  namespace gig {
314          dimension_effect3depth      = 0x5d, ///< Effect 3 Depth (MIDI Controller 93)          dimension_effect3depth      = 0x5d, ///< Effect 3 Depth (MIDI Controller 93)
315          dimension_effect4depth      = 0x5e, ///< Effect 4 Depth (MIDI Controller 94)          dimension_effect4depth      = 0x5e, ///< Effect 4 Depth (MIDI Controller 94)
316          dimension_effect5depth      = 0x5f  ///< Effect 5 Depth (MIDI Controller 95)          dimension_effect5depth      = 0x5f  ///< Effect 5 Depth (MIDI Controller 95)
317      } dimension_t;      );
318    
319      /**      /**
320       * Intended for internal usage: will be used to convert a dimension value       * Intended for internal usage: will be used to convert a dimension value
321       * into the corresponding dimension bit number.       * into the corresponding dimension bit number.
322         *
323         * @see enumCount(), enumKey(), enumKeys(), enumValue()
324       */       */
325      typedef enum {      GIG_DECLARE_ENUM(split_type_t,
326          split_type_normal,         ///< dimension value between 0-127          split_type_normal,         ///< dimension value between 0-127
327          split_type_bit             ///< dimension values are already the sought bit number          split_type_bit             ///< dimension values are already the sought bit number
328      } split_type_t;      );
329    
330      /** General dimension definition. */      /** General dimension definition. */
331      struct dimension_def_t {      struct dimension_def_t {
# Line 276  namespace gig { Line 336  namespace gig {
336          float        zone_size;  ///< Intended for internal usage: reflects the size of each zone (128/zones) for normal split types only, 0 otherwise.          float        zone_size;  ///< Intended for internal usage: reflects the size of each zone (128/zones) for normal split types only, 0 otherwise.
337      };      };
338    
339      /** Defines which frequencies are filtered by the VCF. */      /** Defines which frequencies are filtered by the VCF.
340      typedef enum {       *
341         * @see enumCount(), enumKey(), enumKeys(), enumValue()
342         */
343        GIG_DECLARE_ENUM(vcf_type_t,
344          vcf_type_lowpass      = 0x00,          vcf_type_lowpass      = 0x00,
345          vcf_type_lowpassturbo = 0xff, ///< More poles than normal lowpass          vcf_type_lowpassturbo = 0xff, ///< More poles than normal lowpass
346          vcf_type_bandpass     = 0x01,          vcf_type_bandpass     = 0x01,
347          vcf_type_highpass     = 0x02,          vcf_type_highpass     = 0x02,
348          vcf_type_bandreject   = 0x03          vcf_type_bandreject   = 0x03
349      } vcf_type_t;      );
350    
351      /**      /**
352       * Defines the envelope of a crossfade.       * Defines the envelope of a crossfade.
# Line 304  namespace gig { Line 367  namespace gig {
367          uint8_t out_start;  ///< Start position of fade out.          uint8_t out_start;  ///< Start position of fade out.
368          uint8_t out_end;    ///< End postition of fade out.          uint8_t out_end;    ///< End postition of fade out.
369          #endif // WORDS_BIGENDIAN          #endif // WORDS_BIGENDIAN
370    
371            void serialize(Serialization::Archive* archive);
372      };      };
373    
374      /** Reflects the current playback state for a sample. */      /** Reflects the current playback state for a sample. */
# Line 486  namespace gig { Line 551  namespace gig {
551              DimensionRegion(RIFF::List* _3ewl, const DimensionRegion& src);              DimensionRegion(RIFF::List* _3ewl, const DimensionRegion& src);
552             ~DimensionRegion();             ~DimensionRegion();
553              void CopyAssign(const DimensionRegion* orig, const std::map<Sample*,Sample*>* mSamples);              void CopyAssign(const DimensionRegion* orig, const std::map<Sample*,Sample*>* mSamples);
554                void serialize(Serialization::Archive* archive);
555              friend class Region;              friend class Region;
556                friend class Serialization::Archive;
557          private:          private:
558              typedef enum { ///< Used to decode attenuation, EG1 and EG2 controller              typedef enum { ///< Used to decode attenuation, EG1 and EG2 controller
559                  // official leverage controllers as they were defined in the original Gigasampler/GigaStudio format:                  // official leverage controllers as they were defined in the original Gigasampler/GigaStudio format:
# Line 1014  namespace gig { Line 1081  namespace gig {
1081              void   SetScriptAsText(const String& text);              void   SetScriptAsText(const String& text);
1082              void   SetGroup(ScriptGroup* pGroup);              void   SetGroup(ScriptGroup* pGroup);
1083              ScriptGroup* GetGroup() const;              ScriptGroup* GetGroup() const;
1084                void   CopyAssign(const Script* orig);
1085          protected:          protected:
1086              Script(ScriptGroup* group, RIFF::Chunk* ckScri);              Script(ScriptGroup* group, RIFF::Chunk* ckScri);
1087              virtual ~Script();              virtual ~Script();
# Line 1301  namespace gig { Line 1369  namespace gig {
1369              void PrintMessage();              void PrintMessage();
1370      };      };
1371    
1372    #if HAVE_RTTI
1373        size_t enumCount(const std::type_info& type);
1374        const char* enumKey(const std::type_info& type, size_t value);
1375        bool        enumKey(const std::type_info& type, String key);
1376        const char** enumKeys(const std::type_info& type);
1377    #endif // HAVE_RTTI
1378        size_t enumCount(String typeName);
1379        const char* enumKey(String typeName, size_t value);
1380        bool        enumKey(String typeName, String key);
1381        const char** enumKeys(String typeName);
1382        size_t enumValue(String key);
1383    
1384      String libraryName();      String libraryName();
1385      String libraryVersion();      String libraryVersion();
1386    

Legend:
Removed from v.2989  
changed lines
  Added in v.3181

  ViewVC Help
Powered by ViewVC