Skip to content

Commit c3ea12a

Browse files
wasapi: Remove format check
1 parent 961323e commit c3ea12a

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

src/host/wasapi/device.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use super::{windows_err_to_cpal_err, windows_err_to_cpal_err_message};
3232
use windows::core::Interface;
3333
use windows::core::GUID;
3434
use windows::Win32::Devices::Properties;
35-
use windows::Win32::Foundation;
35+
//use windows::Win32::Foundation;
3636
use windows::Win32::Foundation::PROPERTYKEY;
3737
use windows::Win32::Media::Audio::IAudioRenderClient;
3838
use windows::Win32::Media::{Audio, KernelStreaming, Multimedia};
@@ -192,10 +192,12 @@ unsafe fn data_flow_from_immendpoint(endpoint: &Audio::IMMEndpoint) -> Audio::ED
192192

193193
// Given the audio client and format, returns whether or not the format is supported.
194194
pub unsafe fn is_format_supported(
195-
client: &Audio::IAudioClient,
196-
waveformatex_ptr: *const Audio::WAVEFORMATEX,
195+
_client: &Audio::IAudioClient,
196+
_waveformatex_ptr: *const Audio::WAVEFORMATEX,
197197
) -> Result<bool, SupportedStreamConfigsError> {
198-
// Check if the given format is supported.
198+
// Checking formats is not needed for shared mode with auto-conversion, therefore this check has been removed until someone implements WASAPI exclusive mode support
199+
// I used an NAudio issue as reference: https://github.com/naudio/NAudio/issues/819
200+
/* // Check if the given format is supported.
199201
let mut closest_waveformatex_ptr: *mut Audio::WAVEFORMATEX = ptr::null_mut();
200202
201203
let result = client.IsFormatSupported(
@@ -215,7 +217,9 @@ pub unsafe fn is_format_supported(
215217
r if r.is_err() => Ok(false),
216218
Foundation::S_FALSE => Ok(false),
217219
_ => Ok(true),
218-
}
220+
}*/
221+
222+
Ok(true)
219223
}
220224

221225
// Get a cpal Format from a WAVEFORMATEX.

0 commit comments

Comments
 (0)