From 148c6e4c1ace573280eb0a61b9b7c0f9ba2d1f3a Mon Sep 17 00:00:00 2001 From: Josiah Oberholtzer Date: Thu, 11 May 2023 08:45:23 -0400 Subject: [PATCH 1/3] Add initial_offset to PatternPlayer --- supriya/patterns/players.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/supriya/patterns/players.py b/supriya/patterns/players.py index 23879fcf3..b7ad6ecbd 100644 --- a/supriya/patterns/players.py +++ b/supriya/patterns/players.py @@ -54,11 +54,14 @@ def __init__( self._notes_by_uuid: Dict[Union[UUID, Tuple[UUID, int]], float] = {} self._uuid: UUID = uuid or uuid4() self._next_delta: Optional[float] = None + self._initial_offset: Optional[float] = None def _clock_callback( self, clock_context: ClockContext, *args, **kwargs ) -> Optional[float]: for clock_context, seconds, offset, events in self._find_events(clock_context): + if self._initial_offset is None: + self._initial_offset = offset with self._context.at(seconds): for event, priority in events: event.perform( @@ -239,6 +242,10 @@ def stop(self, quantization: Optional[str] = None) -> None: self._stop_callback, event_type=2, quantization=quantization ) + @property + def initial_offset(self) -> Optional[float]: + return self._initial_offset + @property def uuid(self) -> UUID: return self._uuid From f510e8b5e324fb1506153f5310f205d7eb762d5f Mon Sep 17 00:00:00 2001 From: Josiah Oberholtzer Date: Thu, 11 May 2023 08:48:25 -0400 Subject: [PATCH 2/3] Add PatternPlayer.uuid_to_note_id() --- supriya/patterns/players.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/supriya/patterns/players.py b/supriya/patterns/players.py index b7ad6ecbd..be7d9a524 100644 --- a/supriya/patterns/players.py +++ b/supriya/patterns/players.py @@ -242,6 +242,11 @@ def stop(self, quantization: Optional[str] = None) -> None: self._stop_callback, event_type=2, quantization=quantization ) + def uuid_to_note_id(self, uuid: UUID, index: Optional[int] = None) -> float: + if index is not None: + return self._notes_by_uuid[uuid, index] + return self._notes_by_uuid[uuid] + @property def initial_offset(self) -> Optional[float]: return self._initial_offset From 91466319051da072ef22564dee0ca6e406937e62 Mon Sep 17 00:00:00 2001 From: Josiah Oberholtzer Date: Thu, 11 May 2023 08:51:55 -0400 Subject: [PATCH 3/3] Reformat --- supriya/enums.py | 5 ----- supriya/synthdefs/synthdefs.py | 1 - supriya/ugens/bases.py | 1 - supriya/utils/intervals.py | 1 - 4 files changed, 8 deletions(-) diff --git a/supriya/enums.py b/supriya/enums.py index 016ea9a73..da6e8c870 100644 --- a/supriya/enums.py +++ b/supriya/enums.py @@ -20,7 +20,6 @@ class AddAction(IntEnumeration): class BinaryOperator(IntEnumeration): - ABSOLUTE_DIFFERENCE = 38 # |a - b| ADDITION = 0 AMCLIP = 40 @@ -181,7 +180,6 @@ class DoneAction(IntEnumeration): class EnvelopeShape(IntEnumeration): - CUBED = 7 CUSTOM = 5 EXPONENTIAL = 2 @@ -205,7 +203,6 @@ class HeaderFormat(IntEnumeration): class NodeAction(IntEnumeration): - NODE_CREATED = 0 NODE_REMOVED = 1 NODE_ACTIVATED = 2 @@ -421,7 +418,6 @@ class SignalRange(IntEnumeration): class UnaryOperator(IntEnumeration): - ABSOLUTE_VALUE = 5 AMPLITUDE_TO_DB = 22 ARCCOS = 32 @@ -479,7 +475,6 @@ class UnaryOperator(IntEnumeration): class Unit(IntEnumeration): - UNDEFINED = 0 DECIBELS = 1 AMPLITUDE = 2 diff --git a/supriya/synthdefs/synthdefs.py b/supriya/synthdefs/synthdefs.py index 59ad6ef40..441c705dd 100644 --- a/supriya/synthdefs/synthdefs.py +++ b/supriya/synthdefs/synthdefs.py @@ -889,7 +889,6 @@ def clear(self) -> None: class SuperColliderSynthDef: - ### INITIALIZER ### def __init__(self, name, body, rates=None): diff --git a/supriya/ugens/bases.py b/supriya/ugens/bases.py index 800a5d05f..edd7c94cf 100644 --- a/supriya/ugens/bases.py +++ b/supriya/ugens/bases.py @@ -263,7 +263,6 @@ def wrap(cls: Type) -> Type: class UGenMethodMixin: - ### SPECIAL METHODS ### def __abs__(self): diff --git a/supriya/utils/intervals.py b/supriya/utils/intervals.py index 3f030443d..a91f3cf9b 100644 --- a/supriya/utils/intervals.py +++ b/supriya/utils/intervals.py @@ -1488,7 +1488,6 @@ def __init__(self, start_offset): class IntervalTreeDriver: - ### INITIALIZER ### def __init__(self, intervals=None):