/************************************************************************** * wodPlayer [internal] */ static DWORD CALLBACK wodPlayer(LPVOID pmt) { WORD uDevID = (DWORD_PTR)pmt; WINE_WAVEOUT* wwo = &WOutDev[uDevID]; wwo->state = WINE_WS_STOPPED; SetEvent(wwo->hStartUpEvent); for (;;) { if (wwo->FlowStarted) { AuHandleEvents(wwo->AuServ); if (wwo->state == WINE_WS_PLAYING && wwo->freeBytes && wwo->BufferUsed) nas_send_buffer(wwo); } if (wwo->BufferUsed <= FRAG_SIZE && wwo->writeBytes > 0) wodPlayer_NotifyCompletions(wwo, FALSE); WaitForSingleObject(wwo->msgRing.msg_event, 20); wodPlayer_ProcessMessages(wwo); while(wwo->lpPlayPtr) { wwo->lpPlayPtr->reserved = wwo->WrittenTotal + wwo->lpPlayPtr->dwBufferLength; nas_add_buffer(wwo); wodPlayer_PlayPtrNext(wwo); } return 0; } }
static int nas_free(WINE_WAVEOUT* wwo) { if (!wwo->FlowStarted && wwo->BufferUsed) { AuStartFlow(wwo->AuServ, wwo->AuFlow, NULL); wwo->FlowStarted = 1; } while (wwo->BufferUsed || wwo->writeBytes != wwo->sendBytes) { if (wwo->freeBytes) nas_send_buffer(wwo); AuHandleEvents(wwo->AuServ); } AuFlush(wwo->AuServ); return TRUE; }
static int play(struct audio_play *play) { unsigned char data[MAX_NSAMPLES * 4 * 2]; unsigned int len; len = audio_pcm(data, play->nsamples, play->samples[0], play->samples[1], play->mode, play->stats); buffer.data = data; buffer.len = len; while (buffer.len) AuHandleEvents(server); return 0; }