591 green, 0 warnings.
- `Scene.SceneMutesMic` / `SceneMutesDesktop` are **nullable booleans**: null = leave the mix alone, so
a scene is passive until the creator says otherwise. Schema columns added, NULL for every existing
layout except one deliberate default.
- **Applied once when the scene takes the PROGRAM output** (`TransitionToScene`, only when live or
recording). Staging a scene offline is auditioning, not a stream edit — the test asserts that.
- **The creator is boss:** a manual mute survives any transition into a scene with no opinion; a scene
that does have one wins on its next entry. `SetMicMuted`/`SetGameMuted` are idempotent so a repeated
"mute" cannot clobber the level that unmute would restore.
- **BRB ships muted** (creator spec) for new layouts *and* via a one-time migration for existing rows
where the creator has never expressed an opinion.
- UI: two three-state checkboxes under the layers list ("When this scene goes live"), styled with
`PropertyPillCheck` so the theme test holds.
`SceneAudioTests` covers the whole rule in one integration test: default state, offline staging does
nothing, live entry mutes, manual unmute survives a passive scene, an opinionated scene wins, desktop
untouched, and all three states roundtrip through save/reload.
Needs the creator's eye: the checkboxes are new chrome in the left panel (indeterminate = passive).
136 lines
4.2 KiB
C#
136 lines
4.2 KiB
C#
using System.Collections.ObjectModel;
|
|
using System.ComponentModel;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Windows.Media.Imaging;
|
|
|
|
namespace ytLive.Models;
|
|
|
|
public class Scene : INotifyPropertyChanged
|
|
{
|
|
public string Id { get; init; } = Guid.NewGuid().ToString();
|
|
|
|
private string _name = string.Empty;
|
|
private bool _isHidden;
|
|
private bool _hasBackground;
|
|
private bool _hasSocialBar;
|
|
private bool _isStaged;
|
|
private bool _isLive;
|
|
private string _hotkeyLabel = string.Empty;
|
|
|
|
public bool IsStaged
|
|
{
|
|
get => _isStaged;
|
|
set => Set(ref _isStaged, value);
|
|
}
|
|
|
|
public bool IsLive
|
|
{
|
|
get => _isLive;
|
|
set => Set(ref _isLive, value);
|
|
}
|
|
|
|
public string Name
|
|
{
|
|
get => _name;
|
|
set => Set(ref _name, value);
|
|
}
|
|
|
|
public bool IsHidden
|
|
{
|
|
get => _isHidden;
|
|
set => Set(ref _isHidden, value);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Whether the scene has a live desktop/game background layer. Enforced by
|
|
/// policy: only the canonical Live scene ever has one (see SceneCatalog).
|
|
/// </summary>
|
|
public bool HasBackground
|
|
{
|
|
get => _hasBackground;
|
|
set => Set(ref _hasBackground, value);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Whether the social bar plays on this scene. Toggled by the footer [+]/[-]
|
|
/// control — the socials themselves are a global resource (see SocialsConfig).
|
|
/// </summary>
|
|
public bool HasSocialBar
|
|
{
|
|
get => _hasSocialBar;
|
|
set => Set(ref _hasSocialBar, value);
|
|
}
|
|
|
|
/// <summary>
|
|
/// The scene's rendered elements in z-order (back to front): multi-instance
|
|
/// Sources plus this scene's webcam usage (<see cref="WebcamConfig"/>), if any.
|
|
/// </summary>
|
|
public ObservableCollection<SceneElement> Elements { get; } = new();
|
|
|
|
/// <summary>This scene's webcam usage, or null if the creator hasn't added the webcam here.</summary>
|
|
public WebcamSceneConfig? WebcamConfig => Elements.OfType<WebcamSceneConfig>().FirstOrDefault();
|
|
|
|
public bool IsChatScene { get; init; }
|
|
|
|
private bool? _sceneMutesMic;
|
|
|
|
/// <summary>TASK 35: what this scene does to the mix when it takes the program output.
|
|
/// <c>null</c> = leave it alone (the default; scenes are passive until told); true mutes the mic on
|
|
/// entry. Applied once at entry, never while staging offline — auditioning a scene must not edit
|
|
/// the stream's state.</summary>
|
|
public bool? SceneMutesMic
|
|
{
|
|
get => _sceneMutesMic;
|
|
set => Set(ref _sceneMutesMic, value);
|
|
}
|
|
|
|
private bool? _sceneMutesDesktop;
|
|
|
|
/// <summary>TASK 35: as <see cref="SceneMutesMic"/>, for desktop/game audio.</summary>
|
|
public bool? SceneMutesDesktop
|
|
{
|
|
get => _sceneMutesDesktop;
|
|
set => Set(ref _sceneMutesDesktop, value);
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Asset-table id of this scene's top-strip tile artwork. The tile is a
|
|
/// separate image from the scene's background: the preview pane keeps
|
|
/// rendering the scene's original background, the strip shows this instead.
|
|
/// Null = the strip falls back to the background art (creator ruling 2026-10-10).
|
|
/// </summary>
|
|
public string? ThumbnailAssetId { get; set; }
|
|
|
|
private BitmapSource? _snapshot;
|
|
|
|
/// <summary>
|
|
/// Cached thumbnail snapshot of this scene for the control surface strip.
|
|
/// Updated by the compositor when the scene is not live-previewed.
|
|
/// </summary>
|
|
public BitmapSource? Snapshot
|
|
{
|
|
get => _snapshot;
|
|
set => Set(ref _snapshot, value);
|
|
}
|
|
|
|
/// <summary>
|
|
/// The current hotkey label for this scene (e.g. "F1", "Ctrl+F10").
|
|
/// Set by MainViewModel from the active bindings; empty for non-canonical scenes.
|
|
/// </summary>
|
|
public string HotkeyLabel
|
|
{
|
|
get => _hotkeyLabel;
|
|
set => Set(ref _hotkeyLabel, value);
|
|
}
|
|
|
|
public event PropertyChangedEventHandler? PropertyChanged;
|
|
|
|
private void Set<T>(ref T field, T value, [CallerMemberName] string? propertyName = null)
|
|
{
|
|
if (EqualityComparer<T>.Default.Equals(field, value)) return;
|
|
field = value;
|
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
|
}
|
|
}
|