Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend PatternPlayer interface #333

Merged
merged 3 commits into from
May 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions supriya/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class AddAction(IntEnumeration):


class BinaryOperator(IntEnumeration):

ABSOLUTE_DIFFERENCE = 38 # |a - b|
ADDITION = 0
AMCLIP = 40
Expand Down Expand Up @@ -181,7 +180,6 @@ class DoneAction(IntEnumeration):


class EnvelopeShape(IntEnumeration):

CUBED = 7
CUSTOM = 5
EXPONENTIAL = 2
Expand All @@ -205,7 +203,6 @@ class HeaderFormat(IntEnumeration):


class NodeAction(IntEnumeration):

NODE_CREATED = 0
NODE_REMOVED = 1
NODE_ACTIVATED = 2
Expand Down Expand Up @@ -421,7 +418,6 @@ class SignalRange(IntEnumeration):


class UnaryOperator(IntEnumeration):

ABSOLUTE_VALUE = 5
AMPLITUDE_TO_DB = 22
ARCCOS = 32
Expand Down Expand Up @@ -479,7 +475,6 @@ class UnaryOperator(IntEnumeration):


class Unit(IntEnumeration):

UNDEFINED = 0
DECIBELS = 1
AMPLITUDE = 2
Expand Down
12 changes: 12 additions & 0 deletions supriya/patterns/players.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -239,6 +242,15 @@ 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

@property
def uuid(self) -> UUID:
return self._uuid
1 change: 0 additions & 1 deletion supriya/synthdefs/synthdefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,6 @@ def clear(self) -> None:


class SuperColliderSynthDef:

### INITIALIZER ###

def __init__(self, name, body, rates=None):
Expand Down
1 change: 0 additions & 1 deletion supriya/ugens/bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ def wrap(cls: Type) -> Type:


class UGenMethodMixin:

### SPECIAL METHODS ###

def __abs__(self):
Expand Down
1 change: 0 additions & 1 deletion supriya/utils/intervals.py
Original file line number Diff line number Diff line change
Expand Up @@ -1488,7 +1488,6 @@ def __init__(self, start_offset):


class IntervalTreeDriver:

### INITIALIZER ###

def __init__(self, intervals=None):
Expand Down