36 |
/// reallocated which is time consuming and unefficient. |
/// reallocated which is time consuming and unefficient. |
37 |
#define INITIAL_SAMPLE_BUFFER_SIZE 512000 // 512 kB |
#define INITIAL_SAMPLE_BUFFER_SIZE 512000 // 512 kB |
38 |
|
|
39 |
#if 0 //WORDS_BIGENDIAN |
#if WORDS_BIGENDIAN |
40 |
# define LIST_TYPE_3PRG 0x33707267 |
# define LIST_TYPE_3PRG 0x33707267 |
41 |
# define LIST_TYPE_3EWL 0x3365776C |
# define LIST_TYPE_3EWL 0x3365776C |
42 |
# define CHUNK_ID_SMPL 0x736D706C |
# define CHUNK_ID_SMPL 0x736D706C |
57 |
#endif // WORDS_BIGENDIAN |
#endif // WORDS_BIGENDIAN |
58 |
|
|
59 |
/** (so far) every exponential paramater in the gig format has a basis of 1.000000008813822 */ |
/** (so far) every exponential paramater in the gig format has a basis of 1.000000008813822 */ |
60 |
#define GIG_EXP_DECODE(x) (powl(1.000000008813822, x)) |
#define GIG_EXP_DECODE(x) (pow(1.000000008813822, x)) |
61 |
#define GIG_PITCH_TRACK_EXTRACT(x) (!(x & 0x01)) |
#define GIG_PITCH_TRACK_EXTRACT(x) (!(x & 0x01)) |
62 |
#define GIG_VCF_RESONANCE_CTRL_EXTRACT(x) ((x >> 4) & 0x03) |
#define GIG_VCF_RESONANCE_CTRL_EXTRACT(x) ((x >> 4) & 0x03) |
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 |
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)) |
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) |
69 |
|
#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))) |
70 |
|
|
71 |
/** Gigasampler specific classes and definitions */ |
/** Gigasampler specific classes and definitions */ |
72 |
namespace gig { |
namespace gig { |
366 |
// Key Velocity Transformations |
// Key Velocity Transformations |
367 |
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. |
368 |
uint8_t VelocityResponseDepth; ///< Dynamic range of velocity affecting amplitude (0 - 4). |
uint8_t VelocityResponseDepth; ///< Dynamic range of velocity affecting amplitude (0 - 4). |
369 |
uint8_t VelocityResponseCurveScaling; |
uint8_t VelocityResponseCurveScaling; ///< 0 - 127 |
370 |
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. |
371 |
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). |
372 |
uint8_t ReleaseTriggerDecay; ///< 0 - 8 |
uint8_t ReleaseTriggerDecay; ///< 0 - 8 |
390 |
DLS::Sampler::SampleLoops; |
DLS::Sampler::SampleLoops; |
391 |
DLS::Sampler::pSampleLoops; |
DLS::Sampler::pSampleLoops; |
392 |
|
|
393 |
|
// Methods |
394 |
|
double GetVelocityAttenuation(uint8_t MIDIKeyVelocity); |
395 |
|
protected: |
396 |
DimensionRegion(RIFF::List* _3ewl); |
DimensionRegion(RIFF::List* _3ewl); |
397 |
|
~DimensionRegion(); |
398 |
|
friend class Region; |
399 |
|
private: |
400 |
|
typedef std::map<uint32_t, double*> VelocityTableMap; |
401 |
|
|
402 |
|
static uint Instances; ///< Number of DimensionRegion instances. |
403 |
|
static VelocityTableMap* pVelocityTables; ///< Contains the tables corresponding to the various velocity parameters (VelocityResponseCurve and VelocityResponseDepth). |
404 |
|
double* pVelocityAttenuationTable; ///< Points to the velocity table corresponding to the velocity parameters of this DimensionRegion. |
405 |
}; |
}; |
406 |
|
|
407 |
/** Encapsulates sample waves used for playback. */ |
/** Encapsulates sample waves used for playback. */ |