Changeset 1240bb9 in mainline for uspace/app/dplay/dplay.c
- Timestamp:
- 2012-07-12T18:20:45Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d01e635
- Parents:
- 992ef56
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/dplay/dplay.c
r992ef56 r1240bb9 91 91 ipc_call_t call; 92 92 ipc_callid_t callid = async_get_call(&call); 93 if (IPC_GET_IMETHOD(call) != IPC_FIRST_USER_METHOD) { 94 printf("Unknown event.\n"); 93 switch(IPC_GET_IMETHOD(call)) { 94 case PCM_EVENT_PLAYBACK_DONE: 95 printf("+"); 96 async_answer_0(callid, EOK); 95 97 break; 98 case PCM_EVENT_PLAYBACK_TERMINATED: 99 printf("\nPlayback terminated\n"); 100 fibril_mutex_lock(&pb->mutex); 101 pb->playing = false; 102 fibril_condvar_signal(&pb->cv); 103 async_answer_0(callid, EOK); 104 fibril_mutex_unlock(&pb->mutex); 105 return; 106 default: 107 printf("Unknown event %d.\n", IPC_GET_IMETHOD(call)); 108 async_answer_0(callid, ENOTSUP); 109 continue; 110 96 111 } 97 printf("+");98 112 const size_t bytes = fread(pb->buffer.position, sizeof(uint8_t), 99 113 buffer_part, pb->source); … … 103 117 if (pb->buffer.position >= (pb->buffer.base + pb->buffer.size)) 104 118 pb->buffer.position = pb->buffer.base; 105 async_answer_0(callid, EOK);106 119 if (bytes == 0) { 120 fibril_mutex_lock(&pb->mutex); 107 121 pb->playing = false; 108 122 fibril_condvar_signal(&pb->cv); 123 fibril_mutex_unlock(&pb->mutex); 109 124 } 110 125 } … … 138 153 139 154 audio_pcm_stop_playback(pb->device, pb->buffer.id); 140 fibril_condvar_wait(&pb->cv, &pb->mutex); 155 for (pb->playing = true; pb->playing; 156 fibril_condvar_wait(&pb->cv, &pb->mutex)); 157 fibril_mutex_unlock(&pb->mutex); 141 158 printf("\n"); 142 159 }
Note:
See TracChangeset
for help on using the changeset viewer.