use of de.mossgrabers.framework.controller.color.ColorManager 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.controller.color.ColorManager in project DrivenByMoss by git-moss.
the class PanView method drawGrid.
/**
* {@inheritDoc}
*/
@Override
public void drawGrid() {
final ColorManager cm = this.model.getColorManager();
final IChannelBank tb = this.model.getCurrentTrackBank();
final IMidiOutput output = this.surface.getOutput();
for (int i = 0; i < 8; i++) {
final ITrack track = tb.getTrack(i);
final int color = cm.getColor(BitwigColors.getColorIndex(track.getColor()));
if (this.trackColors[i] != color || !track.doesExist())
this.setupFader(i);
this.trackColors[i] = color;
output.sendCC(LaunchpadControlSurface.LAUNCHPAD_FADER_1 + i, track.getPan());
}
}
use of de.mossgrabers.framework.controller.color.ColorManager in project DrivenByMoss by git-moss.
the class ScalesMode method updateFirstRow.
/**
* {@inheritDoc}
*/
@Override
public void updateFirstRow() {
final int offset = this.scales.getScaleOffset();
final ColorManager cm = this.model.getColorManager();
for (int i = 0; i < 8; i++) {
final boolean isFirstOrLast = i == 0 || i == 7;
this.surface.updateButton(20 + i, i == 7 ? cm.getColor(AbstractMode.BUTTON_COLOR_OFF) : isFirstOrLast ? this.isPush2 ? PushColors.PUSH2_COLOR_ORANGE_LO : PushColors.PUSH1_COLOR_ORANGE_LO : cm.getColor(offset == i - 1 ? AbstractMode.BUTTON_COLOR_HI : AbstractMode.BUTTON_COLOR_ON));
}
}
use of de.mossgrabers.framework.controller.color.ColorManager in project DrivenByMoss by git-moss.
the class ScalesMode method updateSecondRow.
/**
* {@inheritDoc}
*/
@Override
public void updateSecondRow() {
final int offset = this.scales.getScaleOffset();
final ColorManager cm = this.model.getColorManager();
for (int i = 0; i < 8; i++) {
final boolean isFirstOrLast = i == 0 || i == 7;
this.surface.updateButton(102 + i, isFirstOrLast ? this.isPush2 ? PushColors.PUSH2_COLOR2_AMBER : PushColors.PUSH1_COLOR2_AMBER : cm.getColor(offset == i - 1 + 6 ? AbstractMode.BUTTON_COLOR2_HI : AbstractMode.BUTTON_COLOR2_ON));
}
}
use of de.mossgrabers.framework.controller.color.ColorManager in project DrivenByMoss by git-moss.
the class AutomationMode method updateFirstRow.
/**
* {@inheritDoc}
*/
@Override
public void updateFirstRow() {
final String writeMode = this.model.getTransport().getAutomationWriteMode();
final ColorManager colorManager = this.model.getColorManager();
for (int i = 0; i < ITransport.AUTOMATION_MODES_VALUES.length; i++) this.surface.updateButton(20 + i, colorManager.getColor(ITransport.AUTOMATION_MODES_VALUES[i].equals(writeMode) ? AbstractMode.BUTTON_COLOR_HI : AbstractMode.BUTTON_COLOR_ON));
for (int i = ITransport.AUTOMATION_MODES_VALUES.length; i < 8; i++) this.surface.updateButton(20 + i, colorManager.getColor(AbstractMode.BUTTON_COLOR_OFF));
}
Aggregations