From: <man...@us...> - 2013-11-21 16:44:44
|
Revision: 3283 http://sourceforge.net/p/modplug/code/3283 Author: manxorist Date: 2013-11-21 16:44:35 +0000 (Thu, 21 Nov 2013) Log Message: ----------- [Ref] sounddev: Small cleanups. Modified Paths: -------------- trunk/OpenMPT/common/misc_util.cpp trunk/OpenMPT/common/misc_util.h trunk/OpenMPT/mptrack/TrackerSettings.cpp trunk/OpenMPT/sounddev/SoundDevice.cpp trunk/OpenMPT/sounddev/SoundDevice.h Modified: trunk/OpenMPT/common/misc_util.cpp =================================================================== --- trunk/OpenMPT/common/misc_util.cpp 2013-11-21 00:51:53 UTC (rev 3282) +++ trunk/OpenMPT/common/misc_util.cpp 2013-11-21 16:44:35 UTC (rev 3283) @@ -159,6 +159,11 @@ return timeGetTime(); } +uint64 MultimediaClock::NowNanoseconds() const +{ + return (uint64)timeGetTime() * (uint64)1000000; +} + } // namespace Util #endif // MODPLUG_TRACKER Modified: trunk/OpenMPT/common/misc_util.h =================================================================== --- trunk/OpenMPT/common/misc_util.h 2013-11-21 00:51:53 UTC (rev 3282) +++ trunk/OpenMPT/common/misc_util.h 2013-11-21 16:44:35 UTC (rev 3283) @@ -547,6 +547,10 @@ // The epoch (offset) of the timestamps is undefined but constant until the next system reboot. // The resolution is the value returned from GetResolution(). uint32 Now() const; + // Returns current instantaneous timestamp in nanoseconds. + // The epoch (offset) of the timestamps is undefined but constant until the next system reboot. + // The resolution is the value returned from GetResolution() in milliseconds. + uint64 NowNanoseconds() const; }; } // namespace Util Modified: trunk/OpenMPT/mptrack/TrackerSettings.cpp =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.cpp 2013-11-21 00:51:53 UTC (rev 3282) +++ trunk/OpenMPT/mptrack/TrackerSettings.cpp 2013-11-21 16:44:35 UTC (rev 3283) @@ -14,7 +14,6 @@ #include "Moddoc.h" #include "Mainfrm.h" #include "../sounddev/SoundDevice.h" -#include "../sounddev/SoundDeviceASIO.h" #include "../common/version.h" #include "UpdateCheck.h" #include "Mpdlgs.h" Modified: trunk/OpenMPT/sounddev/SoundDevice.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDevice.cpp 2013-11-21 00:51:53 UTC (rev 3282) +++ trunk/OpenMPT/sounddev/SoundDevice.cpp 2013-11-21 16:44:35 UTC (rev 3283) @@ -167,7 +167,7 @@ { SoundTimeInfo timeInfo; timeInfo.StreamFrames = InternalHasGetStreamPosition(); - timeInfo.SystemTimestamp = m_Clock.Now() * (uint64)1000 * (uint64)1000; + timeInfo.SystemTimestamp = Clock().NowNanoseconds(); timeInfo.Speed = 1.0; UpdateTimeInfo(timeInfo); } else @@ -177,7 +177,7 @@ Util::lock_guard<Util::mutex> lock(m_StreamPositionMutex); timeInfo.StreamFrames = m_StreamPositionRenderFrames + numFrames; } - timeInfo.SystemTimestamp = m_Clock.Now() * (uint64)1000 * (uint64)1000 + Util::Round<int64>(m_BufferAttributes.Latency * 1000.0 * 1000.0 * 1000.0); + timeInfo.SystemTimestamp = Clock().NowNanoseconds() + Util::Round<int64>(m_BufferAttributes.Latency * 1000000000.0); timeInfo.Speed = 1.0; UpdateTimeInfo(timeInfo); } Modified: trunk/OpenMPT/sounddev/SoundDevice.h =================================================================== --- trunk/OpenMPT/sounddev/SoundDevice.h 2013-11-21 00:51:53 UTC (rev 3282) +++ trunk/OpenMPT/sounddev/SoundDevice.h 2013-11-21 16:44:35 UTC (rev 3283) @@ -291,6 +291,8 @@ bool FillWaveFormatExtensible(WAVEFORMATEXTENSIBLE &WaveFormat); + const Util::MultimediaClock & Clock() const { return m_Clock; } + void UpdateBufferAttributes(SoundBufferAttributes attributes); void UpdateTimeInfo(SoundTimeInfo timeInfo); @@ -335,6 +337,7 @@ SampleFormat GetActualSampleFormat() const { return IsOpen() ? m_Settings.sampleFormat : SampleFormatInvalid; } SoundBufferAttributes GetBufferAttributes() const { return m_BufferAttributes; } + SoundTimeInfo GetTimeInfo() const { return m_TimeInfo; } // Informational only, do not use for timing. // Use GetStreamPositionFrames() for timing This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |