use of de.mossgrabers.framework.featuregroup.ModeManager in project DrivenByMoss by git-moss.
the class SequencerView method handleSequencerArea.
/**
* {@inheritDoc}
*/
@Override
protected void handleSequencerArea(final int index, final int x, final int y, final int velocity) {
if (!this.isActive())
return;
final ModeManager modeManager = this.surface.getModeManager();
if (velocity > 0) {
// Turn on Note mode if an existing note is pressed
final INoteClip cursorClip = this.getClip();
final int mappedNote = this.keyManager.map(y);
final int editMidiChannel = this.configuration.getMidiEditChannel();
final StepState state = cursorClip.getStep(editMidiChannel, x, mappedNote).getState();
if (state == StepState.START) {
final NoteMode noteMode = (NoteMode) modeManager.get(Modes.NOTE);
noteMode.setValues(cursorClip, editMidiChannel, x, mappedNote);
modeManager.setActive(Modes.NOTE);
}
} else {
// Turn off Note mode
if (modeManager.isActive(Modes.NOTE))
modeManager.restore();
if (this.isNoteEdited) {
this.isNoteEdited = false;
return;
}
}
super.handleSequencerArea(index, x, y, velocity);
}
use of de.mossgrabers.framework.featuregroup.ModeManager in project DrivenByMoss by git-moss.
the class SendModeCommand method handleExecute.
private void handleExecute(final ButtonEvent event, final int index) {
// No Sends on FX tracks
if (event != ButtonEvent.DOWN || this.model.isEffectTrackBankActive())
return;
final ModeManager modeManager = this.surface.getModeManager();
modeManager.setActive(Modes.get(Modes.SEND1, index));
String modeName = "Send " + (index + 1) + ": ";
final ITrackBank trackBank = this.model.getTrackBank();
Optional<ITrack> selectedTrack = trackBank.getSelectedItem();
if (selectedTrack.isEmpty()) {
final ITrack item = trackBank.getItem(0);
selectedTrack = item.doesExist() ? Optional.of(item) : Optional.empty();
}
if (selectedTrack.isPresent())
modeName += selectedTrack.get().getSendBank().getItem(index).getName();
else
modeName += "-";
this.model.getHost().showNotification(modeName);
}
use of de.mossgrabers.framework.featuregroup.ModeManager in project DrivenByMoss by git-moss.
the class DrumView method handleSequencerArea.
/**
* {@inheritDoc}
*/
@Override
protected void handleSequencerArea(final int index, final int x, final int y, final int offsetY, final int velocity) {
if (!this.isActive())
return;
final ModeManager modeManager = this.surface.getModeManager();
if (velocity > 0) {
// Turn on Note mode if an existing note is pressed
final INoteClip cursorClip = this.getClip();
final int channel = this.configuration.getMidiEditChannel();
final int step = this.numColumns * (this.allRows - 1 - y) + x;
final int note = offsetY + this.selectedPad;
final StepState state = cursorClip.getStep(channel, step, note).getState();
if (state == StepState.START) {
final NoteMode noteMode = (NoteMode) modeManager.get(Modes.NOTE);
noteMode.setValues(cursorClip, channel, step, note);
modeManager.setActive(Modes.NOTE);
}
} else {
// Turn off Note mode
if (modeManager.isActive(Modes.NOTE))
modeManager.restore();
if (this.isNoteEdited) {
this.isNoteEdited = false;
return;
}
}
super.handleSequencerArea(index, x, y, offsetY, velocity);
}
use of de.mossgrabers.framework.featuregroup.ModeManager in project DrivenByMoss by git-moss.
the class DrumSequencerSelectCommand method executeNormal.
/**
* {@inheritDoc}}
*/
@Override
public void executeNormal(final ButtonEvent event) {
final ModeManager modeManager = this.surface.getModeManager();
// Toggle note mode
if (this.surface.isPressed(ButtonID.ALT)) {
if (event == ButtonEvent.DOWN) {
this.surface.setTriggerConsumed(ButtonID.ALT);
if (modeManager.isActive(Modes.NOTE))
modeManager.restore();
else
modeManager.setActive(Modes.NOTE);
this.surface.getDisplay().notify("Edit Notes: " + (modeManager.isActive(Modes.NOTE) ? "On" : "Off"));
((INoteMode) modeManager.get(Modes.NOTE)).clearNotes();
}
return;
}
super.executeNormal(event);
if (event == ButtonEvent.UP) {
((INoteMode) modeManager.get(Modes.NOTE)).clearNotes();
final ITrack cursorTrack = this.model.getCursorTrack();
if (cursorTrack.doesExist()) {
final ViewManager viewManager = this.surface.getViewManager();
viewManager.setPreferredView(cursorTrack.getPosition(), viewManager.getActiveID());
}
}
}
use of de.mossgrabers.framework.featuregroup.ModeManager in project DrivenByMoss by git-moss.
the class FireSelectButtonCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event, final int velocity) {
if (velocity > 0)
return;
final ModeManager modeManager = this.surface.getModeManager();
if (modeManager.isActive(Modes.NOTE)) {
((NoteMode) modeManager.get(Modes.NOTE)).resetTranspose();
return;
}
if (modeManager.isActive(Modes.BROWSER)) {
((FireBrowserCommand) this.surface.getButton(ButtonID.BROWSE).getCommand()).discardBrowser(true);
return;
}
final FireConfiguration configuration = this.surface.getConfiguration();
final ICursorDevice cursorDevice = this.model.getCursorDevice();
if (modeManager.isActive(Modes.DEVICE_PARAMS) && configuration.isDeleteModeActive()) {
cursorDevice.remove();
configuration.toggleDeleteModeActive();
return;
}
cursorDevice.toggleWindowOpen();
}
Aggregations