You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the suggestion. Unfortunately I don't think a move to WinRT is something I can do. Several things the crate relies on have no WinRT equivalent that I can find. The capability probe reads the driver's declared data ranges through IDeviceTopology and the KS filter, and I don't see a way to start that from a WinRT device. Session manager and meter access, endpoint properties, the full DeviceState values and the device notifications are in the same position. The endpoint id format would change as well, so it would also be a breaking change.
The crate does not cache the enumerator or any other COM object globally, so the problem in the cpal issue does not apply here as it is described there. Have you run into an actual problem when using wasapi-rs? If so, please describe it, ideally with a small reproduction. If it turns out to be a real problem, I think a much smaller fix is possible. Device could store the endpoint id as a string and create the IMMDevice on demand on the calling thread.
Oh I didn't mean replacing the multimedia stuff, with "removes the need for XY" I was just thinking from a user perspective (same goes for the apartment boundary thing, since users might send stuff to other threads without knowing about COMs threading rules). I'd imagine the WinRT APIs being purely additive to the crate.
Thanks for clarifying, I misread the suggestion as a replacement. I hadn't considered adding a second way to do the same thing next to the existing one, and I think that is out of scope for this crate. It would be a second set of device types with different ids, and the devices found that way could not use the capability probe or the data ranges. I would rather not duplicate the two overlapping APIs that Windows already has.
Anyone who needs the WinRT APIs can use them directly from the windows crate, which exposes all of WinRT.
What I can do is make that combination easier. I would add a constructor that builds an AudioClient from an IAudioClient you have activated yourself, for example through ActivateAudioInterfaceAsync. Then you can enumerate with WinRT and still use the streaming code in this crate.
Do you know of a use case where this approach would not work?
I realized we can do a bit better than what I did before. #94 adds AudioClient::new_device_interface_client, which takes the Id of a WinRT DeviceInformation and does the activation itself, so no completion handler is needed in the user code. Exclusive mode works on these clients too, and the new playsine_winrt example does the device side purely through WinRT.
Activity
HEnquist commentedon Oct 4, 2026
Thanks for the suggestion. Unfortunately I don't think a move to WinRT is something I can do. Several things the crate relies on have no WinRT equivalent that I can find. The capability probe reads the driver's declared data ranges through IDeviceTopology and the KS filter, and I don't see a way to start that from a WinRT device. Session manager and meter access, endpoint properties, the full DeviceState values and the device notifications are in the same position. The endpoint id format would change as well, so it would also be a breaking change.
The crate does not cache the enumerator or any other COM object globally, so the problem in the cpal issue does not apply here as it is described there. Have you run into an actual problem when using wasapi-rs? If so, please describe it, ideally with a small reproduction. If it turns out to be a real problem, I think a much smaller fix is possible. Device could store the endpoint id as a string and create the IMMDevice on demand on the calling thread.
LastExceed commentedon Oct 4, 2026
Oh I didn't mean replacing the multimedia stuff, with "removes the need for XY" I was just thinking from a user perspective (same goes for the apartment boundary thing, since users might send stuff to other threads without knowing about COMs threading rules). I'd imagine the WinRT APIs being purely additive to the crate.
[-]Use WinRT[/-][+]Add support for WinRT[/+]LastExceed commentedon Oct 5, 2026
I recognize that my phrasing was pretty misleading, my bad
HEnquist commentedon Oct 5, 2026
Thanks for clarifying, I misread the suggestion as a replacement. I hadn't considered adding a second way to do the same thing next to the existing one, and I think that is out of scope for this crate. It would be a second set of device types with different ids, and the devices found that way could not use the capability probe or the data ranges. I would rather not duplicate the two overlapping APIs that Windows already has.
Anyone who needs the WinRT APIs can use them directly from the windows crate, which exposes all of WinRT.
What I can do is make that combination easier. I would add a constructor that builds an AudioClient from an IAudioClient you have activated yourself, for example through ActivateAudioInterfaceAsync. Then you can enumerate with WinRT and still use the streaming code in this crate.
Do you know of a use case where this approach would not work?
LastExceed commentedon Oct 5, 2026
Hmm I understand. I'll look into how much would actually have to be duplicated, because I didn't expect it to be that much
Can't think of anything
HEnquist commentedon Nov 20, 2026
I realized we can do a bit better than what I did before. #94 adds
AudioClient::new_device_interface_client, which takes theIdof a WinRTDeviceInformationand does the activation itself, so no completion handler is needed in the user code. Exclusive mode works on these clients too, and the newplaysine_winrtexample does the device side purely through WinRT.I'll close this once it's released.