From 71d1744ea1cdbdfb58fc317ee5d3dc17b3f4d3b8 Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Mon, 28 Jul 2003 10:53:39 +0000 Subject: [PATCH] Add header. --- stepmania/src/arch/Sound/RageSoundDriver_QT1.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/stepmania/src/arch/Sound/RageSoundDriver_QT1.cpp b/stepmania/src/arch/Sound/RageSoundDriver_QT1.cpp index 1164ae76da..d0c1b897d0 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_QT1.cpp +++ b/stepmania/src/arch/Sound/RageSoundDriver_QT1.cpp @@ -8,6 +8,7 @@ */ #include "global.h" +#include "RageSoundManager.h" #include "RageSoundDriver_QT1.h" #include "RageLog.h" #include "RageUtil.h" @@ -54,7 +55,8 @@ RageSound_QT1::RageSound_QT1() { TimeRecord record; SoundComponentGetInfo(soundOutput, NULL, siOutputLatency, &record); latency = record.value.lo / record.scale; - latency += samples / freq; /* double buffer */ + latency += static_cast(samples) / freq; /* double buffer */ + LOG->Trace("The output latency is %f", latency); OSErr err = SndNewChannel(&channel, sampledSynth, initStereo, callback); @@ -87,6 +89,7 @@ RageSound_QT1::RageSound_QT1() { RageSound_QT1::~RageSound_QT1() { if (channel) SndDisposeChannel(channel, true); + SAFE_DELETE(channel); SAFE_DELETE_ARRAY(buffer[0]); SAFE_DELETE_ARRAY(buffer[1]); if (soundOutput) @@ -111,7 +114,8 @@ void RageSound_QT1::GetData(SndChannel *chan, SndCommand *cmd_passed) { temp |= tr.value.lo; double d = static_cast(temp)/tr.scale*freq; temp = static_cast(d); - P->last_pos = static_cast(temp % 0x00000000FFFFFFFFLL); + P->last_pos = static_cast(temp & 0x00000000FFFFFFFFLL); + P->last_pos += samples * 3 / 2; } else P->last_pos += samples; @@ -204,7 +208,7 @@ int RageSound_QT1::GetPosition(const RageSound *snd) const { temp |= tr.value.lo; double d = static_cast(temp)/tr.scale*freq; temp = static_cast(d); - return static_cast(temp % 0x00000000FFFFFFFFLL); + return static_cast(temp & 0x00000000FFFFFFFFLL); } float RageSound_QT1::GetPlayLatency() const {