Class SceneManager
- Namespace
- VisioForge.Core.SceneSwitching
- Assembly
- VisioForge.Core.dll
Top-level orchestrator for scene-based video composition. Manages a pool of registered sources, a collection of named scenes, and provides scene switching with animated transitions. Built on top of VisioForge.Core.LiveVideoCompositor (LVC V2) using the bridge architecture.
public class SceneManager : IDisposable, IAsyncDisposableInheritance
Implements
Inherited Members
Remarks
The SceneManager follows the "All Sources Always Connected" approach: all registered sources are connected to the mixer at all times with pre-allocated slots. Scene switching only modifies mixer stream properties (alpha, position, z-order) rather than changing the pipeline topology. This ensures zero-glitch, instantaneous scene switches.
Key concepts: - Sources are independent and persist across scenes. - Scenes are configurations (named collections of source placements). - Transitions are animations on mixer stream properties. - Studio Mode supports Preview/Program workflow.
Constructors
SceneManager(SceneManagerSettings)
Initializes a new instance of the VisioForge.Core.SceneSwitching.SceneManager class.
public SceneManager(SceneManagerSettings settings)Parameters
settingsSceneManagerSettings-
The configuration settings.
Properties
Settings
Gets the configuration settings for this SceneManager instance.
public SceneManagerSettings Settings { get; }Property Value
StudioMode_Enabled
Gets or sets a value indicating whether Studio Mode (Preview/Program) is enabled.
public bool StudioMode_Enabled { get; set; }Property Value
Methods
Dispose(bool)
Releases resources used by this SceneManager.
protected virtual void Dispose(bool disposing)Parameters
disposingbool-
trueto release managed resources.
Dispose()
Releases all resources used by this SceneManager.
public void Dispose()DisposeAsync()
Asynchronously releases all resources used by this SceneManager.
public ValueTask DisposeAsync()Returns
~SceneManager()
Finalizes this instance.
protected ~SceneManager()GetCompositor()
Gets the underlying LiveVideoCompositor for advanced operations.
public LiveVideoCompositor GetCompositor()Returns
- LiveVideoCompositor
-
The internal VisioForge.Core.LiveVideoCompositorV2.LiveVideoCompositor.
Output_AddAsync(LVCVideoAudioOutput, bool)
Adds a combined video/audio output to the scene manager.
public Task<bool> Output_AddAsync(LVCVideoAudioOutput output, bool start = false)Parameters
outputLVCVideoAudioOutput-
The video/audio output to add.
startbool-
If
true, starts the output immediately.
Returns
Output_AddAsync(LVCVideoOutput, bool)
Adds a video-only output to the scene manager.
public Task<bool> Output_AddAsync(LVCVideoOutput output, bool start = false)Parameters
outputLVCVideoOutput-
The video output to add.
startbool-
If
true, starts the output immediately.
Returns
Output_AddAsync(LVCAudioOutput, bool)
Adds an audio-only output to the scene manager.
public Task<bool> Output_AddAsync(LVCAudioOutput output, bool start = false)Parameters
outputLVCAudioOutput-
The audio output to add.
startbool-
If
true, starts the output immediately.
Returns
Output_RemoveAsync(Guid)
Removes an output by its ID.
public Task<bool> Output_RemoveAsync(Guid id)Parameters
idGuid-
The output ID.
Returns
Scene_Create(string)
Creates a new empty scene.
public Scene Scene_Create(string name)Parameters
namestring-
The name of the scene.
Returns
- Scene
-
The created VisioForge.Core.SceneSwitching.Scene.
Scene_Get(Guid)
Gets a scene by its ID.
public Scene Scene_Get(Guid id)Parameters
idGuid-
The scene ID.
Returns
- Scene
-
The VisioForge.Core.SceneSwitching.Scene if found; otherwise,
null.
Scene_Get(string)
Gets a scene by its name.
public Scene Scene_Get(string name)Parameters
namestring-
The scene name.
Returns
- Scene
-
The first VisioForge.Core.SceneSwitching.Scene with the specified name; otherwise,
null.
Scene_GetActive()
Gets the currently active (program) scene.
public Scene Scene_GetActive()Returns
- Scene
-
The active VisioForge.Core.SceneSwitching.Scene;
nullif none is active.
Scene_List()
Gets all scenes.
public Scene[] Scene_List()Returns
- Scene[]
-
An array of all scenes.
Scene_Remove(Guid)
Removes a scene by its ID.
public bool Scene_Remove(Guid sceneId)Parameters
sceneIdGuid-
The ID of the scene to remove.
Returns
- bool
-
trueif the scene was found and removed; otherwise,false.
Scene_SwitchAsync(Guid, TransitionDefinition)
Switches to a scene by its ID with an optional transition.
public Task<bool> Scene_SwitchAsync(Guid sceneId, TransitionDefinition transition = null)Parameters
sceneIdGuid-
The ID of the scene to switch to.
transitionTransitionDefinition-
The transition to use. If
null, the default transition is used.
Returns
Scene_SwitchAsync(string, TransitionDefinition)
Switches to a scene by its name with an optional transition.
public Task<bool> Scene_SwitchAsync(string sceneName, TransitionDefinition transition = null)Parameters
sceneNamestring-
The name of the scene to switch to.
transitionTransitionDefinition-
The transition to use. If
null, the default transition is used.
Returns
Source_Get(Guid)
Gets a registered source by its ID.
public RegisteredSource Source_Get(Guid id)Parameters
idGuid-
The source ID.
Returns
- RegisteredSource
-
The VisioForge.Core.SceneSwitching.RegisteredSource if found; otherwise,
null.
Source_Get(string)
Gets a registered source by its name.
public RegisteredSource Source_Get(string name)Parameters
namestring-
The source name.
Returns
- RegisteredSource
-
The first VisioForge.Core.SceneSwitching.RegisteredSource with the specified name; otherwise,
null.
Source_List()
Gets all registered sources.
public RegisteredSource[] Source_List()Returns
- RegisteredSource[]
-
An array of all registered sources.
Source_RegisterAsync(string, LVCVideoInput)
Registers a video-only source with the scene manager.
public Task<RegisteredSource> Source_RegisterAsync(string name, LVCVideoInput input)Parameters
namestring-
A descriptive name for this source.
inputLVCVideoInput-
The LVC video input.
Returns
- Task<RegisteredSource>
-
The registered source reference.
Source_RegisterAsync(string, LVCAudioInput)
Registers an audio-only source with the scene manager.
public Task<RegisteredSource> Source_RegisterAsync(string name, LVCAudioInput input)Parameters
namestring-
A descriptive name for this source.
inputLVCAudioInput-
The LVC audio input.
Returns
- Task<RegisteredSource>
-
The registered source reference.
Source_RegisterAsync(string, LVCVideoAudioInput)
Registers a combined video/audio source with the scene manager.
public Task<RegisteredSource> Source_RegisterAsync(string name, LVCVideoAudioInput input)Parameters
namestring-
A descriptive name for this source.
inputLVCVideoAudioInput-
The LVC video/audio input.
Returns
- Task<RegisteredSource>
-
The registered source reference.
Source_UnregisterAsync(Guid)
Unregisters a source from the scene manager and removes it from all scenes.
public Task<bool> Source_UnregisterAsync(Guid sourceId)Parameters
sourceIdGuid-
The ID of the source to unregister.
Returns
StartAsync()
Starts the scene manager and underlying compositor.
public Task<bool> StartAsync()Returns
StopAsync()
Stops the scene manager and underlying compositor. Cancels any in-progress transition and waits for the active scene switch to finish before tearing down the mixer.
public Task StopAsync()Returns
StudioMode_GetPreview()
Gets the current preview scene in Studio Mode.
public Scene StudioMode_GetPreview()Returns
- Scene
-
The preview VisioForge.Core.SceneSwitching.Scene;
nullif none is set.
StudioMode_GetProgram()
Gets the current program scene in Studio Mode.
public Scene StudioMode_GetProgram()Returns
- Scene
-
The program VisioForge.Core.SceneSwitching.Scene;
nullif none is active.
StudioMode_PreviewAsync(Guid)
Sets a scene as the preview scene in Studio Mode.
public Task<bool> StudioMode_PreviewAsync(Guid sceneId)Parameters
sceneIdGuid-
The ID of the scene to preview.
Returns
StudioMode_TransitionAsync(TransitionDefinition)
Transitions the preview scene to the program output in Studio Mode.
public Task<bool> StudioMode_TransitionAsync(TransitionDefinition transition = null)Parameters
transitionTransitionDefinition-
The transition to use.
Returns
OnError
Occurs when an error happens during scene manager operation.
public event EventHandler<ErrorsEventArgs> OnErrorEvent Type
OnSceneSwitched
Occurs when a scene switch has completed.
public event EventHandler<SceneSwitchEventArgs> OnSceneSwitchedEvent Type
OnSceneSwitching
Occurs when a scene switch is about to begin.
public event EventHandler<SceneSwitchEventArgs> OnSceneSwitching