755 |
|
|
756 |
return pitch; |
return pitch; |
757 |
} |
} |
758 |
|
|
759 |
|
void AbstractVoice::onScaleTuningChanged() { |
760 |
|
PitchInfo pitch = this->Pitch; |
761 |
|
double pitchbasecents = InstrInfo.FineTune + RgnInfo.FineTune + GetEngine()->ScaleTuning[MIDIKey % 12]; |
762 |
|
|
763 |
|
// GSt behaviour: maximum transpose up is 40 semitones. If |
764 |
|
// MIDI key is more than 40 semitones above unity note, |
765 |
|
// the transpose is not done. |
766 |
|
if (!SmplInfo.Unpitched && (MIDIKey - (int) RgnInfo.UnityNote) < 40) pitchbasecents += (MIDIKey - (int) RgnInfo.UnityNote) * 100; |
767 |
|
|
768 |
|
pitch.PitchBase = RTMath::CentsToFreqRatioUnlimited(pitchbasecents) * (double(SmplInfo.SampleRate) / double(GetEngine()->SampleRate)); |
769 |
|
this->Pitch = pitch; |
770 |
|
} |
771 |
|
|
772 |
double AbstractVoice::CalculateVolume(double velocityAttenuation) { |
double AbstractVoice::CalculateVolume(double velocityAttenuation) { |
773 |
// For 16 bit samples, we downscale by 32768 to convert from |
// For 16 bit samples, we downscale by 32768 to convert from |