From 205d1000369f60c90428c34f289a7385a3cdca93 Mon Sep 17 00:00:00 2001 From: osoumen Date: Sun, 10 Jan 2016 22:11:38 +0900 Subject: [PATCH] =?UTF-8?q?Windows=E3=82=BF=E3=82=A4=E3=83=9F=E3=83=B3?= =?UTF-8?q?=E3=82=B0=E6=94=B9=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- C700TimeThread.h | 1 + DspController.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/C700TimeThread.h b/C700TimeThread.h index dd52c38..252cec6 100644 --- a/C700TimeThread.h +++ b/C700TimeThread.h @@ -38,6 +38,7 @@ typedef LPTHREAD_START_ROUTINE ThreadFunc; inline void ThreadCreate(HANDLE &obj, ThreadFunc start_routine, LPVOID arg) { DWORD dwID; obj = CreateThread(NULL, 0, start_routine, arg, 0, &dwID); + SetThreadPriority(obj, THREAD_PRIORITY_HIGHEST); } inline void ThreadJoin(HANDLE &obj) { WaitForSingleObject(obj, INFINITE); diff --git a/DspController.cpp b/DspController.cpp index 6489d9a..a903b5f 100644 --- a/DspController.cpp +++ b/DspController.cpp @@ -471,7 +471,7 @@ void DspController::WriteRam(int addr, unsigned char data, bool nonRealtime) else { // mHwFifoに追加 if (mIsHwAvailable) { - long int frameTime = (mSampleInFrame * 1e6) / 32000; + long int frameTime = (mSampleInFrame * 1e6) / 32000 + mHwDelayTime; mHwFifo.AddRamWrite(frameTime, addr, data); } else if (!mMuteEmulation) { @@ -511,7 +511,7 @@ bool DspController::WriteDsp(int addr, unsigned char data, bool nonRealtime) mDspMirror[addr] = data; // mHwFifoに追加 if (mIsHwAvailable) { - long int frameTime = (mSampleInFrame * 1e6) / 32000; + long int frameTime = (mSampleInFrame * 1e6) / 32000 + mHwDelayTime; mHwFifo.AddDspWrite(frameTime, addr, data); } else if (!mMuteEmulation) { @@ -609,7 +609,7 @@ void DspController::BeginFrameProcess(double frameTime) mFrameTime = 0; } MutexUnlock(mHwMtx); - mHwDelayTime = advTime / 4; + mHwDelayTime = 0; mPrevFrameStartTime = nowTime; } @@ -652,7 +652,7 @@ void *DspController::writeHwThreadFunc(void *arg) while (This->mIsHwAvailable) { OSTime nowTime; getNowOSTime(nowTime); - MSTime elapsedTime = calcusTime(nowTime, This->mFrameStartTime) - This->mHwDelayTime; // 1msのバッファ + MSTime elapsedTime = calcusTime(nowTime, This->mFrameStartTime); bool write = false; MutexLock(This->mHwMtx); while ((This->mHwFifo.GetNumWrites() > 0) &&