From f75a281c186bda9cc737956ac5f54764317e8c1e Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 13 Dec 2006 09:10:08 +0000 Subject: [PATCH] GetPosition(pSound) -> GetPosition(); one hardware sound position per driver --- stepmania/src/RageSoundManager.cpp | 2 +- stepmania/src/arch/Sound/RageSoundDriver.h | 6 +++--- .../src/arch/Sound/RageSoundDriver_ALSA9_Software.cpp | 2 +- stepmania/src/arch/Sound/RageSoundDriver_ALSA9_Software.h | 2 +- stepmania/src/arch/Sound/RageSoundDriver_AU.cpp | 2 +- stepmania/src/arch/Sound/RageSoundDriver_AU.h | 2 +- stepmania/src/arch/Sound/RageSoundDriver_CA.cpp | 2 +- stepmania/src/arch/Sound/RageSoundDriver_CA.h | 2 +- .../src/arch/Sound/RageSoundDriver_DSound_Software.cpp | 2 +- .../src/arch/Sound/RageSoundDriver_DSound_Software.h | 2 +- stepmania/src/arch/Sound/RageSoundDriver_Null.cpp | 8 ++++---- stepmania/src/arch/Sound/RageSoundDriver_Null.h | 2 +- stepmania/src/arch/Sound/RageSoundDriver_OSS.cpp | 4 ++-- stepmania/src/arch/Sound/RageSoundDriver_OSS.h | 2 +- stepmania/src/arch/Sound/RageSoundDriver_WDMKS.cpp | 4 ++-- stepmania/src/arch/Sound/RageSoundDriver_WDMKS.h | 2 +- stepmania/src/arch/Sound/RageSoundDriver_WaveOut.cpp | 4 ++-- stepmania/src/arch/Sound/RageSoundDriver_WaveOut.h | 2 +- 18 files changed, 26 insertions(+), 26 deletions(-) diff --git a/stepmania/src/RageSoundManager.cpp b/stepmania/src/RageSoundManager.cpp index d6897ecb9c..b805d8d9ca 100644 --- a/stepmania/src/RageSoundManager.cpp +++ b/stepmania/src/RageSoundManager.cpp @@ -108,7 +108,7 @@ int64_t RageSoundManager::GetPosition( const RageSoundBase *pSound ) const { if( m_pDriver == NULL ) return 0; - return m_pDriver->GetPosition( pSound ); + return m_pDriver->GetPosition(); } void RageSoundManager::Update() diff --git a/stepmania/src/arch/Sound/RageSoundDriver.h b/stepmania/src/arch/Sound/RageSoundDriver.h index bb0a6f32f1..51c6679798 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver.h +++ b/stepmania/src/arch/Sound/RageSoundDriver.h @@ -30,9 +30,9 @@ public: * playing the sound, either). */ virtual bool PauseMixing( RageSoundBase *snd, bool bStop ) = 0; - /* Get the current position of a given buffer, in the same units and time base - * as passed to RageSound::GetPCM. */ - virtual int64_t GetPosition( const RageSoundBase *snd ) const = 0; + /* Get the current hardware frame position, in the same time base as passed to + * RageSound::CommitPlayingPosition. */ + virtual int64_t GetPosition() const = 0; /* When a sound is finished playing (GetPCM returns less than requested) and * the sound has been completely flushed (so GetPosition is no longer meaningful), diff --git a/stepmania/src/arch/Sound/RageSoundDriver_ALSA9_Software.cpp b/stepmania/src/arch/Sound/RageSoundDriver_ALSA9_Software.cpp index 0e5977d0c5..39b6ebd862 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_ALSA9_Software.cpp +++ b/stepmania/src/arch/Sound/RageSoundDriver_ALSA9_Software.cpp @@ -67,7 +67,7 @@ bool RageSoundDriver_ALSA9_Software::GetData() } -int64_t RageSoundDriver_ALSA9_Software::GetPosition( const RageSoundBase *pSound ) const +int64_t RageSoundDriver_ALSA9_Software::GetPosition() const { return m_pPCM->GetPosition(); } diff --git a/stepmania/src/arch/Sound/RageSoundDriver_ALSA9_Software.h b/stepmania/src/arch/Sound/RageSoundDriver_ALSA9_Software.h index a70c6e6248..f03c1366c1 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_ALSA9_Software.h +++ b/stepmania/src/arch/Sound/RageSoundDriver_ALSA9_Software.h @@ -15,7 +15,7 @@ public: RString Init(); /* virtuals: */ - int64_t GetPosition( const RageSoundBase *pSound ) const; + int64_t GetPosition() const; float GetPlayLatency() const; int GetSampleRate( int iRate ) const { return m_iSampleRate; } diff --git a/stepmania/src/arch/Sound/RageSoundDriver_AU.cpp b/stepmania/src/arch/Sound/RageSoundDriver_AU.cpp index 1b61e85cee..c3e14469ba 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_AU.cpp +++ b/stepmania/src/arch/Sound/RageSoundDriver_AU.cpp @@ -184,7 +184,7 @@ RageSoundDriver_AU::~RageSoundDriver_AU() delete m_pNotificationThread; } -int64_t RageSoundDriver_AU::GetPosition( const RageSoundBase *sound ) const +int64_t RageSoundDriver_AU::GetPosition() const { double scale = m_iSampleRate / AudioGetHostClockFrequency(); return int64_t( scale * AudioGetCurrentHostTime() ); diff --git a/stepmania/src/arch/Sound/RageSoundDriver_AU.h b/stepmania/src/arch/Sound/RageSoundDriver_AU.h index 169dd523cd..287da2d391 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_AU.h +++ b/stepmania/src/arch/Sound/RageSoundDriver_AU.h @@ -13,7 +13,7 @@ public: ~RageSoundDriver_AU(); float GetPlayLatency() const; int GetSampleRate( int rate ) const { return m_iSampleRate; } - int64_t GetPosition( const RageSoundBase *sound ) const; + int64_t GetPosition() const; protected: void SetupDecodingThread(); diff --git a/stepmania/src/arch/Sound/RageSoundDriver_CA.cpp b/stepmania/src/arch/Sound/RageSoundDriver_CA.cpp index 489baad560..c165f75a47 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_CA.cpp +++ b/stepmania/src/arch/Sound/RageSoundDriver_CA.cpp @@ -373,7 +373,7 @@ void RageSoundDriver_CA::RemoveListeners() } } -int64_t RageSoundDriver_CA::GetPosition( const RageSoundBase *sound ) const +int64_t RageSoundDriver_CA::GetPosition() const { AudioTimeStamp time; OSStatus error; diff --git a/stepmania/src/arch/Sound/RageSoundDriver_CA.h b/stepmania/src/arch/Sound/RageSoundDriver_CA.h index 09169dc8f7..8076e5144a 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_CA.h +++ b/stepmania/src/arch/Sound/RageSoundDriver_CA.h @@ -17,7 +17,7 @@ public: ~RageSoundDriver_CA(); float GetPlayLatency() const { return m_fLatency; } int GetSampleRate( int rate ) const { return m_iSampleRate; } - int64_t GetPosition( const RageSoundBase *sound ) const; + int64_t GetPosition() const; void SetupDecodingThread(); private: diff --git a/stepmania/src/arch/Sound/RageSoundDriver_DSound_Software.cpp b/stepmania/src/arch/Sound/RageSoundDriver_DSound_Software.cpp index e391581732..65226878b4 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_DSound_Software.cpp +++ b/stepmania/src/arch/Sound/RageSoundDriver_DSound_Software.cpp @@ -60,7 +60,7 @@ void RageSoundDriver_DSound_Software::MixerThread() m_pPCM->Stop(); } -int64_t RageSoundDriver_DSound_Software::GetPosition( const RageSoundBase *pSound ) const +int64_t RageSoundDriver_DSound_Software::GetPosition() const { return m_pPCM->GetPosition(); } diff --git a/stepmania/src/arch/Sound/RageSoundDriver_DSound_Software.h b/stepmania/src/arch/Sound/RageSoundDriver_DSound_Software.h index 37a79895f9..424c19ca77 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_DSound_Software.h +++ b/stepmania/src/arch/Sound/RageSoundDriver_DSound_Software.h @@ -12,7 +12,7 @@ public: virtual ~RageSoundDriver_DSound_Software(); RString Init(); - int64_t GetPosition( const RageSoundBase *pSound ) const; + int64_t GetPosition() const; float GetPlayLatency() const; int GetSampleRate( int rate ) const; diff --git a/stepmania/src/arch/Sound/RageSoundDriver_Null.cpp b/stepmania/src/arch/Sound/RageSoundDriver_Null.cpp index 9c09e7a741..283770a273 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_Null.cpp +++ b/stepmania/src/arch/Sound/RageSoundDriver_Null.cpp @@ -11,17 +11,17 @@ const int channels = 2; void RageSoundDriver_Null::Update() { /* "Play" frames. */ - while( m_iLastCursorPos < GetPosition(NULL)+1024*4 ) + while( m_iLastCursorPos < GetPosition()+1024*4 ) { int16_t buf[256*channels]; - this->Mix( buf, 256, m_iLastCursorPos, GetPosition(NULL) ); + this->Mix( buf, 256, m_iLastCursorPos, GetPosition() ); m_iLastCursorPos += 256; } RageSound_Generic_Software::Update(); } -int64_t RageSoundDriver_Null::GetPosition( const RageSoundBase *snd ) const +int64_t RageSoundDriver_Null::GetPosition() const { return int64_t( RageTimer::GetTimeSinceStart() * m_iSampleRate ); } @@ -31,7 +31,7 @@ RageSoundDriver_Null::RageSoundDriver_Null() m_iSampleRate = PREFSMAN->m_iSoundPreferredSampleRate; if( m_iSampleRate == 0 ) m_iSampleRate = 44100; - m_iLastCursorPos = GetPosition( NULL ); + m_iLastCursorPos = GetPosition(); StartDecodeThread(); } diff --git a/stepmania/src/arch/Sound/RageSoundDriver_Null.h b/stepmania/src/arch/Sound/RageSoundDriver_Null.h index 35395ed3a8..87258bc8d7 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_Null.h +++ b/stepmania/src/arch/Sound/RageSoundDriver_Null.h @@ -7,7 +7,7 @@ class RageSoundDriver_Null: public RageSound_Generic_Software { public: RageSoundDriver_Null(); - int64_t GetPosition( const RageSoundBase *snd ) const; + int64_t GetPosition() const; int GetSampleRate( int iRate ) const; void Update(); diff --git a/stepmania/src/arch/Sound/RageSoundDriver_OSS.cpp b/stepmania/src/arch/Sound/RageSoundDriver_OSS.cpp index 1414124aa3..b3622c9acd 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_OSS.cpp +++ b/stepmania/src/arch/Sound/RageSoundDriver_OSS.cpp @@ -73,7 +73,7 @@ bool RageSoundDriver_OSS::GetData() if(!buf) buf = new int16_t[chunksize / sizeof(int16_t)]; - this->Mix( buf, chunksize/bytes_per_frame, last_cursor_pos, GetPosition( NULL ) ); + this->Mix( buf, chunksize/bytes_per_frame, last_cursor_pos, GetPosition() ); int wrote = write( fd, buf, chunksize ); if( wrote != chunksize ) @@ -87,7 +87,7 @@ bool RageSoundDriver_OSS::GetData() /* XXX: There's a race on last_cursor_pos here: new data might be written after the * ioctl returns, incrementing last_cursor_pos. */ -int64_t RageSoundDriver_OSS::GetPosition(const RageSoundBase *snd) const +int64_t RageSoundDriver_OSS::GetPosition() const { ASSERT( fd != -1 ); diff --git a/stepmania/src/arch/Sound/RageSoundDriver_OSS.h b/stepmania/src/arch/Sound/RageSoundDriver_OSS.h index aeaabf96b0..f99ace703c 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_OSS.h +++ b/stepmania/src/arch/Sound/RageSoundDriver_OSS.h @@ -24,7 +24,7 @@ public: int GetSampleRate( int rate ) const { return samplerate; } /* virtuals: */ - int64_t GetPosition( const RageSoundBase *snd ) const; + int64_t GetPosition() const; float GetPlayLatency() const; void SetupDecodingThread(); diff --git a/stepmania/src/arch/Sound/RageSoundDriver_WDMKS.cpp b/stepmania/src/arch/Sound/RageSoundDriver_WDMKS.cpp index 445bb79bf0..d4b2909791 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_WDMKS.cpp +++ b/stepmania/src/arch/Sound/RageSoundDriver_WDMKS.cpp @@ -1152,7 +1152,7 @@ void RageSoundDriver_WDMKS::Read( void *pData, int iFrames, int iLastCursorPos, bool RageSoundDriver_WDMKS::Fill( int iPacket, RString &sError ) { - uint64_t iCurrentFrame = GetPosition( NULL ); + uint64_t iCurrentFrame = GetPosition(); // if( iCurrentFrame == m_iLastCursorPos ) // LOG->Trace( "underrun" ); @@ -1246,7 +1246,7 @@ void RageSoundDriver_WDMKS::SetupDecodingThread() LOG->Warn( werr_ssprintf(GetLastError(), "Failed to set sound thread priority") ); } -int64_t RageSoundDriver_WDMKS::GetPosition( const RageSoundBase *pSound ) const +int64_t RageSoundDriver_WDMKS::GetPosition() const { KSAUDIO_POSITION pos; diff --git a/stepmania/src/arch/Sound/RageSoundDriver_WDMKS.h b/stepmania/src/arch/Sound/RageSoundDriver_WDMKS.h index 5abe244e08..16a1c88ea0 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_WDMKS.h +++ b/stepmania/src/arch/Sound/RageSoundDriver_WDMKS.h @@ -15,7 +15,7 @@ public: ~RageSoundDriver_WDMKS(); RString Init(); - int64_t GetPosition( const RageSoundBase *pSound ) const; + int64_t GetPosition() const; float GetPlayLatency() const; int GetSampleRate( int iRate ) const; diff --git a/stepmania/src/arch/Sound/RageSoundDriver_WaveOut.cpp b/stepmania/src/arch/Sound/RageSoundDriver_WaveOut.cpp index bbb7585ee3..3edc09f52c 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_WaveOut.cpp +++ b/stepmania/src/arch/Sound/RageSoundDriver_WaveOut.cpp @@ -70,7 +70,7 @@ bool RageSoundDriver_WaveOut::GetData() return false; /* Call the callback. */ - this->Mix( (int16_t *) m_aBuffers[b].lpData, chunksize_frames, m_iLastCursorPos, GetPosition( NULL ) ); + this->Mix( (int16_t *) m_aBuffers[b].lpData, chunksize_frames, m_iLastCursorPos, GetPosition() ); MMRESULT ret = waveOutWrite( m_hWaveOut, &m_aBuffers[b], sizeof(m_aBuffers[b]) ); if(ret != MMSYSERR_NOERROR) @@ -88,7 +88,7 @@ void RageSoundDriver_WaveOut::SetupDecodingThread() LOG->Warn( werr_ssprintf(GetLastError(), "Failed to set sound thread priority") ); } -int64_t RageSoundDriver_WaveOut::GetPosition( const RageSoundBase *pSound ) const +int64_t RageSoundDriver_WaveOut::GetPosition() const { MMTIME tm; tm.wType = TIME_SAMPLES; diff --git a/stepmania/src/arch/Sound/RageSoundDriver_WaveOut.h b/stepmania/src/arch/Sound/RageSoundDriver_WaveOut.h index 9ac7c661c3..6dde12e9a7 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_WaveOut.h +++ b/stepmania/src/arch/Sound/RageSoundDriver_WaveOut.h @@ -13,7 +13,7 @@ public: ~RageSoundDriver_WaveOut(); RString Init(); - int64_t GetPosition( const RageSoundBase *pSound ) const; + int64_t GetPosition() const; float GetPlayLatency() const; int GetSampleRate( int rate ) const { return m_iSampleRate; }