Skip to content

Commit 53f8406

Browse files
committed
Revert "sdl_audio: Remove buffer samples hint. (shadps4-emu#2038)"
This reverts commit f42b8ac.
1 parent 0629365 commit 53f8406

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/core/libraries/audio/sdl_audio.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ class SDLPortBackend : public PortBackend {
1515
public:
1616
explicit SDLPortBackend(const PortOut& port)
1717
: 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+
}
1825
const SDL_AudioSpec fmt = {
1926
.format = port.format_info.is_float ? SDL_AUDIO_F32LE : SDL_AUDIO_S16LE,
2027
.channels = port.format_info.num_channels,

0 commit comments

Comments
 (0)