aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends
diff options
context:
space:
mode:
Diffstat (limited to 'Alc/backends')
-rw-r--r--Alc/backends/base.cpp2
-rw-r--r--Alc/backends/base.h11
2 files changed, 10 insertions, 3 deletions
diff --git a/Alc/backends/base.cpp b/Alc/backends/base.cpp
index f3a4c60e..1839d353 100644
--- a/Alc/backends/base.cpp
+++ b/Alc/backends/base.cpp
@@ -18,7 +18,7 @@ void ALCdevice_Unlock(ALCdevice *device)
ClockLatency GetClockLatency(ALCdevice *device)
{
ClockLatency ret = V0(device->Backend,getClockLatency)();
- ret.Latency += device->FixedLatency;
+ ret.Latency += device->FixedLatency.count();
return ret;
}
diff --git a/Alc/backends/base.h b/Alc/backends/base.h
index 61b71a47..db2127ef 100644
--- a/Alc/backends/base.h
+++ b/Alc/backends/base.h
@@ -7,6 +7,9 @@
#include <mutex>
struct ClockLatency {
+ /* FIXME: These should be nanoseconds. Will require changing backends that
+ * provide this info.
+ */
ALint64 ClockTime;
ALint64 Latency;
};
@@ -16,8 +19,12 @@ struct ClockLatency {
*/
inline ALuint64 GetDeviceClockTime(ALCdevice *device)
{
- return device->ClockBase + (device->SamplesDone * DEVICE_CLOCK_RES /
- device->Frequency);
+ using std::chrono::seconds;
+ using std::chrono::nanoseconds;
+ using std::chrono::duration_cast;
+
+ auto ns = duration_cast<nanoseconds>(seconds{device->SamplesDone}) / device->Frequency;
+ return (device->ClockBase + ns).count();
}
void ALCdevice_Lock(ALCdevice *device);