@@ -2448,7 +2448,7 @@ def __init__(self, channel_map=None, change_device_parameters=False,
2448
2448
2449
2449
class WasapiSettings :
2450
2450
2451
- def __init__ (self , exclusive = False , auto_convert = False ):
2451
+ def __init__ (self , exclusive = False , auto_convert = False , explicit_sample_format = False ):
2452
2452
"""WASAPI-specific input/output settings.
2453
2453
2454
2454
Objects of this class can be used as *extra_settings* argument
@@ -2470,6 +2470,13 @@ def __init__(self, exclusive=False, auto_convert=False):
2470
2470
system mixer sample rate. This only applies in *shared
2471
2471
mode* and has no effect when *exclusive* is set to ``True``.
2472
2472
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
+
2473
2480
Examples
2474
2481
--------
2475
2482
Setting exclusive mode when calling `play()`:
@@ -2487,8 +2494,10 @@ def __init__(self, exclusive=False, auto_convert=False):
2487
2494
flags = 0x0
2488
2495
if exclusive :
2489
2496
flags |= _lib .paWinWasapiExclusive
2490
- elif auto_convert :
2497
+ if auto_convert :
2491
2498
flags |= _lib .paWinWasapiAutoConvert
2499
+ if explicit_sample_format :
2500
+ flags |= _lib .paWinWasapiExplicitSampleFormat
2492
2501
self ._streaminfo = _ffi .new ('PaWasapiStreamInfo*' , dict (
2493
2502
size = _ffi .sizeof ('PaWasapiStreamInfo' ),
2494
2503
hostApiType = _lib .paWASAPI ,
0 commit comments