4 |
* * |
* * |
5 |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
6 |
* Copyright (C) 2005 - 2008 Christian Schoenebeck * |
* Copyright (C) 2005 - 2008 Christian Schoenebeck * |
7 |
* Copyright (C) 2009 - 2011 Christian Schoenebeck and Grigor Iliev * |
* Copyright (C) 2009 - 2012 Christian Schoenebeck and Grigor Iliev * |
8 |
* * |
* * |
9 |
* This program is free software; you can redistribute it and/or modify * |
* This program is free software; you can redistribute it and/or modify * |
10 |
* 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 * |
76 |
ri.Pan = pRegion->Pan; |
ri.Pan = pRegion->Pan; |
77 |
ri.SampleStartOffset = pRegion->SampleStartOffset; |
ri.SampleStartOffset = pRegion->SampleStartOffset; |
78 |
|
|
|
ri.EG1PreAttack = pRegion->EG1PreAttack; |
|
|
ri.EG1Attack = pRegion->EG1Attack; |
|
|
ri.EG1Hold = pRegion->EG1Hold; |
|
|
ri.EG1Decay1 = pRegion->EG1Decay1; |
|
|
ri.EG1Decay2 = pRegion->EG1Decay2; |
|
|
ri.EG1Sustain = pRegion->EG1Sustain; |
|
|
ri.EG1InfiniteSustain = pRegion->EG1InfiniteSustain; |
|
|
ri.EG1Release = pRegion->EG1Release; |
|
|
|
|
79 |
ri.EG2PreAttack = pRegion->EG2PreAttack; |
ri.EG2PreAttack = pRegion->EG2PreAttack; |
80 |
ri.EG2Attack = pRegion->EG2Attack; |
ri.EG2Attack = pRegion->EG2Attack; |
81 |
ri.EG2Decay1 = pRegion->EG2Decay1; |
ri.EG2Decay1 = pRegion->EG2Decay1; |
443 |
} |
} |
444 |
|
|
445 |
void Voice::TriggerEG1(const EGInfo& egInfo, double velrelease, double velocityAttenuation, uint sampleRate, uint8_t velocity) { |
void Voice::TriggerEG1(const EGInfo& egInfo, double velrelease, double velocityAttenuation, uint sampleRate, uint8_t velocity) { |
446 |
EG1.trigger(uint(RgnInfo.EG1PreAttack), |
EG1.trigger(pRegion->EG1PreAttack, |
447 |
RgnInfo.EG1Attack * egInfo.Attack, |
pRegion->EG1Attack * egInfo.Attack, |
448 |
RgnInfo.EG1Hold, |
pRegion->EG1Hold, |
449 |
RgnInfo.EG1Decay1 * egInfo.Decay * velrelease, |
pRegion->EG1Decay1 * egInfo.Decay * velrelease, |
450 |
RgnInfo.EG1Decay2 * egInfo.Decay * velrelease, |
pRegion->EG1Decay2 * egInfo.Decay * velrelease, |
451 |
RgnInfo.EG1InfiniteSustain, |
pRegion->EG1InfiniteSustain, |
452 |
uint(RgnInfo.EG1Sustain), |
pRegion->EG1Sustain, |
453 |
RgnInfo.EG1Release * egInfo.Release * velrelease, |
pRegion->EG1Release * egInfo.Release * velrelease, |
454 |
velocityAttenuation, |
velocityAttenuation, |
455 |
sampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); |
sampleRate / CONFIG_DEFAULT_SUBFRAGMENT_SIZE); |
456 |
} |
} |
483 |
} |
} |
484 |
} |
} |
485 |
|
|
486 |
|
void Voice::CalculateFadeOutCoeff(float FadeOutTime, float SampleRate) { |
487 |
|
EG1.CalculateFadeOutCoeff(FadeOutTime, SampleRate); |
488 |
|
} |
489 |
|
|
490 |
|
int Voice::CalculatePan(uint8_t pan) { |
491 |
|
int p; |
492 |
|
// Gst behaviour: -64 and 63 are special cases |
493 |
|
if (RgnInfo.Pan == -64) p = pan * 2 - 127; |
494 |
|
else if (RgnInfo.Pan == 63) p = pan * 2; |
495 |
|
else p = pan + RgnInfo.Pan; |
496 |
|
|
497 |
|
if (p < 0) return 0; |
498 |
|
if (p > 127) return 127; |
499 |
|
return p; |
500 |
|
} |
501 |
|
|
502 |
}} // namespace LinuxSampler::gig |
}} // namespace LinuxSampler::gig |