Table of Contents

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, IAsyncDisposable

Inheritance

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

settings SceneManagerSettings

The configuration settings.

Properties

Settings

Gets the configuration settings for this SceneManager instance.

public SceneManagerSettings Settings { get; }

Property Value

SceneManagerSettings

StudioMode_Enabled

Gets or sets a value indicating whether Studio Mode (Preview/Program) is enabled.

public bool StudioMode_Enabled { get; set; }

Property Value

bool

Methods

Dispose(bool)

Releases resources used by this SceneManager.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

true to 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

ValueTask

~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

output LVCVideoAudioOutput

The video/audio output to add.

start bool

If true, starts the output immediately.

Returns

Task<bool>

true if the output was added successfully.

Output_AddAsync(LVCVideoOutput, bool)

Adds a video-only output to the scene manager.

public Task<bool> Output_AddAsync(LVCVideoOutput output, bool start = false)

Parameters

output LVCVideoOutput

The video output to add.

start bool

If true, starts the output immediately.

Returns

Task<bool>

true if the output was added successfully.

Output_AddAsync(LVCAudioOutput, bool)

Adds an audio-only output to the scene manager.

public Task<bool> Output_AddAsync(LVCAudioOutput output, bool start = false)

Parameters

output LVCAudioOutput

The audio output to add.

start bool

If true, starts the output immediately.

Returns

Task<bool>

true if the output was added successfully.

Output_RemoveAsync(Guid)

Removes an output by its ID.

public Task<bool> Output_RemoveAsync(Guid id)

Parameters

id Guid

The output ID.

Returns

Task<bool>

true if the output was removed successfully.

Scene_Create(string)

Creates a new empty scene.

public Scene Scene_Create(string name)

Parameters

name string

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

id Guid

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

name string

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; null if 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

sceneId Guid

The ID of the scene to remove.

Returns

bool

true if 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

sceneId Guid

The ID of the scene to switch to.

transition TransitionDefinition

The transition to use. If null, the default transition is used.

Returns

Task<bool>

true if the switch was successful; otherwise, false.

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

sceneName string

The name of the scene to switch to.

transition TransitionDefinition

The transition to use. If null, the default transition is used.

Returns

Task<bool>

true if the switch was successful; otherwise, false.

Source_Get(Guid)

Gets a registered source by its ID.

public RegisteredSource Source_Get(Guid id)

Parameters

id Guid

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

name string

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

name string

A descriptive name for this source.

input LVCVideoInput

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

name string

A descriptive name for this source.

input LVCAudioInput

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

name string

A descriptive name for this source.

input LVCVideoAudioInput

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

sourceId Guid

The ID of the source to unregister.

Returns

Task<bool>

true if the source was found and removed; otherwise, false.

StartAsync()

Starts the scene manager and underlying compositor.

public Task<bool> StartAsync()

Returns

Task<bool>

true if startup was successful; otherwise, false.

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

Task

StudioMode_GetPreview()

Gets the current preview scene in Studio Mode.

public Scene StudioMode_GetPreview()

Returns

Scene

The preview VisioForge.Core.SceneSwitching.Scene; null if 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; null if none is active.

StudioMode_PreviewAsync(Guid)

Sets a scene as the preview scene in Studio Mode.

public Task<bool> StudioMode_PreviewAsync(Guid sceneId)

Parameters

sceneId Guid

The ID of the scene to preview.

Returns

Task<bool>

true if successful; otherwise, false.

StudioMode_TransitionAsync(TransitionDefinition)

Transitions the preview scene to the program output in Studio Mode.

public Task<bool> StudioMode_TransitionAsync(TransitionDefinition transition = null)

Parameters

transition TransitionDefinition

The transition to use.

Returns

Task<bool>

true if successful; otherwise, false.

OnError

Occurs when an error happens during scene manager operation.

public event EventHandler<ErrorsEventArgs> OnError

Event Type

EventHandler<ErrorsEventArgs>

OnSceneSwitched

Occurs when a scene switch has completed.

public event EventHandler<SceneSwitchEventArgs> OnSceneSwitched

Event Type

EventHandler<SceneSwitchEventArgs>

OnSceneSwitching

Occurs when a scene switch is about to begin.

public event EventHandler<SceneSwitchEventArgs> OnSceneSwitching

Event Type

EventHandler<SceneSwitchEventArgs>