Compare commits

...
10 Commits
Author SHA1 Message Date
gramps b00bf48b9d feat(alerts): sound byte under Built-in video, and alert audio that reaches the device
Creator request: a sound-byte browse + label under Built-in video, with an option to loop the
sound while the clip plays. The video itself is always one pass to completion.

- Source gains AlertAudioPath and AlertAudioLoop, persisted (column + migration + INSERT +
  SELECT + reader, the whole chain — that chain is where the blur crashed once).
- The sound byte plays through MediaPlayer on the default output device; MediaEnded re-seeks to
  zero while looping, and StopClip kills it so a tail cannot bleed into the next alert.
- The clip's OWN soundtrack moved off the mixer and onto the device as well
  (Services/Audio/AlertAudioOutput: one WaveOutEvent + buffered float provider).

Why the move: the creator asked that alert audio — the clip's track or the added sound byte —
appear in the desktop sound bar. Only audio that reaches the default device is picked up by the
WASAPI loopback that feeds both the meter and the stream. The old EnqueueAlertAudio route put the
sound in the stream but left the meter flat and the room silent.

Tests: the sound byte and its loop flag round-trip through SQLite, and a fresh alert layer starts
with no sound byte and no loop. Release 0 warnings.
2026-11-01 14:13:57 -08:00
gramps 46d12e5873 fix(alerts): Test alert actually plays — it was queuing into nothing
TestAlert called Enqueue, which is the pure test seam: it fills the queue and returns. The
alert layer needs three more things to show anything — its scene list, the playback ticker
running, and the preview refreshed — and all three live in OnMessageReceived, the same entry
the chat feed uses (MainViewModel.Chat.cs).

Now it calls OnMessageReceived(message, Scenes), so the clip advances on the ticker and writes
frames to the box's VideoImageSource, which is what the preview pane displays.
2026-11-01 14:07:14 -08:00
gramps 005b459fe0 feat(alerts): a Test alert button in the alert properties
Sits to the right of the Built-in video pill, labelled "Test alert". It enqueues one synthetic
Super Chat through the real AlertOverlayLayer, so what plays is exactly what a viewer triggers —
the custom clip when one is set, the built-in clip otherwise — and it goes through the same
output path (preview and encoder) as a live alert. Local only: nothing reaches YouTube and no
chat row is invented.
2026-11-01 14:04:20 -08:00
gramps 754377c5db ui(audio): every header label in the sound area uses one colour
MIC's device name was the only header label at full-strength OnSurface (it was brightened
because it shows a choice), and the lip-sync reading was Tertiary — three different values
across four bays in the same row. All four header labels are now Brush.OnSurfaceVariant, the
standard secondary-text token. No other colours touched.
2026-11-01 13:59:57 -08:00
gramps b75c2b3001 ui(audio): one row grid across the dock — ladders on a line, volume bars on a line
Every bay is now header / ladder / controls. Lip-sync has no ladder, so it holds an empty 20px
row (10px meter + the two margins) that keeps its slider exactly level with the other three,
and MIC's ladder gained the missing 4px bottom margin that had its slider sitting 4px high.

Presets stay under the slider in the narrow lip-sync bay.
2026-11-01 13:57:36 -08:00
gramps 2fedc7cb64 ui(audio): the lip-sync slider moves up one line — onto the header
Not under it: the offset slider now rides the header line beside the LIP-SYNC badge and the
reading, and the preset row is what stays below. The box is narrow, so a slider on its own line
was the only thing making it two-and-a-bit rows tall.
2026-11-01 13:56:53 -08:00
gramps 789272142d fix(build): the wordmark number counts commits again, not compiles
GenerateBuildStamp read BuildCounter.txt, added 1 and wrote it back on every CoreCompile, so
the number tracked BUILDS: a day of iteration reached #1122 against 563 commits. It now uses
git rev-list count of HEAD, which is what the comment always claimed (and why the file existed
in .gitignore). No counter file, no drift; a missing git still falls back to the start.

Also moves the MIC and lip-sync volume bars up one line: both were pinned to the floor of their
bay by a star row plus VerticalAlignment=Bottom. They now sit directly under their headers,
with the auto rows sized to content.
2026-11-01 13:56:17 -08:00
gramps 35c7809c28 fix(audio): bay ladders fill their bay again — the 320px cap was a mistake
Capping the three bay meters at 320px and left-aligning them made each ladder look cut off
mid-bay, which is what the creator saw as deleted bars. The caps are gone; the master ladder
keeps its own 420-900px range so it stays the longest without shortening anything else.
2026-11-01 13:52:31 -08:00
gramps 4c4f22e6bb ui(audio): the master ladder is always the longest one
The master meter was a fixed 420px, but each sound bay's ladder fills its column — on a wide
window a bay could be longer than the master, which is the opposite of what was asked.

Master now stretches between 420 and 760 px, and the three bay ladders cap at 320 with the same
cap for each, so they stay the same relative size to one another and stay shorter than the
master at every window width.
2026-11-01 13:49:05 -08:00
gramps f8e4f2cf29 ui(audio): master meter centred and biggest; TRAX gets its own bay and meter
Creator rulings, 2026-11-01.

- Master strip is 44px (from 36) and its meter is now the largest on screen: 420x14 with 32
  segments, centred under the preview, with a 12px MASTER label — bigger than the 9px bay
  labels. L/R imbalance is a flag on the left, MONO and the session clock on the right.
- The kbps / fps / dropped counters are gone from that line: the live readouts already sit
  above the preview, and the duplicate was noise rather than telemetry.
- TRAX is its own bay (MIC | GAME | TRAX | LIP-SYNC) with its own meter bound to
  TraxMeterFraction. It lived inside the game bay with no ladder, which meant whether the bed
  was actually playing could not be answered from the dock — and the player already measures
  its own output.
- Lip-sync is narrow (0.45 star) since it is one slider and three presets; the three sound bays
  are equal width, so their meters keep the same relative size.

AudioDockLayout moves with it (156 = 112 + 44; collapsed 44) and the layout test is updated.
TraxBayTests now asserts the opposite of the old ruling: the bay HAS a meter, and the game bay
no longer carries it.
2026-11-01 13:48:28 -08:00
21 changed files with 482 additions and 133 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ MARCOM.md
CREDENTIALS.md
.aider*
ffmpeg/
BuildCounter.txt
BuildCounter.txt # unused since 2026-11-01 (the build stamp is the git commit count)
# Steamworks runtime (steam_api64.dll, 312 KB) — extracted from the SDK zip, never committed;
# scripts/steam-sdk.sh documents which file and why. Same rule as ffmpeg/: the pin is the audit trail.
+1
View File
@@ -0,0 +1 @@
1122
+123 -98
View File
@@ -10,16 +10,19 @@
<Grid.RowDefinitions>
<!-- Master FIRST: during a live session attention is on the preview, so the
master strip sits against it and the bays hang below (creator, 2026-10-30). -->
<RowDefinition Height="36"/>
<RowDefinition Height="44"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Four bays: MIC | GAME | TRAX | SYNC. Filled in by the bay units. -->
<!-- Four bays (creator ruling 2026-11-01): MIC | GAME | TRAX | LIP-SYNC. The three
sound bays share equal width so their meters stay the same relative size; lip-sync
is narrow because its function is one slider and three presets. -->
<Grid x:Name="Bays" Grid.Row="1" Margin="8,4,8,6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="1.4*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="0.45*"/>
</Grid.ColumnDefinitions>
<!-- MIC -->
@@ -28,7 +31,7 @@
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0" Cursor="Hand" ToolTip="Change microphone" MouseLeftButtonUp="MicLabel_MouseLeftButtonUp">
<Grid.ColumnDefinitions>
@@ -40,11 +43,11 @@
</Border>
<TextBlock Grid.Column="1" Margin="6,0,0,0" FontSize="11" VerticalAlignment="Center"
TextTrimming="CharacterEllipsis" Text="{Binding MicSourceName, TargetNullValue='No microphone'}"
Foreground="{StaticResource Brush.OnSurface}"/>
Foreground="{StaticResource Brush.OnSurfaceVariant}"/>
</Grid>
<controls:SegmentMeter Grid.Row="1" Height="10" Margin="0,6,0,0" Orientation="Horizontal"
<controls:SegmentMeter Grid.Row="1" Height="10" Margin="0,6,0,4" Orientation="Horizontal"
Level="{Binding MicMeterFraction}" Segments="24"/>
<DockPanel Grid.Row="2" Margin="0,6,0,0" VerticalAlignment="Bottom">
<DockPanel Grid.Row="2" Margin="0,6,0,0">
<Button DockPanel.Dock="Left" Width="24" Height="20" Margin="0,0,6,0"
Style="{StaticResource YtButtonSecondary}" Padding="0"
Command="{Binding ToggleMicMuteCommand}" ToolTip="{Binding MicMuteText}">
@@ -66,7 +69,6 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
@@ -106,64 +108,82 @@
Value="{Binding GameVolumeDb, Mode=TwoWay}" VerticalAlignment="Center"/>
</DockPanel>
<!-- TRAX: background music — one number, two buttons. No meter: it is
background, and the desktop ladder already carries it. -->
<Border Grid.Row="3" Margin="0,4,0,0" Padding="6,3" CornerRadius="{StaticResource Radius.Sm}"
Background="{StaticResource Brush.SurfaceContainerLowest}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="TRAX" FontSize="9" FontWeight="Bold" VerticalAlignment="Center"
Foreground="{StaticResource Brush.OnSurfaceVariant}"/>
<TextBlock Grid.Column="1" Margin="6,0,0,0" FontSize="10" VerticalAlignment="Center"
TextTrimming="CharacterEllipsis" Foreground="{StaticResource Brush.OnSurface}"
Text="{Binding TraxTrackLabel}" Cursor="Hand"
MouseLeftButtonUp="TraxLabel_MouseLeftButtonUp"
MouseRightButtonUp="TraxLabel_MouseRightButtonUp"/>
<Button Grid.Column="2" Width="20" Height="16" Margin="4,0,0,0" Padding="0"
Style="{StaticResource YtButtonSecondary}" Click="TraxPlayPause_Click"
ToolTip="{Binding TraxToolTip}">
<TextBlock FontSize="9" Foreground="{StaticResource Brush.OnSurface}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Text" Value="▶"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsMusicPlaying}" Value="True">
<Setter Property="Text" Value="❚❚"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Button>
<StackPanel Grid.Column="3" Orientation="Horizontal" Margin="6,0,0,0" VerticalAlignment="Center">
<Button Content="−" Width="18" Height="16" Padding="0" FontSize="11"
Style="{StaticResource YtButtonSecondary}" Click="TraxStepDown_Click"
IsEnabled="{Binding CanLowerTrax}" ToolTip="5 dB quieter"/>
<TextBlock Width="52" TextAlignment="Center" FontSize="10" VerticalAlignment="Center"
FontFamily="{StaticResource FontFamily.Mono}"
Foreground="{StaticResource Brush.Tertiary}"
Text="{Binding TraxVolumeDbLabel}"/>
<Button Content="+" Width="18" Height="16" Padding="0" FontSize="11"
Style="{StaticResource YtButtonSecondary}" Click="TraxStepUp_Click"
IsEnabled="{Binding CanRaiseTrax}" ToolTip="5 dB louder"/>
</StackPanel>
</Grid>
</Border>
</Grid>
</Border>
<!-- LIP-SYNC -->
<Border Grid.Column="2" Background="{StaticResource Brush.SurfaceContainerLow}" CornerRadius="{StaticResource Radius.Sm}" Margin="4,0,0,0" Padding="10,6">
<!-- TRAX: its own bay and its own meter now (creator ruling 2026-11-01). It used to
be a strip inside the game bay because the desktop ladder "already carried it";
that hid whether the music was actually playing. -->
<Border Grid.Column="2" Background="{StaticResource Brush.SurfaceContainerLow}" CornerRadius="{StaticResource Radius.Sm}" Margin="4,0" Padding="10,6">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border Background="{StaticResource Brush.SurfaceContainerHighest}" CornerRadius="{StaticResource Radius.Sm}" Padding="5,1">
<TextBlock Text="TRAX" FontSize="9" FontWeight="Bold" Foreground="{StaticResource Brush.OnSurfaceVariant}"/>
</Border>
<TextBlock Grid.Column="1" Margin="6,0,0,0" FontSize="11" VerticalAlignment="Center"
TextTrimming="CharacterEllipsis" Foreground="{StaticResource Brush.OnSurfaceVariant}"
Text="{Binding TraxTrackLabel}" Cursor="Hand"
MouseLeftButtonUp="TraxLabel_MouseLeftButtonUp"
MouseRightButtonUp="TraxLabel_MouseRightButtonUp"/>
</Grid>
<controls:SegmentMeter Grid.Row="1" Height="10" Margin="0,6,0,4" Orientation="Horizontal"
Level="{Binding TraxMeterFraction}" Segments="24"/>
<DockPanel Grid.Row="2" VerticalAlignment="Center">
<Button DockPanel.Dock="Left" Width="24" Height="20" Margin="0,0,6,0" Padding="0"
Style="{StaticResource YtButtonSecondary}" Click="TraxPlayPause_Click"
ToolTip="{Binding TraxToolTip}">
<TextBlock FontSize="9" Foreground="{StaticResource Brush.OnSurface}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Text" Value="▶"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsMusicPlaying}" Value="True">
<Setter Property="Text" Value="❚❚"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Button>
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal" VerticalAlignment="Center">
<Button Content="−" Width="18" Height="16" Padding="0" FontSize="11"
Style="{StaticResource YtButtonSecondary}" Click="TraxStepDown_Click"
IsEnabled="{Binding CanLowerTrax}" ToolTip="5 dB quieter"/>
<TextBlock Width="52" TextAlignment="Center" FontSize="10" VerticalAlignment="Center"
FontFamily="{StaticResource FontFamily.Mono}"
Foreground="{StaticResource Brush.OnSurfaceVariant}"
Text="{Binding TraxVolumeDbLabel}"/>
<Button Content="+" Width="18" Height="16" Padding="0" FontSize="11"
Style="{StaticResource YtButtonSecondary}" Click="TraxStepUp_Click"
IsEnabled="{Binding CanRaiseTrax}" ToolTip="5 dB louder"/>
</StackPanel>
</DockPanel>
</Grid>
</Border>
<!-- LIP-SYNC (narrow: one slider, three presets) -->
<Border Grid.Column="3" Background="{StaticResource Brush.SurfaceContainerLow}" CornerRadius="{StaticResource Radius.Sm}" Margin="4,0,0,0" Padding="10,6">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- Row alignment across the dock (creator ruling 2026-11-01): every bay is
header / meter / controls, so the ladders sit on one horizontal line and the
volume bars on another. Lip-sync has no ladder, so it holds an empty row the
height of one (10px meter + 6/4 margins = 20) to keep its slider level with
the other three. -->
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
@@ -174,9 +194,10 @@
</Border>
<TextBlock Grid.Column="1" Margin="6,0,0,0" FontSize="10" VerticalAlignment="Center"
FontFamily="{StaticResource FontFamily.Mono}" TextAlignment="Right"
Foreground="{StaticResource Brush.Tertiary}" Text="{Binding SyncOffsetLabel}"/>
Foreground="{StaticResource Brush.OnSurfaceVariant}" Text="{Binding SyncOffsetLabel}"/>
</Grid>
<StackPanel Grid.Row="1" VerticalAlignment="Bottom">
<Border Grid.Row="1" Height="20"/>
<StackPanel Grid.Row="2">
<Slider Minimum="-200" Maximum="200" SmallChange="5" LargeChange="25"
TickFrequency="5" IsSnapToTickEnabled="True"
Value="{Binding AudioSyncOffsetMs, Mode=TwoWay}" VerticalAlignment="Center"/>
@@ -193,23 +214,20 @@
</Border>
</Grid>
<!-- Master strip: always visible, even collapsed — it is the telemetry line. -->
<!-- Master strip: always visible, even collapsed. Rebuilt 2026-11-01 — the meter is
CENTRED under the preview and is the biggest one on screen; MASTER's own label is
larger than the bay labels. The kbps / fps / dropped counters that used to end this
line are gone: the live readouts already sit above the preview. -->
<Border x:Name="MasterStrip" Grid.Row="0" Background="{StaticResource Brush.SurfaceContainerLowest}" Padding="12,0">
<DockPanel VerticalAlignment="Center">
<TextBlock DockPanel.Dock="Left" Text="MASTER" FontSize="10" FontWeight="SemiBold"
Foreground="{StaticResource Brush.OnSurfaceVariant}" VerticalAlignment="Center"/>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<!-- One ladder for the mix, plus the imbalance flag: two ladders would cost the
width that the telemetry needs, and the flag is the case that matters. -->
<controls:SegmentMeter DockPanel.Dock="Left" Width="120" Height="8" Margin="10,0,0,0"
Orientation="Horizontal" Segments="24"
Level="{Binding MasterMeterFraction}" VerticalAlignment="Center"/>
<TextBlock DockPanel.Dock="Left" Width="62" Margin="6,0,0,0" FontSize="10"
FontFamily="{StaticResource FontFamily.Mono}" VerticalAlignment="Center"
Foreground="{StaticResource Brush.OnSurfaceVariant}"
Text="{Binding MasterLevelLabel}"/>
<Border DockPanel.Dock="Left" Margin="6,0,0,0" Padding="5,1" VerticalAlignment="Center"
<!-- Left: the imbalance flag, the one case that silently ruins a mix. -->
<Border Grid.Column="0" Margin="0,0,8,0" Padding="5,1" VerticalAlignment="Center"
CornerRadius="{StaticResource Radius.Sm}" Background="{StaticResource Brush.SurfaceContainerHigh}"
Visibility="{Binding MasterImbalance, Converter={StaticResource BoolToVis}}"
ToolTip="Left and right differ by more than 6 dB — one side may be inaudible.">
@@ -217,32 +235,39 @@
Foreground="{StaticResource Brush.Attention}"/>
</Border>
<!-- MONO: the accessibility switch, one click, remembered. -->
<ToggleButton DockPanel.Dock="Left" Margin="10,0,0,0" Height="20" Padding="8,0"
Style="{StaticResource SegmentToggle}" IsChecked="{Binding MonoOutput, Mode=TwoWay}"
ToolTip="Fold the output to mono — both ears hear everything">
<TextBlock Text="MONO" FontSize="10" FontWeight="Bold"
Foreground="{Binding Foreground, RelativeSource={RelativeSource AncestorType=ToggleButton}}"/>
</ToggleButton>
<!-- Centre: MASTER + the long meter + its reading. The ladder stretches with the
window between 420 and 760 px — always longer than the 320-capped bay meters. -->
<Grid Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="MASTER" FontSize="12" FontWeight="Bold" VerticalAlignment="Center"
Foreground="{StaticResource Brush.OnSurface}"/>
<controls:SegmentMeter Grid.Column="1" Height="14" Margin="12,0,0,0" MinWidth="420" MaxWidth="900"
Orientation="Horizontal" Segments="32"
Level="{Binding MasterMeterFraction}" VerticalAlignment="Center"/>
<TextBlock Grid.Column="2" Width="72" Margin="10,0,0,0" FontSize="12"
FontFamily="{StaticResource FontFamily.Mono}" VerticalAlignment="Center"
Foreground="{StaticResource Brush.OnSurface}"
Text="{Binding MasterLevelLabel}"/>
</Grid>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center">
<TextBlock FontSize="10" FontFamily="{StaticResource FontFamily.Mono}" Margin="0,0,12,0"
Foreground="{StaticResource Brush.OnSurfaceVariant}">
<Run Text="{Binding CurrentHealth.CurrentBitrate, StringFormat={}{0:0} kbps}"/>
</TextBlock>
<TextBlock FontSize="10" FontFamily="{StaticResource FontFamily.Mono}" Margin="0,0,12,0"
Foreground="{StaticResource Brush.OnSurfaceVariant}">
<Run Text="{Binding CurrentHealth.FPS, StringFormat={}{0:0} fps}"/>
</TextBlock>
<TextBlock FontSize="10" FontFamily="{StaticResource FontFamily.Mono}" Margin="0,0,12,0"
Foreground="{StaticResource Brush.OnSurfaceVariant}">
<Run Text="drop "/><Run Text="{Binding CurrentHealth.DroppedFrames}"/>
</TextBlock>
<TextBlock FontSize="10" FontFamily="{StaticResource FontFamily.Mono}"
<!-- Right: MONO (accessibility, remembered) + the session clock. -->
<StackPanel Grid.Column="2" Orientation="Horizontal" VerticalAlignment="Center">
<ToggleButton Height="20" Padding="8,0"
Style="{StaticResource SegmentToggle}" IsChecked="{Binding MonoOutput, Mode=TwoWay}"
ToolTip="Fold the output to mono — both ears hear everything">
<TextBlock Text="MONO" FontSize="10" FontWeight="Bold"
Foreground="{Binding Foreground, RelativeSource={RelativeSource AncestorType=ToggleButton}}"/>
</ToggleButton>
<TextBlock FontSize="11" FontFamily="{StaticResource FontFamily.Mono}" Margin="12,0,0,0"
VerticalAlignment="Center"
Foreground="{StaticResource Brush.OnSurfaceVariant}"
Text="{Binding CurrentHealth.StreamDuration, StringFormat={}{0:hh\:mm\:ss}}"/>
</StackPanel>
</DockPanel>
</Grid>
</Border>
</Grid>
</Border>
+28
View File
@@ -767,12 +767,40 @@
Foreground="#888" FontSize="10" TextWrapping="Wrap" Margin="0,0,0,6"/>
<DockPanel Margin="0,0,0,4">
<!-- Test alert (creator ruling 2026-11-01): plays the clip this box
would play — custom if one is set, built-in otherwise. -->
<Button DockPanel.Dock="Right" Content="▶ Test alert"
Command="{Binding TestAlertCommand}"
Style="{StaticResource YtButtonSecondary}"
Padding="8,2" FontSize="11" VerticalAlignment="Center"
ToolTip="Play the alert here, exactly as a viewer would trigger it"/>
<TextBlock DockPanel.Dock="Left" Text="Built-in video" Foreground="{StaticResource Brush.OnSurfaceVariant}" FontSize="11" VerticalAlignment="Center" Width="84"/>
<ToggleButton Style="{StaticResource PillToggle}"
IsChecked="{Binding SelectedElement.AlertUseDefaultVideo, Mode=TwoWay}"
HorizontalAlignment="Left"/>
</DockPanel>
<!-- Sound byte (creator ruling 2026-11-01): plays WITH the alert clip, on
the default device, so it is audible and shows in the desktop meter.
The video itself always plays once to completion. -->
<TextBlock Text="Sound byte" Foreground="{StaticResource Brush.OnSurfaceVariant}" FontSize="11"
FontWeight="SemiBold" Margin="0,6,0,2"/>
<DockPanel Margin="0,0,0,2">
<Button DockPanel.Dock="Right" Content="Browse…" Command="{Binding BrowseAlertAudioCommand}"
CommandParameter="{Binding SelectedElement}" Style="{StaticResource YtButtonSecondary}"
Padding="8,2" Margin="6,0,0,0" FontSize="11"/>
<Button DockPanel.Dock="Right" Content="✕" Command="{Binding ClearAlertAudioCommand}"
CommandParameter="{Binding SelectedElement}" Style="{StaticResource YtButtonSecondary}"
Padding="7,2" FontSize="11" ToolTip="Remove the sound byte"
Visibility="{Binding SelectedElement.HasAlertAudio, Converter={StaticResource BoolToVis}}"/>
<TextBox Text="{Binding SelectedElement.AlertAudioFileDisplay, Mode=OneWay}"
Style="{StaticResource YtTextBoxCompact}" IsReadOnly="True"
Foreground="{StaticResource Brush.OnSurfaceVariant}" VerticalAlignment="Center"/>
</DockPanel>
<CheckBox Content="Loop the sound until the video ends" Style="{StaticResource YtCheckBox}" Margin="0,2,0,6"
IsChecked="{Binding SelectedElement.AlertAudioLoop, Mode=TwoWay}"
IsEnabled="{Binding SelectedElement.HasAlertAudio}"/>
<Grid Margin="0,0,0,4"
Visibility="{Binding SelectedElement.AlertUseDefaultVideo, Converter={StaticResource InverseBoolToVis}}">
<Grid.ColumnDefinitions>
+5 -2
View File
@@ -6,6 +6,9 @@ namespace ytLive.Models;
/// telemetry strip when the window is short, because at 1366×768 a full dock leaves ~398px for the
/// preview and the composition starts letterboxing into a postage stamp.</para>
///
/// <para>2026-11-01: the master strip grew from 36 to 44 so its meter could be the biggest one on
/// screen (centred under the preview), so both constants moved with it — 156 = 112 bays + 44.</para>
///
/// <para>Pure, so the switch is testable without a window.</para></summary>
public static class AudioDockLayout
{
@@ -15,8 +18,8 @@ public static class AudioDockLayout
/// <summary>148 = 112 of bays + the 36px master strip. The mockup wanted 168; the creator
/// read that as wasted space under a 154px scene strip, so the bays lost 20px of air.</summary>
public const double ExpandedHeight = 148;
public const double CollapsedHeight = 36;
public const double ExpandedHeight = 156;
public const double CollapsedHeight = 44;
public static bool IsCollapsed(double windowHeight) => windowHeight < CollapseBelowHeight;
+22
View File
@@ -273,6 +273,28 @@ public class Source : SceneElement
set => Set(ref _alertVideoVolume, Math.Clamp(value, 0.0, 1.0));
}
// Sound byte that plays with the alert clip (creator ruling 2026-11-01). Referenced from disk
// like the clip; the video always plays once to completion, the sound may loop under it.
private string? _alertAudioPath;
public string? AlertAudioPath
{
get => _alertAudioPath;
set => Set(ref _alertAudioPath, value);
}
private bool _alertAudioLoop;
public bool AlertAudioLoop
{
get => _alertAudioLoop;
set => Set(ref _alertAudioLoop, value);
}
public string AlertAudioFileDisplay =>
string.IsNullOrWhiteSpace(_alertAudioPath) ? "No sound byte" : System.IO.Path.GetFileName(_alertAudioPath);
/// <summary>True once a file is chosen — gates the loop switch and the clear button.</summary>
public bool HasAlertAudio => !string.IsNullOrWhiteSpace(_alertAudioPath);
private AlertDisplayMethod _alertDisplayMethod = AlertDisplayMethod.TickerScroll;
public AlertDisplayMethod AlertDisplayMethod
{
+39 -1
View File
@@ -317,6 +317,40 @@ public sealed class AlertOverlayLayer : IDisposable
return Math.Clamp(_elapsed / FadeDurationSeconds, 0.0, 1.0);
}
// Sound byte (creator ruling 2026-11-01): a file the creator picks to play WITH the clip. It
// goes to the default device, not into the mixer, so it is audible and visible in the desktop
// sound bar. MediaPlayer handles the decode; the clip itself still stops playback.
private System.Windows.Media.MediaPlayer? _soundByte;
private void StartSoundByte(Source box)
{
StopSoundByte();
var path = box.AlertAudioPath;
if (string.IsNullOrWhiteSpace(path)) return;
try
{
var player = new System.Windows.Media.MediaPlayer { Volume = Math.Clamp(box.AlertVideoVolume, 0, 1) };
if (box.AlertAudioLoop) player.MediaEnded += (_, _) => { player.Position = TimeSpan.Zero; player.Play(); };
player.Open(new Uri(path, UriKind.Absolute));
player.Play();
_soundByte = player;
AppLog.Write($"Alert sound byte: '{path}' loop={box.AlertAudioLoop}");
}
catch (Exception ex)
{
AppLog.Write(ex, "Alert sound byte failed");
StopSoundByte();
}
}
private void StopSoundByte()
{
var player = _soundByte;
_soundByte = null;
if (player == null) return;
try { player.Stop(); player.Close(); } catch { /* already closed */ }
}
private void BeginClip()
{
StopClip();
@@ -332,7 +366,9 @@ public sealed class AlertOverlayLayer : IDisposable
_tickerMethod = box.AlertDisplayMethod;
}
if (box == null || _clipDecoderFactory == null) return;
if (box == null) return;
StartSoundByte(box);
if (_clipDecoderFactory == null) return;
var path = _clipPathResolver?.Invoke(box);
if (string.IsNullOrWhiteSpace(path)) return;
@@ -358,6 +394,7 @@ public sealed class AlertOverlayLayer : IDisposable
private void StopClip()
{
StopSoundByte();
var clip = _clip;
_clip = null;
_latestClipFrame = null;
@@ -533,6 +570,7 @@ public sealed class AlertOverlayLayer : IDisposable
public void Dispose()
{
StopSoundByte();
_ticker?.Stop();
_queue.Clear();
_current = null;
+83
View File
@@ -0,0 +1,83 @@
using System;
using NAudio.Wave;
using ytLive.Helpers;
namespace ytLive.Services.Audio;
/// <summary>
/// Plays alert audio on the **default output device**, which is what makes it visible in the
/// desktop sound bar (creator ruling 2026-11-01): the app mixes for the encoder, but only audio
/// that actually reaches the speakers is picked up by the WASAPI loopback that feeds both the
/// meter and the stream. Injecting straight into the mixer, as this used to do, produced sound
/// nobody could see and nobody could hear.
///
/// <para>One long-lived <see cref="WaveOutEvent"/> with a buffered float provider: the alert clip
/// submits PCM as it decodes, and a sound byte can be submitted through the same device, so they
/// mix with each other and with everything else on the machine.</para>
/// </summary>
public sealed class AlertAudioOutput : IDisposable
{
private readonly object _gate = new();
private WaveOutEvent? _device;
private BufferedWaveProvider? _buffer;
private int _sampleRate;
private int _channels;
/// <summary>Queue one decoded pulse of the alert clip. Never blocks the decoder: if the device
/// cannot keep up the buffer simply grows, and it is cleared when the alert ends.</summary>
public void Submit(AudioSample sample)
{
if (sample.Samples.Length == 0) return;
lock (_gate)
{
try
{
EnsureDevice(sample.SampleRate, sample.Channels);
if (_buffer == null) return;
var bytes = new byte[sample.Samples.Length * sizeof(float)];
Buffer.BlockCopy(sample.Samples, 0, bytes, 0, bytes.Length);
_buffer.AddSamples(bytes, 0, bytes.Length);
}
catch (Exception ex)
{
// No output device (a headless stream box, a locked-down session): the alert still
// renders, it is simply silent. Never let audio take the alert down.
AppLog.Write(ex, "Alert audio output failed");
Stop();
}
}
}
/// <summary>Stop and flush — called when the clip ends so a queued tail cannot bleed into the
/// next alert.</summary>
public void Stop()
{
lock (_gate)
{
try { _device?.Stop(); } catch { /* already stopped */ }
_buffer?.ClearBuffer();
_device?.Dispose();
_device = null;
_buffer = null;
}
}
private void EnsureDevice(int sampleRate, int channels)
{
if (_device != null && _sampleRate == sampleRate && _channels == channels) return;
_device?.Dispose();
_sampleRate = sampleRate;
_channels = channels;
_buffer = new BufferedWaveProvider(new WaveFormat(sampleRate, 32, channels))
{
BufferDuration = TimeSpan.FromSeconds(2),
DiscardOnBufferOverflow = true,
};
_device = new WaveOutEvent { DesiredLatency = 120 };
_device.Init(_buffer);
_device.Play();
}
public void Dispose() => Stop();
}
+3 -1
View File
@@ -111,7 +111,7 @@ public partial class LayoutStore : IDisposable
ChatShowTimestamps, ChatShowBadges, ChatMemberColor, ChatSuperChatColor,
WebUri, MediaPath, MediaIsLooping, MediaVolume, MediaPlaybackState,
AlertVideoAssetId, AlertVideoPath, AlertUseDefaultVideo, AlertShowTicker, AlertVideoVolume, SortOrder,
AlertDisplayMethod, IsBrandLogo, BlurAmount
AlertDisplayMethod, IsBrandLogo, BlurAmount, AlertAudioPath, AlertAudioLoop
FROM Source ORDER BY SortOrder
""";
using var reader = cmd.ExecuteReader();
@@ -165,6 +165,8 @@ public partial class LayoutStore : IDisposable
AlertDisplayMethod = reader.IsDBNull(36) ? AlertDisplayMethod.TickerScroll : (AlertDisplayMethod)reader.GetInt32(36),
IsBrandLogo = reader.GetInt32(reader.GetOrdinal("IsBrandLogo")) != 0,
BlurAmount = reader.IsDBNull(reader.GetOrdinal("BlurAmount")) ? 0.5 : reader.GetDouble(reader.GetOrdinal("BlurAmount")),
AlertAudioPath = reader.IsDBNull(reader.GetOrdinal("AlertAudioPath")) ? null : reader.GetString(reader.GetOrdinal("AlertAudioPath")),
AlertAudioLoop = reader.GetInt32(reader.GetOrdinal("AlertAudioLoop")) != 0,
};
if (!sourcesByScene.TryGetValue(sceneId, out var list))
sourcesByScene[sceneId] = list = new List<(Source, int)>();
+14
View File
@@ -206,6 +206,20 @@ public partial class LayoutStore : IDisposable
blur.ExecuteNonQuery();
}
if (!columns.Contains("AlertAudioPath"))
{
using var audio = _connection.CreateCommand();
audio.CommandText = "ALTER TABLE Source ADD COLUMN AlertAudioPath TEXT NULL;";
audio.ExecuteNonQuery();
}
if (!columns.Contains("AlertAudioLoop"))
{
using var loop = _connection.CreateCommand();
loop.CommandText = "ALTER TABLE Source ADD COLUMN AlertAudioLoop INTEGER NOT NULL DEFAULT 0;";
loop.ExecuteNonQuery();
}
if (!columns.Contains("IsBrandLogo"))
{
using var cmd = _connection.CreateCommand();
+6 -2
View File
@@ -92,7 +92,7 @@ public partial class LayoutStore : IDisposable
ChatShowTimestamps, ChatShowBadges, ChatMemberColor, ChatSuperChatColor,
WebUri, MediaPath, MediaIsLooping, MediaVolume, MediaPlaybackState,
AlertVideoAssetId, AlertVideoPath, AlertUseDefaultVideo, AlertShowTicker, AlertVideoVolume,
AlertDisplayMethod, IsBrandLogo, BlurAmount)
AlertDisplayMethod, IsBrandLogo, BlurAmount, AlertAudioPath, AlertAudioLoop)
VALUES ($id, $sceneId, $assetId, $type, $name, $isEnabled,
$x, $y, $w, $h, $opacity, $monitor,
$clip, $mirrored, $isBackground, $captureKey, $showDesktop, $sort,
@@ -100,7 +100,7 @@ public partial class LayoutStore : IDisposable
$chatTimestamps, $chatBadges, $chatMemberColor, $chatSuperChatColor,
$webUri, $mediaPath, $mediaIsLooping, $mediaVolume, $mediaPlaybackState,
$alertVideoAssetId, $alertVideoPath, $alertUseDefaultVideo, $alertShowTicker, $alertVideoVolume,
$alertDisplayMethod, $isBrandLogo, $blurAmount)
$alertDisplayMethod, $isBrandLogo, $blurAmount, $alertAudioPath, $alertAudioLoop)
""";
cmd.Transaction = tx;
var idP = cmd.Parameters.Add("$id", SqliteType.Text);
@@ -142,6 +142,8 @@ public partial class LayoutStore : IDisposable
var alertDisplayMethodP = cmd.Parameters.Add("$alertDisplayMethod", SqliteType.Integer);
var isBrandLogoP = cmd.Parameters.Add("$isBrandLogo", SqliteType.Integer);
cmd.Parameters.Add("$blurAmount", SqliteType.Real);
var alertAudioPathP = cmd.Parameters.Add("$alertAudioPath", SqliteType.Text);
var alertAudioLoopP = cmd.Parameters.Add("$alertAudioLoop", SqliteType.Integer);
// Source and WebcamSceneConfig share ONE z-order space per scene:
// each element gets its index within scene.Elements regardless of
@@ -192,6 +194,8 @@ public partial class LayoutStore : IDisposable
alertDisplayMethodP.Value = (int)source.AlertDisplayMethod;
isBrandLogoP.Value = source.IsBrandLogo ? 1 : 0;
cmd.Parameters["$blurAmount"].Value = source.BlurAmount;
alertAudioPathP.Value = (object?)source.AlertAudioPath ?? DBNull.Value;
alertAudioLoopP.Value = source.AlertAudioLoop ? 1 : 0;
cmd.ExecuteNonQuery();
}
}
+19
View File
@@ -187,6 +187,25 @@ public partial class MainViewModel : ViewModelBase
box.AlertUseDefaultVideo = false;
}
private void BrowseAlertAudio(Source? box)
{
if (box == null || box.Type != SourceType.AlertBox) return;
var dialog = new OpenFileDialog
{
Title = "Choose the alert sound byte",
Filter = "Audio files (*.mp3;*.wav;*.m4a;*.aac;*.ogg)|*.mp3;*.wav;*.m4a;*.aac;*.ogg|All files (*.*)|*.*"
};
if (dialog.ShowDialog() != true) return;
box.AlertAudioPath = dialog.FileName;
}
private void ClearAlertAudio(Source? box)
{
if (box == null || box.Type != SourceType.AlertBox) return;
box.AlertAudioPath = null;
box.AlertAudioLoop = false;
}
private void ResetAlertVideo(Source? box)
{
if (box == null || box.Type != SourceType.AlertBox) return;
+27
View File
@@ -119,6 +119,33 @@ public partial class MainViewModel : ViewModelBase
set => SetProperty(ref _featureRequestEmail, value);
}
/// <summary>
/// Properties-panel "Test alert" (creator ruling 2026-11-01): fire one synthetic Super Chat
/// through the REAL alert layer, so what plays is exactly what a viewer would trigger — the
/// custom clip if one is set, the built-in clip otherwise. Local only; nothing is sent to
/// YouTube and no chat row is invented.
/// </summary>
public RelayCommand TestAlertCommand { get; private set; } = null!;
private void TestAlert()
{
// ⛔ OnMessageReceived, not Enqueue: Enqueue only fills the queue. The layer needs its scene
// list, its playback ticker started and its previews refreshed — that is what the chat path
// does (MainViewModel.Chat.cs), and it is why a bare Enqueue played nothing in the pane.
_alertLayer.OnMessageReceived(new Models.ChatMessage
{
AuthorName = "Test viewer",
Message = "Test alert — this is what a Super Chat looks like.",
Timestamp = System.DateTime.Now,
IsSimulated = true,
IsSuperChat = true,
SuperChatAmount = 5.00,
SuperChatCurrency = "$",
SuperChatDisplayString = "$5.00",
Kind = Models.ChatEventKind.SuperChat,
}, Scenes);
}
public ICommand OpenSettingsCommand { get; }
public ICommand OpenBugCommand { get; }
public ICommand OpenFeatureCommand { get; }
+11 -1
View File
@@ -47,6 +47,10 @@ public partial class MainViewModel : ViewModelBase
// born yet (startup crash regression from TASK 31, 2026-09-01; headless RealApp
// tests never ran it, so it waited for the first native launch).
private SceneGraph _sceneGraph = new();
/// <summary>Alert audio plays on the default device (creator ruling 2026-11-01): the WASAPI
/// loopback then picks it up, so it is audible AND visible in the desktop sound bar.</summary>
private readonly Services.Audio.AlertAudioOutput _alertAudioOutput = new();
private readonly TransitionService _transition = new();
private WebView2Manager? _webView2Manager;
@@ -149,6 +153,9 @@ public partial class MainViewModel : ViewModelBase
public ICommand EditElementCommand { get; }
public ICommand ToggleElementVisibilityCommand { get; }
public ICommand BrowseAlertVideoCommand { get; }
/// <summary>Sound byte that plays with the alert clip (creator ruling 2026-11-01).</summary>
public ICommand BrowseAlertAudioCommand { get; }
public ICommand ClearAlertAudioCommand { get; }
public ICommand ResetAlertVideoCommand { get; }
public ICommand ActivateLicenseCommand { get; }
public ICommand OpenLicenseEntryCommand { get; }
@@ -213,6 +220,8 @@ public partial class MainViewModel : ViewModelBase
EditElementCommand = new RelayCommand(element => BeginEditElement(element as SceneElement));
ToggleElementVisibilityCommand = new RelayCommand(element => { PushPreviewUndo(); ToggleElementVisibility(element as SceneElement); });
BrowseAlertVideoCommand = new RelayCommand(element => BrowseAlertVideo(element as Source), element => element is Source { Type: SourceType.AlertBox });
BrowseAlertAudioCommand = new RelayCommand(element => BrowseAlertAudio(element as Source), element => element is Source { Type: SourceType.AlertBox });
ClearAlertAudioCommand = new RelayCommand(element => ClearAlertAudio(element as Source), element => element is Source { Type: SourceType.AlertBox });
ResetAlertVideoCommand = new RelayCommand(element => ResetAlertVideo(element as Source), element => element is Source { Type: SourceType.AlertBox });
ChangeWebcamCommand = new RelayCommand(_ => _ = ChangeWebcamAsync(), _ => CanChangeWebcam);
ShowWebcamCommand = new RelayCommand(_ => ShowWebcamInStagedScene(), _ => CanShowWebcamInStagedScene);
@@ -235,6 +244,7 @@ public partial class MainViewModel : ViewModelBase
OpenMicPickerCommand = new RelayCommand(_ => PickMicrophone());
OpenSettingsCommand = new RelayCommand(_ => ToggleSettingsDrawer());
InitPreviewHistory();
TestAlertCommand = new RelayCommand(_ => TestAlert());
OpenBugCommand = new RelayCommand(_ => ShowOverlay(nameof(IsBugOpen), "Report Bug"));
OpenFeatureCommand = new RelayCommand(_ => ShowOverlay(nameof(IsFeatureOpen), "Feature Request"));
OpenAboutCommand = new RelayCommand(_ => ShowOverlay(nameof(IsAboutOpen), "About"));
@@ -356,7 +366,7 @@ public partial class MainViewModel : ViewModelBase
new AlertRenderer(),
clipDecoderFactory: AlertClipDecoderFor,
clipPathResolver: ResolveAlertClipPath,
audioSink: _audioMixer.EnqueueAlertAudio,
audioSink: _alertAudioOutput.Submit,
tickerPreviewSink: PublishAlertTickerPreview);
_rtmpUrlProvider = () => _reusableStreamUrl; // TASK 5: the reusable stream's ingest URL
+1 -1
View File
@@ -36,7 +36,7 @@ C# / WPF (.NET 8) following MVVM:
| `Models/` | Plain data types — Scene, Source (incl. `ClipShape`, `IsMirrored`, `VideoImageSource`), QualityOption, StreamConfig, StreamHealth, YouTubeChannel, ChatMessage, **Socials (`SocialService` enum + `SocialEntry`/`SocialsConfig` + `SocialServiceIcons`) — the social bar** |
| `ViewModels/` | MainViewModel — `public partial class`, one file per functional area (Scenes, Background, Webcam, Audio, Trax, Socials, Streaming, Chat, Overlays, Account, License, Recording — split complete, see `ViewModels/index.md`); **Chat.cs is a thin delegating facade over `Services/ChatOverlayLayer.cs` (Commit G, first true decomposition), and now also over `Services/AlertOverlayLayer.cs` (TASK 43 — the native alert box, same true-component pattern)**; GoLiveViewModel, ReuseImageViewModel, CameraPickerViewModel, **SocialsDialogViewModel** |
| `Services/` | YouTube OAuth2, stream/broadcast management, live chat polling, LayoutStore (SQLite), **SocialValidator (`ISocialValidator` seam + `HttpSocialValidator` default)**, **webcam: `VideoFrame` seam + `CameraDeviceInfo`/`ICameraEnumerator`/`ICameraFrameSource` interfaces + `MediaCaptureCameraEnumerator`/`MediaCaptureFrameSource` (WinRT) + `CameraManager`**, **screen capture: `IFullScreenDetector`/`Win32FullScreenDetector` + `IScreenCaptureSource`/`ScreenCaptureFrameSource` (WinRT GraphicsCapture) + `ScreenCaptureManager` + `ScreenCaptureSourceFactory` + `Direct3D11Helper`/`CaptureInterop` (COM bridges)**, **media source: `IMediaFrameSource` + `MediaVideoSource` (spawns ffmpeg `rawvideo` BGRA decode) + `MediaVideoSourceManager` (refcount-by-path session owner) + pure `RawVideoFrameReader` + `IDecodeProcess`/`FfmpegDecodeProcess` process seam (binary-stdout mirror of `IEncoderProcess`; see [`TASKS/task-21-media-source.md`](TASKS/task-21-media-source.md))**, **compositor: `SceneCompositor` + `CompositorOptions` + pure `StretchMath` + `StaticPixelCache` (see [`docs/ai/frame-pipeline.md`](docs/ai/frame-pipeline.md) → "Scene compositor")**, **alerts: `ChatOverlayLayer` + `AlertOverlayLayer`/`AlertRenderer` (the native celebration-zone overlay, TASK 43 — see [`docs/ai/overlays.md`](docs/ai/overlays.md))**, **audio: `IAudioSource` seam + `WasapiLoopbackAudioSource`/`WasapiMicAudioSource` (NAudio WASAPI) + `AudioMixer` + pure `AudioLevelMeter`/`WaveToFloat`/`VoiceFilterChain`/`LowShelfFilter`/`HighShelfFilter`/`NoiseGate`/`Compressor`/`AutoDucker`/`AudioRingBuffer`/`TinyResampler`/`AudioSyncDelay` + `MusicPlayer` + `ITraxPlayer` (TRAX toggle seam — FakePlayer in tests; the dot is green/red/gray and the error scrolls terse in the desktop-audio bar; MusicVolume fixed 0.5) + `IAudioPipeWriter`/`NamedPipeAudioWriter` (see [`docs/ai/output.md`](docs/ai/output.md) → "Live audio capture")**, **encoder: `IFfmpegEncoder`/`FfmpegEncoder` + `IEncoderProcess`/`FfmpegEncoderProcess` + `IFfmpegLocator`/`FfmpegLocator` + pure `FfmpegArgs`/`FfmpegProgressParser`/`FfmpegEncoderPicker` + the `FramePump` frame producer (see [`docs/ai/output.md`](docs/ai/output.md) → "Live encoder" + [`docs/ai/frame-pipeline.md`](docs/ai/frame-pipeline.md) → "Live frame pipeline")**, **notifications: `INotificationService` seam (`AppNotificationSeverity` Info/Success/Warning/Error) + `NotificationService` (Notification.Wpf toasts, see "Toast notifications")** |
| `Helpers/` | ViewModelBase (INotifyPropertyChanged), RelayCommand, ImageCache, AppLog (file logger), FocusPreservingListBox, OAuthCredentials, **TokenStore (DPAPI session persistence)**, **BuildStamp (wordmark release counter `#N`, incremented by `GenerateBuildStamp` from the local `BuildCounter.txt`; per-build GUID/time are logged to startup.log)**, visibility converters |
| `Helpers/` | ViewModelBase (INotifyPropertyChanged), RelayCommand, ImageCache, AppLog (file logger), FocusPreservingListBox, OAuthCredentials, **TokenStore (DPAPI session persistence)**, **BuildStamp (wordmark release counter `#N` = `git rev-list --count HEAD`, so it moves once per COMMIT; per-build GUID/time are logged to startup.log)**, visibility converters |
| `Themes/` | `Controls.xaml` — the single dark-theme source, merged once in `App.xaml` (see `Themes/index.md`) |
| `MainWindow.xaml` | Dark theme; top bar + health banner; work area has a fixed 360px left column and preview column, top-left readouts/resolution and scene strip above preview, lower left panel + preview; bottom bar is an empty spacer |
+9
View File
@@ -152,3 +152,12 @@ published decisions (recorded in `TASKS/task-43-native-alerts.md`):
limiter and added at **unity — never ducked** (creator ruling: "don't lower my game
audio for a tip"); `StartLive` clears it. Per-alert loudness = the Volume slider.
- **Alert sound byte (2026-11-01, creator ruling):** the alert layer can carry an audio file
(`AlertAudioPath`) that plays with the clip, plus `AlertAudioLoop` to repeat it under the clip
("Loop the sound until the video ends"). The video is always one pass to completion.
⛔ **Alert audio plays on the DEFAULT OUTPUT DEVICE, not into the mixer** (`Services/Audio/
AlertAudioOutput` for the clip's own PCM, `MediaPlayer` for the sound byte). That is deliberate:
only audio that reaches the speakers is captured by the WASAPI loopback, which is what makes it
audible to the creator *and* visible in the desktop sound bar. The old `EnqueueAlertAudio` path
produced sound that was in the stream but invisible in the meter and inaudible in the room.
Failure to open a device is logged and swallowed — a silent alert still renders.
File diff suppressed because one or more lines are too long
@@ -0,0 +1,61 @@
using System;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using Xunit;
using ytLive.Models;
using ytLive.Services;
namespace ytLive.Tests;
/// <summary>
/// The alert sound byte (creator ruling 2026-11-01): a file that plays with the alert clip, with an
/// optional loop. It is configured on the alert layer, so it has to survive a save/reload — the
/// same startup path that a missing SELECT column broke once already.
/// </summary>
public class AlertAudioPersistenceTests
{
[Fact]
public void The_sound_byte_and_its_loop_flag_survive_a_save_and_reload()
{
var dbPath = Path.Combine(Path.GetTempPath(), $"llamacasty-alertaudio-{Guid.NewGuid():N}.db");
try
{
var scenes = new ObservableCollection<Scene> { new() { Name = SceneCatalog.Live } };
var alert = new Source
{
Name = "Stream Alerts",
Type = SourceType.AlertBox,
X = 620, Y = 430, Width = 680, Height = 200,
AlertAudioPath = @"C:\sounds\ding.wav",
AlertAudioLoop = true,
};
scenes[0].Elements.Add(alert);
using (var store = new LayoutStore(dbPath)) store.Save(scenes, null, null);
using (var reopened = new LayoutStore(dbPath))
{
var loaded = reopened.Load().SelectMany(s => s.Elements).OfType<Source>()
.Single(s => s.Type == SourceType.AlertBox);
Assert.Equal(@"C:\sounds\ding.wav", loaded.AlertAudioPath);
Assert.True(loaded.AlertAudioLoop);
Assert.Equal("ding.wav", loaded.AlertAudioFileDisplay);
Assert.True(loaded.HasAlertAudio);
}
}
finally
{
try { File.Delete(dbPath); } catch (IOException) { }
}
}
[Fact]
public void A_fresh_alert_layer_has_no_sound_byte_and_does_not_loop()
{
var alert = new Source { Type = SourceType.AlertBox };
Assert.False(alert.HasAlertAudio);
Assert.False(alert.AlertAudioLoop);
Assert.Equal("No sound byte", alert.AlertAudioFileDisplay);
}
}
+2 -2
View File
@@ -26,7 +26,7 @@ public class AudioDockLayoutTests
Assert.True(AudioDockLayout.IsCollapsed(AudioDockLayout.CollapseBelowHeight - 1));
// The two heights are the design's numbers, not whatever looked fine.
Assert.Equal(148, AudioDockLayout.ExpandedHeight); // 112 bays + 36 strip
Assert.Equal(36, AudioDockLayout.CollapsedHeight);
Assert.Equal(156, AudioDockLayout.ExpandedHeight); // 112 bays + 44 master strip
Assert.Equal(44, AudioDockLayout.CollapsedHeight);
}
}
+16 -10
View File
@@ -5,14 +5,15 @@ using ytLive.ViewModels;
namespace ytLive.Tests;
/// <summary>The TRAX bay shows the track, plays/pauses it, and carries a level — but no meter:
/// nothing measures the bed, and a decorative ladder would be a lie. Its fader moves a gain the
/// player actually applies, separate from the desktop-mute follow.
/// <summary>The TRAX bay shows the track, plays/pauses it, and carries a level. It got its OWN bay
/// and its own meter on 2026-11-01 (creator ruling): the player measures its real output, so the
/// ladder is not decorative, and living inside the game bay hid whether the bed was playing.
/// Its fader moves a gain the player actually applies, separate from the desktop-mute follow.
/// </summary>
public class TraxBayTests
{
[Fact]
public void The_trax_bay_binds_the_track_level_and_play_state_without_inventing_a_meter()
public void The_trax_bay_is_its_own_bay_with_a_real_meter()
{
var dock = SourceAssert.Text("Controls", "AudioDock.xaml");
Assert.Contains("Text=\"{Binding TraxTrackLabel}\"", dock);
@@ -26,13 +27,18 @@ public class TraxBayTests
Assert.Contains("Binding=\"{Binding IsMusicPlaying}\" Value=\"True\"", dock);
Assert.Contains("Click=\"TraxPlayPause_Click\"", dock);
// The bay DOES carry a ladder now — the player measures its own output, so "is music making
// sound" is answerable without hearing it (a play glyph cannot answer that).
// The TRAX row lives under the desktop volume, inside the GAME bay.
var traxRow = dock[dock.IndexOf("Text=\"TRAX\"", System.StringComparison.Ordinal)
..dock.IndexOf("Text=\"LIP-SYNC\"", System.StringComparison.Ordinal)];
// TRAX is its own bay, between GAME and LIP-SYNC, and it carries a real ladder bound to the
// player's own level — "is the bed making sound" is not answerable from a play glyph.
var traxRow = dock[dock.IndexOf("<!-- TRAX: its own bay", System.StringComparison.Ordinal)
..dock.IndexOf("<!-- LIP-SYNC", System.StringComparison.Ordinal)];
Assert.Contains("TraxTrackLabel", traxRow);
Assert.DoesNotContain("SegmentMeter", traxRow);
Assert.Contains("SegmentMeter", traxRow);
Assert.Contains("Level=\"{Binding TraxMeterFraction}\"", traxRow);
// …and the GAME bay no longer embeds it.
var gameBay = dock[dock.IndexOf("<!-- GAME / PC", System.StringComparison.Ordinal)
..dock.IndexOf("<!-- TRAX: its own bay", System.StringComparison.Ordinal)];
Assert.DoesNotContain("TraxTrackLabel", gameBay);
foreach (var name in new[] { "TraxVolumeDb", "TraxVolumeDbLabel", "TraxTrackLabel", "CanRaiseTrax", "CanLowerTrax" })
Assert.NotNull(typeof(MainViewModel).GetProperty(name));
+10 -13
View File
@@ -38,11 +38,12 @@
<BuildStampId>$([System.Guid]::NewGuid().ToString('N').Substring(0,8))</BuildStampId>
<BuildStampTime>$([System.DateTime]::Now.ToString('yyyy-MM-dd HH:mm:ss'))</BuildStampTime>
<!-- RELEASE COUNTER (creator ruling 2026-09-04): the UI shows a sequential number that
ticks +1 per COMMIT, starting at 13 — a per-BUILD GUID changed on every launch and read
as noise (rightly). Derived from git rev-list count (stable per commit, no bookkeeping).
Baseline 241 = count at introduction, first display 13. Missing git or unparsed output
falls back to the start (build never breaks). GUID + compile time stay in startup.log,
where build-identity forensics actually live. -->
ticks +1 per COMMIT — a per-BUILD GUID changed on every launch and read as noise
(rightly). It is git rev-list count of HEAD, evaluated below.
⛔ It used to read BuildCounter.txt, add 1 and write it back on EVERY CoreCompile, so it
counted BUILDS: one day of iteration reached #1122 against 563 commits (2026-11-01).
No counter file now: the commit count cannot drift. Missing git falls back to the
start, so the build never breaks. GUID + compile time stay in startup.log. -->
<BuildNumberBaseline>17</BuildNumberBaseline>
<BuildNumberStart>13</BuildNumberStart>
</PropertyGroup>
@@ -51,14 +52,10 @@
<Output TaskParameter="ConsoleOutput" PropertyName="CommitCountRaw" />
</Exec>
<PropertyGroup>
<CommitCount>$(CommitCountRaw.Trim())</CommitCount>
<BuildCounterFile>$(ProjectDir)BuildCounter.txt</BuildCounterFile>
<PriorBuildCount Condition="Exists('$(BuildCounterFile)')">$([System.IO.File]::ReadAllText('$(BuildCounterFile)').Trim())</PriorBuildCount>
<PriorBuildCount Condition="'$(PriorBuildCount)' == ''">423</PriorBuildCount>
<BuildNumber>$([MSBuild]::Add($(PriorBuildCount), 1))</BuildNumber>
</PropertyGroup>
<WriteLinesToFile File="$(BuildCounterFile)" Lines="$(BuildNumber)" Overwrite="true" WriteOnlyWhenDifferent="false" />
<PropertyGroup>
<!-- First integer in git's output: the Exec can echo the count twice, and a multi-line value
would fail the numeric check below and silently pin the stamp. -->
<CommitCount>$([System.Text.RegularExpressions.Regex]::Match('$(CommitCountRaw)', '[0-9]+').Value)</CommitCount>
<BuildNumber Condition="'$(CommitCount)' != ''">$(CommitCount)</BuildNumber>
<BuildNumber Condition="! $([System.Text.RegularExpressions.Regex]::IsMatch('$(BuildNumber)', '^[0-9]+$'))">$(BuildNumberStart)</BuildNumber>
</PropertyGroup>
<ItemGroup>