@@ -2448,7 +2448,7 @@ def __init__(self, channel_map=None, change_device_parameters=False,
24482448
24492449class WasapiSettings :
24502450
2451- def __init__ (self , exclusive = False , auto_convert = False ):
2451+ def __init__ (self , exclusive = False , auto_convert = False , explicit_sample_format = False ):
24522452 """WASAPI-specific input/output settings.
24532453
24542454 Objects of this class can be used as *extra_settings* argument
@@ -2470,6 +2470,13 @@ def __init__(self, exclusive=False, auto_convert=False):
24702470 system mixer sample rate. This only applies in *shared
24712471 mode* and has no effect when *exclusive* is set to ``True``.
24722472
2473+ explicit_sample_format : bool
2474+ Force explicit sample format and do not allow PortAudio to
2475+ select suitable working format. API will fail if provided
2476+ sample format is not supported by audio hardware in Exclusive
2477+ mode or system mixer in Shared mode. This is required for
2478+ accurate native format detection.
2479+
24732480 Examples
24742481 --------
24752482 Setting exclusive mode when calling `play()`:
@@ -2487,8 +2494,10 @@ def __init__(self, exclusive=False, auto_convert=False):
24872494 flags = 0x0
24882495 if exclusive :
24892496 flags |= _lib .paWinWasapiExclusive
2490- elif auto_convert :
2497+ if auto_convert :
24912498 flags |= _lib .paWinWasapiAutoConvert
2499+ if explicit_sample_format :
2500+ flags |= _lib .paWinWasapiExplicitSampleFormat
24922501 self ._streaminfo = _ffi .new ('PaWasapiStreamInfo*' , dict (
24932502 size = _ffi .sizeof ('PaWasapiStreamInfo' ),
24942503 hostApiType = _lib .paWASAPI ,
0 commit comments