aboutsummaryrefslogtreecommitdiffstats
path: root/alc/backends/wasapi.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'alc/backends/wasapi.cpp')
-rw-r--r--alc/backends/wasapi.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/alc/backends/wasapi.cpp b/alc/backends/wasapi.cpp
index b6f5b5fb..181518d0 100644
--- a/alc/backends/wasapi.cpp
+++ b/alc/backends/wasapi.cpp
@@ -689,10 +689,10 @@ FORCE_ALIGN int WasapiPlayback::mixerProc()
hr = mRender->GetBuffer(len, &buffer);
if(SUCCEEDED(hr))
{
- lock();
+ std::unique_lock<WasapiPlayback> dlock{*this};
aluMixData(mDevice, buffer, len);
mPadding.store(written + len, std::memory_order_relaxed);
- unlock();
+ dlock.unlock();
hr = mRender->ReleaseBuffer(len, 0);
}
if(FAILED(hr))
@@ -1136,11 +1136,10 @@ ClockLatency WasapiPlayback::getClockLatency()
{
ClockLatency ret;
- lock();
+ std::lock_guard<WasapiPlayback> _{*this};
ret.ClockTime = GetDeviceClockTime(mDevice);
ret.Latency = std::chrono::seconds{mPadding.load(std::memory_order_relaxed)};
ret.Latency /= mDevice->Frequency;
- unlock();
return ret;
}