Changeset 2cc5c835 in mainline for uspace/app/dplay/dplay.c
- Timestamp:
- 2012-07-15T15:14:10Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 57e8b3b
- Parents:
- b497018
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/dplay/dplay.c
rb497018 r2cc5c835 63 63 fibril_mutex_t mutex; 64 64 fibril_condvar_t cv; 65 a sync_exch_t *device;65 audio_pcm_sess_t *device; 66 66 } playback_t; 67 67 68 static void playback_initialize(playback_t *pb, a sync_exch_t *exch)69 { 70 assert( exch);68 static void playback_initialize(playback_t *pb, audio_pcm_sess_t *sess) 69 { 70 assert(sess); 71 71 assert(pb); 72 72 pb->buffer.base = NULL; … … 75 75 pb->playing = false; 76 76 pb->source = NULL; 77 pb->device = exch;77 pb->device = sess; 78 78 fibril_mutex_initialize(&pb->mutex); 79 79 fibril_condvar_initialize(&pb->cv); … … 168 168 } 169 169 170 devman_handle_t pcm_handle; 171 int ret = devman_fun_get_handle(device, &pcm_handle, 0); 172 if (ret != EOK) { 173 printf("Failed to get device(%s) handle: %s.\n", 174 device, str_error(ret)); 175 return 1; 176 } 177 178 async_sess_t *session = devman_device_connect( 179 EXCHANGE_SERIALIZE, pcm_handle, IPC_FLAG_BLOCKING); 170 audio_pcm_sess_t *session = audio_pcm_open(device); 180 171 if (!session) { 181 172 printf("Failed to connect to device.\n"); … … 183 174 } 184 175 185 async_exch_t *exch = async_exchange_begin(session);186 if (!exch) {187 ret = EPARTY;188 printf("Failed to start session exchange.\n");189 goto close_session;190 }191 176 const char* info = NULL; 192 ret = audio_pcm_get_info_str(exch, &info);177 int ret = audio_pcm_get_info_str(session, &info); 193 178 if (ret != EOK) { 194 179 printf("Failed to get PCM info.\n"); … … 199 184 200 185 playback_t pb; 201 playback_initialize(&pb, exch);186 playback_initialize(&pb, session); 202 187 203 188 ret = audio_pcm_get_buffer(pb.device, &pb.buffer.base, … … 236 221 cleanup: 237 222 munmap(pb.buffer.base, pb.buffer.size); 238 audio_pcm_release_buffer( exch);223 audio_pcm_release_buffer(pb.device); 239 224 close_session: 240 async_exchange_end(exch); 241 async_hangup(session); 225 audio_pcm_close(session); 242 226 return ret == EOK ? 0 : 1; 243 227 }
Note:
See TracChangeset
for help on using the changeset viewer.