home/ atoms/ osc-property-listener-implementation

AbletonOSC's property listener uses Live's add_<prop>_listener API and immediately sends the current value on subscribe

The start_listen method in AbletonOSCHandler registers a callback via Live’s add<property_name>_listener() method, then immediately calls the callback to push the current value to the client. The callback sends an OSC message to /live/<class_identifier>/get/ with the track/clip index prepended. Listener functions are stored in a dict keyed by (prop, params_tuple) to allow per-object subscriptions (e.g. volume on track 0 and track 1 are independent subscriptions). On stop_listen, the corresponding remove_listener() is called. This pattern is the standard Ableton Live remote script observer pattern.

Examples

Python handler pattern: add_volume_listener(callback) → callback fires on any volume change → sends /live/track/get/volume (track_id, new_value) to client. On reload, _clear_listeners() iterates all keys and removes all observers before re-registering fresh ones.

Assessment

Why does _start_listen immediately send the current value when called? What data structure does AbletonOSC use to prevent duplicate listeners for the same property on the same object?

“Start listening for the property named `prop` on the Live object `target`. `params` is typically a tuple containing the track/clip index.”
corpus · abletonosc-osc-control-interface-for-ableton-live-live-objec · chunk 25