update (Mac drivers untested)
This commit is contained in:
@@ -126,7 +126,7 @@ bool RageSound_ALSA9::stream::GetData(bool init)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void RageSound_ALSA9::StartMixing(RageSound *snd)
|
void RageSound_ALSA9::StartMixing(RageSoundBase *snd)
|
||||||
{
|
{
|
||||||
LockMutex L(SOUNDMAN->lock);
|
LockMutex L(SOUNDMAN->lock);
|
||||||
|
|
||||||
@@ -192,7 +192,7 @@ void RageSound_ALSA9::Update(float delta)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageSound_ALSA9::StopMixing(RageSound *snd)
|
void RageSound_ALSA9::StopMixing(RageSoundBase *snd)
|
||||||
{
|
{
|
||||||
ASSERT(snd != NULL);
|
ASSERT(snd != NULL);
|
||||||
LockMutex L(SOUNDMAN->lock);
|
LockMutex L(SOUNDMAN->lock);
|
||||||
@@ -215,14 +215,14 @@ void RageSound_ALSA9::StopMixing(RageSound *snd)
|
|||||||
/* Flush two buffers worth of data. */
|
/* Flush two buffers worth of data. */
|
||||||
stream_pool[i]->flush_pos = stream_pool[i]->pcm->GetPlayPos();
|
stream_pool[i]->flush_pos = stream_pool[i]->pcm->GetPlayPos();
|
||||||
|
|
||||||
/* This function is called externally (by RageSound) to stop immediately.
|
/* This function is called externally (by RageSoundBase) to stop immediately.
|
||||||
* We need to prevent SoundStopped from being called; it should only be
|
* We need to prevent SoundStopped from being called; it should only be
|
||||||
* called when we stop implicitely at the end of a sound. Set snd to NULL. */
|
* called when we stop implicitely at the end of a sound. Set snd to NULL. */
|
||||||
stream_pool[i]->snd = NULL;
|
stream_pool[i]->snd = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int RageSound_ALSA9::GetPosition(const RageSound *snd) const
|
int RageSound_ALSA9::GetPosition(const RageSoundBase *snd) const
|
||||||
{
|
{
|
||||||
LockMutex L(SOUNDMAN->lock);
|
LockMutex L(SOUNDMAN->lock);
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ private:
|
|||||||
|
|
||||||
/* Sound object that's playing on this stream, or NULL if this
|
/* Sound object that's playing on this stream, or NULL if this
|
||||||
* channel is available: */
|
* channel is available: */
|
||||||
RageSound *snd;
|
RageSoundBase *snd;
|
||||||
RageTimer start_time;
|
RageTimer start_time;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@@ -49,9 +49,9 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
/* virtuals: */
|
/* virtuals: */
|
||||||
void StartMixing(RageSound *snd);
|
void StartMixing(RageSoundBase *snd);
|
||||||
void StopMixing(RageSound *snd);
|
void StopMixing(RageSoundBase *snd);
|
||||||
int GetPosition(const RageSound *snd) const;
|
int GetPosition(const RageSoundBase *snd) const;
|
||||||
int GetSampleRate( int rate ) const;
|
int GetSampleRate( int rate ) const;
|
||||||
|
|
||||||
void Update(float delta);
|
void Update(float delta);
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ bool RageSound_ALSA9_Software::GetData()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void RageSound_ALSA9_Software::StartMixing(RageSound *snd)
|
void RageSound_ALSA9_Software::StartMixing(RageSoundBase *snd)
|
||||||
{
|
{
|
||||||
sound *s = new sound;
|
sound *s = new sound;
|
||||||
s->snd = snd;
|
s->snd = snd;
|
||||||
@@ -161,7 +161,7 @@ void RageSound_ALSA9_Software::Update(float delta)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageSound_ALSA9_Software::StopMixing(RageSound *snd)
|
void RageSound_ALSA9_Software::StopMixing(RageSoundBase *snd)
|
||||||
{
|
{
|
||||||
LockMutex L(SOUNDMAN->lock);
|
LockMutex L(SOUNDMAN->lock);
|
||||||
|
|
||||||
@@ -185,7 +185,7 @@ void RageSound_ALSA9_Software::StopMixing(RageSound *snd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int RageSound_ALSA9_Software::GetPosition(const RageSound *snd) const
|
int RageSound_ALSA9_Software::GetPosition(const RageSoundBase *snd) const
|
||||||
{
|
{
|
||||||
return pcm->GetPosition();
|
return pcm->GetPosition();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class RageSound_ALSA9_Software: public RageSoundDriver
|
|||||||
private:
|
private:
|
||||||
struct sound
|
struct sound
|
||||||
{
|
{
|
||||||
RageSound *snd;
|
RageSoundBase *snd;
|
||||||
RageTimer start_time;
|
RageTimer start_time;
|
||||||
bool stopping;
|
bool stopping;
|
||||||
int flush_pos; /* state == STOPPING only */
|
int flush_pos; /* state == STOPPING only */
|
||||||
@@ -34,9 +34,9 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
/* virtuals: */
|
/* virtuals: */
|
||||||
void StartMixing(RageSound *snd);
|
void StartMixing(RageSoundBase *snd);
|
||||||
void StopMixing(RageSound *snd);
|
void StopMixing(RageSoundBase *snd);
|
||||||
int GetPosition(const RageSound *snd) const;
|
int GetPosition(const RageSoundBase *snd) const;
|
||||||
float GetPlayLatency() const;
|
float GetPlayLatency() const;
|
||||||
int GetSampleRate( int rate ) const;
|
int GetSampleRate( int rate ) const;
|
||||||
|
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ RageSound_CA::~RageSound_CA()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageSound_CA::StartMixing(RageSound *snd)
|
void RageSound_CA::StartMixing(RageSoundBase *snd)
|
||||||
{
|
{
|
||||||
LockMutex L(SOUNDMAN->lock);
|
LockMutex L(SOUNDMAN->lock);
|
||||||
soundPtr s = new sound;
|
soundPtr s = new sound;
|
||||||
@@ -231,7 +231,7 @@ void RageSound_CA::StartMixing(RageSound *snd)
|
|||||||
sounds.push_back(s);
|
sounds.push_back(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageSound_CA::StopMixing(RageSound *snd)
|
void RageSound_CA::StopMixing(RageSoundBase *snd)
|
||||||
{
|
{
|
||||||
LockMutex L(SOUNDMAN->lock);
|
LockMutex L(SOUNDMAN->lock);
|
||||||
|
|
||||||
@@ -249,7 +249,7 @@ void RageSound_CA::StopMixing(RageSound *snd)
|
|||||||
sounds.erase(sounds.begin()+i);
|
sounds.erase(sounds.begin()+i);
|
||||||
}
|
}
|
||||||
|
|
||||||
int RageSound_CA::GetPosition(const RageSound *snd) const
|
int RageSound_CA::GetPosition(const RageSoundBase *snd) const
|
||||||
{
|
{
|
||||||
AudioTimeStamp time;
|
AudioTimeStamp time;
|
||||||
OSStatus err = AudioDeviceGetCurrentTime(outputDevice, &time);
|
OSStatus err = AudioDeviceGetCurrentTime(outputDevice, &time);
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class RageSound_CA : public RageSoundDriver
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
typedef struct sound {
|
typedef struct sound {
|
||||||
RageSound *snd;
|
RageSoundBase *snd;
|
||||||
bool stopping;
|
bool stopping;
|
||||||
int flush_pos;
|
int flush_pos;
|
||||||
sound() { snd=NULL; stopping=false; flush_pos=0; }
|
sound() { snd=NULL; stopping=false; flush_pos=0; }
|
||||||
@@ -52,9 +52,9 @@ private:
|
|||||||
|
|
||||||
static int ConvertAudioTimeStampToPosition(const AudioTimeStamp *time);
|
static int ConvertAudioTimeStampToPosition(const AudioTimeStamp *time);
|
||||||
protected:
|
protected:
|
||||||
virtual void StartMixing(RageSound *snd);
|
virtual void StartMixing(RageSoundBase *snd);
|
||||||
virtual void StopMixing(RageSound *snd);
|
virtual void StopMixing(RageSoundBase *snd);
|
||||||
virtual int GetPosition(const RageSound *snd) const;
|
virtual int GetPosition(const RageSoundBase *snd) const;
|
||||||
virtual void Update (float delta);
|
virtual void Update (float delta);
|
||||||
virtual float GetPlayLatency() const { return latency; }
|
virtual float GetPlayLatency() const { return latency; }
|
||||||
|
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ bool RageSound_OSS::GetData()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageSound_OSS::StartMixing(RageSound *snd)
|
void RageSound_OSS::StartMixing(RageSoundBase *snd)
|
||||||
{
|
{
|
||||||
sound *s = new sound;
|
sound *s = new sound;
|
||||||
s->snd = snd;
|
s->snd = snd;
|
||||||
@@ -162,7 +162,7 @@ void RageSound_OSS::Update(float delta)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageSound_OSS::StopMixing(RageSound *snd)
|
void RageSound_OSS::StopMixing(RageSoundBase *snd)
|
||||||
{
|
{
|
||||||
LockMutex L(SOUNDMAN->lock);
|
LockMutex L(SOUNDMAN->lock);
|
||||||
|
|
||||||
@@ -180,7 +180,7 @@ void RageSound_OSS::StopMixing(RageSound *snd)
|
|||||||
sounds.erase(sounds.begin()+i, sounds.begin()+i+1);
|
sounds.erase(sounds.begin()+i, sounds.begin()+i+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int RageSound_OSS::GetPosition(const RageSound *snd) const
|
int RageSound_OSS::GetPosition(const RageSoundBase *snd) const
|
||||||
{
|
{
|
||||||
LockMutex L(SOUNDMAN->lock);
|
LockMutex L(SOUNDMAN->lock);
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class RageSound_OSS: public RageSoundDriver
|
|||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
struct sound {
|
struct sound {
|
||||||
RageSound *snd;
|
RageSoundBase *snd;
|
||||||
RageTimer start_time;
|
RageTimer start_time;
|
||||||
|
|
||||||
bool stopping;
|
bool stopping;
|
||||||
@@ -37,9 +37,9 @@ public:
|
|||||||
int GetSampleRate( int rate ) const { return samplerate; }
|
int GetSampleRate( int rate ) const { return samplerate; }
|
||||||
|
|
||||||
/* virtuals: */
|
/* virtuals: */
|
||||||
void StartMixing(RageSound *snd); /* used by RageSound */
|
void StartMixing(RageSoundBase *snd); /* used by RageSoundBase */
|
||||||
void StopMixing(RageSound *snd); /* used by RageSound */
|
void StopMixing(RageSoundBase *snd); /* used by RageSoundBase */
|
||||||
int GetPosition(const RageSound *snd) const;
|
int GetPosition(const RageSoundBase *snd) const;
|
||||||
float GetPlayLatency() const;
|
float GetPlayLatency() const;
|
||||||
|
|
||||||
RageSound_OSS();
|
RageSound_OSS();
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ RageException::Throw(#func " failed with error: %d at %s:%d", err, __FILE__, __L
|
|||||||
|
|
||||||
typedef struct soundInfo
|
typedef struct soundInfo
|
||||||
{
|
{
|
||||||
RageSound *snd;
|
RageSoundBase *snd;
|
||||||
long stopPos;
|
long stopPos;
|
||||||
bool stopping;
|
bool stopping;
|
||||||
|
|
||||||
@@ -218,7 +218,7 @@ RageSound_QT::~RageSound_QT()
|
|||||||
DisposeHandle(Handle(sndDescHdl));
|
DisposeHandle(Handle(sndDescHdl));
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageSound_QT::StartMixing(RageSound *snd)
|
void RageSound_QT::StartMixing(RageSoundBase *snd)
|
||||||
{
|
{
|
||||||
LockMutex L(SOUNDMAN->lock);
|
LockMutex L(SOUNDMAN->lock);
|
||||||
CHECKPOINT;
|
CHECKPOINT;
|
||||||
@@ -228,7 +228,7 @@ void RageSound_QT::StartMixing(RageSound *snd)
|
|||||||
sounds.push_back(s);
|
sounds.push_back(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageSound_QT::StopMixing(RageSound *snd)
|
void RageSound_QT::StopMixing(RageSoundBase *snd)
|
||||||
{
|
{
|
||||||
LockMutex L(SOUNDMAN->lock);
|
LockMutex L(SOUNDMAN->lock);
|
||||||
CHECKPOINT;
|
CHECKPOINT;
|
||||||
@@ -260,7 +260,7 @@ void RageSound_QT::Update(float delta)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int RageSound_QT::GetPosition(const RageSound *snd) const
|
int RageSound_QT::GetPosition(const RageSoundBase *snd) const
|
||||||
{
|
{
|
||||||
LockMutex L(SOUNDMAN->lock);
|
LockMutex L(SOUNDMAN->lock);
|
||||||
return GetMovieTime(movie, NULL);
|
return GetMovieTime(movie, NULL);
|
||||||
|
|||||||
@@ -15,9 +15,9 @@
|
|||||||
|
|
||||||
class RageSound_QT: public RageSoundDriver {
|
class RageSound_QT: public RageSoundDriver {
|
||||||
protected:
|
protected:
|
||||||
virtual void StartMixing(RageSound *snd);
|
virtual void StartMixing(RageSoundBase *snd);
|
||||||
virtual void StopMixing(RageSound *snd);
|
virtual void StopMixing(RageSoundBase *snd);
|
||||||
virtual int GetPosition(const RageSound *snd) const;
|
virtual int GetPosition(const RageSoundBase *snd) const;
|
||||||
virtual void Update (float delta);
|
virtual void Update (float delta);
|
||||||
virtual float GetPlayLatency() const;
|
virtual float GetPlayLatency() const;
|
||||||
|
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ bail:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageSound_QT1::StartMixing(RageSound *snd) {
|
void RageSound_QT1::StartMixing(RageSoundBase *snd) {
|
||||||
sound *s = new sound;
|
sound *s = new sound;
|
||||||
s->snd = snd;
|
s->snd = snd;
|
||||||
|
|
||||||
@@ -161,7 +161,7 @@ void RageSound_QT1::StartMixing(RageSound *snd) {
|
|||||||
LOG->Trace("There are %ld sounds playing", sounds.size());
|
LOG->Trace("There are %ld sounds playing", sounds.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageSound_QT1::StopMixing(RageSound *snd) {
|
void RageSound_QT1::StopMixing(RageSoundBase *snd) {
|
||||||
LockMutex L(SOUNDMAN->lock);
|
LockMutex L(SOUNDMAN->lock);
|
||||||
|
|
||||||
/* Find the sound. */
|
/* Find the sound. */
|
||||||
@@ -193,7 +193,7 @@ void RageSound_QT1::Update(float delta) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int RageSound_QT1::GetPosition(const RageSound *snd) const {
|
int RageSound_QT1::GetPosition(const RageSoundBase *snd) const {
|
||||||
#pragma unused (snd)
|
#pragma unused (snd)
|
||||||
TimeRecord tr;
|
TimeRecord tr;
|
||||||
ClockGetTime(clock, &tr);
|
ClockGetTime(clock, &tr);
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace QT {
|
|||||||
class RageSound_QT1: public RageSoundDriver {
|
class RageSound_QT1: public RageSoundDriver {
|
||||||
private:
|
private:
|
||||||
struct sound {
|
struct sound {
|
||||||
RageSound *snd;
|
RageSoundBase *snd;
|
||||||
bool stopping;
|
bool stopping;
|
||||||
int flush_pos;
|
int flush_pos;
|
||||||
sound() { snd=NULL; stopping=false; flush_pos=0; }
|
sound() { snd=NULL; stopping=false; flush_pos=0; }
|
||||||
@@ -39,9 +39,9 @@ private:
|
|||||||
float latency;
|
float latency;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void StartMixing(RageSound *snd);
|
virtual void StartMixing(RageSoundBase *snd);
|
||||||
virtual void StopMixing(RageSound *snd);
|
virtual void StopMixing(RageSoundBase *snd);
|
||||||
virtual int GetPosition(const RageSound *snd) const;
|
virtual int GetPosition(const RageSoundBase *snd) const;
|
||||||
virtual void Update (float delta);
|
virtual void Update (float delta);
|
||||||
virtual float GetPlayLatency() const;
|
virtual float GetPlayLatency() const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user