use of de.mossgrabers.framework.daw.INoteClip in project DrivenByMoss by git-moss.
the class SequencerView method getTrackButtonColor.
/**
* {@inheritDoc}
*/
@Override
public int getTrackButtonColor(final int index) {
final int octave = this.scales.getOctave();
final INoteClip clip = this.getClip();
switch(index) {
case 0:
return octave < Scales.OCTAVE_RANGE ? APCminiControlSurface.APC_BUTTON_STATE_ON : APCminiControlSurface.APC_BUTTON_STATE_OFF;
case 1:
return octave > -Scales.OCTAVE_RANGE ? APCminiControlSurface.APC_BUTTON_STATE_ON : APCminiControlSurface.APC_BUTTON_STATE_OFF;
case 2:
return clip.doesExist() && clip.canScrollStepsBackwards() ? APCminiControlSurface.APC_BUTTON_STATE_ON : APCminiControlSurface.APC_BUTTON_STATE_OFF;
case 3:
return clip.doesExist() && clip.canScrollStepsForwards() ? APCminiControlSurface.APC_BUTTON_STATE_ON : APCminiControlSurface.APC_BUTTON_STATE_OFF;
default:
return APCminiControlSurface.APC_BUTTON_STATE_OFF;
}
}
use of de.mossgrabers.framework.daw.INoteClip in project DrivenByMoss by git-moss.
the class DrumView method onGridNoteLongPress.
/**
* {@inheritDoc}
*/
@Override
public void onGridNoteLongPress(final int note) {
if (!this.isActive())
return;
final int index = note - DRUM_START_KEY;
this.surface.getButton(ButtonID.get(ButtonID.PAD1, index)).setConsumed();
final int y = index / GRID_COLUMNS;
// Sequencer steps?
if (y < this.playRows)
return;
final int x = index % GRID_COLUMNS;
final int stepX = GRID_COLUMNS * (this.allRows - 1 - y) + x;
final int stepY = this.scales.getDrumOffset() + this.getSelectedPad();
final int channel = this.configuration.getMidiEditChannel();
final INoteClip clip = this.getClip();
this.editNote(clip, channel, stepX, stepY, false);
}
use of de.mossgrabers.framework.daw.INoteClip in project DrivenByMoss by git-moss.
the class SequencerView method onGridNoteLongPress.
/**
* {@inheritDoc}
*/
@Override
public void onGridNoteLongPress(final int note) {
if (!this.isActive())
return;
final int index = note - 36;
this.surface.getButton(ButtonID.get(ButtonID.PAD1, index)).setConsumed();
final int y = index / 8;
if (y >= this.numSequencerRows)
return;
final int step = index % 8;
final INoteClip clip = this.getClip();
final int mappedNote = this.keyManager.map(y);
final int channel = this.configuration.getMidiEditChannel();
this.editNote(clip, channel, step, mappedNote, false);
}
use of de.mossgrabers.framework.daw.INoteClip in project DrivenByMoss by git-moss.
the class DrumView method drawGrid.
/**
* {@inheritDoc}
*/
@Override
public void drawGrid() {
final IPadGrid padGrid = this.surface.getPadGrid();
if (!this.model.canSelectedTrackHoldNotes()) {
padGrid.turnOff();
return;
}
if (this.isPlayMode) {
final IDrumDevice primary = this.model.getDrumDevice();
for (int y = 0; y < 2; y++) {
for (int x = 0; x < 8; x++) {
final int index = 8 * y + x;
padGrid.lightEx(x, y, this.getDrumPadColor(index, primary));
}
}
return;
}
final INoteClip clip = this.getClip();
// Paint the sequencer steps
final int step = clip.getCurrentStep();
final int hiStep = this.isInXRange(step) ? step % DrumView.NUM_DISPLAY_COLS : -1;
final int offsetY = this.scales.getDrumOffset();
final int editMidiChannel = this.configuration.getMidiEditChannel();
for (int col = 0; col < DrumView.NUM_DISPLAY_COLS; col++) {
final StepState stepState = clip.getStep(editMidiChannel, col, offsetY + this.selectedPad).getState();
final boolean hilite = col == hiStep;
final int x = col % 8;
final int y = col / 8;
padGrid.lightEx(x, 1 - y, getSequencerPadColor(stepState, hilite));
}
}
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) {
// Handle note editor mode
final ModeManager modeManager = this.surface.getModeManager();
if (velocity > 0) {
if (modeManager.isActive(Modes.NOTE)) {
// Store existing note for editing
final INoteClip clip = this.getClip();
final int channel = this.configuration.getMidiEditChannel();
final int mappedY = this.keyManager.map(y);
final StepState state = clip.getStep(channel, x, mappedY).getState();
if (state == StepState.START)
this.editNote(clip, channel, x, mappedY, true);
return;
}
} else {
if (this.isNoteEdited)
this.isNoteEdited = false;
if (modeManager.isActive(Modes.NOTE))
return;
}
super.handleSequencerArea(index, x, y, velocity);
}
Aggregations