update wavesaudio backend, now supports Windows (ASIO) as well as OS X (CoreAudio)
[ardour.git] / libs / backends / wavesaudio / wavesapi / miscutils / UMicroseconds.cpp
index e3de7155087ab819ffc5bdc16b86d2b843b08bd4..a644b61c92cd6339414ab06909cdc3d80687b41d 100644 (file)
@@ -1,87 +1,69 @@
-/*
-    Copyright (C) 2013 Waves Audio Ltd.
+#ifdef _WINDOWS
+    #include "IncludeWindows.h"
+#endif
+#if defined(__linux__) || defined(__MACOS__)
+       #include <sys/time.h>
+#endif
+
+#include "UMicroseconds.h"
+
+namespace wvNS { 
+UMicroseconds& UMicroseconds::ReadTime()
+{
+#ifdef _WINDOWS
+       LARGE_INTEGER Frequency, Count ;
 
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
+       QueryPerformanceFrequency(&Frequency) ;
+       QueryPerformanceCounter(&Count);
+       theTime = uint64_t((Count.QuadPart * 1000000.0 / Frequency.QuadPart));
+#endif
 
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
+#if defined(__linux__) || defined(__MACOS__)
+//     Mac code replaced by posix calls, to reduce Carbon dependency. 
+       timeval buf;
 
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+       gettimeofday(&buf,NULL);
 
+       // micro sec
+       theTime = uint64_t(buf.tv_sec) * 1000*1000 + buf.tv_usec;
+#endif
+
+       return *this;
+}
+/*
+ Removed in favor of the posix implementation. 
+#ifdef __MACOS__
+       uint32_t UMicroseconds::hi() {return reinterpret_cast<UnsignedWide*>(&theTime)->hi;}
+       uint32_t UMicroseconds::lo() {return reinterpret_cast<UnsignedWide*>(&theTime)->lo;}
+#endif
 */
-#ifdef _WINDOWS\r
-    #include "IncludeWindows.h"\r
-#endif\r
-#if defined(__linux__) || defined(__MACOS__)\r
-       #include <sys/time.h>\r
-#endif\r
-\r
-#include "UMicroseconds.h"\r
-\r
-namespace wvNS { \r
-UMicroseconds& UMicroseconds::ReadTime()\r
-{\r
-#ifdef _WINDOWS\r
-       LARGE_INTEGER Frequency, Count ;\r
-\r
-       QueryPerformanceFrequency(&Frequency) ;\r
-       QueryPerformanceCounter(&Count);\r
-       theTime = uint64_t((Count.QuadPart * 1000000.0 / Frequency.QuadPart));\r
-#endif\r
-\r
-#if defined(__linux__) || defined(__MACOS__)\r
-//     Mac code replaced by posix calls, to reduce Carbon dependency. \r
-       timeval buf;\r
-\r
-       gettimeofday(&buf,NULL);\r
-\r
-       // micro sec\r
-       theTime = uint64_t(buf.tv_sec) * 1000*1000 + buf.tv_usec;\r
-#endif\r
-\r
-       return *this;\r
-}\r
-/*\r
- Removed in favor of the posix implementation. \r
-#ifdef __MACOS__\r
-       uint32_t UMicroseconds::hi() {return reinterpret_cast<UnsignedWide*>(&theTime)->hi;}\r
-       uint32_t UMicroseconds::lo() {return reinterpret_cast<UnsignedWide*>(&theTime)->lo;}\r
-#endif\r
-*/\r
-void UMicrosecondsAccumulator::Start()\r
-{\r
-       m_start_time.ReadTime();\r
-}\r
-\r
-void UMicrosecondsAccumulator::Stop()\r
-{\r
-       UMicroseconds stop_time;\r
-       \r
-       m_accumulator += stop_time.GetNativeTime() - m_start_time.GetNativeTime();\r
-}\r
-\r
-void UMicrosecondsAccumulator::Clear()\r
-{\r
-       m_start_time = 0;\r
-       m_accumulator = 0;\r
-}\r
-\r
-UMicroseconds UMicrosecondsAccumulator::GetAccumulatedTime() const\r
-{\r
-       return m_accumulator;\r
-}\r
-\r
-UMicrosecondsAccumulator& UMicrosecondsAccumulator::operator+=(const UMicrosecondsAccumulator& inaccum_to_add)\r
-{\r
-       m_accumulator += inaccum_to_add.GetAccumulatedTime();\r
-       return *this;\r
-}\r
-       \r
-} // namespace wvNS { \r
+void UMicrosecondsAccumulator::Start()
+{
+       m_start_time.ReadTime();
+}
+
+void UMicrosecondsAccumulator::Stop()
+{
+       UMicroseconds stop_time;
+       
+       m_accumulator += stop_time.GetNativeTime() - m_start_time.GetNativeTime();
+}
+
+void UMicrosecondsAccumulator::Clear()
+{
+       m_start_time = 0;
+       m_accumulator = 0;
+}
+
+UMicroseconds UMicrosecondsAccumulator::GetAccumulatedTime() const
+{
+       return m_accumulator;
+}
+
+UMicrosecondsAccumulator& UMicrosecondsAccumulator::operator+=(const UMicrosecondsAccumulator& inaccum_to_add)
+{
+       m_accumulator += inaccum_to_add.GetAccumulatedTime();
+       return *this;
+}
+       
+} // namespace wvNS {