use of de.mossgrabers.osc.protocol.OSCWriter 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.");
}
Aggregations