void FrameWait(void) { QueryPerformanceCounter(&CurrentTime); while ( (TargetTime.QuadPart-CurrentTime.QuadPart)> (OneMs.QuadPart*2)) //If we have more that 2Ms till the end of the frame { Sleep(1); //Give about 1Ms back to the system QueryPerformanceCounter(&CurrentTime); //And check again } if (GetSoundStatus()) //Lean on the sound card a bit for timing { PurgeAuxBuffer(); if (FrameSkip==1) { if (GetFreeBlockCount()>AUDIOBUFFERS/2) //Dont let the buffer get lest that half full return; while (GetFreeBlockCount() < 1); // Dont let it fill up either } } while ( CurrentTime.QuadPart< TargetTime.QuadPart) //Poll Untill frame end. QueryPerformanceCounter(&CurrentTime); return; }
dword CFileSystem::GetDiskLeftSpace() { return FSParams.BlockSize * GetFreeBlockCount(); }