From 2e6a55a87ce24a9303c3039609b41fb0eb302483 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 21 Dec 2019 20:43:46 -0800 Subject: Handle padding between device sample frames The padding must be constant and sample type aligned (e.g. some fixed multiple of two bytes between the start of two consecutive frames for 16-bit output). The intent is to always have the ability for stereo output with WASAPI even if the device has some other unsupported configuration, as long as front-left and front-right exist. --- alc/backends/jack.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'alc/backends/jack.cpp') diff --git a/alc/backends/jack.cpp b/alc/backends/jack.cpp index c7bf8469..2be52e35 100644 --- a/alc/backends/jack.cpp +++ b/alc/backends/jack.cpp @@ -292,6 +292,8 @@ int JackPlayback::mixerProc() SetRTPriority(); althrd_setname(MIXER_THREAD_NAME); + const size_t frame_step{mDevice->channelsFromFmt()}; + std::unique_lock dlock{*this}; while(!mKillNow.load(std::memory_order_acquire) && mDevice->Connected.load(std::memory_order_acquire)) @@ -311,9 +313,9 @@ int JackPlayback::mixerProc() ALuint len1{minu(static_cast(data.first.len), todo)}; ALuint len2{minu(static_cast(data.second.len), todo-len1)}; - aluMixData(mDevice, data.first.buf, len1); + aluMixData(mDevice, data.first.buf, len1, frame_step); if(len2 > 0) - aluMixData(mDevice, data.second.buf, len2); + aluMixData(mDevice, data.second.buf, len2, frame_step); mRing->writeAdvance(todo); } -- cgit v1.2.3