realtime¶
Tools for interacting with realtime execution contexts.
-
class AsyncServer(options: Options | None =
None
, name: str | None =None
, **kwargs)¶ Bases:
BaseServer
A realtime execution context with
asyncio
-based OSC and process protocols.- Parameters:
-
async connect(*, options: Options | None =
None
, **kwargs) AsyncServer ¶ Connect to a running server.
- async disconnect() AsyncServer ¶
Disconnect from a running server.
-
async dump_tree(group: Group | None =
None
, include_controls: bool =True
, sync: bool =True
) QueryTreeGroup | None ¶ Dump the server’s node tree.
Emit
/g_dumpTree
requests.
-
async get_buffer(buffer: Buffer, *indices: int, sync: bool =
True
) dict[int, float] | None ¶ Get a buffer sample.
Emit
/b_get
requests.
-
async get_buffer_range(buffer: Buffer, index: int, count: int, sync: bool =
True
) Sequence[float] | None ¶ Get a buffer sample range.
Emit
/b_getn
requests.
-
async get_bus(bus: Bus, sync: bool =
True
) float | None ¶ Get a control bus value.
Emit
/c_get
requests.
-
async get_bus_range(bus: Bus, count: int, sync: bool =
True
) Sequence[float] | None ¶ Get a range of control bus values.
Emit
/c_getn
requests.
-
async get_synth_control_range(synth: Synth, control: int | str, count: int, sync: bool =
True
) Sequence[float | str] | None ¶ Get a range of synth controls.
Emit
/s_getn
requests.
-
async get_synth_controls(synth: Synth, *controls: int | str, sync: bool =
True
) dict[int | str, float] | None ¶ Get a synth control.
Emit
/s_get
requests.
-
async query_buffer(buffer: Buffer, sync: bool =
True
) BufferInfo | None ¶ Query a buffer.
Emit
/b_query
requests.
-
async query_node(node: Node, sync: bool =
True
) NodeInfo | None ¶ Query a node.
Emit
/n_query
requests.
-
async query_status(sync: bool =
True
) StatusInfo | None ¶ Query the server’s status.
Emit
/status
requests.
-
async query_tree(group: Group | None =
None
, include_controls: bool =True
, sync: bool =True
) QueryTreeGroup | None ¶ Query the server’s node tree.
Emit
/g_queryTree
requests.
-
async query_version(sync: bool =
True
) VersionInfo | None ¶ Query the server’s version.
Emit
/version
requests.
-
async quit(force: bool =
False
) AsyncServer ¶ Quit the server.
Emit
/quit
requests.
- async reboot() AsyncServer ¶
Reboot the server.
-
register_lifecycle_callback(event: ServerLifecycleEvent | SupportsInt | str | None | Iterable[ServerLifecycleEvent | SupportsInt | str | None], procedure: Callable[[ServerLifecycleEvent], Awaitable[None] | None], *, once: bool =
False
, args: tuple | None =None
, kwargs: dict | None =None
) ServerLifecycleCallback ¶ Register a server lifecycle callback.
-
register_osc_callback(pattern: Sequence[float | str], procedure: Callable[[OscMessage], Awaitable[None] | None], *, failure_pattern: Sequence[float | str] | None =
None
, once: bool =False
, args: tuple | None =None
, kwargs: dict | None =None
) OscCallback ¶ Register an OSC callback.
- async reset() AsyncServer ¶
Reset the server’s state without quitting.
-
async sync(sync_id: int | None =
None
, timeout: float =1.0
) AsyncServer ¶ Sync the server.
Emit
/sync
requests.
- unregister_osc_callback(callback: OscCallback) None ¶
Unregister an OSC callback.
- Parameters:
- callback: OscCallback¶
The callback to unregister.
- property boot_future : Future[bool]¶
Get the server’s boot future.
Only reference this _after_ booting or connecting, as the future is created when booting or connecting.
- property exit_future : Future[bool]¶
Get the server’s exit future.
Only reference this _after_ booting or connecting, as the future is created when booting or connecting.
- property osc_protocol : AsyncOscProtocol¶
Get the server’s OSC protocol.
- property process_protocol : AsyncProcessProtocol¶
Get the server’s process protocol.
-
class BaseServer(options: Options | None, name: str | None =
None
, **kwargs)¶ Bases:
Context
Base class for realtime execution contexts.
- __contains__(object_: ContextObject) bool ¶
- send(message: Sequence | SupportsOsc | str) None ¶
Send a message to the execution context.
- Parameters:
- message: Sequence | SupportsOsc | str¶
The message to send.
- unregister_lifecycle_callback(callback: ServerLifecycleCallback) None ¶
Unregister a lifecycle callback.
- Parameters:
- callback: ServerLifecycleCallback¶
The callback to unregister.
Get the server’s shared memory interface, if available.
- property status : StatusInfo | None¶
Get the server’s last received status.
-
class Server(options: Options | None =
None
, name: str | None =None
, **kwargs)¶ Bases:
BaseServer
A realtime execution context with
threading
-based OSC and process protocols.- Parameters:
-
dump_tree(group: Group | None =
None
, include_controls: bool =True
, sync: bool =True
) QueryTreeGroup | None ¶ Dump the server’s node tree.
Emit
/g_dumpTree
requests.
-
get_buffer(buffer: Buffer, *indices: int, sync: bool =
True
) dict[int, float] | None ¶ Get a buffer sample.
Emit
/b_get
requests.
-
get_buffer_range(buffer: Buffer, index: int, count: int, sync: bool =
True
) Sequence[float] | None ¶ Get a buffer sample range.
Emit
/b_getn
requests.
-
get_bus_range(bus: Bus, count: int, sync: bool =
True
) Sequence[float] | None ¶ Get a range of control bus values.
Emit
/c_getn
requests.
-
get_synth_control_range(synth: Synth, control: int | str, count: int, sync: bool =
True
) Sequence[float | str] | None ¶ Get a range of synth controls.
Emit
/s_getn
requests.
-
get_synth_controls(synth: Synth, *controls: int | str, sync: bool =
True
) dict[int | str, float] | None ¶ Get a synth control.
Emit
/s_get
requests.
-
query_buffer(buffer: Buffer, sync: bool =
True
) BufferInfo | None ¶ Query a buffer.
Emit
/b_query
requests.
-
query_status(sync: bool =
True
) StatusInfo | None ¶ Query the server’s status.
Emit
/status
requests.
-
query_tree(group: Group | None =
None
, include_controls: bool =True
, sync: bool =True
) QueryTreeGroup | None ¶ Query the server’s node tree.
Emit
/g_queryTree
requests.
-
query_version(sync: bool =
True
) VersionInfo | None ¶ Query the server’s version.
Emit
/version
requests.
-
register_lifecycle_callback(event: ServerLifecycleEvent | SupportsInt | str | None | Iterable[ServerLifecycleEvent | SupportsInt | str | None], procedure: Callable[[ServerLifecycleEvent], None], *, once: bool =
False
, args: tuple | None =None
, kwargs: dict | None =None
) ServerLifecycleCallback ¶ Register a server lifecycle callback.
-
register_osc_callback(pattern: Sequence[float | str], procedure: Callable[[OscMessage], None], *, failure_pattern: Sequence[float | str] | None =
None
, once: bool =False
, args: tuple | None =None
, kwargs: dict | None =None
) OscCallback ¶ Register an OSC callback.
-
sync(sync_id: int | None =
None
, timeout: float =1.0
) Server ¶ Sync the server.
Emit
/sync
requests.
- unregister_osc_callback(callback: OscCallback) None ¶
Unregister an OSC callback.
- Parameters:
- callback: OscCallback¶
The callback to unregister.
- property boot_future : Future[bool]¶
Get the server’s boot future.
Only reference this _after_ booting or connecting, as the future is created when booting or connecting.
- property exit_future : Future[bool]¶
Get the server’s exit future.
Only reference this _after_ booting or connecting, as the future is created when booting or connecting.
- property osc_protocol : ThreadedOscProtocol¶
Get the server’s OSC protocol.
- property process_protocol : ThreadedProcessProtocol¶
Get the server’s process protocol.
- exception FailWarning¶