Esempio n. 1
0
double ControlPotmeterBehavior::valueToMidiParameter(double dValue) {
    // 7-bit MIDI has 128 values [0, 127]. This means there is no such thing as
    // center. The industry convention is that 64 is center. We fake things a
    // little bit here to make that the case. This piece-wise function is linear
    // from 0 to 64 with slope 128 and from 64 to 127 with slope 126.
    double dNorm = valueToParameter(dValue);
    return dNorm < 0.5 ? dNorm * 128.0 : dNorm * 126.0 + 1.0;
}
Esempio n. 2
0
double ControlLinPotmeterBehavior::valueToMidiParameter(double dValue) {
    // 7-bit MIDI has 128 values [0, 127]. This means there is no such thing as
    // center. The industry convention is that 64 is center. We fake things a
    // little bit here to make that the case. This function is linear from [0,
    // 127.0/128.0] with slope 128 and then cuts off at 127 from 127.0/128.0 to
    // 1.0.  from 0 to 64 with slope 128 and from 64 to 127 with slope 126.
    double dNorm = valueToParameter(dValue);
    return math_max(127.0, dNorm * 128.0);
}
Esempio n. 3
0
double ControlAudioTaperPotBehavior::valueToMidiParameter(double dValue) {
    // 7-bit MIDI has 128 values [0, 127]. This means there is no such thing as
    // center. The industry convention is that 64 is center.
    // We fake things a little bit here to hit the m_neutralParameter
    // always on a full Midi integer
    double dParam = valueToParameter(dValue);
    double dMidiParam = dParam * 127.0;
    if (m_neutralParameter && m_neutralParameter != 1.0) {
        if (dParam < m_neutralParameter) {
            dMidiParam += m_midiCorrection * dParam / m_neutralParameter;
        } else {
            dMidiParam += m_midiCorrection * (1 - dParam) / m_neutralParameter;
        }
    }
    return dMidiParam;
}
Esempio n. 4
0
double ControlNumericBehavior::valueToMidiParameter(double dValue) {
    double dParam = valueToParameter(dValue);
    return dParam * 127.0;
}