コード例 #1
0
ファイル: Sum3.py プロジェクト: inegm/supriya
 def __init__(self, input_one=None, input_two=None, input_three=None):
     inputs = [input_one, input_two, input_three]
     calculation_rate = CalculationRate.from_expr(inputs)
     inputs.sort(key=lambda x: CalculationRate.from_expr(x), reverse=True)
     inputs = tuple(inputs)
     UGen.__init__(
         self,
         calculation_rate=calculation_rate,
         input_one=input_one,
         input_two=input_two,
         input_three=input_three,
     )
コード例 #2
0
 def __init__(self, input_one=None, input_two=None, input_three=None):
     inputs = [input_one, input_two, input_three]
     calculation_rate = CalculationRate.from_expr(inputs)
     inputs.sort(key=lambda x: CalculationRate.from_expr(x), reverse=True)
     inputs = tuple(inputs)
     UGen.__init__(
         self,
         calculation_rate=calculation_rate,
         input_one=input_one,
         input_two=input_two,
         input_three=input_three,
     )
コード例 #3
0
ファイル: MulAdd.py プロジェクト: inegm/supriya
 def _inputs_are_valid(source, multiplier, addend):
     if CalculationRate.from_expr(source) == CalculationRate.AUDIO:
         return True
     if CalculationRate.from_expr(source) == CalculationRate.CONTROL:
         if CalculationRate.from_expr(multiplier) in (
             CalculationRate.CONTROL,
             CalculationRate.SCALAR,
         ):
             if CalculationRate.from_expr(addend) in (
                 CalculationRate.CONTROL,
                 CalculationRate.SCALAR,
             ):
                 return True
     return False
コード例 #4
0
 def _inputs_are_valid(source, multiplier, addend):
     if CalculationRate.from_expr(source) == CalculationRate.AUDIO:
         return True
     if CalculationRate.from_expr(source) == CalculationRate.CONTROL:
         if CalculationRate.from_expr(multiplier) in (
             CalculationRate.CONTROL,
             CalculationRate.SCALAR,
         ):
             if CalculationRate.from_expr(addend) in (
                 CalculationRate.CONTROL,
                 CalculationRate.SCALAR,
             ):
                 return True
     return False
コード例 #5
0
 def __init__(
     self,
     bus_group_or_index=None,
     calculation_rate=CalculationRate.CONTROL,
 ):
     import supriya.realtime
     ServerObjectProxy.__init__(self)
     bus_group = None
     bus_id = None
     self._bus_id_was_set_manually = False
     if bus_group_or_index is not None:
         self._bus_id_was_set_manually = True
         if isinstance(bus_group_or_index, supriya.realtime.BusGroup):
             bus_group = bus_group_or_index
         elif isinstance(bus_group_or_index, int):
             bus_id = int(bus_group_or_index)
     self._bus_group = bus_group
     self._bus_id = bus_id
     if calculation_rate is None:
         calculation_rate = 'control'
     calculation_rate = CalculationRate.from_expr(calculation_rate)
     assert calculation_rate in (
         CalculationRate.AUDIO,
         CalculationRate.CONTROL,
     )
     self._calculation_rate = calculation_rate
コード例 #6
0
 def __init__(
     self,
     bus_group_or_index: Optional[int] = None,
     calculation_rate: CalculationRateLike = CalculationRate.CONTROL,
 ):
     ServerObject.__init__(self)
     bus_group = None
     bus_id = None
     self._bus_id_was_set_manually = False
     if bus_group_or_index is not None:
         self._bus_id_was_set_manually = True
         if isinstance(bus_group_or_index, BusGroup):
             bus_group = bus_group_or_index
         elif isinstance(bus_group_or_index, int):
             bus_id = int(bus_group_or_index)
     self._bus_group = bus_group
     self._bus_id = bus_id
     if calculation_rate is None:
         calculation_rate = "control"
     self._calculation_rate = CalculationRate.from_expr(calculation_rate)
     if self._calculation_rate not in (
             CalculationRate.AUDIO,
             CalculationRate.CONTROL,
     ):
         raise ValueError(calculation_rate)
コード例 #7
0
 def __init__(
     self,
     *,
     bus_id: int,
     calculation_rate: CalculationRateLike,
     server: "supriya.realtime.servers.Server",
     value: float = 0.0,
 ):
     self._bus_id = bus_id
     self._calculation_rate = CalculationRate.from_expr(calculation_rate)
     self._server = server
     self._value = value
コード例 #8
0
 def __init__(
     self, bus_count=1, calculation_rate=CalculationRate.CONTROL, *, bus_id=None
 ):
     ServerObject.__init__(self)
     calculation_rate = CalculationRate.from_expr(calculation_rate)
     assert calculation_rate in (CalculationRate.AUDIO, CalculationRate.CONTROL)
     self._calculation_rate = calculation_rate
     bus_count = int(bus_count)
     assert 0 < bus_count
     self._buses = tuple(
         Bus(bus_group_or_index=self, calculation_rate=self.calculation_rate)
         for _ in range(bus_count)
     )
     assert isinstance(bus_id, (type(None), int))
     self._bus_id = bus_id
コード例 #9
0
    def __init__(
        self, bus_count=1, calculation_rate=CalculationRate.CONTROL, bus_id=None
    ):
        import supriya.realtime

        ServerObject.__init__(self)
        calculation_rate = CalculationRate.from_expr(calculation_rate)
        assert calculation_rate in (CalculationRate.AUDIO, CalculationRate.CONTROL)
        self._calculation_rate = calculation_rate
        bus_count = int(bus_count)
        assert 0 < bus_count
        self._buses = tuple(
            supriya.realtime.Bus(
                bus_group_or_index=self, calculation_rate=self.calculation_rate
            )
            for _ in range(bus_count)
        )
        assert isinstance(bus_id, (type(None), int))
        self._bus_id = bus_id
コード例 #10
0
 def __init__(
     self, bus_group_or_index=None, calculation_rate=CalculationRate.CONTROL
 ):
     ServerObject.__init__(self)
     bus_group = None
     bus_id = None
     self._bus_id_was_set_manually = False
     if bus_group_or_index is not None:
         self._bus_id_was_set_manually = True
         if isinstance(bus_group_or_index, BusGroup):
             bus_group = bus_group_or_index
         elif isinstance(bus_group_or_index, int):
             bus_id = int(bus_group_or_index)
     self._bus_group = bus_group
     self._bus_id = bus_id
     if calculation_rate is None:
         calculation_rate = "control"
     calculation_rate = CalculationRate.from_expr(calculation_rate)
     assert calculation_rate in (CalculationRate.AUDIO, CalculationRate.CONTROL)
     self._calculation_rate = calculation_rate
コード例 #11
0
    def __init__(
        self, bus_group_or_index=None, calculation_rate=CalculationRate.CONTROL
    ):
        import supriya.realtime

        ServerObject.__init__(self)
        bus_group = None
        bus_id = None
        self._bus_id_was_set_manually = False
        if bus_group_or_index is not None:
            self._bus_id_was_set_manually = True
            if isinstance(bus_group_or_index, supriya.realtime.BusGroup):
                bus_group = bus_group_or_index
            elif isinstance(bus_group_or_index, int):
                bus_id = int(bus_group_or_index)
        self._bus_group = bus_group
        self._bus_id = bus_id
        if calculation_rate is None:
            calculation_rate = "control"
        calculation_rate = CalculationRate.from_expr(calculation_rate)
        assert calculation_rate in (CalculationRate.AUDIO, CalculationRate.CONTROL)
        self._calculation_rate = calculation_rate
コード例 #12
0
 def __init__(self,
              bus_count=1,
              calculation_rate=CalculationRate.CONTROL,
              *,
              bus_id=None):
     ServerObject.__init__(self)
     self._calculation_rate = CalculationRate.from_expr(calculation_rate)
     if self._calculation_rate not in (
             CalculationRate.AUDIO,
             CalculationRate.CONTROL,
     ):
         raise ValueError(self._calculation_rate)
     bus_count = int(bus_count)
     if bus_count <= 0:
         raise ValueError(bus_count)
     self._buses = tuple(
         Bus(bus_group_or_index=self,
             calculation_rate=self.calculation_rate)
         for _ in range(bus_count))
     if not isinstance(bus_id, (type(None), int)):
         raise ValueError(bus_id)
     self._bus_id = bus_id
コード例 #13
0
 def __init__(
     self,
     bus_count=1,
     calculation_rate=CalculationRate.CONTROL,
     bus_id=None,
 ):
     import supriya.realtime
     ServerObjectProxy.__init__(self)
     calculation_rate = CalculationRate.from_expr(calculation_rate)
     assert calculation_rate in (
         CalculationRate.AUDIO,
         CalculationRate.CONTROL,
     )
     self._calculation_rate = calculation_rate
     bus_count = int(bus_count)
     assert 0 < bus_count
     self._buses = tuple(
         supriya.realtime.Bus(
             bus_group_or_index=self,
             calculation_rate=self.calculation_rate,
         ) for _ in range(bus_count))
     assert isinstance(bus_id, (type(None), int))
     self._bus_id = bus_id
コード例 #14
0
ファイル: controls.py プロジェクト: inegm/supriya
 def calculation_rate(self):
     return CalculationRate.from_expr(self)