use of de.mossgrabers.framework.daw.data.ITrack in project DrivenByMoss by git-moss.
the class AbstractRaindropsView method drawGrid.
/**
* {@inheritDoc}
*/
@Override
public void drawGrid() {
final IPadGrid padGrid = this.surface.getPadGrid();
if (!this.isActive()) {
padGrid.turnOff();
return;
}
if (this.ongoingResolutionChange)
return;
final ITrack cursorTrack = this.useDawColors ? this.model.getCursorTrack() : null;
final INoteClip clip = this.getClip();
final int length = (int) Math.floor(clip.getLoopLength() / Resolution.getValueAt(this.selectedResolutionIndex));
final int step = clip.getCurrentStep();
for (int x = 0; x < AbstractRaindropsView.NUM_DISPLAY_COLS; x++) {
final int mappedKey = this.keyManager.map(x);
if (mappedKey == -1)
continue;
final int left = this.getNoteDistanceToTheLeft(mappedKey, step, length);
final int right = this.getNoteDistanceToTheRight(mappedKey, step, length);
final boolean isOn = left >= 0 && right >= 0;
final int sum = left + right;
final int distance = sum == 0 ? 0 : (sum + 1) / 2;
for (int y = 0; y < this.numDisplayRows; y++) {
String colorID = y == 0 ? this.getPadColor(x, cursorTrack) : AbstractSequencerView.COLOR_NO_CONTENT;
if (isOn) {
if (y == distance)
colorID = AbstractSequencerView.COLOR_CONTENT;
if (left <= distance && y == left || left > distance && y == sum - left)
colorID = AbstractSequencerView.COLOR_STEP_HILITE_NO_CONTENT;
}
padGrid.lightEx(x, this.numDisplayRows - 1 - y, colorID);
}
}
}
use of de.mossgrabers.framework.daw.data.ITrack 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.ITrack in project DrivenByMoss by git-moss.
the class ColorView method onGridNote.
/**
* {@inheritDoc}
*/
@Override
public void onGridNote(final int note, final int velocity) {
if (velocity > 0)
return;
final int offset = this.page * this.pageSize;
final int color = offset + note - 36;
final DAWColor[] dawColors = DAWColor.values();
if (color < dawColors.length) {
final ColorEx entry = dawColors[color].getColor();
switch(this.mode) {
case MODE_TRACK:
final ITrack cursorTrack = this.model.getCursorTrack();
if (cursorTrack.doesExist())
cursorTrack.setColor(entry);
else {
final IMasterTrack master = this.model.getMasterTrack();
if (master.isSelected())
master.setColor(entry);
}
break;
case MODE_LAYER:
final IBank<? extends ILayer> layerBank = this.getLayerBank();
final Optional<?> selectedItem = layerBank.getSelectedItem();
if (selectedItem.isPresent())
((ILayer) selectedItem.get()).setColor(entry);
break;
case MODE_CLIP:
final IClip clip = this.model.getCursorClip();
if (clip.doesExist())
clip.setColor(entry);
break;
}
}
this.surface.getViewManager().restore();
}
use of de.mossgrabers.framework.daw.data.ITrack in project DrivenByMoss by git-moss.
the class MastertrackCommand method handleButtonUp.
private void handleButtonUp(final ModeManager modeManager) {
if (this.quitMasterMode) {
modeManager.restore();
return;
}
if (Modes.MASTER.equals(modeManager.getActiveID())) {
if (this.selectedTrackBeforeMasterMode >= 0)
this.model.getCurrentTrackBank().getItem(this.selectedTrackBeforeMasterMode).select();
return;
}
modeManager.setActive(Modes.MASTER);
this.model.getMasterTrack().select();
final ITrack cursorTrack = this.model.getCursorTrack();
this.selectedTrackBeforeMasterMode = cursorTrack.doesExist() ? cursorTrack.getIndex() : -1;
}
use of de.mossgrabers.framework.daw.data.ITrack in project DrivenByMoss by git-moss.
the class TrackEditing method onTrackKnob.
/**
* A knob is moved for changing a track parameter.
*
* @param index The index of the knob
* @param value The knobs value
* @param isTurnedRight The knob is turned to the right (positive value change)
*/
public void onTrackKnob(final int index, final int value, final boolean isTurnedRight) {
final ITrackBank tb = this.model.getCurrentTrackBank();
final Optional<ITrack> selectedTrack = tb.getSelectedItem();
if (selectedTrack.isEmpty())
return;
switch(index) {
case 0:
selectedTrack.get().changeVolume(value);
break;
case 1:
selectedTrack.get().changePan(value);
break;
case 2:
selectedTrack.get().setMute(isTurnedRight);
break;
case 3:
selectedTrack.get().setSolo(isTurnedRight);
break;
case 4:
selectedTrack.get().getCrossfadeParameter().changeValue(value);
break;
case 5:
this.model.getTransport().changeTempo(isTurnedRight, this.surface.isShiftPressed());
break;
case 6:
this.model.getTransport().changePosition(isTurnedRight, this.surface.isShiftPressed());
break;
case 7:
this.model.getMasterTrack().changeVolume(value);
break;
// Send 1 - 4
case 8:
case 9:
case 10:
case 11:
if (!this.model.isEffectTrackBankActive())
selectedTrack.get().getSendBank().getItem(index - 8).changeValue(value);
break;
default:
// Not used
break;
}
}
Aggregations