add RageSound::SoundIsFinishedPlaying (replaces StopPlaying for

use from sound drivers)
This commit is contained in:
Glenn Maynard
2004-04-07 04:10:26 +00:00
parent 37de4a8898
commit fb5be14eeb
2 changed files with 25 additions and 1 deletions
+21
View File
@@ -607,6 +607,27 @@ void RageSound::StopPlaying()
pos_map.clear();
}
/* This is similar to StopPlaying, except it's called by sound drivers when we're done
* playing, rather than by users to as us to stop. (The only difference is that this
* doesn't call SOUNDMAN->StopMixing; there's no reason to tell the sound driver to
* stop mixing, since they're the one telling us we're done.) */
void RageSound::SoundIsFinishedPlaying()
{
if(!playing)
return;
stopped_position = (int) GetPositionSecondsInternal();
SOUNDMAN->lock.Lock();
SOUNDMAN->playing_sounds.erase( this );
SOUNDMAN->lock.Unlock();
playing = false;
playing_thread = 0;
pos_map.clear();
}
RageSound *RageSound::Play( const RageSoundParams *params )
{
return SOUNDMAN->PlaySound( *this, params );
+4 -1
View File
@@ -12,7 +12,8 @@ class RageSoundBase
{
public:
virtual ~RageSoundBase() { }
virtual void StopPlaying() = 0;
virtual void StopPlaying() = 0; // deprecated
virtual void SoundIsFinishedPlaying() = 0;
virtual bool GetDataToPlay( int16_t *buffer, int size, int &pos, int &got_bytes ) = 0;
virtual int GetPCM( char *buffer, int size, int64_t frameno ) = 0;
virtual int GetSampleRate() const = 0;
@@ -174,6 +175,8 @@ private:
int Bytes_Available() const;
RageSoundParams::StopMode_t GetStopMode() const; /* resolves M_AUTO */
void SoundIsFinishedPlaying(); // called by sound drivers
static void RateChange(char *buf, int &cnt, int speed_input_samples, int speed_output_samples, int channels);
public: