use of de.mossgrabers.framework.daw.data.ISlot in project DrivenByMoss by git-moss.
the class ControlMode method sendClipData.
/**
* Send clip data.
*
* @param d The display
* @param isMPC Is it MPC or Force?
* @param trackIndex The index of the track to which the clips belong
* @param slotBank The bank containing the clips
*/
private void sendClipData(final ACVSDisplay d, final boolean isMPC, final int trackIndex, final ISlotBank slotBank) {
// Clips on the screen
for (int clipIndex = 0; clipIndex < 8; clipIndex++) {
final ISlot slot = slotBank.getItem(clipIndex);
final int position = clipIndex * 8 + trackIndex;
final int slotState = convertSlotState(slot);
d.setRow(ACVSDisplay.ITEM_ID_CLIPS_FIRST + position, slot.getName());
d.setScreenItem(ScreenItem.get(ScreenItem.CLIP1_STATE, position), slotState);
// Clip colors can alternatively set with CC from the color palette:
// <pre>d.setScreenItem (ScreenItem.get (ScreenItem.CLIP1_COLOR, position),
// slotColor);</pre>
d.setColor(ACVSDisplay.ITEM_ID_CLIPS_FIRST + position, slot.getColor());
}
// Progress currently not supported in the API
d.setScreenItem(ScreenItem.get(ScreenItem.TRACK1_CLIP_PROGRESS, trackIndex), 0);
// Set pad colors and state representing clips
if (!this.surface.getConfiguration().isLaunchClips())
return;
for (int clipIndex = 0; clipIndex < 8; clipIndex++) {
final ISlot slot = slotBank.getItem(clipIndex);
final int position = clipIndex * 8 + trackIndex;
final int slotState = convertSlotState(slot);
final int slotColor = this.convertSlotStateToColor(slot);
if (isMPC) {
d.setScreenItem(ScreenItem.get(ScreenItem.MPC_PAD1_STATE, position), slotState);
d.setScreenItem(ScreenItem.get(ScreenItem.MPC_PAD1_COLOR, position), slotColor);
} else {
d.setScreenItem(ScreenItem.get(ScreenItem.FORCE_PAD1_STATE, position), slotState);
d.setScreenItem(ScreenItem.get(ScreenItem.FORCE_PAD1_COLOR, position), slotColor);
}
}
}
use of de.mossgrabers.framework.daw.data.ISlot in project DrivenByMoss by git-moss.
the class AbstractSessionView method onGridNote.
/**
* {@inheritDoc}
*/
@Override
public void onGridNote(final int note, final int velocity) {
// Trigger on pad release to intercept long presses
if (velocity != 0)
return;
final Pair<Integer, Integer> padPos = this.getPad(note);
final ITrack track = this.model.getCurrentTrackBank().getItem(padPos.getKey().intValue());
final ISlot slot = track.getSlotBank().getItem(padPos.getValue().intValue());
if (this.handleButtonCombinations(track, slot))
return;
if (this.surface.isSelectPressed()) {
slot.select();
if (slot.hasContent()) {
final String slotName = slot.getName();
if (!slotName.isBlank())
this.surface.getDisplay().notify(slotName);
}
return;
}
if (this.doSelectClipOnLaunch())
slot.select();
if (!track.isRecArm() || slot.hasContent()) {
slot.launch();
return;
}
final C configuration = this.surface.getConfiguration();
switch(configuration.getActionForRecArmedPad()) {
case 0:
this.model.recordNoteClip(track, slot);
break;
case 1:
final int lengthInBeats = configuration.getNewClipLenghthInBeats(this.model.getTransport().getQuartersPerMeasure());
this.model.createNoteClip(track, slot, lengthInBeats, true);
break;
case 2:
default:
// Do nothing
break;
}
}
use of de.mossgrabers.framework.daw.data.ISlot in project DrivenByMoss by git-moss.
the class FootswitchCommand method handleLooper.
/**
* Handle clip looper.
*
* @param event The button event
*/
private void handleLooper(final ButtonEvent event) {
if (event == ButtonEvent.LONG)
return;
final ITrack cursorTrack = this.model.getCursorTrack();
if (!cursorTrack.doesExist()) {
this.surface.getDisplay().notify("Please select an Instrument track first.");
return;
}
final ISlotBank slotBank = cursorTrack.getSlotBank();
final Optional<ISlot> selectedSlot = slotBank.getSelectedItem();
final ISlot slot = selectedSlot.isEmpty() ? slotBank.getItem(0) : selectedSlot.get();
final boolean isDown = event == ButtonEvent.DOWN;
if (isDown && !slot.hasContent()) {
// If there is no clip in the selected slot, create a clip and begin record
// mode. Releasing it ends record mode.
this.newCommand.execute();
slot.select();
}
this.model.getTransport().setLauncherOverdub(isDown);
// Start transport if not already playing
slot.launch();
}
use of de.mossgrabers.framework.daw.data.ISlot in project DrivenByMoss by git-moss.
the class ConfiguredRecordCommand method isLit.
/**
* Returns true if the record button should be lit depending on the selected function.
*
* @return True if lit
*/
public boolean isLit() {
final C configuration = this.surface.getConfiguration();
final AbstractConfiguration.RecordFunction recordMode = this.isShifted() ? configuration.getShiftedRecordButtonFunction() : configuration.getRecordButtonFunction();
switch(recordMode) {
case RECORD_ARRANGER:
return this.model.getTransport().isRecording();
case NEW_CLIP:
case RECORD_CLIP:
final Optional<ISlot> slot = this.model.getSelectedSlot();
if (slot.isEmpty())
return false;
final ISlot s = slot.get();
return s.isRecording();
case TOGGLE_ARRANGER_OVERDUB:
return this.model.getTransport().isArrangerOverdub();
case TOGGLE_CLIP_OVERDUB:
return this.model.getTransport().isLauncherOverdub();
case TOGGLE_REC_ARM:
final Optional<ITrack> selectedTrack = this.model.getCurrentTrackBank().getSelectedItem();
return selectedTrack.isPresent() && selectedTrack.get().isRecArm();
default:
return false;
}
}
use of de.mossgrabers.framework.daw.data.ISlot in project DrivenByMoss by git-moss.
the class ClipView method drawGrid.
/**
* {@inheritDoc}
*/
@Override
public void drawGrid() {
final IPadGrid padGrid = this.surface.getPadGrid();
final Optional<ITrack> selectedTrack = this.model.getCurrentTrackBank().getSelectedItem();
if (selectedTrack.isEmpty())
return;
final ISlotBank slotBank = selectedTrack.get().getSlotBank();
for (int i = 0; i < 16; i++) {
final ISlot item = slotBank.getItem(i);
final int x = i % 4;
final int y = 3 - i / 4;
if (item.doesExist()) {
if (item.isRecordingQueued())
padGrid.lightEx(x, y, MaschineColorManager.COLOR_RED_LO);
else if (item.isRecording())
padGrid.lightEx(x, y, MaschineColorManager.COLOR_RED);
else if (item.isPlayingQueued())
padGrid.lightEx(x, y, MaschineColorManager.COLOR_GREEN_LO);
else if (item.isPlaying())
padGrid.lightEx(x, y, MaschineColorManager.COLOR_GREEN);
else if (item.isStopQueued())
padGrid.lightEx(x, y, MaschineColorManager.COLOR_GREEN_LO);
else
padGrid.lightEx(x, y, DAWColor.getColorIndex(item.getColor()));
} else
padGrid.lightEx(x, y, AbstractFeatureGroup.BUTTON_COLOR_OFF);
}
}
Aggregations