Changeset 68e005d in mainline
- Timestamp:
- 2012-07-05T23:31:46Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6be06d0
- Parents:
- 2afae0e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/dplay/dplay.c
r2afae0e r68e005d 84 84 static void device_event_callback(ipc_callid_t iid, ipc_call_t *icall, void* arg) 85 85 { 86 static unsigned wait = SUBBUFFERS; 86 async_answer_0(iid, EOK); 87 playback_t *pb = arg; 88 const size_t buffer_part = pb->buffer.size / SUBBUFFERS; 87 89 while (1) { 88 90 ipc_call_t call; … … 90 92 if (IPC_GET_IMETHOD(call) != IPC_FIRST_USER_METHOD) { 91 93 printf("Unknown event.\n"); 92 async_answer_0(callid,EOK);93 94 break; 94 95 } 95 playback_t *pb = arg; 96 // printf("Got device event!!!\n"); 97 const size_t buffer_part = pb->buffer.size / SUBBUFFERS; 96 printf("Got device event!!!\n"); 98 97 const size_t bytes = fread(pb->buffer.position, sizeof(uint8_t), 99 98 buffer_part, pb->source); … … 104 103 if (pb->buffer.position >= (pb->buffer.base + pb->buffer.size)) 105 104 pb->buffer.position = pb->buffer.base; 106 async_answer_0(callid, EOK);107 if (bytes == 0 && (wait-- == 0)) {105 async_answer_0(callid, EOK); 106 if (bytes == 0) { 108 107 pb->playing = false; 109 108 fibril_condvar_signal(&pb->cv); 110 return;111 109 } 112 110 } … … 137 135 138 136 for (pb->playing = true; pb->playing; 139 fibril_condvar_wait(&pb->cv, &pb->mutex));137 fibril_condvar_wait(&pb->cv, &pb->mutex)); 140 138 141 139 audio_pcm_buffer_stop_playback(pb->device, pb->buffer.id); 140 fibril_condvar_wait(&pb->cv, &pb->mutex); 142 141 } 143 142
Note:
See TracChangeset
for help on using the changeset viewer.