From 4bd59b5a7b54f68360afe28ddb3f80148e285a0e Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 24 Oct 2005 02:42:56 +0000 Subject: [PATCH] cleanup --- .../Sound/RageSoundDriver_ALSA9_Software.cpp | 24 +++++++++---------- .../Sound/RageSoundDriver_ALSA9_Software.h | 19 +++++++-------- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/stepmania/src/arch/Sound/RageSoundDriver_ALSA9_Software.cpp b/stepmania/src/arch/Sound/RageSoundDriver_ALSA9_Software.cpp index bf1d540f5a..935dcea384 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_ALSA9_Software.cpp +++ b/stepmania/src/arch/Sound/RageSoundDriver_ALSA9_Software.cpp @@ -22,12 +22,12 @@ static const int bytes_per_frame = sizeof(int16_t) * samples_per_frame; /* Linux 2.6 has a fine-grained scheduler. We can almost always use a smaller buffer * size than in 2.4. XXX: Some cards can handle smaller buffer sizes than others. */ -static const unsigned max_writeahead_linux_26 = 512; +static const unsigned g_iMaxWriteahead_linux_26 = 512; static const unsigned safe_writeahead = 1024*4; -static unsigned max_writeahead; +static unsigned g_iMaxWriteahead; const int num_chunks = 8; -int RageSound_ALSA9_Software::MixerThread_start(void *p) +int RageSound_ALSA9_Software::MixerThread_start( void *p ) { ((RageSound_ALSA9_Software *) p)->MixerThread(); return 0; @@ -55,7 +55,7 @@ bool RageSound_ALSA9_Software::GetData() static int16_t *buf = NULL; if (!buf) - buf = new int16_t[max_writeahead*samples_per_frame]; + buf = new int16_t[g_iMaxWriteahead*samples_per_frame]; const int64_t play_pos = m_pPCM->GetPlayPos(); const int64_t cur_play_pos = m_pPCM->GetPosition(); @@ -67,7 +67,7 @@ bool RageSound_ALSA9_Software::GetData() } -int64_t RageSound_ALSA9_Software::GetPosition(const RageSoundBase *snd) const +int64_t RageSound_ALSA9_Software::GetPosition( const RageSoundBase *pSound ) const { return m_pPCM->GetPosition(); } @@ -90,16 +90,16 @@ CString RageSound_ALSA9_Software::Init() if( sError != "" ) return ssprintf( "Driver unusable: %s", sError.c_str() ); - max_writeahead = safe_writeahead; + g_iMaxWriteahead = safe_writeahead; CString sys; int vers; GetKernel( sys, vers ); LOG->Trace( "OS: %s ver %06i", sys.c_str(), vers ); if( sys == "Linux" && vers >= 20600 ) - max_writeahead = max_writeahead_linux_26; + g_iMaxWriteahead = g_iMaxWriteahead_linux_26; if( PREFSMAN->m_iSoundWriteAhead ) - max_writeahead = PREFSMAN->m_iSoundWriteAhead; + g_iMaxWriteahead = PREFSMAN->m_iSoundWriteAhead; m_pPCM = new Alsa9Buf(); sError = m_pPCM->Init( Alsa9Buf::HW_DONT_CARE, channels ); @@ -110,8 +110,8 @@ CString RageSound_ALSA9_Software::Init() m_pPCM->SetSampleRate( samplerate ); LOG->Info( "ALSA: Software mixing at %ihz", samplerate ); - m_pPCM->SetWriteahead( max_writeahead ); - m_pPCM->SetChunksize( max_writeahead / num_chunks ); + m_pPCM->SetWriteahead( g_iMaxWriteahead ); + m_pPCM->SetChunksize( g_iMaxWriteahead / num_chunks ); m_pPCM->LogParams(); StartDecodeThread(); @@ -140,10 +140,10 @@ RageSound_ALSA9_Software::~RageSound_ALSA9_Software() float RageSound_ALSA9_Software::GetPlayLatency() const { - return float(max_writeahead)/samplerate; + return float(g_iMaxWriteahead)/samplerate; } -int RageSound_ALSA9_Software::GetSampleRate( int rate ) const +int RageSound_ALSA9_Software::GetSampleRate( int iRate ) const { return samplerate; } diff --git a/stepmania/src/arch/Sound/RageSoundDriver_ALSA9_Software.h b/stepmania/src/arch/Sound/RageSoundDriver_ALSA9_Software.h index 0fb7848b53..6da8acc0f6 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_ALSA9_Software.h +++ b/stepmania/src/arch/Sound/RageSoundDriver_ALSA9_Software.h @@ -11,27 +11,24 @@ class RageSound_ALSA9_Software: public RageSound_Generic_Software { public: /* virtuals: */ - int64_t GetPosition( const RageSoundBase *snd ) const; + int64_t GetPosition( const RageSoundBase *pSound ) const; float GetPlayLatency() const; - int GetSampleRate( int rate ) const; + int GetSampleRate( int iRate ) const; void SetupDecodingThread(); - RageSound_ALSA9_Software(); - CString Init(); ~RageSound_ALSA9_Software(); + CString Init(); private: - bool shutdown; - - Alsa9Buf *pcm; - - static int MixerThread_start(void *p); + static int MixerThread_start( void *p ); void MixerThread(); - RageThread MixingThread; - bool GetData(); + + bool m_bShutdown; + Alsa9Buf *m_pPCM; + RageThread m_MixingThread; }; #define USE_RAGE_SOUND_ALSA9_SOFTWARE