From e67b6aae2a6e03d168b963e4d40ab9186d7ee6bc Mon Sep 17 00:00:00 2001 From: "J. Wolf Oberholtzer" Date: Tue, 26 Mar 2024 06:00:35 -0400 Subject: [PATCH] Fixing tests --- supriya/ugens/core.py | 2 +- supriya/ugens/factories.py | 43 +++++++++++++++++++++++++------------- supriya/ugens/inout.py | 2 +- 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/supriya/ugens/core.py b/supriya/ugens/core.py index fcbf6f651..264b6790f 100644 --- a/supriya/ugens/core.py +++ b/supriya/ugens/core.py @@ -1295,7 +1295,7 @@ def __getitem__(self, i): return UGenVector(*self._values[i]) def __len__(self) -> int: - return len(self._values) + return self._channel_count def __repr__(self): return f"<{type(self).__name__}.{self.calculation_rate.token}()>" diff --git a/supriya/ugens/factories.py b/supriya/ugens/factories.py index b9f1d3943..fb2a80f70 100644 --- a/supriya/ugens/factories.py +++ b/supriya/ugens/factories.py @@ -761,17 +761,18 @@ def with_gate(self, attack_time=0.02, release_time=0.02): synthdef: name: ... ugens: - - Control.ir: - out: 0.0 - - In.ar: - bus: Control.ir[0:out] - - Control.kr: null + - Control.kr: + gate: 1.0 - Linen.kr: gate: Control.kr[0:gate] attack_time: 0.02 sustain_level: 1.0 release_time: 0.02 done_action: 2.0 + - Control.ir: + out: 0.0 + - In.ar: + bus: Control.ir[0:out] - ExpRand.ir/0: minimum: 0.01 maximum: 0.1 @@ -1050,6 +1051,7 @@ def with_input(self, feedback=False, private=False, windowed=False): name: ... ugens: - Control.ir: + duration: 1.0 out: 0.0 - Line.kr: start: 0.0 @@ -1108,6 +1110,7 @@ def with_input(self, feedback=False, private=False, windowed=False): name: ... ugens: - Control.ir: + duration: 1.0 out: 0.0 - Line.kr: start: 0.0 @@ -1306,11 +1309,12 @@ def with_output( synthdef: name: ... ugens: + - Control.kr: + mix: 0.0 - Control.ir: out: 0.0 - In.ar: bus: Control.ir[0:out] - - Control.kr: null - ExpRand.ir/0: minimum: 0.01 maximum: 0.1 @@ -1355,11 +1359,12 @@ def with_output( synthdef: name: ... ugens: + - Control.kr: + level: 1.0 - Control.ir: out: 0.0 - In.ar: bus: Control.ir[0:out] - - Control.kr: null - ExpRand.ir/0: minimum: 0.01 maximum: 0.1 @@ -1410,6 +1415,7 @@ def with_output( name: ... ugens: - Control.ir: + duration: 1.0 out: 0.0 - Line.kr: start: 0.0 @@ -1467,7 +1473,10 @@ def with_output( synthdef: name: ... ugens: + - Control.kr: + level: 1.0 - Control.ir: + duration: 1.0 out: 0.0 - Line.kr: start: 0.0 @@ -1476,12 +1485,11 @@ def with_output( done_action: 2.0 - UnaryOpUGen(HANNING_WINDOW).kr: source: Line.kr[0] - - In.ar: - bus: Control.ir[1:out] - - Control.kr: null - BinaryOpUGen(MULTIPLICATION).kr: left: UnaryOpUGen(HANNING_WINDOW).kr[0] right: Control.kr[0:level] + - In.ar: + bus: Control.ir[1:out] - ExpRand.ir/0: minimum: 0.01 maximum: 0.1 @@ -1526,7 +1534,10 @@ def with_output( synthdef: name: ... ugens: + - Control.kr: + level: 1.0 - Control.ir: + duration: 1.0 out: 0.0 - Line.kr: start: 0.0 @@ -1535,15 +1546,14 @@ def with_output( done_action: 2.0 - UnaryOpUGen(HANNING_WINDOW).kr: source: Line.kr[0] + - BinaryOpUGen(MULTIPLICATION).kr: + left: UnaryOpUGen(HANNING_WINDOW).kr[0] + right: Control.kr[0:level] - In.ar: bus: Control.ir[1:out] - BinaryOpUGen(MULTIPLICATION).ar: left: In.ar[0] right: UnaryOpUGen(HANNING_WINDOW).kr[0] - - Control.kr: null - - BinaryOpUGen(MULTIPLICATION).kr: - left: UnaryOpUGen(HANNING_WINDOW).kr[0] - right: Control.kr[0:level] - ExpRand.ir/0: minimum: 0.01 maximum: 0.1 @@ -2166,6 +2176,7 @@ def with_rand_id(self, rand_id=0): ugens: - Control.ir: out: 0.0 + rand_id: 23.0 - RandID.ir: rand_id: Control.ir[1:rand_id] - In.ar: @@ -2417,7 +2428,10 @@ def with_silence_detection(self): synthdef: name: ... ugens: + - Control.kr: + level: 1.0 - Control.ir: + duration: 1.0 out: 0.0 - Line.kr: start: 0.0 @@ -2428,7 +2442,6 @@ def with_silence_detection(self): source: Line.kr[0] - In.ar: bus: Control.ir[1:out] - - Control.kr: null - ExpRand.ir/0: minimum: 0.01 maximum: 0.1 diff --git a/supriya/ugens/inout.py b/supriya/ugens/inout.py index c061bfcb9..ee5ad9d6c 100644 --- a/supriya/ugens/inout.py +++ b/supriya/ugens/inout.py @@ -62,7 +62,7 @@ def _postprocess_kwargs( if not isinstance(default, Sequence): default = [default] kwargs["default"] = list( - repeat_to_length([float(x) for x in default], len(self)) + repeat_to_length([float(x) for x in default], self._channel_count) ) return calculation_rate, kwargs