File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,13 @@ class SDLPortBackend : public PortBackend {
15
15
public:
16
16
explicit SDLPortBackend (const PortOut& port)
17
17
: frame_size(port.format_info.FrameSize()), guest_buffer_size(port.BufferSize()) {
18
+ // We want the latency for delivering frames out to be as small as possible,
19
+ // so set the sample frames hint to the number of frames per buffer.
20
+ const auto samples_num_str = std::to_string (port.buffer_frames );
21
+ if (!SDL_SetHint (SDL_HINT_AUDIO_DEVICE_SAMPLE_FRAMES, samples_num_str.c_str ())) {
22
+ LOG_WARNING (Lib_AudioOut, " Failed to set SDL audio sample frames hint to {}: {}" ,
23
+ samples_num_str, SDL_GetError ());
24
+ }
18
25
const SDL_AudioSpec fmt = {
19
26
.format = port.format_info .is_float ? SDL_AUDIO_F32LE : SDL_AUDIO_S16LE,
20
27
.channels = port.format_info .num_channels ,
You can’t perform that action at this time.
0 commit comments