Skip to content

Commit

Permalink
Windowsタイミング改善
Browse files Browse the repository at this point in the history
  • Loading branch information
osoumen committed Jan 10, 2016
1 parent 98f26a3 commit 205d100
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions C700TimeThread.h
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions DspController.cpp
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -609,7 +609,7 @@ void DspController::BeginFrameProcess(double frameTime)
mFrameTime = 0;
}
MutexUnlock(mHwMtx);
mHwDelayTime = advTime / 4;
mHwDelayTime = 0;
mPrevFrameStartTime = nowTime;
}

Expand Down Expand Up @@ -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) &&
Expand Down

0 comments on commit 205d100

Please sign in to comment.