Skip to content

Commit

Permalink
Tinkering
Browse files Browse the repository at this point in the history
  • Loading branch information
josephine-wolf-oberholtzer committed Dec 20, 2024
1 parent a2423aa commit a164b0f
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions supriya/mixers/tracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,6 @@ def _register_feedback(
)
return self._get_audio_bus(context, name=ComponentNames.FEEDBACK)

def _set_soloed(self, soloed: bool) -> None:
self._is_soloed = soloed

def _unregister_feedback(self, dependent: "Component") -> bool:
if should_tear_down := super()._unregister_feedback(dependent):
# check if feedback should be torn down
Expand All @@ -326,8 +323,16 @@ def _unregister_feedback(self, dependent: "Component") -> bool:
return should_tear_down

def _update_activation(self, force=True) -> None:
if not (mixer := self.mixer):
return
was_active = self._is_active
self._is_active = not self._is_muted
if mixer._soloed_tracks:
self._is_active = self._is_active and any(
track._is_soloed
for track in self._iterate_parentage()
if isinstance(track, Track)
)
if self._can_allocate() and (force or (was_active != self._is_active)):
self._control_buses[ComponentNames.ACTIVE].set(float(self._is_active))

Expand Down Expand Up @@ -404,7 +409,20 @@ async def set_output(

async def set_soloed(self, soloed: bool = True, exclusive: bool = True) -> None:
async with self._lock:
pass
self._is_soloed = soloed
if not (mixer := self.mixer):
return
if soloed:
if exclusive:
mixer._soloed_tracks.discard(self)
for track in mixer._soloed_tracks:
track._is_soloed = False
mixer._soloed_tracks.add(self)
else:
mixer._soloed_tracks.discard(self)
for component in mixer._walk(Track):
if isinstance(component, Track):
component._update_activation()

async def ungroup(self) -> None:
async with self._lock:
Expand Down

0 comments on commit a164b0f

Please sign in to comment.