Binding

class supriya.tools.bindingtools.Binding[source]

A binding.

>>> source = bindingtools.BindingInput()
>>> target = bindingtools.BindingOutput()
>>> binding = bind(source, target)
>>> binding
Binding()
>>> source._send_bound_event('An event!')
Received 'An event!' @ supriya.tools.bindingtools.BindingOutput()
>>> binding.unbind()
>>> binding = bind(source, target, target_range=(0., 127.))
>>> for i in range(11):
...     source._send_bound_event(float(i) / 10.)
...
Received 0.0 @ supriya.tools.bindingtools.BindingOutput()
Received 12.7... @ supriya.tools.bindingtools.BindingOutput()
Received 25.4... @ supriya.tools.bindingtools.BindingOutput()
Received 38.1 @ supriya.tools.bindingtools.BindingOutput()
Received 50.8... @ supriya.tools.bindingtools.BindingOutput()
Received 63.5 @ supriya.tools.bindingtools.BindingOutput()
Received 76.2 @ supriya.tools.bindingtools.BindingOutput()
Received 88.899... @ supriya.tools.bindingtools.BindingOutput()
Received 101.6... @ supriya.tools.bindingtools.BindingOutput()
Received 114.3 @ supriya.tools.bindingtools.BindingOutput()
Received 127.0 @ supriya.tools.bindingtools.BindingOutput()
>>> binding.unbind()
>>> binding = bind(source, target, target_range=(0., 127.), exponent=2.)
>>> for i in range(11):
...     source._send_bound_event(float(i) / 10.)
...
Received 0.0 @ supriya.tools.bindingtools.BindingOutput()
Received 1.27... @ supriya.tools.bindingtools.BindingOutput()
Received 5.08... @ supriya.tools.bindingtools.BindingOutput()
Received 11.43 @ supriya.tools.bindingtools.BindingOutput()
Received 20.32... @ supriya.tools.bindingtools.BindingOutput()
Received 31.75 @ supriya.tools.bindingtools.BindingOutput()
Received 45.72 @ supriya.tools.bindingtools.BindingOutput()
Received 62.2299... @ supriya.tools.bindingtools.BindingOutput()
Received 81.28... @ supriya.tools.bindingtools.BindingOutput()
Received 102.87 @ supriya.tools.bindingtools.BindingOutput()
Received 127.0 @ supriya.tools.bindingtools.BindingOutput()
>>> binding.unbind()

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=2, group=1, label=object, shape=box]; } subgraph cluster_bindingtools { graph [label=bindingtools]; "supriya.tools.bindingtools.Binding.Binding" [color=black, fontcolor=white, group=0, label=<<B>Binding</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.bindingtools.Binding.Binding"; }

Bases

Attribute summary

bind(source, target[, source_range, ...])
exponent
source
source_range
target
target_range
unbind()
__call__([event])
__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.

Read-only properties

Binding.exponent
Binding.source
Binding.source_range
Binding.target
Binding.target_range

Methods

Binding.bind(source, target, source_range=None, target_range=None, exponent=None)[source]
Binding.unbind()[source]

Special methods

Binding.__call__(event=None)[source]
(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.