Added supports_input/output methods to DeviceTrait (#920)

Time to get list of WASAPI devices on my machine (5 devices in total) before change:
Input devices: 12 ms, output devices: 187 ms

After change:
Input devices: 1 ms, output devices: 1 ms
This commit is contained in:
Jesper Nordenberg 2024-11-03 15:09:27 +01:00 • committed by GitHub
parent ca77d848ad
commit 582e93c41d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 42 additions and 14 deletions

View file

@ -58,6 +58,14 @@ impl DeviceTrait for Device {
Device::name(self)
}
fn supports_input(&self) -> bool {
self.data_flow() == Audio::eCapture
}
fn supports_output(&self) -> bool {
self.data_flow() == Audio::eRender
}
fn supported_input_configs(
&self,
) -> Result<Self::SupportedInputConfigs, SupportedStreamConfigsError> {