From 92684a90db8efc8fe76c19eb4aae866574df1939 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 15 Jan 2004 02:59:44 +0000 Subject: [PATCH] s/RageSound/RageSoundBase/ linux/mac in a moment --- stepmania/src/arch/Sound/RageSoundDriver.h | 14 ++++++-------- .../src/arch/Sound/RageSoundDriver_DSound.cpp | 6 +++--- stepmania/src/arch/Sound/RageSoundDriver_DSound.h | 8 ++++---- .../arch/Sound/RageSoundDriver_DSound_Software.cpp | 8 ++++---- .../arch/Sound/RageSoundDriver_DSound_Software.h | 8 ++++---- stepmania/src/arch/Sound/RageSoundDriver_Null.cpp | 6 +++--- stepmania/src/arch/Sound/RageSoundDriver_Null.h | 8 ++++---- .../src/arch/Sound/RageSoundDriver_WaveOut.cpp | 6 +++--- stepmania/src/arch/Sound/RageSoundDriver_WaveOut.h | 8 ++++---- 9 files changed, 35 insertions(+), 37 deletions(-) diff --git a/stepmania/src/arch/Sound/RageSoundDriver.h b/stepmania/src/arch/Sound/RageSoundDriver.h index 0bf010dfe3..4706fc75c6 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver.h +++ b/stepmania/src/arch/Sound/RageSoundDriver.h @@ -1,30 +1,29 @@ #ifndef RAGE_SOUND_DRIVER #define RAGE_SOUND_DRIVER +class RageSoundBase; class RageSoundDriver { - friend class RageSound; - -protected: +public: friend class RageSoundManager; /* A RageSound calls this to request to be played. * XXX: define what we should do when it can't be played (eg. out of * channels) */ - virtual void StartMixing(RageSound *snd) = 0; + virtual void StartMixing( RageSoundBase *snd ) = 0; /* A RageSound calls this to request it not be played. When this function * returns, snd is no longer valid; ensure no running threads are still * accessing it before returning. This must handle gracefully the case where * snd was not actually being played, though it may print a warning. */ - virtual void StopMixing(RageSound *snd) = 0; + virtual void StopMixing( RageSoundBase *snd ) = 0; /* Get the current position of a given buffer, in the same units and time base * as passed to RageSound::GetPCM. */ - virtual int GetPosition(const RageSound *snd) const = 0; + virtual int GetPosition( const RageSoundBase *snd ) 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), - * call RageSound::StopPlaying(). Do *not* call it when StopMixing is called. */ + * call RageSoundBase::StopPlaying(). Do *not* call it when StopMixing is called. */ /* Optional, if needed: */ virtual void Update(float delta) { } @@ -39,7 +38,6 @@ protected: virtual int GetSampleRate( int rate ) const { return 44100; } -public: virtual ~RageSoundDriver() { } }; diff --git a/stepmania/src/arch/Sound/RageSoundDriver_DSound.cpp b/stepmania/src/arch/Sound/RageSoundDriver_DSound.cpp index 50489d78b3..b3a94e2040 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_DSound.cpp +++ b/stepmania/src/arch/Sound/RageSoundDriver_DSound.cpp @@ -246,7 +246,7 @@ void RageSound_DSound::VolumeChanged() } } -void RageSound_DSound::StartMixing(RageSound *snd) +void RageSound_DSound::StartMixing( RageSoundBase *snd ) { LockMutex L(SOUNDMAN->lock); @@ -294,7 +294,7 @@ void RageSound_DSound::StartMixing(RageSound *snd) * call completes, snd->GetPCM (which runs in a separate thread) will * not be running and will not be called unless StartMixing is called * again. */ -void RageSound_DSound::StopMixing(RageSound *snd) +void RageSound_DSound::StopMixing( RageSoundBase *snd ) { ASSERT(snd != NULL); LockMutex L(SOUNDMAN->lock); @@ -321,7 +321,7 @@ void RageSound_DSound::StopMixing(RageSound *snd) stream_pool[i]->snd = NULL; } -int RageSound_DSound::GetPosition(const RageSound *snd) const +int RageSound_DSound::GetPosition( const RageSoundBase *snd ) const { LockMutex L(SOUNDMAN->lock); diff --git a/stepmania/src/arch/Sound/RageSoundDriver_DSound.h b/stepmania/src/arch/Sound/RageSoundDriver_DSound.h index ea9bc8194d..c3df2d4b0e 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_DSound.h +++ b/stepmania/src/arch/Sound/RageSoundDriver_DSound.h @@ -17,7 +17,7 @@ class RageSound_DSound: public RageSoundDriver /* Sound object that's playing on this stream, or NULL if this * channel is available: */ - RageSound *snd; + RageSoundBase *snd; enum { INACTIVE, @@ -47,9 +47,9 @@ class RageSound_DSound: public RageSoundDriver RageThread MixingThread; /* virtuals: */ - void StartMixing(RageSound *snd); /* used by RageSound */ - void StopMixing(RageSound *snd); /* used by RageSound */ - int GetPosition(const RageSound *snd) const; + void StartMixing( RageSoundBase *snd ); /* used by RageSound */ + void StopMixing( RageSoundBase *snd ); /* used by RageSound */ + int GetPosition( const RageSoundBase *snd ) const; void Update(float delta); void VolumeChanged(); diff --git a/stepmania/src/arch/Sound/RageSoundDriver_DSound_Software.cpp b/stepmania/src/arch/Sound/RageSoundDriver_DSound_Software.cpp index 0ad7def92e..dcc432f545 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_DSound_Software.cpp +++ b/stepmania/src/arch/Sound/RageSoundDriver_DSound_Software.cpp @@ -131,7 +131,7 @@ bool RageSound_DSound_Software::GetData() } -void RageSound_DSound_Software::StartMixing(RageSound *snd) +void RageSound_DSound_Software::StartMixing( RageSoundBase *snd ) { sound *s = new sound; s->snd = snd; @@ -146,7 +146,7 @@ void RageSound_DSound_Software::Update(float delta) ASSERT(SOUNDMAN); LockMut(SOUNDMAN->lock); - /* SoundStopped might erase sounds out from under us, so make a copy + /* StopPlaying might erase sounds out from under us, so make a copy * of the sound list. */ vector snds = sounds; for(unsigned i = 0; i < snds.size(); ++i) @@ -161,7 +161,7 @@ void RageSound_DSound_Software::Update(float delta) } } -void RageSound_DSound_Software::StopMixing(RageSound *snd) +void RageSound_DSound_Software::StopMixing( RageSoundBase *snd ) { LockMut(SOUNDMAN->lock); @@ -184,7 +184,7 @@ void RageSound_DSound_Software::StopMixing(RageSound *snd) pcm->Reset(); } -int RageSound_DSound_Software::GetPosition(const RageSound *snd) const +int RageSound_DSound_Software::GetPosition( const RageSoundBase *snd ) const { LockMut(SOUNDMAN->lock); return pcm->GetPosition(); diff --git a/stepmania/src/arch/Sound/RageSoundDriver_DSound_Software.h b/stepmania/src/arch/Sound/RageSoundDriver_DSound_Software.h index 07c67b2df5..76331dc2a9 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_DSound_Software.h +++ b/stepmania/src/arch/Sound/RageSoundDriver_DSound_Software.h @@ -12,7 +12,7 @@ struct IDirectSoundBuffer; class RageSound_DSound_Software: public RageSoundDriver { struct sound { - RageSound *snd; + RageSoundBase *snd; RageTimer start_time; bool stopping; @@ -38,9 +38,9 @@ class RageSound_DSound_Software: public RageSoundDriver RageThread MixingThread; /* virtuals: */ - void StartMixing(RageSound *snd); /* used by RageSound */ - void StopMixing(RageSound *snd); /* used by RageSound */ - int GetPosition(const RageSound *snd) const; + void StartMixing( RageSoundBase *snd ); /* used by RageSound */ + void StopMixing( RageSoundBase *snd ); /* used by RageSound */ + int GetPosition( const RageSoundBase *snd ) 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 a66137909b..3ce0aa56ac 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_Null.cpp +++ b/stepmania/src/arch/Sound/RageSoundDriver_Null.cpp @@ -85,7 +85,7 @@ bool RageSound_Null::GetData() return true; } -void RageSound_Null::StartMixing(RageSound *snd) +void RageSound_Null::StartMixing( RageSoundBase *snd ) { sound *s = new sound; s->snd = snd; @@ -113,7 +113,7 @@ void RageSound_Null::Update(float delta) } } -void RageSound_Null::StopMixing(RageSound *snd) +void RageSound_Null::StopMixing( RageSoundBase *snd ) { LockMutex L(SOUNDMAN->lock); @@ -131,7 +131,7 @@ void RageSound_Null::StopMixing(RageSound *snd) sounds.erase(sounds.begin()+i, sounds.begin()+i+1); } -int RageSound_Null::GetPosition(const RageSound *snd) const +int RageSound_Null::GetPosition( const RageSoundBase *snd ) const { return int(RageTimer::GetTimeSinceStart() * samplerate); } diff --git a/stepmania/src/arch/Sound/RageSoundDriver_Null.h b/stepmania/src/arch/Sound/RageSoundDriver_Null.h index 314acb38f9..eee963470e 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_Null.h +++ b/stepmania/src/arch/Sound/RageSoundDriver_Null.h @@ -20,7 +20,7 @@ class RageSound_Null: public RageSoundDriver { private: struct sound { - RageSound *snd; + RageSoundBase *snd; bool stopping; int samples_buffered; /* fake */ sound() { snd = NULL; stopping=false; samples_buffered = 0; } @@ -37,9 +37,9 @@ private: protected: /* virtuals: */ - virtual void StartMixing(RageSound *snd); - virtual void StopMixing(RageSound *snd); - virtual int GetPosition(const RageSound *snd) const; + virtual void StartMixing( RageSoundBase *snd ); + virtual void StopMixing( RageSoundBase *snd ); + virtual int GetPosition( const RageSoundBase *snd ) const; virtual float GetPlayLatency() const; virtual void Update(float delta); virtual bool GetData(); diff --git a/stepmania/src/arch/Sound/RageSoundDriver_WaveOut.cpp b/stepmania/src/arch/Sound/RageSoundDriver_WaveOut.cpp index 97b18f8755..e99316c406 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_WaveOut.cpp +++ b/stepmania/src/arch/Sound/RageSoundDriver_WaveOut.cpp @@ -134,7 +134,7 @@ bool RageSound_WaveOut::GetData() return true; } -void RageSound_WaveOut::StartMixing(RageSound *snd) +void RageSound_WaveOut::StartMixing( RageSoundBase *snd ) { sound *s = new sound; s->snd = snd; @@ -163,7 +163,7 @@ void RageSound_WaveOut::Update(float delta) } } -void RageSound_WaveOut::StopMixing(RageSound *snd) +void RageSound_WaveOut::StopMixing( RageSoundBase *snd ) { LockMutex L(SOUNDMAN->lock); @@ -181,7 +181,7 @@ void RageSound_WaveOut::StopMixing(RageSound *snd) sounds.erase(sounds.begin()+i, sounds.begin()+i+1); } -int RageSound_WaveOut::GetPosition(const RageSound *snd) const +int RageSound_WaveOut::GetPosition( const RageSoundBase *snd ) const { LockMutex L(SOUNDMAN->lock); diff --git a/stepmania/src/arch/Sound/RageSoundDriver_WaveOut.h b/stepmania/src/arch/Sound/RageSoundDriver_WaveOut.h index 711b2ae9a6..d932e5dbd4 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_WaveOut.h +++ b/stepmania/src/arch/Sound/RageSoundDriver_WaveOut.h @@ -10,7 +10,7 @@ class RageSound_WaveOut: public RageSoundDriver { struct sound { - RageSound *snd; + RageSoundBase *snd; RageTimer start_time; bool stopping; @@ -37,9 +37,9 @@ class RageSound_WaveOut: public RageSoundDriver void Update(float delta); /* virtuals: */ - void StartMixing(RageSound *snd); /* used by RageSound */ - void StopMixing(RageSound *snd); /* used by RageSound */ - int GetPosition(const RageSound *snd) const; + void StartMixing( RageSoundBase *snd ); /* used by RageSound */ + void StopMixing( RageSoundBase *snd ); /* used by RageSound */ + int GetPosition( const RageSoundBase *snd ) const; float GetPlayLatency() const; public: