Cleanup and fix compile.

This commit is contained in:
Steve Checkoway
2004-02-20 22:52:20 +00:00
parent 00bfa2b892
commit dd38b1ea67
2 changed files with 35 additions and 31 deletions
+25 -21
View File
@@ -77,21 +77,24 @@ typedef struct VRBChunkHeader VRBChunkHeader;
#endif #endif
namespace
{
inline void TEST_ERR(OSStatus result)
{
#if defined(DEBUG) #if defined(DEBUG)
static char *__errorMessage; char *errorMessage;
static char __fourcc[5]; char fourcc[5];
#define TEST_ERR(result) \
CHECKPOINT; \
memcpy(__fourcc, &result, 4); \
__fourcc[4] = '\000'; \
asprintf(&__errorMessage, "err = %d, %s", result, __fourcc); \
RAGE_ASSERT_M(result == noErr, __errorMessage); \
free(__errorMessage)
CHECKPOINT;
memcpy(fourcc, &result, 4);
fourcc[4] = '\000';
asprintf(&errorMessage, "err = %d, %s", result, fourcc);
free(errorMessage);
#else #else
#define TEST_ERR(result) # pragma unused(result)
#endif #endif
}
}
#define INTERNAL_DEBUG 0 #define INTERNAL_DEBUG 0
#if (INTERNAL_DEBUG) #if (INTERNAL_DEBUG)
@@ -361,7 +364,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);
@@ -376,8 +379,8 @@ void RageSound_CA::StartMixing(RageSound *snd)
// No free buffer? Fake it. (and log it) // No free buffer? Fake it. (and log it)
if (i == stream_pool.size()) if (i == stream_pool.size())
{ {
LOG->Info(LOG_MARKER "RageSound_CA::StartMixing -- exceeded free buffers, faking it"); LOG->Warn(LOG_MARKER "RageSound_CA::StartMixing -- exceeded free buffers, faking it");
SOUNDMAN->AddFakeSound(snd); //SOUNDMAN->AddFakeSound(snd);
return; return;
} }
@@ -439,7 +442,7 @@ void RageSound_CA::Update(float delta)
} }
} }
void RageSound_CA::StopMixing(RageSound *snd) void RageSound_CA::StopMixing(RageSoundBase *snd)
{ {
ASSERT(snd != NULL); ASSERT(snd != NULL);
LockMutex L(SOUNDMAN->lock); LockMutex L(SOUNDMAN->lock);
@@ -473,7 +476,7 @@ void RageSound_CA::StopMixing(RageSound *snd)
stream_pool[i]->snd = NULL; stream_pool[i]->snd = NULL;
} }
int RageSound_CA::GetPosition(const RageSound *snd) const int64_t RageSound_CA::GetPosition(const RageSoundBase *snd) const
{ {
AudioTimeStamp time; AudioTimeStamp time;
OSStatus err = AudioDeviceGetCurrentTime(outputDevice, &time); OSStatus err = AudioDeviceGetCurrentTime(outputDevice, &time);
@@ -798,12 +801,13 @@ OSStatus RageSound_CA::OverloadListener(AudioDeviceID inDevice, UInt32 inChannel
} }
int RageSound_CA::ConvertSampleTimeToPosition(const Float64 sampleTime) const /*int64_t RageSound_CA::ConvertSampleTimeToPosition(const Float64 sampleTime) const
{ {
return (int) (sampleTime - startSampleTime); return int64_t(sampleTime - startSampleTime);
} }*/
int RageSound_CA::ConvertAudioTimeStampToPosition(const AudioTimeStamp *time) const int64_t RageSound_CA::ConvertAudioTimeStampToPosition(const AudioTimeStamp *time) const
{ {
return this->ConvertSampleTimeToPosition(time->mSampleTime); //return this->ConvertSampleTimeToPosition(time->mSampleTime);
return int64_t(time->mSampleTime - startSampleTime);
} }
@@ -54,7 +54,7 @@ private:
{ {
enum { INACTIVE, PLAYING, STOPPING } state; enum { INACTIVE, PLAYING, STOPPING } state;
RageSound *snd; RageSoundBase *snd;
int flush_pos; int flush_pos;
void clear() { snd=NULL; state=INACTIVE; flush_pos=0; } void clear() { snd=NULL; state=INACTIVE; flush_pos=0; }
@@ -95,16 +95,16 @@ private:
void FeederThread(); void FeederThread();
#endif #endif
int ConvertSampleTimeToPosition(const Float64 sampleTime) const; //int64_t ConvertSampleTimeToPosition(const Float64 sampleTime) const;
int ConvertAudioTimeStampToPosition(const AudioTimeStamp *time) const; int64_t ConvertAudioTimeStampToPosition(const AudioTimeStamp *time) const;
protected: protected:
virtual void StartMixing(RageSound *snd); void StartMixing(RageSoundBase *snd);
virtual void Update (float delta); void Update (float delta);
virtual void StopMixing(RageSound *snd); void StopMixing(RageSoundBase *snd);
virtual int GetPosition(const RageSound *snd) const; int64_t GetPosition(const RageSoundBase *snd) const;
virtual float GetPlayLatency() const; float GetPlayLatency() const;
virtual int GetSampleRate() const; int GetSampleRate() const;
size_t smSamplesToBytes(int samples); size_t smSamplesToBytes(int samples);
int smBytesToSamples(size_t bytes); int smBytesToSamples(size_t bytes);