Unit 5. The dock's first working bay: - 24-segment ladder fed by `MicMeterFraction` — the MEASURED display level (already scaled by the volume and zeroed when muted), never the gain setting. - Fader in dB via `MicVolumeDb` (−60 … +6, 0 = unity) with a mono-weight readout (`MicVolumeDbLabel`), so "−6.0 dB" is what the creator reads instead of "0.50". - Mute button whose dot uses the existing MicStatusBrush; clicking the device name opens the mic picker, so the label stays the control (the KISS rule: one place to change the mic). The preview's own mic row stays for now — it is removed in the final unit, after the dock bays are complete, so nothing is lost if a bay misbehaves. Guard: MicBayTests — the bay binds the dB face and the measured level (not the gain), the fader range IS the scale's range, the VM surface exists, and mute still zeroes the ladder.
98 lines
6.6 KiB
XML
98 lines
6.6 KiB
XML
<UserControl x:Class="ytLive.Controls.AudioDock"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:controls="clr-namespace:ytLive.Controls">
|
|
<!-- The sound bars. Replaces the empty bottom-bar spacer; collapses to the telemetry strip
|
|
on short windows (AudioDockLayout decides the height, not this file). -->
|
|
<Border x:Name="DockRoot" Background="{StaticResource Brush.SurfaceContainer}"
|
|
BorderBrush="{StaticResource Brush.Outline}" BorderThickness="0,1,0,0">
|
|
<Grid>
|
|
<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="*"/>
|
|
</Grid.RowDefinitions>
|
|
|
|
<!-- Four bays: MIC | GAME | TRAX | SYNC. Filled in by the bay units. -->
|
|
<Grid x:Name="Bays" Grid.Row="1" Margin="8,4,8,6">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*"/>
|
|
<ColumnDefinition Width="*"/>
|
|
<ColumnDefinition Width="*"/>
|
|
<ColumnDefinition Width="*"/>
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<Border Grid.Column="0" Background="{StaticResource Brush.SurfaceContainerLow}" CornerRadius="{StaticResource Radius.Sm}" Margin="0,0,4,0" Padding="10,6">
|
|
<Grid>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="*"/>
|
|
</Grid.RowDefinitions>
|
|
|
|
<!-- Clicking the name opens the mic picker: the label is the control. -->
|
|
<Grid Grid.Row="0" Cursor="Hand" ToolTip="Change microphone"
|
|
MouseLeftButtonUp="MicLabel_MouseLeftButtonUp">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="*"/>
|
|
</Grid.ColumnDefinitions>
|
|
<Border Background="{StaticResource Brush.SurfaceContainerHighest}" CornerRadius="{StaticResource Radius.Sm}" Padding="5,1">
|
|
<TextBlock Text="MIC 1" FontSize="9" FontWeight="Bold" Foreground="{StaticResource Brush.OnSurfaceVariant}"/>
|
|
</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}"/>
|
|
</Grid>
|
|
|
|
<controls:SegmentMeter Grid.Row="1" Height="10" Margin="0,6,0,0" Orientation="Horizontal"
|
|
Level="{Binding MicMeterFraction}" Segments="24"/>
|
|
|
|
<DockPanel Grid.Row="2" Margin="0,6,0,0" VerticalAlignment="Bottom">
|
|
<Button DockPanel.Dock="Left" Width="24" Height="20" Margin="0,0,6,0"
|
|
Style="{StaticResource YtButtonSecondary}" Padding="0"
|
|
Command="{Binding ToggleMicMuteCommand}" ToolTip="{Binding MicMuteText}">
|
|
<Ellipse Width="9" Height="9" Fill="{Binding MicStatusBrush}"/>
|
|
</Button>
|
|
<TextBlock DockPanel.Dock="Right" Width="56" TextAlignment="Right" FontSize="10"
|
|
FontFamily="{StaticResource FontFamily.Mono}" VerticalAlignment="Center"
|
|
Foreground="{StaticResource Brush.OnSurfaceVariant}"
|
|
Text="{Binding MicVolumeDbLabel}"/>
|
|
<Slider Minimum="-60" Maximum="6" SmallChange="0.5" LargeChange="3"
|
|
Value="{Binding MicVolumeDb, Mode=TwoWay}" VerticalAlignment="Center"/>
|
|
</DockPanel>
|
|
</Grid>
|
|
</Border>
|
|
<Border Grid.Column="1" Background="{StaticResource Brush.SurfaceContainerLow}" CornerRadius="{StaticResource Radius.Sm}" Margin="4,0" Padding="10,6">
|
|
<StackPanel>
|
|
<TextBlock Text="GAME / PC" FontSize="10" FontWeight="SemiBold" Foreground="{StaticResource Brush.OnSurfaceVariant}"/>
|
|
<TextBlock x:Name="GameBayBody" Text="—" FontSize="11" Foreground="{StaticResource Brush.OnSurfaceDisabled}"/>
|
|
</StackPanel>
|
|
</Border>
|
|
<Border Grid.Column="2" Background="{StaticResource Brush.SurfaceContainerLow}" CornerRadius="{StaticResource Radius.Sm}" Margin="4,0" Padding="10,6">
|
|
<StackPanel>
|
|
<TextBlock Text="TRAX" FontSize="10" FontWeight="SemiBold" Foreground="{StaticResource Brush.OnSurfaceVariant}"/>
|
|
<TextBlock x:Name="TraxBayBody" Text="—" FontSize="11" Foreground="{StaticResource Brush.OnSurfaceDisabled}"/>
|
|
</StackPanel>
|
|
</Border>
|
|
<Border Grid.Column="3" Background="{StaticResource Brush.SurfaceContainerLow}" CornerRadius="{StaticResource Radius.Sm}" Margin="4,0,0,0" Padding="10,6">
|
|
<StackPanel>
|
|
<TextBlock Text="LIP-SYNC" FontSize="10" FontWeight="SemiBold" Foreground="{StaticResource Brush.OnSurfaceVariant}"/>
|
|
<TextBlock x:Name="SyncBayBody" Text="—" FontSize="11" Foreground="{StaticResource Brush.OnSurfaceDisabled}"/>
|
|
</StackPanel>
|
|
</Border>
|
|
</Grid>
|
|
|
|
<!-- Master strip: always visible, even collapsed — it is the telemetry line. -->
|
|
<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"/>
|
|
</DockPanel>
|
|
</Border>
|
|
</Grid>
|
|
</Border>
|
|
</UserControl>
|