GetPosition(pSound) -> GetPosition(); one hardware sound position

per driver
This commit is contained in:
Glenn Maynard
2006-12-13 09:10:08 +00:00
parent fb9639f52c
commit f75a281c18
18 changed files with 26 additions and 26 deletions
+1 -1
View File
@@ -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()
+3 -3
View File
@@ -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),
@@ -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();
}
@@ -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; }
@@ -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() );
@@ -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();
@@ -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;
@@ -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:
@@ -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();
}
@@ -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;
@@ -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();
}
@@ -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();
@@ -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 );
@@ -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();
@@ -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;
@@ -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;
@@ -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;
@@ -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; }