diff options
author | André Nusser <andre.nusser@googlemail.com> | 2019-07-22 02:35:34 +0200 |
---|---|---|
committer | André Nusser <andre.nusser@googlemail.com> | 2019-07-22 02:35:34 +0200 |
commit | 85f0c0b1adc57c33a7c4d3ef50ac22e7001739a1 (patch) | |
tree | 578b80600b8f0d91c50dbf67aae3e29a68983466 /src/inputprocessor.cc | |
parent | bf2ef1bb3a7f25338944ec3ce233f8b57611adba (diff) |
Center velocities as well as disable stddev when disabling humanizer.
Diffstat (limited to 'src/inputprocessor.cc')
-rw-r--r-- | src/inputprocessor.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/inputprocessor.cc b/src/inputprocessor.cc index b5b887f..4b0b20f 100644 --- a/src/inputprocessor.cc +++ b/src/inputprocessor.cc @@ -182,7 +182,11 @@ bool InputProcessor::processOnset(event_t& event, } - const auto sample = instr->sample(event.velocity, event.offset + pos); + auto const power_max = instr->getMaxPower(); + auto const power_min = instr->getMinPower(); + float const power_span = power_max - power_min; + float const instrument_level = power_min + event.velocity*power_span; + const auto sample = instr->sample(instrument_level, event.offset + pos); if(sample == nullptr) { @@ -190,9 +194,7 @@ bool InputProcessor::processOnset(event_t& event, return false; } - auto selected_level = - (sample->getPower() - instr->getMinPower()) / - (instr->getMaxPower() - instr->getMinPower()); + auto const selected_level = (sample->getPower() - instr->getMinPower())/power_span; settings.velocity_modifier_current.store(selected_level / orig_level); for(Channel& ch: kit.channels) |