Search in sources :

Example 1 with OscModule

use of com.bitwig.extension.api.opensoundcontrol.OscModule in project DrivenByMoss by git-moss.

the class HostImpl method createOSCServer.

/**
 * {@inheritDoc}
 */
@Override
public IOpenSoundControlServer createOSCServer(final IOpenSoundControlCallback callback) {
    final OscModule oscModule = this.host.getOscModule();
    final OscAddressSpace addressSpace = oscModule.createAddressSpace();
    addressSpace.registerDefaultMethod((source, message) -> callback.handle(new OpenSoundControlMessageImpl(message)));
    return new OpenSoundControlServerImpl(oscModule.createUdpServer(addressSpace));
}
Also used : OscAddressSpace(com.bitwig.extension.api.opensoundcontrol.OscAddressSpace) OscModule(com.bitwig.extension.api.opensoundcontrol.OscModule) OpenSoundControlMessageImpl(de.mossgrabers.bitwig.framework.osc.OpenSoundControlMessageImpl) OpenSoundControlServerImpl(de.mossgrabers.bitwig.framework.osc.OpenSoundControlServerImpl)

Example 2 with OscModule

use of com.bitwig.extension.api.opensoundcontrol.OscModule 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)2 OscModule (com.bitwig.extension.api.opensoundcontrol.OscModule)2 ControllerHost (com.bitwig.extension.controller.api.ControllerHost)1 OpenSoundControlMessageImpl (de.mossgrabers.bitwig.framework.osc.OpenSoundControlMessageImpl)1 OpenSoundControlServerImpl (de.mossgrabers.bitwig.framework.osc.OpenSoundControlServerImpl)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