From: <man...@us...> - 2013-10-26 08:41:35
|
Revision: 3032 http://sourceforge.net/p/modplug/code/3032 Author: manxorist Date: 2013-10-26 08:41:27 +0000 (Sat, 26 Oct 2013) Log Message: ----------- [Ref] sounddev: Make some functions and variable names more clear. Modified Paths: -------------- trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/sounddev/SoundDevice.cpp trunk/OpenMPT/sounddev/SoundDevice.h trunk/OpenMPT/sounddev/SoundDevicePortAudio.cpp trunk/OpenMPT/sounddev/SoundDevicePortAudio.h trunk/OpenMPT/sounddev/SoundDeviceWaveout.cpp trunk/OpenMPT/sounddev/SoundDeviceWaveout.h Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2013-10-26 07:42:58 UTC (rev 3031) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2013-10-26 08:41:27 UTC (rev 3032) @@ -654,7 +654,7 @@ int64 currenttotalsamples = 0; if(gpSoundDevice) { - currenttotalsamples = gpSoundDevice->GetStreamPositionSamples(); + currenttotalsamples = gpSoundDevice->GetStreamPositionFrames(); } { // advance to the newest notification, drop the obsolete ones Modified: trunk/OpenMPT/sounddev/SoundDevice.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDevice.cpp 2013-10-26 07:42:58 UTC (rev 3031) +++ trunk/OpenMPT/sounddev/SoundDevice.cpp 2013-10-26 08:41:27 UTC (rev 3032) @@ -43,8 +43,8 @@ m_RealUpdateIntervalMS = static_cast<float>(m_Settings.UpdateIntervalMS); m_IsPlaying = false; - m_FramesStreamRenderPosition = 0; - m_FramesStreamOutputPosition = 0; + m_StreamPositionRenderFrames = 0; + m_StreamPositionOutputFrames = 0; } @@ -155,9 +155,9 @@ int64 framesRendered = 0; { Util::lock_guard<Util::mutex> lock(m_StreamPositionMutex); - m_FramesStreamRenderPosition += numFrames; - m_FramesStreamOutputPosition = m_FramesStreamRenderPosition - framesLatency; - framesRendered = m_FramesStreamRenderPosition; + m_StreamPositionRenderFrames += numFrames; + m_StreamPositionOutputFrames = m_StreamPositionRenderFrames - framesLatency; + framesRendered = m_StreamPositionRenderFrames; } m_Source->AudioDone(m_Settings, numFrames, framesRendered); } @@ -181,8 +181,8 @@ { { Util::lock_guard<Util::mutex> lock(m_StreamPositionMutex); - m_FramesStreamRenderPosition = 0; - m_FramesStreamOutputPosition = 0; + m_StreamPositionRenderFrames = 0; + m_StreamPositionOutputFrames = 0; } InternalStart(); m_IsPlaying = true; @@ -200,24 +200,24 @@ m_IsPlaying = false; { Util::lock_guard<Util::mutex> lock(m_StreamPositionMutex); - m_FramesStreamRenderPosition = 0; - m_FramesStreamOutputPosition = 0; + m_StreamPositionRenderFrames = 0; + m_StreamPositionOutputFrames = 0; } } } -int64 ISoundDevice::GetStreamPositionSamples() const +int64 ISoundDevice::GetStreamPositionFrames() const //-------------------------------------------------- { if(!IsOpen()) return 0; if(InternalHasGetStreamPosition()) { - return InternalGetStreamPositionSamples(); + return InternalGetStreamPositionFrames(); } else { Util::lock_guard<Util::mutex> lock(m_StreamPositionMutex); - return m_FramesStreamOutputPosition; + return m_StreamPositionOutputFrames; } } Modified: trunk/OpenMPT/sounddev/SoundDevice.h =================================================================== --- trunk/OpenMPT/sounddev/SoundDevice.h 2013-10-26 07:42:58 UTC (rev 3031) +++ trunk/OpenMPT/sounddev/SoundDevice.h 2013-10-26 08:41:27 UTC (rev 3032) @@ -234,8 +234,8 @@ bool m_IsPlaying; mutable Util::mutex m_StreamPositionMutex; - int64 m_FramesStreamRenderPosition; - int64 m_FramesStreamOutputPosition; + int64 m_StreamPositionRenderFrames; + int64 m_StreamPositionOutputFrames; protected: virtual void FillAudioBuffer() = 0; @@ -273,14 +273,14 @@ virtual void InternalStop() = 0; virtual bool InternalClose() = 0; virtual bool InternalHasGetStreamPosition() const { return false; } - virtual int64 InternalGetStreamPositionSamples() const { return 0; } + virtual int64 InternalGetStreamPositionFrames() const { return 0; } public: bool Open(const SoundDeviceSettings &settings); bool Close(); void Start(); void Stop(); - int64 GetStreamPositionSamples() const; + int64 GetStreamPositionFrames() const; SampleFormat GetActualSampleFormat() { return IsOpen() ? m_Settings.sampleFormat : SampleFormatInvalid; } virtual bool IsOpen() const = 0; virtual UINT GetNumBuffers() { return 0; } Modified: trunk/OpenMPT/sounddev/SoundDevicePortAudio.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDevicePortAudio.cpp 2013-10-26 07:42:58 UTC (rev 3031) +++ trunk/OpenMPT/sounddev/SoundDevicePortAudio.cpp 2013-10-26 08:41:27 UTC (rev 3032) @@ -135,7 +135,7 @@ } -int64 CPortaudioDevice::InternalGetStreamPositionSamples() const +int64 CPortaudioDevice::InternalGetStreamPositionFrames() const //-------------------------------------------------------------- { if(Pa_IsStreamActive(m_Stream) != 1) return 0; Modified: trunk/OpenMPT/sounddev/SoundDevicePortAudio.h =================================================================== --- trunk/OpenMPT/sounddev/SoundDevicePortAudio.h 2013-10-26 07:42:58 UTC (rev 3031) +++ trunk/OpenMPT/sounddev/SoundDevicePortAudio.h 2013-10-26 08:41:27 UTC (rev 3032) @@ -52,7 +52,7 @@ UINT GetNumBuffers() { return 1; } float GetCurrentRealLatencyMS(); bool InternalHasGetStreamPosition() const { return false; } - int64 InternalGetStreamPositionSamples() const; + int64 InternalGetStreamPositionFrames() const; SoundDeviceCaps GetDeviceCaps(const std::vector<uint32> &baseSampleRates); int StreamCallback( Modified: trunk/OpenMPT/sounddev/SoundDeviceWaveout.cpp =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceWaveout.cpp 2013-10-26 07:42:58 UTC (rev 3031) +++ trunk/OpenMPT/sounddev/SoundDeviceWaveout.cpp 2013-10-26 08:41:27 UTC (rev 3032) @@ -100,6 +100,7 @@ return true; } + bool CWaveDevice::InternalClose() //------------------------------- { @@ -183,7 +184,7 @@ } -int64 CWaveDevice::InternalGetStreamPositionSamples() const +int64 CWaveDevice::InternalGetStreamPositionFrames() const //--------------------------------------------------------- { MMTIME mmtime; Modified: trunk/OpenMPT/sounddev/SoundDeviceWaveout.h =================================================================== --- trunk/OpenMPT/sounddev/SoundDeviceWaveout.h 2013-10-26 07:42:58 UTC (rev 3031) +++ trunk/OpenMPT/sounddev/SoundDeviceWaveout.h 2013-10-26 08:41:27 UTC (rev 3032) @@ -48,7 +48,7 @@ UINT GetNumBuffers() { return m_nPreparedHeaders; } float GetCurrentRealLatencyMS() { return InterlockedExchangeAdd(&m_nBuffersPending, 0) * m_nWaveBufferSize * 1000.0f / m_Settings.GetBytesPerSecond(); } bool InternalHasGetStreamPosition() const { return true; } - int64 InternalGetStreamPositionSamples() const; + int64 InternalGetStreamPositionFrames() const; public: static void CALLBACK WaveOutCallBack(HWAVEOUT, UINT uMsg, DWORD_PTR, DWORD_PTR dw1, DWORD_PTR dw2); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |