Closed mikepelley closed 8 years ago
I've added the MMEndpoint
class.
Example usage:
var device = MMDeviceEnumerator.DefaultAudioEndpoint(DataFlow.Render, Role.Console);
Console.WriteLine(device.QueryInterface<MMEndpoint>().DataFlow);
Console.WriteLine(new MMEndpoint(device).DataFlow);
In addition, I've added the DataFlow
property to the MMDevice
class:
var device = MMDeviceEnumerator.DefaultAudioEndpoint(DataFlow.Render, Role.Console);
Console.WriteLine(device.DataFlow);
So fast! Thanks very much - this will be much cleaner. One note: while testing I noticed MMEndpoint.cs is missing from the CSCore project.
I've added the missing file to the project. See https://github.com/filoe/cscore/commit/298c3ea82067ecdcec7cb8946f1db27ea580ce86
MMDevice does not have a DataFlow property, but I can enumerate Render and Capture separately and save DataFlow with the device. However, it seems I cannot get the DataFlow for new devices reported by MMNotificationClient.DeviceAdded without re-enumerating all devices.
Ideally MMDevice would have a DataFlow parameter, although perhaps I've misunderstood something. Perhaps there's a way to use QueryInterface to do this? It seems I'd need to leverage IMMEndpoint, but I don't think that's been wrapped by CSCore.