Files
ytLlive/Services/WinRtMicrophoneEnumerator.cs
T
gramps b00a4cbd5e Mic audio UX: realtime read-only meter + mic picker
- Meter is a READ-ONLY realtime level display: fill = Math.Min(1, AudioLevel * MicVolume) (AudioLevel = live input from the future mixer, 0 with no input; MicVolume is gain on ambient noise). While the slider is dragged the bar previews the slider position (PreviewMouseLeftButtonDown/Up + LostMouseCapture -> SetVolumeAdjusting); on release it returns to the live level (bounces to 0 with no input). Clicking the meter does nothing.
- MicVolume drives MicMuted (read-only, muted <=> volume 0): sliding to 0 flips the speaker to the red slashed mute icon, sliding up from 0 clears it; speaker button runs volume to 0 or restores the prior level (_volumeBeforeMute, default 0.8) and flashes the meter to the restored position for ~300ms (BeginVolumeFlash/EndVolumeFlash DispatcherTimer, cancelled if the slider is grabbed).
- MIC label opens MicPickerDialog (WinRT audio-capture device enumeration, mirrors camera picker, no new packages); the chosen voice source name shows left-justified INSIDE the meter bar (fill at 75% opacity so text + ruler markings show through).
- New files: Services/IMicrophoneEnumerator, MicrophoneDeviceInfo, WinRtMicrophoneEnumerator; ViewModels/MicPickerViewModel; MicPickerDialog.
- Docs updated (ai.md, TASKS.md, Services/index.md, ViewModels/index.md); build 0 warnings, 65 tests passing
2026-08-07 17:44:16 -07:00

16 lines
522 B
C#

using Windows.Devices.Enumeration;
namespace ytLive.Services;
public sealed class WinRtMicrophoneEnumerator : IMicrophoneEnumerator
{
public async Task<IReadOnlyList<MicrophoneDeviceInfo>> GetMicrophonesAsync()
{
var devices = await DeviceInformation.FindAllAsync(DeviceClass.AudioCapture);
var result = new List<MicrophoneDeviceInfo>(devices.Count);
foreach (var device in devices)
result.Add(new MicrophoneDeviceInfo(device.Id, device.Name));
return result;
}
}