diff --git a/build/MidiControl/Classes/IControlMIDI.cs b/build/MidiControl/Classes/IControlMIDI.cs index c0dfe17..5bf02d4 100644 --- a/build/MidiControl/Classes/IControlMIDI.cs +++ b/build/MidiControl/Classes/IControlMIDI.cs @@ -120,13 +120,10 @@ Deinitializes the output device */ public void DisconnectDevice() { - lock (lockDevice) + if (device != null) { - if (device != null) - { - device.Dispose(); - device = null; - } + device.Dispose(); + device = null; } } diff --git a/build/MidiControl/Classes/RotaryKnob.xaml.cs b/build/MidiControl/Classes/RotaryKnob.xaml.cs index 6bb39a7..6d4902f 100644 --- a/build/MidiControl/Classes/RotaryKnob.xaml.cs +++ b/build/MidiControl/Classes/RotaryKnob.xaml.cs @@ -150,7 +150,7 @@ private void SetRotation(ref double dAngle) dAngle = dAngle < Constants.KNOB_ROTATION_MIN ? Constants.KNOB_ROTATION_MIN : dAngle; //Calculate the knob status and set its angle - Status = Steps[(int)Math.Floor((dAngle - Constants.KNOB_ROTATION_MIN) / (Constants.KNOB_ROTATION_MAX - Constants.KNOB_ROTATION_MIN) * (Steps.Count - 1))]; + Status = Steps[(int)Math.Round((dAngle - Constants.KNOB_ROTATION_MIN) / (Constants.KNOB_ROTATION_MAX - Constants.KNOB_ROTATION_MIN) * (Steps.Count - 1))]; transformKnob.Angle = Constants.KNOB_ROTATION_MIN + (Constants.KNOB_ROTATION_MAX - Constants.KNOB_ROTATION_MIN) * (double)Steps.IndexOf(Status) / (Steps.Count - 1); } else