summaryrefslogtreecommitdiff
path: root/sounddevice.py
diff options
context:
space:
mode:
authoryin kaisheng <yinkaisheng@live.com>2023-10-07 16:57:50 +0800
committerGitHub <noreply@github.com>2023-10-07 10:57:50 +0200
commit69966580147804e64f95f5d978843027d91e154c (patch)
tree717ee5a417ed84f90a16706823a1b28a9b7f43ef /sounddevice.py
parentc5732425ba0d46a33d1a2534a4616847d6f536c9 (diff)
support sample rate auto convert using PortAudio paWinWasapiAutoConvert flag when in share mode (#492)
Diffstat (limited to 'sounddevice.py')
-rw-r--r--sounddevice.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/sounddevice.py b/sounddevice.py
index 7fc7c10..1592609 100644
--- a/sounddevice.py
+++ b/sounddevice.py
@@ -2413,7 +2413,7 @@ class CoreAudioSettings:
class WasapiSettings:
- def __init__(self, exclusive=False):
+ def __init__(self, exclusive=False, auto_convert=False):
"""WASAPI-specific input/output settings.
Objects of this class can be used as *extra_settings* argument
@@ -2427,6 +2427,10 @@ class WasapiSettings:
Exclusive mode allows to deliver audio data directly to
hardware bypassing software mixing.
+ auto_convert : bool
+ auto_convert allows to resample audio data to hardware
+ supported samplerate when in shared mode(None exclusive mode)
+
Examples
--------
Setting exclusive mode when calling `play()`:
@@ -2444,6 +2448,8 @@ class WasapiSettings:
flags = 0x0
if exclusive:
flags |= _lib.paWinWasapiExclusive
+ elif auto_convert:
+ flags |= _lib.paWinWasapiAutoConvert
self._streaminfo = _ffi.new('PaWasapiStreamInfo*', dict(
size=_ffi.sizeof('PaWasapiStreamInfo'),
hostApiType=_lib.paWASAPI,