Search in sources :

Example 1 with OSCWriter

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.");
}
Also used : ControllerHost(com.bitwig.extension.controller.api.ControllerHost) SettingsUI(de.mossgrabers.framework.bitwig.configuration.SettingsUI) OscAddressSpace(com.bitwig.extension.api.opensoundcontrol.OscAddressSpace) OscModule(com.bitwig.extension.api.opensoundcontrol.OscModule) Scales(de.mossgrabers.framework.scale.Scales) OSCWriter(de.mossgrabers.osc.protocol.OSCWriter) OSCModel(de.mossgrabers.osc.protocol.OSCModel) ColorManager(de.mossgrabers.framework.controller.color.ColorManager) OSCParser(de.mossgrabers.osc.protocol.OSCParser)

Aggregations

OscAddressSpace (com.bitwig.extension.api.opensoundcontrol.OscAddressSpace)1 OscModule (com.bitwig.extension.api.opensoundcontrol.OscModule)1 ControllerHost (com.bitwig.extension.controller.api.ControllerHost)1 SettingsUI (de.mossgrabers.framework.bitwig.configuration.SettingsUI)1 ColorManager (de.mossgrabers.framework.controller.color.ColorManager)1 Scales (de.mossgrabers.framework.scale.Scales)1 OSCModel (de.mossgrabers.osc.protocol.OSCModel)1 OSCParser (de.mossgrabers.osc.protocol.OSCParser)1 OSCWriter (de.mossgrabers.osc.protocol.OSCWriter)1