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;
    }
}
