--- libgig/trunk/src/gig.h 2004/04/27 09:06:07 55 +++ libgig/trunk/src/gig.h 2005/01/21 16:40:37 345 @@ -63,10 +63,6 @@ #define GIG_EG_CTR_ATTACK_INFLUENCE_EXTRACT(x) ((x >> 1) & 0x03) #define GIG_EG_CTR_DECAY_INFLUENCE_EXTRACT(x) ((x >> 3) & 0x03) #define GIG_EG_CTR_RELEASE_INFLUENCE_EXTRACT(x) ((x >> 5) & 0x03) -//TODO: the transformation functions are not very accurate compared to the original ones -#define GIG_VELOCITY_TRANSFORM_NONLINEAR(x,dynamic,scale) ((1.0-1.0/pow(x,1.0/(129.0-x))) * (1.0+scale/20.0) + (5.0-dynamic)*pow(x/300.0* (1.0+2.0*scale/128.0),2)) -#define GIG_VELOCITY_TRANSFORM_LINEAR(x,dynamic,scale) ((1.0+scale*3.0/128.0)/110.0*x+(5.0-dynamic)/5.0+(5.0-dynamic)*scale) -#define GIG_VELOCITY_TRANSFORM_SPECIAL(x,dynamic,scale) ((1.0+9.0*scale/129.0)*(1.0-1.0/pow(x,1.0/(129.0-x))+pow(3.0*x/pow(129,2),2)+pow((5.0-dynamic)*x/500.0,2))) /** Gigasampler specific classes and definitions */ namespace gig { @@ -278,18 +274,25 @@ vcf_type_bandreject = 0x03 } vcf_type_t; - /** Defines the envelope of a crossfade. */ + /** + * Defines the envelope of a crossfade. + * + * Note: The default value for crossfade points is 0,0,0,0. Layers with + * such a default value should be treated as if they would not have a + * crossfade, that is the crossfade volume factor should always + * be 1.0f for such layers. + */ struct crossfade_t { #if WORDS_BIGENDIAN - uint8_t in_start; ///< Start position of fade in. - uint8_t in_end; ///< End position of fade in. - uint8_t out_start; ///< Start position of fade out. - uint8_t out_end; ///< End postition of fade out. - #else // little endian uint8_t out_end; ///< End postition of fade out. uint8_t out_start; ///< Start position of fade out. uint8_t in_end; ///< End position of fade in. uint8_t in_start; ///< Start position of fade in. + #else // little endian + uint8_t in_start; ///< Start position of fade in. + uint8_t in_end; ///< End position of fade in. + uint8_t out_start; ///< Start position of fade out. + uint8_t out_end; ///< End postition of fade out. #endif // WORDS_BIGENDIAN }; @@ -304,6 +307,7 @@ class File; class Instrument; class Sample; + class Region; /** Encapsulates articulation information of a dimension region. * @@ -382,9 +386,9 @@ bool VCFKeyboardTracking; ///< If true: VCF cutoff frequence will be dependend to the note key position relative to the defined breakpoint value. uint8_t VCFKeyboardTrackingBreakpoint; ///< See VCFKeyboardTracking (0 - 127). // Key Velocity Transformations - curve_type_t VelocityResponseCurve; ///< Defines a transformation curve to the incoming velocity values affecting amplitude. - uint8_t VelocityResponseDepth; ///< Dynamic range of velocity affecting amplitude (0 - 4). - uint8_t VelocityResponseCurveScaling; ///< 0 - 127 + curve_type_t VelocityResponseCurve; ///< Defines a transformation curve to the incoming velocity values affecting amplitude (usually you don't have to interpret this parameter, use GetVelocityAttenuation() instead). + uint8_t VelocityResponseDepth; ///< Dynamic range of velocity affecting amplitude (0 - 4) (usually you don't have to interpret this parameter, use GetVelocityAttenuation() instead). + uint8_t VelocityResponseCurveScaling; ///< 0 - 127 (usually you don't have to interpret this parameter, use GetVelocityAttenuation() instead) curve_type_t ReleaseVelocityResponseCurve; ///< Defines a transformation curve to the incoming release veloctiy values affecting envelope times. uint8_t ReleaseVelocityResponseDepth; ///< Dynamic range of release velocity affecting envelope time (0 - 4). uint8_t ReleaseTriggerDecay; ///< 0 - 8 @@ -450,6 +454,7 @@ double* pVelocityAttenuationTable; ///< Points to the velocity table corresponding to the velocity parameters of this DimensionRegion. leverage_ctrl_t DecodeLeverageController(_lev_ctrl_t EncodedController); + double* CreateVelocityTable(curve_type_t curveType, uint8_t depth, uint8_t scaling); }; /** Encapsulates sample waves used for playback. */ @@ -570,6 +575,7 @@ dimension_def_t pDimensionDefinitions[5]; ///< Defines the five possible dimensions (the dimension's controller and number of bits/splits). uint32_t DimensionRegions; ///< Total number of DimensionRegions this Region contains. DimensionRegion* pDimensionRegions[32]; ///< Pointer array to the 32 possible dimension regions (reflects NULL for dimension regions not in use). Avoid to access the array directly and better use GetDimensionRegionByValue() instead, but of course in some cases it makes sense to use the array (e.g. iterating through all DimensionRegions). + unsigned int Layers; ///< Amount of defined layers (1 - 32). A value of 1 actually means no layering, a value > 1 means there is Layer dimension. The same information can of course also be obtained by accessing pDimensionDefinitions. DimensionRegion* GetDimensionRegionByValue(uint Dim4Val, uint Dim3Val, uint Dim2Val, uint Dim1Val, uint Dim0Val); DimensionRegion* GetDimensionRegionByBit(uint8_t Dim4Bit, uint8_t Dim3Bit, uint8_t Dim2Bit, uint8_t Dim1Bit, uint8_t Dim0Bit);