Skip to content

Commit

Permalink
Rotary knob control and device system
Browse files Browse the repository at this point in the history
Updated the rotary knob control system.
Updated the device control system.
  • Loading branch information
DavidMolTor committed Sep 20, 2024
1 parent b12ebfd commit 5cacb50
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions build/MidiControl/Classes/IControlMIDI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
2 changes: 1 addition & 1 deletion build/MidiControl/Classes/RotaryKnob.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5cacb50

Please sign in to comment.