bool MemoryOutputStream::setPosition (std::int64_t newPosition) { if (newPosition <= (std::int64_t) size) { // ok to seek backwards position = blimit ((size_t) 0, size, (size_t) newPosition); return true; } // can't move beyond the end of the stream.. return false; }
void start (int newPeriod) { if (newPeriod != periodMs) { stop(); periodMs = newPeriod; TIMECAPS tc; if (timeGetDevCaps (&tc, sizeof (tc)) == TIMERR_NOERROR) { const int actualPeriod = blimit ((int) tc.wPeriodMin, (int) tc.wPeriodMax, newPeriod); timerID = timeSetEvent (actualPeriod, tc.wPeriodMin, callbackFunction, (DWORD_PTR) this, TIME_PERIODIC | TIME_CALLBACK_FUNCTION | 0x100 /*TIME_KILL_SYNCHRONOUS*/); } } }