Changeset 92b638c in mainline for uspace/lib/drv/generic/remote_audio_pcm.c
- Timestamp:
- 2012-08-30T11:41:48Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5eed99d
- Parents:
- ed3816d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/generic/remote_audio_pcm.c
red3816d r92b638c 342 342 * 0 to turn off event generation. 343 343 */ 344 int audio_pcm_start_playback (audio_pcm_sess_t *sess, unsigned frames,344 int audio_pcm_start_playback_fragment(audio_pcm_sess_t *sess, unsigned frames, 345 345 unsigned channels, unsigned sample_rate, pcm_sample_format_t format) 346 346 { … … 357 357 return ret; 358 358 } 359 360 /** 361 * Stop current playback. 359 /** 360 * Stops playback after current fragment. 361 * 362 * @param sess Audio device session. 363 * 364 * @return Error code. 365 */ 366 int audio_pcm_last_playback_fragment(audio_pcm_sess_t *sess) 367 { 368 async_exch_t *exch = async_exchange_begin(sess); 369 const int ret = async_req_2_0(exch, 370 DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), 371 IPC_M_AUDIO_PCM_STOP_PLAYBACK, false); 372 async_exchange_end(exch); 373 return ret; 374 } 375 376 /** 377 * Start playback on buffer from the current position. 378 * 379 * @param sess Audio device session. 380 * @param channels Number of channels. 381 * @param sample_rate Sampling rate (for one channel). 382 * @param format Sample format. 383 * 384 * @return Error code. 385 */ 386 int audio_pcm_start_playback(audio_pcm_sess_t *sess, 387 unsigned channels, unsigned sample_rate, pcm_sample_format_t format) 388 { 389 return audio_pcm_start_playback_fragment( 390 sess, 0, channels, sample_rate, format); 391 } 392 393 /** 394 * Immediately stops current playback. 362 395 * 363 396 * @param sess Audio device session. … … 368 401 { 369 402 async_exch_t *exch = async_exchange_begin(sess); 370 const int ret = async_req_ 1_0(exch,371 DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), 372 IPC_M_AUDIO_PCM_STOP_PLAYBACK );373 async_exchange_end(exch); 374 return ret; 375 } 376 377 /** 378 * Start capture on buffer from position 0.403 const int ret = async_req_2_0(exch, 404 DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), 405 IPC_M_AUDIO_PCM_STOP_PLAYBACK, true); 406 async_exchange_end(exch); 407 return ret; 408 } 409 410 /** 411 * Start capture on buffer from the current position. 379 412 * 380 413 * @param sess Audio device session. … … 389 422 * 0 to turn off event generation. 390 423 */ 391 int audio_pcm_start_capture (audio_pcm_sess_t *sess, unsigned frames,424 int audio_pcm_start_capture_fragment(audio_pcm_sess_t *sess, unsigned frames, 392 425 unsigned channels, unsigned sample_rate, pcm_sample_format_t format) 393 426 { … … 405 438 406 439 /** 407 * Stop current playback. 440 * Start capture on buffer from the current position. 441 * 442 * @param sess Audio device session. 443 * @param channels Number of channels. 444 * @param sample_rate Sampling rate (for one channel). 445 * @param format Sample format. 446 * 447 * @return Error code. 448 */ 449 int audio_pcm_start_capture(audio_pcm_sess_t *sess, 450 unsigned channels, unsigned sample_rate, pcm_sample_format_t format) 451 { 452 return audio_pcm_start_capture_fragment( 453 sess, 0, channels, sample_rate, format); 454 } 455 456 /** 457 * Stops capture at the end of current fragment. 458 * 459 * Won't work if capture was started with fragment size 0. 460 * @param sess Audio device session. 461 * 462 * @return Error code. 463 */ 464 int audio_pcm_last_capture_fragment(audio_pcm_sess_t *sess) 465 { 466 async_exch_t *exch = async_exchange_begin(sess); 467 const int ret = async_req_2_0(exch, 468 DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), 469 IPC_M_AUDIO_PCM_STOP_CAPTURE, false); 470 async_exchange_end(exch); 471 return ret; 472 } 473 474 /** 475 * Immediately stops current capture. 408 476 * 409 477 * @param sess Audio device session. … … 414 482 { 415 483 async_exch_t *exch = async_exchange_begin(sess); 416 const int ret = async_req_1_0(exch, 417 DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), IPC_M_AUDIO_PCM_STOP_CAPTURE); 484 const int ret = async_req_2_0(exch, 485 DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), 486 IPC_M_AUDIO_PCM_STOP_CAPTURE, true); 418 487 async_exchange_end(exch); 419 488 return ret; … … 648 717 { 649 718 const audio_pcm_iface_t *pcm_iface = iface; 719 const bool immediate = DEV_IPC_GET_ARG1(*call); 650 720 651 721 const int ret = pcm_iface->stop_playback ? 652 pcm_iface->stop_playback(fun ) : ENOTSUP;722 pcm_iface->stop_playback(fun, immediate) : ENOTSUP; 653 723 async_answer_0(callid, ret); 654 724 } … … 674 744 { 675 745 const audio_pcm_iface_t *pcm_iface = iface; 746 const bool immediate = DEV_IPC_GET_ARG1(*call); 676 747 677 748 const int ret = pcm_iface->stop_capture ? 678 pcm_iface->stop_capture(fun ) : ENOTSUP;749 pcm_iface->stop_capture(fun, immediate) : ENOTSUP; 679 750 async_answer_0(callid, ret); 680 751 }
Note:
See TracChangeset
for help on using the changeset viewer.