use of de.mossgrabers.framework.daw.IStepInfo in project DrivenByMoss by git-moss.
the class NoteMode method getButtonColor.
/**
* {@inheritDoc}
*/
@Override
public int getButtonColor(final ButtonID buttonID) {
if (this.notes.isEmpty())
return SLMkIIIColorManager.SLMKIII_BLACK;
for (final GridStep noteInfo : this.notes) {
final int channel = noteInfo.channel();
final int step = noteInfo.step();
final int note = noteInfo.note();
final IStepInfo stepInfo = this.clip.getStep(channel, step, note);
int index = this.isButtonRow(0, buttonID);
if (index >= 0) {
switch(this.page) {
case NOTE:
if (index == 0)
return SLMkIIIColorManager.SLMKIII_GREEN;
if (index == 5 && this.host.supports(Capability.NOTE_EDIT_CHANCE))
return stepInfo.isChanceEnabled() ? SLMkIIIColorManager.SLMKIII_AMBER : SLMkIIIColorManager.SLMKIII_AMBER_HALF;
if (index == 6 && this.host.supports(Capability.NOTE_EDIT_OCCURRENCE))
return stepInfo.isOccurrenceEnabled() ? SLMkIIIColorManager.SLMKIII_AMBER : SLMkIIIColorManager.SLMKIII_AMBER_HALF;
if (index == 7 && this.host.supports(Capability.NOTE_EDIT_RECCURRENCE))
return stepInfo.isRecurrenceEnabled() ? SLMkIIIColorManager.SLMKIII_AMBER : SLMkIIIColorManager.SLMKIII_AMBER_HALF;
break;
case EXPRESSIONS:
if (index == 1)
return SLMkIIIColorManager.SLMKIII_GREEN;
break;
case REPEAT:
if (index == 2)
return SLMkIIIColorManager.SLMKIII_GREEN;
if (index == 4)
return stepInfo.isRepeatEnabled() ? SLMkIIIColorManager.SLMKIII_AMBER : SLMkIIIColorManager.SLMKIII_AMBER_HALF;
break;
case RECCURRENCE_PATTERN:
if (index == 3)
return SLMkIIIColorManager.SLMKIII_GREEN;
break;
}
if (index < 4 && this.host.supports(Capability.NOTE_EDIT_EXPRESSIONS))
return SLMkIIIColorManager.SLMKIII_GREY;
return SLMkIIIColorManager.SLMKIII_BLACK;
}
index = this.isButtonRow(1, buttonID);
if (index >= 0) {
switch(this.page) {
case NOTE:
if (index == 0)
return SLMkIIIColorManager.SLMKIII_GREEN_GRASS;
break;
case EXPRESSIONS:
if (index == 1)
return SLMkIIIColorManager.SLMKIII_GREEN_GRASS;
break;
case REPEAT:
if (index == 2)
return SLMkIIIColorManager.SLMKIII_GREEN_GRASS;
break;
case RECCURRENCE_PATTERN:
if (index == 7)
return SLMkIIIColorManager.SLMKIII_GREEN_GRASS;
break;
}
if (index == 0 || index == 1 && this.host.supports(Capability.NOTE_EDIT_EXPRESSIONS))
return SLMkIIIColorManager.SLMKIII_DARK_GREY;
if (index == 2 && this.host.supports(Capability.NOTE_EDIT_REPEAT) || index == 7 && this.host.supports(Capability.NOTE_EDIT_RECCURRENCE))
return SLMkIIIColorManager.SLMKIII_DARK_GREY;
return SLMkIIIColorManager.SLMKIII_BLACK;
}
}
return SLMkIIIColorManager.SLMKIII_BLACK;
}
use of de.mossgrabers.framework.daw.IStepInfo in project DrivenByMoss by git-moss.
the class NoteMode method updateDisplay.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay() {
final SLMkIIIDisplay d = this.surface.getDisplay();
d.clear();
d.setCell(0, 8, "Note Edit");
if (this.notes.isEmpty()) {
d.setBlock(1, 1, " Please select a").setBlock(1, 2, "note.");
d.setCell(1, 8, "");
d.hideAllElements();
for (int i = 0; i < 8; i++) d.setPropertyColor(i, 2, SLMkIIIColorManager.SLMKIII_BLACK);
} else {
final GridStep noteInfo = this.notes.get(0);
final int channel = noteInfo.channel();
final int step = noteInfo.step();
final int note = noteInfo.note();
final IStepInfo stepInfo = this.clip.getStep(channel, step, note);
if (this.page != Page.RECCURRENCE_PATTERN) {
d.setCell(0, 0, "Length").setCell(1, 0, this.formatLength(stepInfo.getDuration()));
d.setCell(0, 1, " Mute");
if (stepInfo.isMuted())
d.setCell(1, 1, " MUTED");
d.setPropertyColor(0, 0, SLMkIIIColorManager.SLMKIII_ROSE);
d.setPropertyColor(0, 1, SLMkIIIColorManager.SLMKIII_BLACK);
d.setPropertyColor(1, 0, SLMkIIIColorManager.SLMKIII_ROSE);
d.setPropertyColor(1, 1, SLMkIIIColorManager.SLMKIII_BLACK);
final int size = this.notes.size();
final boolean isOneNote = size == 1;
d.setCell(2, 0, isOneNote ? "Step: " + (step + 1) : "Notes: " + size);
d.setCell(2, 1, isOneNote ? Scales.formatNoteAndOctave(note, -3) : "*");
}
switch(this.page) {
case NOTE:
d.setCell(1, 8, "Common");
d.setPropertyValue(0, 1, 1);
setColor(d, 2, true);
d.setCell(0, 2, "Velocity");
d.setCell(1, 2, StringUtils.formatPercentage(stepInfo.getVelocity()));
d.setPropertyColor(2, 2, SLMkIIIColorManager.SLMKIII_BLACK);
final boolean supportsVelocitySpread = this.host.supports(Capability.NOTE_EDIT_VELOCITY_SPREAD);
setColor(d, 3, supportsVelocitySpread);
d.setPropertyColor(3, 2, SLMkIIIColorManager.SLMKIII_BLACK);
if (supportsVelocitySpread) {
d.setCell(0, 3, "V-Spread");
d.setCell(1, 3, StringUtils.formatPercentage(stepInfo.getVelocitySpread()));
}
final boolean supportsReleaseVelocity = this.host.supports(Capability.NOTE_EDIT_RELEASE_VELOCITY);
setColor(d, 4, supportsReleaseVelocity);
d.setPropertyColor(4, 2, SLMkIIIColorManager.SLMKIII_BLACK);
if (supportsReleaseVelocity) {
d.setCell(0, 4, "R-Velcty");
d.setCell(1, 4, StringUtils.formatPercentage(stepInfo.getReleaseVelocity()));
}
final boolean supportsChance = this.host.supports(Capability.NOTE_EDIT_CHANCE);
setColor(d, 5, supportsChance);
if (supportsChance) {
d.setCell(0, 5, "Chance");
d.setCell(1, 5, StringUtils.formatPercentage(stepInfo.getChance()));
d.setCell(3, 5, stepInfo.isChanceEnabled() ? ON : OFF);
d.setPropertyColor(5, 2, SLMkIIIColorManager.SLMKIII_ROSE);
d.setPropertyValue(5, 1, stepInfo.isChanceEnabled() ? 1 : 0);
}
final boolean supportsOccurrence = this.host.supports(Capability.NOTE_EDIT_OCCURRENCE);
d.setPropertyColor(6, 0, supportsOccurrence ? SLMkIIIColorManager.SLMKIII_ROSE : SLMkIIIColorManager.SLMKIII_BLACK);
d.setPropertyColor(6, 1, SLMkIIIColorManager.SLMKIII_BLACK);
if (supportsOccurrence) {
d.setCell(0, 6, "Occurnce");
d.setCell(1, 6, StringUtils.optimizeName(stepInfo.getOccurrence().getName(), 8));
d.setCell(3, 6, stepInfo.isOccurrenceEnabled() ? ON : OFF);
d.setPropertyColor(6, 2, SLMkIIIColorManager.SLMKIII_ROSE);
d.setPropertyValue(6, 1, stepInfo.isOccurrenceEnabled() ? 1 : 0);
}
final boolean supportsRecurrence = this.host.supports(Capability.NOTE_EDIT_RECCURRENCE);
setColor(d, 7, supportsRecurrence);
if (supportsRecurrence) {
final int recurrence = stepInfo.getRecurrenceLength();
final String recurrenceStr = recurrence < 2 ? "Off" : Integer.toString(recurrence);
d.setCell(0, 7, "Recurnce");
d.setCell(1, 7, recurrenceStr);
d.setCell(3, 7, stepInfo.isRecurrenceEnabled() ? ON : OFF);
d.setPropertyColor(7, 2, SLMkIIIColorManager.SLMKIII_ROSE);
d.setPropertyValue(7, 1, stepInfo.isRecurrenceEnabled() ? 1 : 0);
}
break;
case EXPRESSIONS:
if (this.host.supports(Capability.NOTE_EDIT_EXPRESSIONS)) {
for (int i = 3; i < 8; i++) d.setPropertyColor(i, 2, SLMkIIIColorManager.SLMKIII_BLACK);
d.setCell(1, 8, "Expressions");
setColor(d, 2, false);
setColor(d, 3, true);
d.setCell(0, 3, "Gain").setCell(1, 3, StringUtils.formatPercentage(stepInfo.getGain()));
setColor(d, 4, true);
d.setCell(0, 4, "Pan").setCell(1, 4, StringUtils.formatPercentage(stepInfo.getPan()));
setColor(d, 5, true);
d.setCell(0, 5, "Pitch").setCell(1, 5, String.format("%.1f", Double.valueOf(stepInfo.getTranspose())));
setColor(d, 6, true);
d.setCell(0, 6, "Timbre").setCell(1, 6, StringUtils.formatPercentage(stepInfo.getTimbre()));
setColor(d, 7, true);
d.setCell(0, 7, "Pressure").setCell(1, 7, StringUtils.formatPercentage(stepInfo.getPressure()));
}
break;
case REPEAT:
final int repeatColor = stepInfo.isRepeatEnabled() ? SLMkIIIColorManager.SLMKIII_AMBER : SLMkIIIColorManager.SLMKIII_AMBER_HALF;
for (int i = 3; i < 8; i++) d.setPropertyColor(i, 2, i == 4 ? repeatColor : SLMkIIIColorManager.SLMKIII_BLACK);
d.setCell(1, 8, "Repeat");
setColor(d, 2, false);
setColor(d, 3, false);
setColor(d, 4, true);
d.setCell(0, 4, "Count");
d.setCell(1, 4, stepInfo.getFormattedRepeatCount());
d.setCell(3, 4, stepInfo.isRepeatEnabled() ? ON : OFF);
final double repeatCurve = stepInfo.getRepeatCurve();
setColor(d, 5, true);
d.setCell(0, 5, "Curve");
d.setCell(1, 5, StringUtils.formatPercentage(repeatCurve));
final double repeatVelocityCurve = stepInfo.getRepeatVelocityCurve();
setColor(d, 6, true);
d.setCell(0, 6, "Vel-Crve");
d.setCell(1, 6, StringUtils.formatPercentage(repeatVelocityCurve));
final double repeatVelocityEnd = stepInfo.getRepeatVelocityEnd();
setColor(d, 7, true);
d.setCell(0, 7, "Vel. End");
d.setCell(1, 7, StringUtils.formatPercentage(repeatVelocityEnd));
break;
case RECCURRENCE_PATTERN:
d.setCell(1, 8, "Pattern");
for (int i = 3; i < 8; i++) d.setPropertyColor(i, 2, SLMkIIIColorManager.SLMKIII_BLACK);
final int recurrenceLength = stepInfo.getRecurrenceLength();
final int mask = stepInfo.getRecurrenceMask();
for (int i = 0; i < 8; i++) {
final boolean isOn = (mask & 1 << i) > 0;
String label = " -";
final boolean active = i < recurrenceLength;
if (active)
label = i + 1 + ": " + (isOn ? "On" : "Off");
d.setCell(0, i, label);
d.setPropertyColor(i, 0, active ? SLMkIIIColorManager.SLMKIII_ROSE : SLMkIIIColorManager.SLMKIII_BLACK);
d.setPropertyColor(i, 1, SLMkIIIColorManager.SLMKIII_BLACK);
}
break;
}
}
this.setButtonInfo(d);
d.allDone();
}
use of de.mossgrabers.framework.daw.IStepInfo in project DrivenByMoss by git-moss.
the class DrumView method handleSequencerAreaButtonCombinations.
/**
* {@inheritDoc}
*/
@Override
protected boolean handleSequencerAreaButtonCombinations(final INoteClip clip, final int channel, final int step, final int note, final int velocity) {
if (this.isButtonCombination(ButtonID.MUTE)) {
final IStepInfo stepInfo = clip.getStep(channel, step, note);
final StepState isSet = stepInfo.getState();
if (isSet == StepState.START)
this.getClip().updateMuteState(channel, step, note, !stepInfo.isMuted());
return true;
}
final ModeManager modeManager = this.surface.getModeManager();
if (modeManager.isActive(Modes.NOTE)) {
this.model.getHost().showNotification("Note " + Scales.formatNoteAndOctave(note, -3) + " - Step " + Integer.toString(step + 1));
this.editNote(clip, channel, step, note, true);
return true;
}
final boolean isSelectPressed = this.surface.isSelectPressed();
if (isSelectPressed) {
if (velocity > 0)
this.handleSequencerAreaRepeatOperator(clip, channel, step, note, velocity, isSelectPressed);
return true;
}
return super.handleSequencerAreaButtonCombinations(clip, channel, step, note, velocity);
}
use of de.mossgrabers.framework.daw.IStepInfo in project DrivenByMoss by git-moss.
the class EditNoteMode method updateDisplay.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay() {
final ITextDisplay d = this.surface.getTextDisplay().clear();
if (this.notes.isEmpty()) {
d.setBlock(0, 0, "Please select");
d.setBlock(0, 1, "a note...");
d.allDone();
return;
}
final GridStep noteInfo = this.notes.get(0);
final int channel = noteInfo.channel();
final int step = noteInfo.step();
final int note = noteInfo.note();
final IStepInfo stepInfo = this.clip.getStep(channel, step, note);
d.setCell(0, 0, "Note");
if (this.notes.size() > 1)
d.setCell(1, 0, "*:" + this.notes.size());
else
d.setCell(1, 0, stepInfo == null ? "-" : Integer.toString(step + 1) + ":" + Scales.formatNoteAndOctave(note, -3));
d.setCell(0, 1, this.mark("Length", DURATION + this.selectedPage * 10));
if (stepInfo == null)
d.setCell(1, 2, "-");
else {
final String[] formatLength = this.formatLength(stepInfo.getDuration()).split(":");
d.setCell(1, 1, formatLength[0]);
d.setCell(1, 2, ":" + formatLength[1]);
}
switch(this.selectedPage) {
default:
case PAGE_NOTE:
d.setCell(0, 3, this.mark("Velocity", VELOCITY)).setCell(1, 3, stepInfo == null ? "-" : StringUtils.formatPercentage(stepInfo.getVelocity()));
if (this.host.supports(Capability.NOTE_EDIT_VELOCITY_SPREAD))
d.setCell(0, 4, this.mark("Spread", VELOCITY_SPREAD)).setCell(1, 4, stepInfo == null ? "-" : StringUtils.formatPercentage(stepInfo.getVelocitySpread()));
if (this.host.supports(Capability.NOTE_EDIT_RELEASE_VELOCITY))
d.setCell(0, 5, this.mark("R-Vel", RELEASE_VELOCITY)).setCell(1, 5, stepInfo == null ? "-" : StringUtils.formatPercentage(stepInfo.getReleaseVelocity()));
if (this.host.supports(Capability.NOTE_EDIT_CHANCE))
d.setCell(0, 6, this.mark("Chance", CHANCE)).setCell(1, 6, stepInfo == null ? "-" : StringUtils.formatPercentage(stepInfo.getChance()));
if (this.host.supports(Capability.NOTE_EDIT_OCCURRENCE))
d.setCell(0, 7, this.mark("Occurnce", OCCURRENCE)).setCell(1, 7, stepInfo == null ? "-" : StringUtils.optimizeName(stepInfo.getOccurrence().getName(), 8));
break;
case PAGE_EXPRESSIONS:
d.setCell(0, 3, this.mark("Gain", GAIN)).setCell(1, 3, stepInfo == null ? "-" : StringUtils.formatPercentage(stepInfo.getGain()));
d.setCell(0, 4, this.mark("Pan", PANORAMA)).setCell(1, 4, stepInfo == null ? "-" : StringUtils.formatPercentage(stepInfo.getPan()));
d.setCell(0, 5, this.mark("Pitch", PITCH)).setCell(1, 5, stepInfo == null ? "-" : String.format("%.1f", Double.valueOf(stepInfo.getTranspose())));
d.setCell(0, 6, this.mark("Timbre", TIMBRE)).setCell(1, 6, stepInfo == null ? "-" : StringUtils.formatPercentage(stepInfo.getTimbre()));
d.setCell(0, 7, this.mark("Pressure", PRESSURE)).setCell(1, 7, stepInfo == null ? "-" : StringUtils.formatPercentage(stepInfo.getPressure()));
break;
case PAGE_REPEAT:
d.setCell(0, 3, this.mark("Velocity", VELOCITY2)).setCell(1, 3, stepInfo == null ? "-" : StringUtils.formatPercentage(stepInfo.getVelocity()));
d.setCell(0, 4, this.mark("V-End", VELOCITY_END)).setCell(1, 4, stepInfo == null ? "-" : StringUtils.formatPercentage(stepInfo.getRepeatVelocityEnd()));
d.setCell(0, 5, this.mark("V-Curve", VELOCITY_CURVE)).setCell(1, 5, stepInfo == null ? "-" : StringUtils.formatPercentage(stepInfo.getRepeatVelocityCurve()));
d.setCell(0, 6, this.mark("Count", COUNT)).setCell(1, 6, stepInfo == null ? "-" : stepInfo.getFormattedRepeatCount());
d.setCell(0, 7, this.mark("Curve", CURVE)).setCell(1, 7, stepInfo == null ? "-" : StringUtils.formatPercentage(stepInfo.getRepeatCurve()));
break;
}
d.allDone();
}
use of de.mossgrabers.framework.daw.IStepInfo in project DrivenByMoss by git-moss.
the class DrumView method drawGrid.
/**
* {@inheritDoc}
*/
@Override
public void drawGrid() {
final IPadGrid padGrid = this.surface.getPadGrid();
final IDrumDevice primary = this.model.getDrumDevice();
if (this.isPlayMode) {
for (int y = 0; y < 2; y++) {
for (int x = 0; x < 8; x++) {
final int index = 8 * y + x;
padGrid.lightEx(x, 1 - y, this.getDrumPadColor(index, primary, false));
}
}
return;
}
if (!this.isActive()) {
padGrid.turnOff();
return;
}
// Paint the sequencer steps
final INoteClip clip = this.getClip();
final int step = clip.getCurrentStep();
final int hiStep = this.isInXRange(step) ? step % this.sequencerSteps : -1;
final int offsetY = this.scales.getDrumOffset();
final int editMidiChannel = this.configuration.getMidiEditChannel();
final int selPad = this.getSelectedPad();
final List<GridStep> editNotes = this.getEditNotes();
for (int col = 0; col < DrumView.NUM_DISPLAY_COLS; col++) {
final int noteRow = offsetY + selPad;
final IStepInfo stepInfo = clip.getStep(editMidiChannel, col, noteRow);
final boolean hilite = col == hiStep;
final int x = col % GRID_COLUMNS;
final int y = col / GRID_COLUMNS;
final Optional<ColorEx> rowColor = this.getPadColor(primary, this.selectedPad);
padGrid.lightEx(x, y, this.getStepColor(stepInfo, hilite, rowColor, editMidiChannel, col, noteRow, editNotes));
}
}
Aggregations