public static MMDevice getDevice(string device) { NAudioHandler handler = new NAudioHandler(); MMDevice[] devices = handler.getDevices(); foreach (MMDevice d in devices) { string stringDevice = d.ToString(); for (int i = 0; i < device.Length; i++) { Console.Write(stringDevice[i]); if (i == device.Length - 1 && stringDevice[i] == device[i]) { return(d); } if (stringDevice[i] != device[i]) { break; } } } return(null); }
private void getDevices() { MMDevice[] devices = nAudioHandler.getDevices(); //this.devices = nAudioHandler.getDirectDevices(); updateDevices(devices); }