buses

class AudioInputBusGroup(server)

Bases: supriya.realtime.buses.BusGroup

Audio input bus group.

Allocated automatically on server boot.

>>> server = supriya.Server().boot()
>>> bus_group = server.audio_input_bus_group
>>> bus_group
<+ AudioInputBusGroup{8}: 8 (audio)>
>>> bus_group.is_allocated
True
allocate()
free()
class AudioOutputBusGroup(server)

Bases: supriya.realtime.buses.BusGroup

Audio output bus group.

Allocated automatically on server boot.

>>> server = supriya.Server().boot()
>>> bus_group = server.audio_output_bus_group
>>> bus_group
<+ AudioOutputBusGroup{8}: 0 (audio)>
>>> bus_group.is_allocated
True
allocate()
free()
class Bus(bus_group_or_index: Optional[int] = None, calculation_rate: Optional[Union[supriya.enums.CalculationRate, SupportsInt, str]] = CalculationRate.CONTROL)

Bases: supriya.realtime.bases.ServerObject

A bus.

>>> server = supriya.Server().boot()
>>> bus = server.add_bus()
>>> bus
<+ Bus: 0 (control)>
>>> bus.get()
0.0
>>> bus.set(0.5)
>>> bus.get()
0.5
>>> print(bus)
c0
>>> bus.free()
<- Bus: ??? (control)>
__float__() float
__int__() int
allocate(server: supriya.realtime.servers.Server) supriya.realtime.buses.Bus
property bus_group: Optional[supriya.realtime.buses.BusGroup]
property bus_id: Optional[int]
property calculation_rate: supriya.enums.CalculationRate
free() supriya.realtime.buses.Bus
get(completion_callback=None) float
property is_allocated: bool
property map_symbol: str
property server: Optional[supriya.realtime.servers.Server]
set(value: float) None
property value: Optional[float]
class BusGroup(bus_count=1, calculation_rate=CalculationRate.CONTROL, *, bus_id=None)

Bases: supriya.realtime.bases.ServerObject

A bus group.

>>> server = supriya.Server().boot()
>>> bus_group = supriya.BusGroup(bus_count=4)
>>> bus_group
<- BusGroup{4}: ??? (control)>
>>> bus_group.allocate(server)
<+ BusGroup{4}: 0 (control)>
>>> bus_group[2]
<+ Bus: 2 (control)>
>>> for i in range(len(bus_group)):
...     bus = bus_group[i]
...     value = (i * 0.2) + 0.1
...     bus.set(value)
... 
>>> bus_values = bus_group.get()

Values in scsynth don’t necessarily have the same precision as in Python, so we’ll round them here for display purposes:

>>> print([round(value, 1) for value in bus_values])
[0.1, 0.3, 0.5, 0.7]
>>> print(bus_group)
c0
>>> bus_group.free()
<- BusGroup{4}: ??? (control)>
__contains__(item) bool

Test if a bus belongs to the bus group.

>>> bus_group = supriya.BusGroup(4, "control")
>>> bus_group[0] in bus_group
True
>>> bus = supriya.Bus("audio")
>>> bus in bus_group
False
__float__() float
__getitem__(item: int) supriya.realtime.buses.Bus

Get item in bus group.

>>> server = supriya.Server().boot()
>>> bus_group = supriya.BusGroup(4, "control").allocate(server)
>>> bus_group[0]
<+ Bus: 0 (control)>
>>> bus_group[1:]
<+ BusGroup{3}: 1 (control)>
__int__() int
__iter__()
__len__() int
allocate(server: supriya.realtime.servers.Server) supriya.realtime.buses.BusGroup
property bus_id: Optional[int]
property buses: Tuple[supriya.realtime.buses.Bus, ...]
property calculation_rate: supriya.enums.CalculationRate
fill(value: float)

Fill buses in bus group with value.

>>> server = supriya.Server().boot()
>>> bus_group = server.add_bus_group(4, "control")
>>> bus_group.get()
(0.0, 0.0, 0.0, 0.0)
>>> bus_group.fill(0.5)
>>> bus_group.get()
(0.5, 0.5, 0.5, 0.5)
>>> bus_group = supriya.BusGroup(4, "audio")
>>> bus_group.fill(0.5)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/josiah/Source/github.com/josiah-wolf-oberholtzer/supriya/supriya/realtime/buses.py", line 475, in fill
    raise supriya.exceptions.BusNotAllocated
supriya.exceptions.BusNotAllocated
>>> bus_group.allocate(server).fill(0.5)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/josiah/Source/github.com/josiah-wolf-oberholtzer/supriya/supriya/realtime/buses.py", line 477, in fill
    raise supriya.exceptions.IncompatibleRate
supriya.exceptions.IncompatibleRate
free() supriya.realtime.buses.BusGroup
get() Tuple[float, ...]

Get bus group values.

>>> server = supriya.Server().boot()
>>> bus_group = supriya.BusGroup(4, "control").allocate(server)
>>> bus_group.get()
(0.0, 0.0, 0.0, 0.0)
index(item) int
property is_allocated: bool
property map_symbol: str
set(*values: float) None

Set bus group values.

>>> server = supriya.Server().boot()
>>> bus_group = supriya.BusGroup(4, "control").allocate(server)
>>> bus_group.get()
(0.0, 0.0, 0.0, 0.0)
>>> bus_group.set(-0.5, 0.5, -0.5, 0.5)
>>> bus_group.get()
(-0.5, 0.5, -0.5, 0.5)
class BusProxy(*, bus_id: int, calculation_rate: Optional[Union[supriya.enums.CalculationRate, SupportsInt, str]], server: supriya.realtime.servers.Server, value: float = 0.0)

Bases: supriya.system.SupriyaValueObject

A buffer proxy.

__float__() float
__int__() int
property bus_id: int
property calculation_rate: supriya.enums.CalculationRate
property map_symbol: str
property server: supriya.realtime.servers.Server
property value: float