348 |
} |
} |
349 |
|
|
350 |
void AbstractVoice::SetSampleStartOffset() { |
void AbstractVoice::SetSampleStartOffset() { |
351 |
finalSynthesisParameters.dPos = RgnInfo.SampleStartOffset; // offset where we should start playback of sample (0 - 2000 sample points) |
double pos = RgnInfo.SampleStartOffset; // offset where we should start playback of sample |
352 |
Pos = RgnInfo.SampleStartOffset; |
|
353 |
|
// if another sample playback start position was requested by instrument |
354 |
|
// script (built-in script function play_note()) |
355 |
|
if (pNote && pNote->Override.SampleOffset >= 0) { |
356 |
|
double overridePos = |
357 |
|
double(SmplInfo.SampleRate) * double(pNote->Override.SampleOffset) / 1000000.0; |
358 |
|
if (overridePos < SmplInfo.TotalFrameCount) |
359 |
|
pos = overridePos; |
360 |
|
} |
361 |
|
|
362 |
|
finalSynthesisParameters.dPos = pos; |
363 |
|
Pos = pos; |
364 |
} |
} |
365 |
|
|
366 |
/** |
/** |
798 |
|
|
799 |
case Event::synth_param_attack: |
case Event::synth_param_attack: |
800 |
case Event::synth_param_decay: |
case Event::synth_param_decay: |
801 |
|
case Event::synth_param_sustain: |
802 |
case Event::synth_param_release: |
case Event::synth_param_release: |
803 |
break; // noop |
break; // noop |
804 |
} |
} |
861 |
// GSt behaviour: maximum transpose up is 40 semitones. If |
// GSt behaviour: maximum transpose up is 40 semitones. If |
862 |
// MIDI key is more than 40 semitones above unity note, |
// MIDI key is more than 40 semitones above unity note, |
863 |
// the transpose is not done. |
// the transpose is not done. |
864 |
if (!SmplInfo.Unpitched && (MIDIKey() - (int) RgnInfo.UnityNote) < 40) pitchbasecents += (MIDIKey() - (int) RgnInfo.UnityNote) * 100; |
// |
865 |
|
// Update: Removed this GSt misbehavior. I don't think that any stock |
866 |
|
// gig sound requires it to resemble its original sound. |
867 |
|
// -- Christian, 2017-07-09 |
868 |
|
if (!SmplInfo.Unpitched /* && (MIDIKey() - (int) RgnInfo.UnityNote) < 40*/) |
869 |
|
pitchbasecents += (MIDIKey() - (int) RgnInfo.UnityNote) * 100; |
870 |
|
|
871 |
pitch.PitchBase = RTMath::CentsToFreqRatioUnlimited(pitchbasecents) * (double(SmplInfo.SampleRate) / double(GetEngine()->SampleRate)); |
pitch.PitchBase = RTMath::CentsToFreqRatioUnlimited(pitchbasecents) * (double(SmplInfo.SampleRate) / double(GetEngine()->SampleRate)); |
872 |
pitch.PitchBendRange = 1.0 / 8192.0 * 100.0 * InstrInfo.PitchbendRange; |
pitch.PitchBendRange = 1.0 / 8192.0 * 100.0 * InstrInfo.PitchbendRange; |
882 |
// GSt behaviour: maximum transpose up is 40 semitones. If |
// GSt behaviour: maximum transpose up is 40 semitones. If |
883 |
// MIDI key is more than 40 semitones above unity note, |
// MIDI key is more than 40 semitones above unity note, |
884 |
// the transpose is not done. |
// the transpose is not done. |
885 |
if (!SmplInfo.Unpitched && (MIDIKey() - (int) RgnInfo.UnityNote) < 40) pitchbasecents += (MIDIKey() - (int) RgnInfo.UnityNote) * 100; |
// |
886 |
|
// Update: Removed this GSt misbehavior. I don't think that any stock |
887 |
|
// gig sound requires it to resemble its original sound. |
888 |
|
// -- Christian, 2017-07-09 |
889 |
|
if (!SmplInfo.Unpitched /* && (MIDIKey() - (int) RgnInfo.UnityNote) < 40*/) |
890 |
|
pitchbasecents += (MIDIKey() - (int) RgnInfo.UnityNote) * 100; |
891 |
|
|
892 |
pitch.PitchBase = RTMath::CentsToFreqRatioUnlimited(pitchbasecents) * (double(SmplInfo.SampleRate) / double(GetEngine()->SampleRate)); |
pitch.PitchBase = RTMath::CentsToFreqRatioUnlimited(pitchbasecents) * (double(SmplInfo.SampleRate) / double(GetEngine()->SampleRate)); |
893 |
this->Pitch = pitch; |
this->Pitch = pitch; |