From 5cb8ac2801d5aeeecfb80e5f4801973300865cbc Mon Sep 17 00:00:00 2001 From: tlipinski Date: Thu, 15 Jun 2017 17:26:58 +0200 Subject: [PATCH] Cursor tracks fix --- .../net/tlipinski/bitwig/controller/Controller.java | 2 +- .../bitwig/controller/commands/TrackNextCommand.java | 10 ++++------ .../controller/commands/TrackPreviousCommand.java | 10 ++++------ 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/main/java/net/tlipinski/bitwig/controller/Controller.java b/src/main/java/net/tlipinski/bitwig/controller/Controller.java index 356922e..76bd733 100644 --- a/src/main/java/net/tlipinski/bitwig/controller/Controller.java +++ b/src/main/java/net/tlipinski/bitwig/controller/Controller.java @@ -79,6 +79,6 @@ public ImpulseModel getModel() { private EncoderMode encoderMode = EncoderMode.PLUGIN; private boolean shiftPressed = false; private EncoderMixerModePage encoderMixerPage = new EncoderMixerModePage(); - private ImpulseModel model; + private ImpulseModel model = ImpulseModel.IMPULSE_25; } diff --git a/src/main/java/net/tlipinski/bitwig/controller/commands/TrackNextCommand.java b/src/main/java/net/tlipinski/bitwig/controller/commands/TrackNextCommand.java index 37b5953..c1e1695 100644 --- a/src/main/java/net/tlipinski/bitwig/controller/commands/TrackNextCommand.java +++ b/src/main/java/net/tlipinski/bitwig/controller/commands/TrackNextCommand.java @@ -33,12 +33,10 @@ public Stream triggersWhen(int statusByte, int data1, int data2) { @Override public void handle(int data1, int data2) { CursorTrack cursorTrack = controller.getTracks().getCursorTrack(); - if (cursorTrack.hasNext().get()) { - int position = cursorTrack.position().get(); - Track t = controller.getTracks().get(position + 1); - cursorTrack.selectChannel(t); - sysexSend.displayText(t.name().get()); - } + cursorTrack.selectNext(); + controller.getHost().scheduleTask(() -> { + sysexSend.displayText(cursorTrack.name().get()); + }, 200); } private final Controller controller; diff --git a/src/main/java/net/tlipinski/bitwig/controller/commands/TrackPreviousCommand.java b/src/main/java/net/tlipinski/bitwig/controller/commands/TrackPreviousCommand.java index 5de8641..c71a348 100644 --- a/src/main/java/net/tlipinski/bitwig/controller/commands/TrackPreviousCommand.java +++ b/src/main/java/net/tlipinski/bitwig/controller/commands/TrackPreviousCommand.java @@ -33,12 +33,10 @@ public Stream triggersWhen(int statusByte, int data1, int data2) { @Override public void handle(int data1, int data2) { CursorTrack cursorTrack = controller.getTracks().getCursorTrack(); - if (cursorTrack.hasPrevious().get()) { - int position = cursorTrack.position().get(); - Track t = controller.getTracks().get(position - 1); - cursorTrack.selectChannel(t); - sysexSend.displayText(t.name().get()); - } + cursorTrack.selectPrevious(); + controller.getHost().scheduleTask(() -> { + sysexSend.displayText(cursorTrack.name().get()); + }, 200); } private final Controller controller;