Use PBD::get_microseconds() from pbd/windows_timer_utils.h in DummyBackend
authorTim Mayberry <mojofunk@gmail.com>
Mon, 14 Sep 2015 10:44:27 +0000 (20:44 +1000)
committerTim Mayberry <mojofunk@gmail.com>
Wed, 16 Sep 2015 01:22:17 +0000 (11:22 +1000)
libs/backends/dummy/dummy_audiobackend.cc

index 25ace782f7cf4c1d56a4499ec4596bae6523ba49..7c45ad818687116c62cd56b3223df116f3e6f830 100644 (file)
@@ -25,6 +25,7 @@
 
 #ifdef PLATFORM_WINDOWS
 #include <windows.h>
+#include <pbd/windows_timer_utils.h>
 #endif
 
 #include "dummy_audiobackend.h"
@@ -43,20 +44,9 @@ std::vector<AudioBackend::DeviceStatus> DummyAudioBackend::_device_status;
 
 std::vector<DummyAudioBackend::DriverSpeed> DummyAudioBackend::_driver_speed;
 
-#ifdef PLATFORM_WINDOWS
-static double _win_pc_rate = 0; // usec per tick
-#endif
-
 static int64_t _x_get_monotonic_usec() {
 #ifdef PLATFORM_WINDOWS
-       if (_win_pc_rate > 0) {
-               LARGE_INTEGER Count;
-               // not very reliable, but the only realistic way for sub milli-seconds
-               if (QueryPerformanceCounter (&Count)) {
-                       return (int64_t) (Count.QuadPart * _win_pc_rate);
-               }
-               return -1;
-       }
+       return PBD::get_microseconds();
 #endif
        return g_get_monotonic_time();
 }
@@ -1384,14 +1374,6 @@ static int
 instantiate (const std::string& arg1, const std::string& /* arg2 */)
 {
        s_instance_name = arg1;
-#ifdef PLATFORM_WINDOWS
-       LARGE_INTEGER Frequency;
-       if (!QueryPerformanceFrequency(&Frequency) || Frequency.QuadPart < 1) {
-               _win_pc_rate = 0;
-       } else {
-               _win_pc_rate = 1000000.0 / Frequency.QuadPart;
-       }
-#endif
        return 0;
 }