2 |
* * |
* * |
3 |
* libgig - C++ cross-platform Gigasampler format file loader library * |
* libgig - C++ cross-platform Gigasampler format file loader library * |
4 |
* * |
* * |
5 |
* Copyright (C) 2003 by Christian Schoenebeck * |
* Copyright (C) 2003, 2004 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 * |
9 |
* it under the terms of the GNU General Public License as published by * |
* it under the terms of the GNU General Public License as published by * |
63 |
#define GIG_EG_CTR_ATTACK_INFLUENCE_EXTRACT(x) ((x >> 1) & 0x03) |
#define GIG_EG_CTR_ATTACK_INFLUENCE_EXTRACT(x) ((x >> 1) & 0x03) |
64 |
#define GIG_EG_CTR_DECAY_INFLUENCE_EXTRACT(x) ((x >> 3) & 0x03) |
#define GIG_EG_CTR_DECAY_INFLUENCE_EXTRACT(x) ((x >> 3) & 0x03) |
65 |
#define GIG_EG_CTR_RELEASE_INFLUENCE_EXTRACT(x) ((x >> 5) & 0x03) |
#define GIG_EG_CTR_RELEASE_INFLUENCE_EXTRACT(x) ((x >> 5) & 0x03) |
66 |
//TODO: the transformation functions are not very accurate compared to the original ones |
#define GIG_VELOCITY_TRANSFORM_NONLINEAR(x,dynamic,scale) (-0.1666235937e0+0.5143775427e-4*x*x+0.5318278732e-1*dynamic*dynamic-0.3560390502e-4*scale*scale+0.4683631221e-2*x-0.9484386143e-1*dynamic+0.8030068910e-2*scale) |
67 |
#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+dynamic/5.0+dynamic*scale) |
68 |
#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) (-0.1630504921e0+0.5794551347e-4*x*x+0.8361491099e-2*dynamic*dynamic-0.4303475615e-5*scale*scale+0.2085522765e-2*x+0.1313747345e-1*dynamic+0.3220916836e-2*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))) |
|
69 |
|
|
70 |
/** Gigasampler specific classes and definitions */ |
/** Gigasampler specific classes and definitions */ |
71 |
namespace gig { |
namespace gig { |
166 |
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) |
167 |
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) |
168 |
} vcf_res_ctrl_t; |
} vcf_res_ctrl_t; |
169 |
|
|
170 |
/** |
/** |
171 |
* Defines a controller that has a certain contrained influence on a |
* Defines a controller that has a certain contrained influence on a |
172 |
* particular synthesis parameter (used to define attenuation controller, |
* particular synthesis parameter (used to define attenuation controller, |
182 |
type_velocity = 0xff, ///< Key Velocity |
type_velocity = 0xff, ///< Key Velocity |
183 |
type_controlchange = 0xfe ///< Ordinary MIDI control change controller, see field 'controller_number' |
type_controlchange = 0xfe ///< Ordinary MIDI control change controller, see field 'controller_number' |
184 |
} type_t; |
} type_t; |
185 |
|
|
186 |
type_t type; ///< Controller type |
type_t type; ///< Controller type |
187 |
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 |
188 |
}; |
}; |
189 |
|
|
190 |
/** |
/** |
191 |
* Defines controller influencing attenuation. |
* Defines controller influencing attenuation. |
192 |
* |
* |
193 |
* @see leverage_ctrl_t |
* @see leverage_ctrl_t |
194 |
*/ |
*/ |
195 |
typedef leverage_ctrl_t attenuation_ctrl_t; |
typedef leverage_ctrl_t attenuation_ctrl_t; |
196 |
|
|
197 |
/** |
/** |
198 |
* Defines controller influencing envelope generator 1. |
* Defines controller influencing envelope generator 1. |
199 |
* |
* |
200 |
* @see leverage_ctrl_t |
* @see leverage_ctrl_t |
201 |
*/ |
*/ |
202 |
typedef leverage_ctrl_t eg1_ctrl_t; |
typedef leverage_ctrl_t eg1_ctrl_t; |
203 |
|
|
204 |
/** |
/** |
205 |
* Defines controller influencing envelope generator 2. |
* Defines controller influencing envelope generator 2. |
206 |
* |
* |
381 |
bool VCFKeyboardTracking; ///< If <i>true</i>: VCF cutoff frequence will be dependend to the note key position relative to the defined breakpoint value. |
bool VCFKeyboardTracking; ///< If <i>true</i>: VCF cutoff frequence will be dependend to the note key position relative to the defined breakpoint value. |
382 |
uint8_t VCFKeyboardTrackingBreakpoint; ///< See VCFKeyboardTracking (0 - 127). |
uint8_t VCFKeyboardTrackingBreakpoint; ///< See VCFKeyboardTracking (0 - 127). |
383 |
// Key Velocity Transformations |
// Key Velocity Transformations |
384 |
curve_type_t VelocityResponseCurve; ///< Defines a transformation curve to the incoming velocity values affecting amplitude. |
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). |
385 |
uint8_t VelocityResponseDepth; ///< Dynamic range of velocity affecting amplitude (0 - 4). |
uint8_t VelocityResponseDepth; ///< Dynamic range of velocity affecting amplitude (0 - 4) (usually you don't have to interpret this parameter, use GetVelocityAttenuation() instead). |
386 |
uint8_t VelocityResponseCurveScaling; ///< 0 - 127 |
uint8_t VelocityResponseCurveScaling; ///< 0 - 127 (usually you don't have to interpret this parameter, use GetVelocityAttenuation() instead) |
387 |
curve_type_t ReleaseVelocityResponseCurve; ///< Defines a transformation curve to the incoming release veloctiy values affecting envelope times. |
curve_type_t ReleaseVelocityResponseCurve; ///< Defines a transformation curve to the incoming release veloctiy values affecting envelope times. |
388 |
uint8_t ReleaseVelocityResponseDepth; ///< Dynamic range of release velocity affecting envelope time (0 - 4). |
uint8_t ReleaseVelocityResponseDepth; ///< Dynamic range of release velocity affecting envelope time (0 - 4). |
389 |
uint8_t ReleaseTriggerDecay; ///< 0 - 8 |
uint8_t ReleaseTriggerDecay; ///< 0 - 8 |
441 |
_lev_ctrl_effect5depth = 0x2d, ///< Effect 5 Depth (MIDI Controller 95) |
_lev_ctrl_effect5depth = 0x2d, ///< Effect 5 Depth (MIDI Controller 95) |
442 |
_lev_ctrl_channelaftertouch = 0x2f, ///< Channel Key Pressure |
_lev_ctrl_channelaftertouch = 0x2f, ///< Channel Key Pressure |
443 |
_lev_ctrl_velocity = 0xff ///< Key Velocity |
_lev_ctrl_velocity = 0xff ///< Key Velocity |
444 |
} _lev_ctrl_t; |
} _lev_ctrl_t; |
445 |
typedef std::map<uint32_t, double*> VelocityTableMap; |
typedef std::map<uint32_t, double*> VelocityTableMap; |
446 |
|
|
447 |
static uint Instances; ///< Number of DimensionRegion instances. |
static uint Instances; ///< Number of DimensionRegion instances. |
448 |
static VelocityTableMap* pVelocityTables; ///< Contains the tables corresponding to the various velocity parameters (VelocityResponseCurve and VelocityResponseDepth). |
static VelocityTableMap* pVelocityTables; ///< Contains the tables corresponding to the various velocity parameters (VelocityResponseCurve and VelocityResponseDepth). |
449 |
double* pVelocityAttenuationTable; ///< Points to the velocity table corresponding to the velocity parameters of this DimensionRegion. |
double* pVelocityAttenuationTable; ///< Points to the velocity table corresponding to the velocity parameters of this DimensionRegion. |
450 |
|
|
451 |
leverage_ctrl_t DecodeLeverageController(_lev_ctrl_t EncodedController); |
leverage_ctrl_t DecodeLeverageController(_lev_ctrl_t EncodedController); |
452 |
}; |
}; |
453 |
|
|