use of de.mossgrabers.framework.daw.data.bank.ISlotBank 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.bank.ISlotBank in project DrivenByMoss by git-moss.
the class MixerMode method getKnobValue.
/**
* {@inheritDoc}
*/
@Override
public int getKnobValue(final int index) {
// Note: Since we need multiple value (more than 8), index is the MIDI CC of the knob
final IValueChanger valueChanger = this.model.getValueChanger();
if (index >= KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME && index < KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME + 8) {
final ITrack track = this.bank.getItem(index - KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME);
return valueChanger.toMidiValue(track.getVolume());
}
if (index >= KontrolProtocolControlSurface.KONTROL_TRACK_PAN && index < KontrolProtocolControlSurface.KONTROL_TRACK_PAN + 8) {
final ITrack track = this.bank.getItem(index - KontrolProtocolControlSurface.KONTROL_TRACK_PAN);
return valueChanger.toMidiValue(track.getPan());
}
final Optional<ITrack> selectedTrack = this.bank.getSelectedItem();
final int scrollTracksState = (this.bank.canScrollBackwards() ? 1 : 0) + (this.bank.canScrollForwards() ? 2 : 0);
int scrollClipsState = 0;
if (selectedTrack.isPresent()) {
final ISlotBank slotBank = selectedTrack.get().getSlotBank();
scrollClipsState = (slotBank.canScrollBackwards() ? 1 : 0) + (slotBank.canScrollForwards() ? 2 : 0);
}
final ISceneBank sceneBank = this.model.getSceneBank();
final int scrollScenesState = (sceneBank.canScrollBackwards() ? 1 : 0) + (sceneBank.canScrollForwards() ? 2 : 0);
final KontrolProtocolConfiguration configuration = this.surface.getConfiguration();
switch(index) {
case KontrolProtocolControlSurface.KONTROL_NAVIGATE_BANKS:
return (this.bank.canScrollPageBackwards() ? 1 : 0) + (this.bank.canScrollPageForwards() ? 2 : 0);
case KontrolProtocolControlSurface.KONTROL_NAVIGATE_TRACKS:
if (configuration.isFlipTrackClipNavigation())
return configuration.isFlipClipSceneNavigation() ? scrollScenesState : scrollClipsState;
return scrollTracksState;
case KontrolProtocolControlSurface.KONTROL_NAVIGATE_CLIPS:
if (configuration.isFlipTrackClipNavigation())
return scrollTracksState;
return configuration.isFlipClipSceneNavigation() ? scrollScenesState : scrollClipsState;
default:
return 0;
}
}
use of de.mossgrabers.framework.daw.data.bank.ISlotBank 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);
}
}
use of de.mossgrabers.framework.daw.data.bank.ISlotBank in project DrivenByMoss by git-moss.
the class PageCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event, final int velocity) {
if (event != ButtonEvent.DOWN)
return;
final ModeManager modeManager = this.surface.getModeManager();
final Modes mode = modeManager.getActiveID();
switch(mode) {
case DEVICE_PARAMS:
final ICursorDevice cursorDevice = this.model.getCursorDevice();
if (this.direction == Direction.LEFT)
cursorDevice.selectPrevious();
else
cursorDevice.selectNext();
this.mvHelper.notifySelectedDevice();
break;
case USER:
final IParameterBank userBank = this.model.getUserParameterBank();
if (this.direction == Direction.LEFT)
userBank.selectPreviousPage();
else
userBank.selectNextPage();
this.mvHelper.notifySelectedUserPage();
break;
case BROWSER:
if (this.direction == Direction.LEFT)
this.model.getBrowser().previousContentType();
else
this.model.getBrowser().nextContentType();
break;
default:
final ITrack cursorTrack = this.model.getCursorTrack();
if (!cursorTrack.doesExist())
return;
final ISlotBank slotBank = cursorTrack.getSlotBank();
if (this.direction == Direction.LEFT) {
if (this.surface.isShiftPressed()) {
this.surface.setStopConsumed();
slotBank.selectPreviousPage();
} else
slotBank.selectPreviousItem();
} else {
if (this.surface.isShiftPressed()) {
this.surface.setStopConsumed();
slotBank.selectNextPage();
} else
slotBank.selectNextItem();
}
break;
}
}
use of de.mossgrabers.framework.daw.data.bank.ISlotBank in project DrivenByMoss by git-moss.
the class SessionView method drawGrid.
/**
* {@inheritDoc}
*/
@Override
public void drawGrid() {
final ITrackBank tb = this.model.getCurrentTrackBank();
for (int x = 0; x < 8; x++) {
final ITrack t = tb.getItem(x);
final ISlotBank slotBank = t.getSlotBank();
for (int y = 0; y < 8; y++) this.drawPad(slotBank.getItem(y), x, y, t.isRecArm());
}
}
Aggregations