use of de.mossgrabers.framework.daw.INoteClip in project DrivenByMoss by git-moss.
the class PolySequencerView method onButton.
/**
* {@inheritDoc}
*/
@Override
public void onButton(final ButtonID buttonID, final ButtonEvent event, final int velocity) {
if (event != ButtonEvent.DOWN || !this.isActive())
return;
final ITrack cursorTrack = this.model.getCursorTrack();
final INoteClip clip = this.getClip();
switch(buttonID) {
case ARROW_LEFT:
if (this.surface.isPressed(ButtonID.ALT))
this.setResolutionIndex(this.selectedResolutionIndex - 1);
else {
clip.scrollStepsPageBackwards();
this.mvHelper.notifyEditPage(clip);
}
break;
case ARROW_RIGHT:
if (this.surface.isPressed(ButtonID.ALT))
this.setResolutionIndex(this.selectedResolutionIndex + 1);
else {
clip.scrollStepsPageForward();
this.mvHelper.notifyEditPage(clip);
}
break;
case SCENE1:
cursorTrack.stop();
break;
case SCENE2:
cursorTrack.toggleMute();
break;
case SCENE3:
cursorTrack.toggleSolo();
break;
case SCENE4:
cursorTrack.toggleRecArm();
break;
default:
// Not used
break;
}
}
use of de.mossgrabers.framework.daw.INoteClip in project DrivenByMoss by git-moss.
the class AbstractDrumLaneView method drawGrid.
/**
* {@inheritDoc}
*/
@Override
public void drawGrid() {
final IPadGrid padGrid = this.surface.getPadGrid();
if (!this.isActive()) {
padGrid.turnOff();
return;
}
// Clip length/loop area
final INoteClip clip = this.getClip();
final int step = clip.getCurrentStep();
// Paint the sequencer steps
final int hiStep = this.isInXRange(step) ? step % this.clipCols : -1;
final int offsetY = this.scales.getDrumOffset();
final int editMidiChannel = this.configuration.getMidiEditChannel();
final List<GridStep> editNotes = this.getEditNotes();
for (int sound = 0; sound < this.lanes; sound++) {
final int noteRow = offsetY + sound;
final Optional<ColorEx> drumPadColor = this.getPadColor(this.primary, sound);
for (int col = 0; col < this.clipCols; col++) {
final IStepInfo stepInfo = clip.getStep(editMidiChannel, col, noteRow);
final boolean hilite = col == hiStep;
final int x = col % this.numColumns;
int y = this.lanes - 1 - sound;
if (col >= this.numColumns)
y += this.lanes;
padGrid.lightEx(x, y, this.getStepColor(stepInfo, hilite, drumPadColor, editMidiChannel, col, noteRow, editNotes));
}
}
}
use of de.mossgrabers.framework.daw.INoteClip in project DrivenByMoss by git-moss.
the class AbstractDrumLaneView method onGridNote.
/**
* {@inheritDoc}
*/
@Override
public void onGridNote(final int note, final int velocity) {
if (!this.isActive())
return;
final int index = note - DRUM_START_KEY;
final int x = index % this.numColumns;
final int y = index / this.numColumns;
final int sound = y % this.lanes + this.scales.getDrumOffset();
final int laneOffset = (this.allRows - 1 - y) / this.lanes * this.numColumns;
final int col = laneOffset + x;
final int channel = this.configuration.getMidiEditChannel();
final int vel = this.configuration.isAccentActive() ? this.configuration.getFixedAccentValue() : this.surface.getButton(ButtonID.get(ButtonID.PAD1, index)).getPressedVelocity();
final INoteClip clip = this.getClip();
if (this.handleNoteAreaButtonCombinations(clip, channel, col, y, sound, velocity, vel))
return;
if (velocity == 0)
clip.toggleStep(channel, col, sound, vel);
}
use of de.mossgrabers.framework.daw.INoteClip in project DrivenByMoss by git-moss.
the class AbstractDrumView method handleLoopArea.
/**
* Handle button presses in the loop area of the drum sequencer.
*
* @param pad The pressed pad
* @param velocity The velocity
*/
protected void handleLoopArea(final int pad, final int velocity) {
final boolean isAccentActive = this.configuration.isAccentActive();
if (isAccentActive) {
if (velocity == 0)
return;
final int selPad = (3 - pad / 4) * 4 + pad % 4;
this.configuration.setFixedAccentValue((selPad + 1) * 8 - 1);
return;
}
// Button pressed?
if (velocity > 0) {
// Not yet a button pressed, store it
if (this.loopPadPressed == -1)
this.loopPadPressed = pad;
return;
}
if (this.loopPadPressed == -1)
return;
final INoteClip clip = this.getClip();
if (pad == this.loopPadPressed && pad != clip.getEditPage()) {
// Only single pad pressed -> page selection
clip.scrollToPage(pad);
} else {
final int start = this.loopPadPressed < pad ? this.loopPadPressed : pad;
final int end = (this.loopPadPressed < pad ? pad : this.loopPadPressed) + 1;
final int lengthOfOnePad = this.getLengthOfOnePage(this.sequencerSteps);
// Set a new loop between the 2 selected pads
final int newStart = start * lengthOfOnePad;
clip.setLoopStart(newStart);
clip.setLoopLength((end - start) * lengthOfOnePad);
clip.setPlayRange(newStart, (double) end * lengthOfOnePad);
}
this.loopPadPressed = -1;
}
use of de.mossgrabers.framework.daw.INoteClip 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);
}
Aggregations