aboutsummaryrefslogtreecommitdiffstats
path: root/alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-12-03 14:31:24 -0800
committerChris Robinson <[email protected]>2023-12-03 14:31:24 -0800
commit859319fa7864ed6a81af1f12c68627ab58bb7a7d (patch)
tree325898299b5eca15d729f83bedba049cc2a4a01a /alc
parent2c27d8bc756fd4b134aa16ef9901734e1509062b (diff)
Replace a global function with a member function
Diffstat (limited to 'alc')
-rw-r--r--alc/backends/alsa.cpp4
-rw-r--r--alc/backends/base.cpp2
-rw-r--r--alc/backends/base.h6
-rw-r--r--alc/backends/jack.cpp2
-rw-r--r--alc/backends/opensl.cpp2
-rw-r--r--alc/backends/pipewire.cpp4
-rw-r--r--alc/backends/pulseaudio.cpp4
-rw-r--r--alc/backends/wasapi.cpp2
8 files changed, 10 insertions, 16 deletions
diff --git a/alc/backends/alsa.cpp b/alc/backends/alsa.cpp
index 0d9ff30d..5aae834a 100644
--- a/alc/backends/alsa.cpp
+++ b/alc/backends/alsa.cpp
@@ -852,7 +852,7 @@ ClockLatency AlsaPlayback::getClockLatency()
ClockLatency ret;
std::lock_guard<std::mutex> _{mMutex};
- ret.ClockTime = GetDeviceClockTime(mDevice);
+ ret.ClockTime = mDevice->getClockTime();
snd_pcm_sframes_t delay{};
int err{snd_pcm_delay(mPcmHandle, &delay)};
if(err < 0)
@@ -1170,7 +1170,7 @@ ClockLatency AlsaCapture::getClockLatency()
{
ClockLatency ret;
- ret.ClockTime = GetDeviceClockTime(mDevice);
+ ret.ClockTime = mDevice->getClockTime();
snd_pcm_sframes_t delay{};
int err{snd_pcm_delay(mPcmHandle, &delay)};
if(err < 0)
diff --git a/alc/backends/base.cpp b/alc/backends/base.cpp
index ab3ad028..675d8043 100644
--- a/alc/backends/base.cpp
+++ b/alc/backends/base.cpp
@@ -50,7 +50,7 @@ ClockLatency BackendBase::getClockLatency()
uint refcount;
do {
refcount = mDevice->waitForMix();
- ret.ClockTime = GetDeviceClockTime(mDevice);
+ ret.ClockTime = mDevice->getClockTime();
std::atomic_thread_fence(std::memory_order_acquire);
} while(refcount != ReadRef(mDevice->MixCount));
diff --git a/alc/backends/base.h b/alc/backends/base.h
index f38c1d45..70f96275 100644
--- a/alc/backends/base.h
+++ b/alc/backends/base.h
@@ -52,12 +52,6 @@ enum class BackendType {
};
-/* Helper to get the current clock time from the device's ClockBase, and
- * SamplesDone converted from the sample rate.
- */
-inline std::chrono::nanoseconds GetDeviceClockTime(const DeviceBase *device) noexcept
-{ return device->getClockTime(); }
-
/* Helper to get the device latency from the backend, including any fixed
* latency from post-processing.
*/
diff --git a/alc/backends/jack.cpp b/alc/backends/jack.cpp
index a0a5c440..4999a738 100644
--- a/alc/backends/jack.cpp
+++ b/alc/backends/jack.cpp
@@ -657,7 +657,7 @@ ClockLatency JackPlayback::getClockLatency()
ClockLatency ret;
std::lock_guard<std::mutex> _{mMutex};
- ret.ClockTime = GetDeviceClockTime(mDevice);
+ ret.ClockTime = mDevice->getClockTime();
ret.Latency = std::chrono::seconds{mRing ? mRing->readSpace() : mDevice->UpdateSize};
ret.Latency /= mDevice->Frequency;
diff --git a/alc/backends/opensl.cpp b/alc/backends/opensl.cpp
index 61e3c9a7..32745edd 100644
--- a/alc/backends/opensl.cpp
+++ b/alc/backends/opensl.cpp
@@ -631,7 +631,7 @@ ClockLatency OpenSLPlayback::getClockLatency()
ClockLatency ret;
std::lock_guard<std::mutex> _{mMutex};
- ret.ClockTime = GetDeviceClockTime(mDevice);
+ ret.ClockTime = mDevice->getClockTime();
ret.Latency = std::chrono::seconds{mRing->readSpace() * mDevice->UpdateSize};
ret.Latency /= mDevice->Frequency;
diff --git a/alc/backends/pipewire.cpp b/alc/backends/pipewire.cpp
index 6a001d7a..e2f32758 100644
--- a/alc/backends/pipewire.cpp
+++ b/alc/backends/pipewire.cpp
@@ -1590,7 +1590,7 @@ bool PipeWirePlayback::reset()
}
mStreamListener = {};
mRateMatch = nullptr;
- mTimeBase = GetDeviceClockTime(mDevice);
+ mTimeBase = mDevice->getClockTime();
/* If connecting to a specific device, update various device parameters to
* match its format.
@@ -1824,7 +1824,7 @@ ClockLatency PipeWirePlayback::getClockLatency()
uint refcount;
do {
refcount = mDevice->waitForMix();
- mixtime = GetDeviceClockTime(mDevice);
+ mixtime = mDevice->getClockTime();
clock_gettime(CLOCK_MONOTONIC, &tspec);
std::atomic_thread_fence(std::memory_order_acquire);
} while(refcount != ReadRef(mDevice->MixCount));
diff --git a/alc/backends/pulseaudio.cpp b/alc/backends/pulseaudio.cpp
index bebc182d..2f0e7a84 100644
--- a/alc/backends/pulseaudio.cpp
+++ b/alc/backends/pulseaudio.cpp
@@ -1034,7 +1034,7 @@ ClockLatency PulsePlayback::getClockLatency()
{
MainloopUniqueLock plock{mMainloop};
- ret.ClockTime = GetDeviceClockTime(mDevice);
+ ret.ClockTime = mDevice->getClockTime();
err = pa_stream_get_latency(mStream, &latency, &neg);
}
@@ -1362,7 +1362,7 @@ ClockLatency PulseCapture::getClockLatency()
{
MainloopUniqueLock plock{mMainloop};
- ret.ClockTime = GetDeviceClockTime(mDevice);
+ ret.ClockTime = mDevice->getClockTime();
err = pa_stream_get_latency(mStream, &latency, &neg);
}
diff --git a/alc/backends/wasapi.cpp b/alc/backends/wasapi.cpp
index 3ee98457..436ee402 100644
--- a/alc/backends/wasapi.cpp
+++ b/alc/backends/wasapi.cpp
@@ -2072,7 +2072,7 @@ ClockLatency WasapiPlayback::getClockLatency()
ClockLatency ret;
std::lock_guard<std::mutex> _{mMutex};
- ret.ClockTime = GetDeviceClockTime(mDevice);
+ ret.ClockTime = mDevice->getClockTime();
ret.Latency = seconds{mPadding.load(std::memory_order_relaxed)};
ret.Latency /= mFormat.Format.nSamplesPerSec;
if(mResampler)