Allow controlling ServiceSwitcher with either immediate frames (SystemFrames) or in-order frames (ControlFrames).

Immediate is the "default", i.e. has the more obvious name (e.g. `ManuallySwitchServiceFrame` v `ManuallySwitchServiceControlFrame`), since that's *probably* what users will want to reach for. Also, the immediate frames are more likely to behave like what we had before the last few commits, where the service switch would always "jump the queue" by having an immediate effect once it hit the `ServiceSwitcher` in the pipeline, jumping ahead of frames in front of it destined for the service.
This commit is contained in:
Paul Kompfner
2025-09-12 15:36:56 -04:00
parent a1f84e1b50
commit b814b70e1e
3 changed files with 142 additions and 22 deletions

View File

@@ -1603,17 +1603,46 @@ class MixerEnableFrame(MixerControlFrame):
@dataclass
class ServiceSwitcherFrame(ControlFrame):
"""A base class for frames that control ServiceSwitcher behavior."""
class ManuallySwitchServiceBaseFrame:
"""Base class for frames that request a manual service switch from a ServiceSwitcher.
Must be inherited alongside either ServiceSwitcherFrame or ServiceSwitcherControlFrame.
"""
service: "FrameProcessor"
@dataclass
class ServiceSwitcherFrame(SystemFrame):
"""A base class for frames that affect ServiceSwitcher behavior immediately."""
pass
@dataclass
class ManuallySwitchServiceFrame(ServiceSwitcherFrame):
"""A frame to request a manual switch in the active service in a ServiceSwitcher.
class ManuallySwitchServiceFrame(ServiceSwitcherFrame, ManuallySwitchServiceBaseFrame):
"""A frame to request an immediate manual switch in the active service in a ServiceSwitcher.
Handled by ServiceSwitcherStrategyManual to switch the active service.
"""
service: "FrameProcessor"
pass
@dataclass
class ServiceSwitcherControlFrame(ControlFrame):
"""A base class for frames that affect ServiceSwitcher behavior, in order."""
pass
@dataclass
class ManuallySwitchServiceControlFrame(
ServiceSwitcherControlFrame, ManuallySwitchServiceBaseFrame
):
"""A frame to request a manual switch in the active service in a ServiceSwitcher, in order.
Handled by ServiceSwitcherStrategyManual to switch the active service.
"""
pass