X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=_MIDI.pde;h=4e1f20acbcf9a03bab451300007e87f394f376e7;hb=ab65d40b549a354ba5f70b08c29d35d0971243cf;hp=36ec92c02f5b6e7906980c1152268564ffbb844a;hpb=4ad9f85959980d306800ad50636f4fd7c2a5d36b;p=SugarCubes.git diff --git a/_MIDI.pde b/_MIDI.pde index 36ec92c..4e1f20a 100644 --- a/_MIDI.pde +++ b/_MIDI.pde @@ -710,7 +710,7 @@ class KorgNanoKontrolMidiInput extends GenericDeviceMidiInput { } } -class APC40MidiOutput implements LXParameter.Listener, GridOutput { +class APC40MidiOutput implements LXParameterListener, GridOutput { private final MidiEngine midiEngine; private final MidiOutput output; @@ -863,7 +863,11 @@ class APC40MidiOutput implements LXParameter.Listener, GridOutput { } private void sendKnob(int i, LXParameter p) { - sendKnob(i, (int) (p.getValuef() * 127.)); + float pv = constrain(p.getValuef(), 0, 1); + if (p instanceof LXNormalizedParameter) { + pv = ((LXNormalizedParameter)p).getNormalizedf(); + } + sendKnob(i, (int) (pv * 127.)); } private void sendKnob(int i, int value) {