ResponseManager

class supriya.tools.responsetools.ResponseManager[source]

Handles OSC responses from scsynth.

>>> from supriya import osctools
>>> from supriya import responsetools
>>> manager = responsetools.ResponseManager
>>> message = osctools.OscMessage(
...     '/status.reply', 1, 0, 0, 2, 4,
...     0.040679048746824265, 0.15118031203746796,
...     44100.0, 44100.00077873274,
...     )
>>> manager.handle_message(message)
StatusResponse(
    actual_sample_rate=44100.00077873274,
    average_cpu_usage=0.040679048746824,
    group_count=2,
    peak_cpu_usage=0.151180312037468,
    synth_count=0,
    synthdef_count=4,
    target_sample_rate=44100.0,
    ugen_count=0
    )
>>> message = osctools.OscMessage('/b_info', 1100, 512, 1, 44100.0)
>>> manager.handle_message(message)[0]
BufferInfoResponse(
    buffer_id=1100,
    frame_count=512,
    channel_count=1,
    sample_rate=44100.0
    )
>>> message = osctools.OscMessage('/n_set', 1023, '/one', -1, '/two', 0)
>>> manager.handle_message(message)
NodeSetResponse(
    node_id=1023,
    items=(
        NodeSetItem(
            control_index_or_name='/one',
            control_value=-1
            ),
        NodeSetItem(
            control_index_or_name='/two',
            control_value=0
            ),
        )
    )
>>> message = osctools.OscMessage('/b_setn', 1, 0, 8, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
>>> manager.handle_message(message)
BufferSetContiguousResponse(
    items=(
        BufferSetContiguousItem(
            starting_sample_index=0,
            sample_values=(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
            ),
        ),
    buffer_id=1
    )
>>> message = osctools.OscMessage('/g_queryTree.reply', 0, 0, 1, 1, 2, 1001, 0, 1000, 1, 1002, 0)
>>> manager.handle_message(message)
QueryTreeResponse(
    node_id=0,
    query_tree_group=QueryTreeGroup(
        node_id=0,
        children=(
            QueryTreeGroup(
                node_id=1,
                children=(
                    QueryTreeGroup(
                        node_id=1001,
                        children=()
                        ),
                    QueryTreeGroup(
                        node_id=1000,
                        children=(
                            QueryTreeGroup(
                                node_id=1002,
                                children=()
                                ),
                            )
                        ),
                    )
                ),
            )
        )
    )
>>> print(manager.handle_message(message))
NODE TREE 0 group
    1 group
        1001 group
        1000 group
            1002 group

Lineage

digraph InheritanceGraph { graph [background=transparent, bgcolor=transparent, color=lightslategrey, fontname=Arial, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, root="__builtin__.object", splines=spline, style="dotted, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=12, penwidth=2, style="filled, rounded"]; edge [color=lightsteelblue2, penwidth=2]; subgraph cluster_builtins { graph [label=builtins]; "builtins.object" [color=1, group=0, label=object, shape=box]; } subgraph cluster_responsetools { graph [label=responsetools]; "supriya.tools.responsetools.ResponseManager.ResponseManager" [color=black, fontcolor=white, group=1, label=<<B>ResponseManager</B>>, shape=box, style="filled, rounded"]; } subgraph cluster_systemtools { graph [label=systemtools]; "supriya.tools.systemtools.SupriyaObject.AbstractBase" [color=3, group=2, label=AbstractBase, shape=box]; "supriya.tools.systemtools.SupriyaObject.SupriyaObject" [color=3, group=2, label=SupriyaObject, shape=box]; "supriya.tools.systemtools.SupriyaObject.AbstractBase" -> "supriya.tools.systemtools.SupriyaObject.SupriyaObject"; } "builtins.object" -> "supriya.tools.systemtools.SupriyaObject.AbstractBase"; "supriya.tools.systemtools.SupriyaObject.SupriyaObject" -> "supriya.tools.responsetools.ResponseManager.ResponseManager"; }

Bases

Attribute summary

group_items(items, length)
handle_b_info(command, contents)
handle_b_set(command, contents)
handle_b_setn(command, contents)
handle_c_set(command, contents)
handle_c_setn(command, contents)
handle_d_removed(command, contents)
handle_done(command, contents)
handle_fail(command, contents)
handle_g_query_tree_reply(command, contents)
handle_message(message)
handle_n_info(command, contents)
handle_n_set(command, contents)
handle_n_setn(command, contents)
handle_status_reply(command, contents)
handle_synced(command, contents)
handle_tr(command, contents)
__eq__(expr) Is true when ID of expr equals ID of Supriya object.
__format__([format_specification]) Formats Supriya object.
__hash__() Hashes Supriya object.
__repr__() Gets interpreter representation of Supriya object.

Class & static methods

static ResponseManager.group_items(items, length)[source]
static ResponseManager.handle_b_info(command, contents)[source]
static ResponseManager.handle_b_set(command, contents)[source]
static ResponseManager.handle_b_setn(command, contents)[source]
static ResponseManager.handle_c_set(command, contents)[source]
static ResponseManager.handle_c_setn(command, contents)[source]
static ResponseManager.handle_d_removed(command, contents)[source]
static ResponseManager.handle_done(command, contents)[source]
static ResponseManager.handle_fail(command, contents)[source]
static ResponseManager.handle_g_query_tree_reply(command, contents)[source]
static ResponseManager.handle_message(message)[source]
static ResponseManager.handle_n_info(command, contents)[source]
static ResponseManager.handle_n_set(command, contents)[source]
static ResponseManager.handle_n_setn(command, contents)[source]
static ResponseManager.handle_status_reply(command, contents)[source]
static ResponseManager.handle_synced(command, contents)[source]
static ResponseManager.handle_tr(command, contents)[source]

Special methods

(SupriyaObject).__eq__(expr)

Is true when ID of expr equals ID of Supriya object. Otherwise false.

Returns boolean.

(SupriyaObject).__format__(format_specification='')

Formats Supriya object.

Set format_specification to ‘’ or ‘storage’. Interprets ‘’ equal to ‘storage’.

Returns string.

(SupriyaObject).__hash__()

Hashes Supriya object.

Required to be explicitely re-defined on Python 3 if __eq__ changes.

Returns integer.

(SupriyaObject).__repr__()

Gets interpreter representation of Supriya object.

Returns string.