use of de.mossgrabers.framework.scale.Scales in project DrivenByMoss by git-moss.
the class BeatstepControllerSetup method createScales.
/**
* {@inheritDoc}
*/
@Override
protected void createScales() {
this.scales = new Scales(this.valueChanger, 36, 52, 8, 2);
this.scales.setDrumMatrix(DRUM_MATRIX);
this.scales.setDrumNoteEnd(52);
}
use of de.mossgrabers.framework.scale.Scales in project DrivenByMoss by git-moss.
the class OSCExtension method init.
/**
* {@inheritDoc}
*/
@Override
public void init() {
this.configuration.init(new SettingsUI(this.getHost().getPreferences()));
final Scales scales = new Scales(this.valueChanger, 0, 128, 128, 1);
scales.setChromatic(true);
final ControllerHost host = this.getHost();
final OSCModel model = new OSCModel(host, new ColorManager(), this.valueChanger, scales);
final OscModule oscModule = host.getOscModule();
// Send OSC messages
this.writer = new OSCWriter(model, this.configuration, oscModule);
// Receive OSC messages
final OscAddressSpace addressSpace = oscModule.createAddressSpace();
this.configuration.addSettingObserver(OSCConfiguration.DEBUG_COMMANDS, () -> addressSpace.setShouldLogMessages(this.configuration.getDebugCommands()));
addressSpace.registerDefaultMethod(new OSCParser(host, this.writer, this.configuration, model));
oscModule.createUdpServer(this.configuration.getReceivePort(), addressSpace);
// Initial flush of the whole DAW state
host.scheduleTask(() -> this.writer.flush(true), 1000);
host.println("Initialized.");
}
use of de.mossgrabers.framework.scale.Scales in project DrivenByMoss by git-moss.
the class LaunchpadCursorCommand method updateArrowStates.
/**
* {@inheritDoc}
*/
@Override
protected void updateArrowStates() {
final IChannelBank tb = this.model.getCurrentTrackBank();
final ViewManager viewManager = this.surface.getViewManager();
if (viewManager.isActiveView(Views.VIEW_PLAY)) {
final Scales scales = this.model.getScales();
final int octave = scales.getOctave();
this.canScrollUp = octave < 3;
this.canScrollDown = octave > -3;
final int scale = scales.getScale().ordinal();
this.canScrollLeft = scale > 0;
this.canScrollRight = scale < Scale.values().length - 1;
return;
}
if (viewManager.isActiveView(Views.VIEW_DRUM)) {
final int octave = this.model.getScales().getDrumOctave();
this.canScrollUp = octave < 5;
this.canScrollDown = octave > -3;
this.canScrollLeft = this.model.getCursorClip().getEditPage() > 0;
// TODO API extension required - We do not know the number of steps
this.canScrollRight = true;
return;
}
if (viewManager.isActiveView(Views.VIEW_DRUM64)) {
final DrumView64 drumView64 = (DrumView64) viewManager.getView(Views.VIEW_DRUM64);
final int octave = drumView64.getDrumOctave();
this.canScrollUp = octave < 1;
this.canScrollDown = octave > -2;
this.canScrollLeft = false;
this.canScrollRight = false;
return;
}
if (viewManager.isActiveView(Views.VIEW_SEQUENCER) || viewManager.isActiveView(Views.VIEW_RAINDROPS)) {
final int octave = this.model.getScales().getOctave();
this.canScrollUp = octave < Scales.OCTAVE_RANGE;
this.canScrollDown = octave > -Scales.OCTAVE_RANGE;
this.canScrollLeft = this.model.getCursorClip().getEditPage() > 0;
// TODO API extension required - We do not know the number of steps
this.canScrollRight = true;
return;
}
if (viewManager.isActiveView(Views.VIEW_DEVICE)) {
final ICursorDevice cursorDevice = this.model.getCursorDevice();
this.canScrollUp = cursorDevice.canSelectNextFX();
this.canScrollDown = cursorDevice.canSelectPreviousFX();
this.canScrollLeft = cursorDevice.hasPreviousParameterPage();
this.canScrollRight = cursorDevice.hasNextParameterPage();
return;
}
if (viewManager.isActiveView(Views.VIEW_BROWSER)) {
final IBrowser browser = this.model.getBrowser();
final int index = browser.getSelectedContentTypeIndex();
this.canScrollUp = false;
this.canScrollDown = false;
this.canScrollLeft = index > 0;
this.canScrollRight = index < browser.getContentTypeNames().length - 1;
return;
}
if (viewManager.isActiveView(Views.VIEW_SHIFT) || viewManager.isActiveView(Views.VIEW_DRUM4) || viewManager.isActiveView(Views.VIEW_DRUM8)) {
this.canScrollUp = false;
this.canScrollDown = false;
this.canScrollLeft = false;
this.canScrollRight = false;
return;
}
// VIEW_SESSION, VIEW_VOLUME, VIEW_PAN, VIEW_SENDS
final ITrack sel = tb.getSelectedTrack();
final int selIndex = sel != null ? sel.getIndex() : -1;
this.canScrollLeft = selIndex > 0 || tb.canScrollTracksUp();
this.canScrollRight = selIndex >= 0 && selIndex < 7 && tb.getTrack(selIndex + 1).doesExist() || tb.canScrollTracksDown();
this.canScrollUp = tb.canScrollScenesUp();
this.canScrollDown = tb.canScrollScenesDown();
}
use of de.mossgrabers.framework.scale.Scales in project DrivenByMoss by git-moss.
the class LaunchpadCursorCommand method scrollRight.
/**
* {@inheritDoc}
*/
@SuppressWarnings("rawtypes")
@Override
protected void scrollRight() {
final ViewManager viewManager = this.surface.getViewManager();
if (viewManager.isActiveView(Views.VIEW_PLAY)) {
final Scales scales = this.model.getScales();
scales.nextScale();
final String name = scales.getScale().getName();
this.surface.getConfiguration().setScale(name);
this.surface.getDisplay().notify(name);
return;
}
if (viewManager.isActiveView(Views.VIEW_DEVICE)) {
final ICursorDevice cursorDevice = this.model.getCursorDevice();
cursorDevice.nextParameterPage();
this.surface.getDisplay().notify(cursorDevice.getSelectedParameterPageName());
return;
}
if (viewManager.isActiveView(Views.VIEW_BROWSER)) {
this.model.getBrowser().nextContentType();
return;
}
if (viewManager.isActiveView(Views.VIEW_SHIFT) || viewManager.isActiveView(Views.VIEW_DRUM64))
return;
// VIEW_SEQUENCER, VIEW_RAINDROPS, VIEW_DRUM, VIEW_DRUM4, VIEW_DRUM8
final View activeView = viewManager.getActiveView();
if (activeView instanceof AbstractSequencerView) {
((AbstractSequencerView) activeView).onRight(ButtonEvent.DOWN);
return;
}
// VIEW_SESSION, VIEW_VOLUME, VIEW_PAN, VIEW_SENDS
this.scrollTracksRight();
}
use of de.mossgrabers.framework.scale.Scales in project DrivenByMoss by git-moss.
the class LaunchpadCursorCommand method scrollLeft.
/**
* {@inheritDoc}
*/
@SuppressWarnings("rawtypes")
@Override
protected void scrollLeft() {
final ViewManager viewManager = this.surface.getViewManager();
if (viewManager.isActiveView(Views.VIEW_PLAY)) {
final Scales scales = this.model.getScales();
scales.prevScale();
final String name = scales.getScale().getName();
this.surface.getConfiguration().setScale(name);
this.surface.getDisplay().notify(name);
return;
}
if (viewManager.isActiveView(Views.VIEW_DEVICE)) {
final ICursorDevice cursorDevice = this.model.getCursorDevice();
cursorDevice.previousParameterPage();
this.surface.getDisplay().notify(cursorDevice.getSelectedParameterPageName());
return;
}
if (viewManager.isActiveView(Views.VIEW_BROWSER)) {
this.model.getBrowser().previousContentType();
return;
}
if (viewManager.isActiveView(Views.VIEW_SHIFT) || viewManager.isActiveView(Views.VIEW_DRUM64))
return;
// VIEW_SEQUENCER, VIEW_RAINDROPS, VIEW_DRUM, VIEW_DRUM4, VIEW_DRUM8
final View activeView = viewManager.getActiveView();
if (activeView instanceof AbstractSequencerView) {
((AbstractSequencerView) activeView).onLeft(ButtonEvent.DOWN);
return;
}
// VIEW_SESSION, VIEW_VOLUME, VIEW_PAN, VIEW_SENDS
this.scrollTracksLeft();
}
Aggregations