Skip to content

Commit b36dcc4

Browse files
committed
Add extra_settings in check_input_settings() and check_output_settings()
1 parent 1e16a3a commit b36dcc4

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

sounddevice.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ def query_hostapis(index=None):
702702

703703

704704
def check_input_settings(device=None, channels=None, dtype=None,
705-
samplerate=None):
705+
extra_settings=None, samplerate=None):
706706
"""Check if given input device settings are supported.
707707
708708
All parameters are optional, `default` settings are used for any
@@ -717,18 +717,21 @@ def check_input_settings(device=None, channels=None, dtype=None,
717717
Number of input channels, see `default.channels`.
718718
dtype : str or numpy.dtype, optional
719719
Data type for input samples, see `default.dtype`.
720+
extra_settings : settings object, optional
721+
This can be used for host-API-specific input settings.
722+
See `default.extra_settings`.
720723
samplerate : float, optional
721724
Sampling frequency, see `default.samplerate`.
722725
723726
"""
724727
parameters, dtype, samplesize, samplerate = _get_stream_parameters(
725728
'input', device=device, channels=channels, dtype=dtype, latency=None,
726-
samplerate=samplerate)
729+
extra_settings=extra_settings, samplerate=samplerate)
727730
_check(_lib.Pa_IsFormatSupported(parameters, _ffi.NULL, samplerate))
728731

729732

730733
def check_output_settings(device=None, channels=None, dtype=None,
731-
samplerate=None):
734+
extra_settings=None, samplerate=None):
732735
"""Check if given output device settings are supported.
733736
734737
Same as `check_input_settings()`, just for output device
@@ -737,7 +740,7 @@ def check_output_settings(device=None, channels=None, dtype=None,
737740
"""
738741
parameters, dtype, samplesize, samplerate = _get_stream_parameters(
739742
'output', device=device, channels=channels, dtype=dtype, latency=None,
740-
samplerate=samplerate)
743+
extra_settings=extra_settings, samplerate=samplerate)
741744
_check(_lib.Pa_IsFormatSupported(_ffi.NULL, parameters, samplerate))
742745

743746

@@ -2400,7 +2403,7 @@ def _check_dtype(dtype):
24002403

24012404

24022405
def _get_stream_parameters(kind, device, channels, dtype, latency,
2403-
extra_settings, samplerate):
2406+
extra_settings, samplerate):
24042407
"""Get parameters for one direction (input or output) of a stream."""
24052408
if device is None:
24062409
device = default.device[kind]

0 commit comments

Comments
 (0)