Skip to content

OscModule

Source: OscModule.h

OscModule

class OscModule
src/core/services/OscModule.h:46

Inherits: MoonModule, ControlSurface

Receives OSC over the network and writes it onto this device's controls.

A surface addresses the surface: the faders, encoders and switches the control module owns. One address form reaches any control directly, which is what makes this useful on day one.

OscModule card

Public Attributes

bool enabledOsc = false : Whether to receive at all, off by default since the port is unauthenticated.

uint16_t port = : The port we listen on.

bool feedback = false : Whether to mirror changes back, which is what makes this a surface rather than a remote.

uint16_t feedbackPort = 9001 : Where the client listens, which is not where we do.

Public Methods

virtual inline ModuleRole role() const override : A service, so the container accepts it as a child.

virtual inline void defineControls() override : Declare the receive settings and the feedback settings.

virtual inline void onControlChanged(const char * name) override : Reopen the socket on a receive change, and re-seed the client on a feedback change.

virtual inline void release() override : Detach from the surface list before closing, since it is walked from the render thread.

virtual inline void sendValue(SurfaceControl kind, uint8_t index, uint8_t value) override : Mirror one control's value back to the client, as the float an application expects.

virtual inline void tick1s() override : Refresh the status, which is time-dependent because a peer goes stale.

virtual inline void tick() override : Drain whatever arrived, learning where to answer, then re-seed a new client once.

More info

Feedback

With it on, a control that changes anywhere is mirrored back to the surface. That is what keeps a client honest, and what moves a motorised fader. A client learns the state three ways: on its first write, on an address change, and on asking. The last exists because a restart on the same address is invisible to the other two. Most controllers send nothing on load, so every widget would otherwise show its own defaults.

What it refuses

The port is unauthenticated and writes controls, so it is off until turned on. Feedback is off for the same reason, sending unasked-for traffic to whatever last wrote. OSC control ingest: a fader move in another application becomes a control write here.

@moreinfo

It owns no surface of its own. The control module already has the pads, encoders and faders, and everything here lands in the same control-set primitive the API and the UI use.

So OSC gains no privilege, every validator still runs, and there is no second copy of state. Sending OSC, bundles and address wildcards are all out of scope.