Skip to content

Commit 876d9a3

Browse files
committed
New Sequencer Modes for LPP, ALT Launch and fixes
1 parent 97fb723 commit 876d9a3

File tree

13 files changed

+1469
-1384
lines changed

13 files changed

+1469
-1384
lines changed

src/main/java/com/akai/fire/AkaiFireDrumSeqExtension.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import com.bitwig.extension.callback.ShortMidiMessageReceivedCallback;
1212
import com.bitwig.extension.controller.ControllerExtension;
1313
import com.bitwig.extension.controller.api.*;
14-
import com.bitwig.extensions.debug.RemoteConsole;
1514
import com.bitwig.extensions.framework.Layer;
1615
import com.bitwig.extensions.framework.Layers;
1716
import com.bitwig.extensions.rh.BooleanValueObject;
@@ -62,7 +61,6 @@ protected AkaiFireDrumSeqExtension(final AkaiFireDrumSeqDefinition definition, f
6261
@Override
6362
public void init() {
6463
host = getHost();
65-
RemoteConsole.out.registerHost(host);
6664
Arrays.fill(lastCcValue, -1);
6765

6866
layers = new Layers(this);

src/main/java/com/akai/fire/sequence/DrumSequenceMode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public DrumSequenceMode(final AkaiFireDrumSeqExtension driver) {
9494
}
9595
});
9696
cursorClip.isPinned().markInterested();
97-
positionHandler = new StepViewPosition(cursorClip);
97+
positionHandler = new StepViewPosition(cursorClip, 32, "AKAI");
9898

9999
padHandler = new PadHandler(driver, this, mainLayer, muteLayer, soloLayer);
100100
clipHandler = new SeqClipHandler(driver, this, mainLayer);

src/main/java/com/akai/fire/sequence/SeqClipHandler.java

Lines changed: 118 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -8,141 +8,138 @@
88
import com.bitwig.extension.controller.api.ClipLauncherSlotBank;
99
import com.bitwig.extension.controller.api.CursorTrack;
1010
import com.bitwig.extension.controller.api.PinnableCursorClip;
11-
import com.bitwig.extensions.debug.RemoteConsole;
1211
import com.bitwig.extensions.framework.Layer;
1312

1413
public class SeqClipHandler {
1514

16-
private final DrumSequenceMode parent;
17-
private final PinnableCursorClip cursorClip;
18-
private int selectedSlotIndex = -1;
19-
private final ClipLauncherSlotBank slotBank;
20-
private final RgbLigthState[] slotColors = new RgbLigthState[16];
21-
private final CursorTrack cursorTrack;
22-
private int blinkState = 0;
15+
private final DrumSequenceMode parent;
16+
private final PinnableCursorClip cursorClip;
17+
private int selectedSlotIndex = -1;
18+
private final ClipLauncherSlotBank slotBank;
19+
private final RgbLigthState[] slotColors = new RgbLigthState[16];
20+
private final CursorTrack cursorTrack;
21+
private int blinkState = 0;
2322

24-
public SeqClipHandler(final AkaiFireDrumSeqExtension driver, final DrumSequenceMode parent, final Layer clipLayer) {
25-
this.parent = parent;
26-
this.cursorClip = parent.getCursorClip();
27-
cursorTrack = driver.getViewControl().getCursorTrack();
28-
slotBank = cursorTrack.clipLauncherSlotBank();
29-
initClipControlButtons(clipLayer, driver);
30-
}
23+
public SeqClipHandler(final AkaiFireDrumSeqExtension driver, final DrumSequenceMode parent, final Layer clipLayer) {
24+
this.parent = parent;
25+
this.cursorClip = parent.getCursorClip();
26+
cursorTrack = driver.getViewControl().getCursorTrack();
27+
slotBank = cursorTrack.clipLauncherSlotBank();
28+
initClipControlButtons(clipLayer, driver);
29+
}
3130

32-
private void initClipControlButtons(final Layer clipLayer, final AkaiFireDrumSeqExtension driver) {
33-
final RgbButton[] rgbButtons = driver.getRgbButtons();
34-
for (int i = 0; i < 16; i++) {
35-
final RgbButton button = rgbButtons[i + 16];
36-
final int index = i;
31+
private void initClipControlButtons(final Layer clipLayer, final AkaiFireDrumSeqExtension driver) {
32+
final RgbButton[] rgbButtons = driver.getRgbButtons();
33+
for (int i = 0; i < 16; i++) {
34+
final RgbButton button = rgbButtons[i + 16];
35+
final int index = i;
3736

38-
final ClipLauncherSlot cs = slotBank.getItemAt(index);
37+
final ClipLauncherSlot cs = slotBank.getItemAt(index);
3938

40-
cs.color().addValueObserver((r, g, b) -> {
41-
slotColors[index] = ColorLookup.getColor(r, g, b);
42-
});
43-
cs.isSelected().addValueObserver(selected -> {
44-
if (selected) {
45-
selectedSlotIndex = index;
46-
}
47-
});
48-
slotColors[index] = ColorLookup.getColor(cs.color().get());
49-
cs.exists().markInterested();
50-
cs.hasContent().markInterested();
51-
cs.isPlaybackQueued().markInterested();
52-
cs.isPlaying().markInterested();
53-
cs.isRecording().markInterested();
54-
cs.isRecordingQueued().markInterested();
55-
cs.isSelected().markInterested();
56-
cs.isStopQueued().markInterested();
39+
cs.color().addValueObserver((r, g, b) -> {
40+
slotColors[index] = ColorLookup.getColor(r, g, b);
41+
});
42+
cs.isSelected().addValueObserver(selected -> {
43+
if (selected) {
44+
selectedSlotIndex = index;
45+
}
46+
});
47+
slotColors[index] = ColorLookup.getColor(cs.color().get());
48+
cs.exists().markInterested();
49+
cs.hasContent().markInterested();
50+
cs.isPlaybackQueued().markInterested();
51+
cs.isPlaying().markInterested();
52+
cs.isRecording().markInterested();
53+
cs.isRecordingQueued().markInterested();
54+
cs.isSelected().markInterested();
55+
cs.isStopQueued().markInterested();
5756

58-
button.bindPressed(clipLayer, p -> handleClip(index, cs, p), () -> getClipSate(index, cs));
59-
}
60-
}
57+
button.bindPressed(clipLayer, p -> handleClip(index, cs, p), () -> getClipSate(index, cs));
58+
}
59+
}
6160

62-
private RgbLigthState getClipSate(final int index, final ClipLauncherSlot slot) {
63-
if (slot.hasContent().get()) {
64-
if (slotColors[index] == null) {
65-
return RgbLigthState.OFF;
66-
}
67-
final RgbLigthState color = slotColors[index];
68-
if (slot.isSelected().get()) {
61+
private RgbLigthState getClipSate(final int index, final ClipLauncherSlot slot) {
62+
if (slot.hasContent().get()) {
63+
if (slotColors[index] == null) {
64+
return RgbLigthState.OFF;
65+
}
66+
final RgbLigthState color = slotColors[index];
67+
if (slot.isSelected().get()) {
6968

70-
if (slot.isPlaying().get()) {
71-
return blinkSlow(color.getBrightest(), color);
72-
}
73-
if (slot.isPlaybackQueued().get()) {
74-
return blinkFast(color.getBrightest(), color.getDimmed());
75-
}
76-
return color.getBrightend();
77-
} else {
78-
if (slot.isPlaying().get()) {
79-
return blinkSlow(color, color.getDimmed());
80-
}
81-
if (slot.isPlaybackQueued().get()) {
82-
return blinkFast(color, color.getDimmed());
83-
}
84-
return color.getDimmed();
85-
}
86-
}
87-
return RgbLigthState.OFF;
88-
}
69+
if (slot.isPlaying().get()) {
70+
return blinkSlow(color.getBrightest(), color);
71+
}
72+
if (slot.isPlaybackQueued().get()) {
73+
return blinkFast(color.getBrightest(), color.getDimmed());
74+
}
75+
return color.getBrightend();
76+
} else {
77+
if (slot.isPlaying().get()) {
78+
return blinkSlow(color, color.getDimmed());
79+
}
80+
if (slot.isPlaybackQueued().get()) {
81+
return blinkFast(color, color.getDimmed());
82+
}
83+
return color.getDimmed();
84+
}
85+
}
86+
return RgbLigthState.OFF;
87+
}
8988

90-
private RgbLigthState blinkSlow(final RgbLigthState on, final RgbLigthState off) {
91-
if (blinkState % 8 < 4) {
92-
return on;
93-
}
94-
return off;
95-
}
89+
private RgbLigthState blinkSlow(final RgbLigthState on, final RgbLigthState off) {
90+
if (blinkState % 8 < 4) {
91+
return on;
92+
}
93+
return off;
94+
}
9695

97-
private RgbLigthState blinkFast(final RgbLigthState on, final RgbLigthState off) {
98-
if (blinkState % 2 == 0) {
99-
return on;
100-
}
101-
return off;
102-
}
96+
private RgbLigthState blinkFast(final RgbLigthState on, final RgbLigthState off) {
97+
if (blinkState % 2 == 0) {
98+
return on;
99+
}
100+
return off;
101+
}
103102

104-
private void handleClip(final int index, final ClipLauncherSlot slot, final boolean pressed) {
105-
if (!pressed) {
106-
return;
107-
}
108-
final boolean hasContent = slot.hasContent().get();
109-
if (hasContent) {
110-
if (parent.isDeleteHeld()) {
111-
if (parent.isShiftHeld()) { // SHIFT + DELETE => remove clip
112-
slot.deleteObject();
113-
} else { // SHIFT + DELETE => clear all steps
114-
final int previous = selectedSlotIndex;
115-
slot.select();
116-
cursorClip.clearSteps();
117-
if (previous != -1) {
118-
slotBank.getItemAt(previous).select();
119-
}
120-
}
121-
} else if (parent.isCopyHeld()) { // copies note
122-
RemoteConsole.out.println("Copy Clip ", selectedSlotIndex);
123-
if (selectedSlotIndex != -1 && selectedSlotIndex != index) {
124-
slot.replaceInsertionPoint().copySlotsOrScenes(slotBank.getItemAt(selectedSlotIndex));
125-
}
126-
} else if (parent.isSelectHeld()) {
127-
slot.select();
128-
} else {
129-
slot.select();
130-
slot.launch();
131-
}
132-
} else {
133-
if (parent.isCopyHeld()) {
134-
if (selectedSlotIndex != -1 && selectedSlotIndex != index) {
135-
RemoteConsole.out.println("Copy Clip ", index);
136-
slot.replaceInsertionPoint().copySlotsOrScenes(slotBank.getItemAt(selectedSlotIndex));
137-
}
138-
} else {
139-
slot.createEmptyClip(4);
140-
}
141-
}
142-
}
103+
private void handleClip(final int index, final ClipLauncherSlot slot, final boolean pressed) {
104+
if (!pressed) {
105+
return;
106+
}
107+
final boolean hasContent = slot.hasContent().get();
108+
if (hasContent) {
109+
if (parent.isDeleteHeld()) {
110+
if (parent.isShiftHeld()) { // SHIFT + DELETE => remove clip
111+
slot.deleteObject();
112+
} else { // SHIFT + DELETE => clear all steps
113+
final int previous = selectedSlotIndex;
114+
slot.select();
115+
cursorClip.clearSteps();
116+
if (previous != -1) {
117+
slotBank.getItemAt(previous).select();
118+
}
119+
}
120+
} else if (parent.isCopyHeld()) { // copies note
121+
if (selectedSlotIndex != -1 && selectedSlotIndex != index) {
122+
slot.replaceInsertionPoint().copySlotsOrScenes(slotBank.getItemAt(selectedSlotIndex));
123+
}
124+
} else if (parent.isSelectHeld()) {
125+
slot.select();
126+
} else {
127+
slot.select();
128+
slot.launch();
129+
}
130+
} else {
131+
if (parent.isCopyHeld()) {
132+
if (selectedSlotIndex != -1 && selectedSlotIndex != index) {
133+
slot.replaceInsertionPoint().copySlotsOrScenes(slotBank.getItemAt(selectedSlotIndex));
134+
}
135+
} else {
136+
slot.createEmptyClip(4);
137+
}
138+
}
139+
}
143140

144-
public void notifyBlink(final int blinkState) {
145-
this.blinkState = blinkState;
146-
}
141+
public void notifyBlink(final int blinkState) {
142+
this.blinkState = blinkState;
143+
}
147144

148145
}

0 commit comments

Comments
 (0)