use of de.mossgrabers.framework.scale.Scale in project DrivenByMoss by git-moss.
the class ScalesMode method updateDisplay2.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay2() {
final Scale scale = this.scales.getScale();
final int offset = this.scales.getScaleOffset();
final Scale[] scaleValues = Scale.values();
final String rangeText = this.scales.getRangeText();
final PushDisplay display = (PushDisplay) this.surface.getDisplay();
final DisplayMessage message = display.createMessage();
final String[] items = new String[6];
final boolean[] selected = new boolean[6];
for (int i = 0; i < 6; i++) {
final int pos = scale.ordinal() + i;
items[i] = pos < scaleValues.length ? scaleValues[pos].getName() : "";
selected[i] = i == 0;
}
message.addListElement(items, selected);
for (int i = 0; i < 6; i++) message.addOptionElement(i == 3 ? "Note range: " + rangeText : "", Scales.BASES[6 + i], offset == 6 + i, "", Scales.BASES[i], offset == i, false);
message.addOptionElement("", this.scales.isChromatic() ? "Chromatc" : "In Key", this.scales.isChromatic(), "", "", false, false);
display.send(message);
}
use of de.mossgrabers.framework.scale.Scale in project DrivenByMoss by git-moss.
the class AbstractNoteSequencerView method getScrollOffset.
/**
* Calculates how many seminotes are between the first and last 'pad'.
*
* @return The number of seminotes
*/
protected int getScrollOffset() {
// In chromatic mode all seminotes are present
if (this.scales.isChromatic())
return this.numSequencerRows;
final Scale scale = this.scales.getScale();
int lower = scale.getIndexInScale(this.offsetY);
if (lower < 0)
lower = 0;
final int upper = lower + this.numSequencerRows;
final int[] intervals = scale.getIntervals();
final int lowerNote = intervals[lower];
final int upperNote = upper / intervals.length * OCTAVE + intervals[upper % intervals.length];
return upperNote - lowerNote;
}
use of de.mossgrabers.framework.scale.Scale in project DrivenByMoss by git-moss.
the class ScalesMode method updateDisplay1.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay1() {
final Display d = this.surface.getDisplay();
final Scale scale = this.scales.getScale();
final int offset = this.scales.getScaleOffset();
final Scale[] scaleValues = Scale.values();
final String rangeText = this.scales.getRangeText();
d.setBlock(0, 0, PushDisplay.RIGHT_ARROW + scale.getName()).clearBlock(0, 1).clearBlock(0, 2).setBlock(0, 3, rangeText).done(0);
int pos = scale.ordinal() + 1;
final String name1 = pos < scaleValues.length ? scaleValues[pos].getName() : "";
d.setBlock(1, 0, " " + name1).clearBlock(1, 1).clearBlock(1, 2).clearBlock(1, 3).done(1);
pos++;
final String name2 = pos < scaleValues.length ? scaleValues[pos].getName() : "";
d.setCell(2, 0, " " + name2);
for (int i = 0; i < 6; i++) d.setCell(2, i + 1, " " + (offset == i ? PushDisplay.RIGHT_ARROW : " ") + Scales.BASES[i]);
d.clearCell(2, 7).done(2);
pos++;
final String name3 = pos < scaleValues.length ? scaleValues[pos].getName() : "";
d.setCell(3, 0, " " + name3);
for (int i = 6; i < 12; i++) d.setCell(3, i - 5, " " + (offset == i ? PushDisplay.RIGHT_ARROW : " ") + Scales.BASES[i]);
d.setCell(3, 7, this.scales.isChromatic() ? "Chromatc" : "In Key").done(3);
}
Aggregations