RageSoundDriver_QT.cpp

This commit is contained in:
Steve Checkoway
2003-08-05 11:40:21 +00:00
parent 703637a8c9
commit 8d40a35d59
@@ -20,11 +20,9 @@
#include <sys/types.h> #include <sys/types.h>
const unsigned numchannels = 2; const unsigned numchannels = 2;
//const unsigned samplesize = 2 * numchannels;
const unsigned samplesize = 16 * numchannels; const unsigned samplesize = 16 * numchannels;
const unsigned samples = 4096; const unsigned samples = 40960;
const unsigned freq = 44100; const unsigned freq = 44100;
//const unsigned buffersize = samples * samplesize;
const unsigned buffersize = samples * samplesize / 8; const unsigned buffersize = samples * samplesize / 8;
#if defined(DEBUG) #if defined(DEBUG)
@@ -183,13 +181,11 @@ int RageSound_QT::GetPosition(const RageSound *snd) const {
HUnlock(Handle(sHdl)); HUnlock(Handle(sHdl));
return 0; /* It hasn't started yet. */ return 0; /* It hasn't started yet. */
} }
int ret = s->finishedBuffers * samples + GetMovieTime(s->movie[!s->fillme], NULL); int ret = s->finishedBuffers * samples + GetMovieTime(s->movie[s->fillme], NULL);
HUnlock(Handle(sHdl)); HUnlock(Handle(sHdl));
LOG->Trace("GetPostion is returning: %d", ret);
return ret; return ret;
} }
RageException::Throw("Can't get the position of a sound that isn't playing"); RageException::Throw("Can't get the position of a sound that isn't playing");
//return 0; /* unrechable statement */
} }
@@ -205,6 +201,8 @@ void CallBack(QTCallBack cb, long refCon) {
s->finishedBuffers++; s->finishedBuffers++;
if (!cb) if (!cb)
GetData(s); GetData(s);
else
DisposeCallBack(cb);
long playme = !s->fillme; long playme = !s->fillme;
ASSERT(s->movie[playme]); ASSERT(s->movie[playme]);
GoToBeginningOfMovie(s->movie[playme]); GoToBeginningOfMovie(s->movie[playme]);
@@ -215,12 +213,11 @@ void CallBack(QTCallBack cb, long refCon) {
/* Not stopping */ /* Not stopping */
GetData(s); GetData(s);
QTCallBack callBack = NewCallBack(GetMovieTimeBase(s->movie[playme]), callBackAtExtremes); QTCallBack callBack = NewCallBack(GetMovieTimeBase(s->movie[playme]), callBackAtExtremes);
CallMeWhen(callBack, CallBack, long(sHdl), 0, 0, 0); CallMeWhen(callBack, CallBack, long(sHdl), triggerAtStop, triggerAtStop, triggerAtStop);
} }
HUnlock(Handle(sHdl)); HUnlock(Handle(sHdl));
err = MemError(); err = MemError();
TEST_ERR(err, HUnlock); TEST_ERR(err, HUnlock);
DisposeCallBack(cb);
} }