DWORD CALLBACK DSOUND_mixthread(void *p) { DirectSoundDevice *dev = p; TRACE("(%p)\n", dev); while (dev->ref) { DWORD ret; /* * Some audio drivers are retarded and won't fire after being * stopped, add a timeout to handle this. */ ret = WaitForSingleObject(dev->sleepev, dev->sleeptime); if (ret == WAIT_FAILED) WARN("wait returned error %u %08x!\n", GetLastError(), GetLastError()); else if (ret != WAIT_OBJECT_0) WARN("wait returned %08x!\n", ret); if (!dev->ref) break; RtlAcquireResourceShared(&(dev->buffer_list_lock), TRUE); DSOUND_PerformMix(dev); RtlReleaseResource(&(dev->buffer_list_lock)); } return 0; }
void CALLBACK DSOUND_timer(UINT timerID, UINT msg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2) { DirectSoundDevice * device = (DirectSoundDevice*)dwUser; DWORD start_time = GetTickCount(); DWORD end_time; TRACE("(%d,%d,0x%lx,0x%lx,0x%lx)\n",timerID,msg,dwUser,dw1,dw2); TRACE("entering at %d\n", start_time); if (DSOUND_renderer[device->drvdesc.dnDevNode] != device) { ERR("dsound died without killing us?\n"); timeKillEvent(timerID); timeEndPeriod(DS_TIME_RES); return; } RtlAcquireResourceShared(&(device->buffer_list_lock), TRUE); if (device->ref) DSOUND_PerformMix(device); RtlReleaseResource(&(device->buffer_list_lock)); end_time = GetTickCount(); TRACE("completed processing at %d, duration = %d\n", end_time, end_time - start_time); }
void CALLBACK DSOUND_timer(UINT timerID, UINT msg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2) { DirectSoundDevice * device = (DirectSoundDevice*)dwUser; DWORD start_time = GetTickCount(); DWORD end_time; TRACE("(%d,%d,0x%lx,0x%lx,0x%lx)\n",timerID,msg,dwUser,dw1,dw2); TRACE("entering at %d\n", start_time); RtlAcquireResourceShared(&(device->buffer_list_lock), TRUE); if (device->ref) DSOUND_PerformMix(device); RtlReleaseResource(&(device->buffer_list_lock)); end_time = GetTickCount(); TRACE("completed processing at %d, duration = %d\n", end_time, end_time - start_time); }