Exemplo n.º 1
0
 def add_bus(self, calculation_rate=CalculationRate.CONTROL) -> BusProxy:
     if not self.moment:
         raise ValueError("No current moment")
     calculation_rate = CalculationRate.from_expr(calculation_rate)
     if calculation_rate not in (CalculationRate.AUDIO,
                                 CalculationRate.CONTROL):
         raise ValueError(f"Invalid calculation rate: {calculation_rate!r}")
     identifier = self.session.add_bus(calculation_rate=calculation_rate)
     return BusProxy(calculation_rate=calculation_rate,
                     identifier=identifier,
                     provider=self)
Exemplo n.º 2
0
 def add_bus(self, calculation_rate=CalculationRate.CONTROL) -> BusProxy:
     if not self.moment:
         raise ValueError("No current moment")
     calculation_rate = CalculationRate.from_expr(calculation_rate)
     if calculation_rate not in (CalculationRate.AUDIO,
                                 CalculationRate.CONTROL):
         raise ValueError(f"Invalid calculation rate: {calculation_rate!r}")
     allocator = realtime.Bus._get_allocator(calculation_rate,
                                             server=self.server)
     identifier = allocator.allocate(1)
     return BusProxy(calculation_rate=calculation_rate,
                     identifier=identifier,
                     provider=self)
Exemplo n.º 3
0
 def add_bus_group(
         self,
         channel_count=1,
         calculation_rate=CalculationRate.CONTROL) -> BusGroupProxy:
     if not self.moment:
         raise ValueError("No current moment")
     calculation_rate = CalculationRate.from_expr(calculation_rate)
     if calculation_rate not in (CalculationRate.AUDIO,
                                 CalculationRate.CONTROL):
         raise ValueError(f"Invalid calculation rate: {calculation_rate!r}")
     if channel_count < 1:
         raise ValueError(
             "Channel-count must be positive, non-zero integer")
     identifier = self.session.add_bus_group(
         bus_count=channel_count, calculation_rate=calculation_rate)
     return BusGroupProxy(
         calculation_rate=calculation_rate,
         channel_count=channel_count,
         identifier=identifier,
         provider=self,
     )
Exemplo n.º 4
0
 def add_bus_group(
         self,
         channel_count=1,
         calculation_rate=CalculationRate.CONTROL) -> BusGroupProxy:
     if not self.moment:
         raise ValueError("No current moment")
     calculation_rate = CalculationRate.from_expr(calculation_rate)
     if calculation_rate not in (CalculationRate.AUDIO,
                                 CalculationRate.CONTROL):
         raise ValueError(f"Invalid calculation rate: {calculation_rate!r}")
     if channel_count < 1:
         raise ValueError(
             "Channel-count must be positive, non-zero integer")
     allocator = realtime.Bus._get_allocator(calculation_rate,
                                             server=self.server)
     identifier = allocator.allocate(channel_count)
     if identifier is None:
         raise RuntimeError
     return BusGroupProxy(
         calculation_rate=calculation_rate,
         channel_count=channel_count,
         identifier=identifier,
         provider=self,
     )
Exemplo n.º 5
0
 def __init__(self, id_, *, calculation_rate="audio", channel_count=1, delta=0.0):
     Event.__init__(self, delta=delta)
     self.id_ = id_
     self.calculation_rate = CalculationRate.from_expr(calculation_rate)
     self.channel_count = channel_count