diff options
author | Chris Robinson <[email protected]> | 2020-03-30 16:06:34 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-03-30 16:06:34 -0700 |
commit | b9f19c6ca27c7363aa82b1cf0970d137d4e450ea (patch) | |
tree | fe5cacf38cf7bf6c2a62ba1c07e6243894be4b6b | |
parent | 662d77159bf9b24b9ef48717547a6d454551bc43 (diff) |
Inline a small helper method
-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; |