~tytel/helm/development

« back to all changes in this revision

Viewing changes to src/plugin/value_bridge.h

  • Committer: mtytel
  • Date: 2017-07-22 20:50:28 UTC
  • Revision ID: git-v1:cb54f5d9645fbd384a73b503448a9bf37ab38ace
Fixed Midi mapping to stepped value

Show diffs side-by-side

added added

removed removed

Lines of Context:
84
84
 
85
85
    // Converts from value from 0.0 to 1.0 to internal synth value.
86
86
    float convertToSynthValue(mopo::mopo_float plugin_value) const {
87
 
      mopo::mopo_float raw_value = span_ * plugin_value + details_.min;
88
 
      if (details_.steps)
89
 
        return floor(raw_value + 0.5);
90
 
      return raw_value;
 
87
      mopo::mopo_float percent = plugin_value;
 
88
      if (details_.steps) {
 
89
        mopo::mopo_float max_step = details_.steps - 1;
 
90
        percent = floor(percent * max_step + 0.5) / max_step;
 
91
      }
 
92
 
 
93
      return percent * span_ + details_.min;
91
94
    }
92
95
 
93
96
    void setValueNotifyHost(float new_value) {