diff options
Diffstat (limited to 'alc')
-rw-r--r-- | alc/backends/base.cpp | 10 | ||||
-rw-r--r-- | alc/backends/base.h | 38 |
2 files changed, 24 insertions, 24 deletions
diff --git a/alc/backends/base.cpp b/alc/backends/base.cpp index 3a05cb2b..01cc5213 100644 --- a/alc/backends/base.cpp +++ b/alc/backends/base.cpp @@ -14,16 +14,6 @@ #include "atomic.h" -ClockLatency GetClockLatency(ALCdevice *device) -{ - BackendBase *backend{device->Backend.get()}; - ClockLatency ret{backend->getClockLatency()}; - ret.Latency += device->FixedLatency; - return ret; -} - - -/* BackendBase method implementations. */ bool BackendBase::reset() { throw al::backend_exception{ALC_INVALID_DEVICE, "Invalid BackendBase call"}; } diff --git a/alc/backends/base.h b/alc/backends/base.h index 839fc424..07200e0e 100644 --- a/alc/backends/base.h +++ b/alc/backends/base.h @@ -17,20 +17,6 @@ struct ClockLatency { std::chrono::nanoseconds Latency; }; -/* Helper to get the current clock time from the device's ClockBase, and - * SamplesDone converted from the sample rate. - */ -inline std::chrono::nanoseconds GetDeviceClockTime(ALCdevice *device) -{ - using std::chrono::seconds; - using std::chrono::nanoseconds; - - auto ns = nanoseconds{seconds{device->SamplesDone}} / device->Frequency; - return device->ClockBase + ns; -} - -ClockLatency GetClockLatency(ALCdevice *device); - struct BackendBase { virtual void open(const ALCchar *name) = 0; @@ -56,6 +42,30 @@ 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(ALCdevice *device) +{ + using std::chrono::seconds; + using std::chrono::nanoseconds; + + auto ns = nanoseconds{seconds{device->SamplesDone}} / device->Frequency; + return device->ClockBase + ns; +} + +/* Helper to get the device latency from the backend, including any fixed + * latency from post-processing. + */ +inline ClockLatency GetClockLatency(ALCdevice *device) +{ + BackendBase *backend{device->Backend.get()}; + ClockLatency ret{backend->getClockLatency()}; + ret.Latency += device->FixedLatency; + return ret; +} + + struct BackendFactory { virtual bool init() = 0; |