using System.Collections.Generic; namespace Luski.net.Sound { public static class Devices { public static RecordingDevice GetDefaltRecordingDevice() { return GetRecordingDevices()[0]; } public static PlaybackDevice GetDefaltPlaybackDevice() { return GetPlaybackDevices()[0]; } public static IReadOnlyList GetRecordingDevices() { List RecordingNames = WinSound.GetRecordingNames(); List RecordingDevices = new(); foreach (string Device in RecordingNames) { RecordingDevices.Add(new RecordingDevice(Device)); } return RecordingDevices.AsReadOnly(); } public static IReadOnlyList GetPlaybackDevices() { List PlaybackName = WinSound.GetPlaybackNames(); List PlaybackDevices = new(); foreach (string Device in PlaybackName) { PlaybackDevices.Add(new PlaybackDevice(Device)); } return PlaybackDevices.AsReadOnly(); } } public class RecordingDevice { internal RecordingDevice(string name) { Name = name; } public string Name { get; } } public class PlaybackDevice { internal PlaybackDevice(string name) { Name = name; } public string Name { get; } } }