Skip to content

Commit 9057b39

Browse files
committed
Adding audio buffer size to preferences, with reasonable default limits (128-4096). 512 should be a good default for most systems. This will allow users to customize how much audio buffer must be filled prior to audio playback for their systems. Updating docs also, with a description of this setting.
1 parent 341978b commit 9057b39

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

doc/preferences.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ real-time preview audio settings, for example, which audio device and sample rat
9999
================================ ================== ===========
100100
Setting Default Description
101101
================================ ================== ===========
102-
Default Video Profile HD 720P 30 fps Select the profile for Preview and Export defaults
102+
Default Video Profile HD 720P 30 fps Select the profile for Preview and Export defaults
103+
Playback Audio Buffer Size 512 Adjust how many audio samples must be buffered before audio playback begins. Allowed range of values is 128 to 4096. NOTE: If you are experiencing a large drift or delay in audio playback, try setting this value lower.
103104
Playback Audio Device Default
104105
Default Audio Sample Rate 44100
105106
Default Audio Channels Stereo (2 Channel)

src/settings/_default.settings

+10
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,16 @@
138138
"values": [],
139139
"restart": true
140140
},
141+
{
142+
"min": 128,
143+
"max": 4096,
144+
"value": 512,
145+
"title": "Playback Audio Buffer Size",
146+
"category": "Preview",
147+
"setting": "playback-buffer-size",
148+
"type": "spinner-int",
149+
"restart": true
150+
},
141151
{
142152
"value": "",
143153
"title": "Playback Audio Device",

src/windows/main_window.py

+2
Original file line numberDiff line numberDiff line change
@@ -3675,6 +3675,7 @@ def __init__(self, *args):
36753675
# - OLD settings only includes device name (i.e. "PulseAudio Sound Server")
36763676
# - NEW settings include both device name and type (double pipe delimited)
36773677
# (i.e. "PulseAudio Sound Server||ALSA")
3678+
playback_buffer_size = s.get("playback-buffer-size") or 512
36783679
playback_device_value = s.get("playback-audio-device") or ""
36793680
playback_device_parts = playback_device_value.split("||")
36803681
playback_device_name = playback_device_parts[0]
@@ -3685,6 +3686,7 @@ def __init__(self, *args):
36853686
# Set libopenshot settings
36863687
lib_settings.PLAYBACK_AUDIO_DEVICE_NAME = playback_device_name
36873688
lib_settings.PLAYBACK_AUDIO_DEVICE_TYPE = playback_device_type
3689+
lib_settings.PLAYBACK_AUDIO_BUFFER_SIZE = playback_buffer_size
36883690

36893691
# Set scaling mode to lower quality scaling (for faster previews)
36903692
lib_settings.HIGH_QUALITY_SCALING = False

0 commit comments

Comments
 (0)