Changeset ad1aedc in mainline


Ignore:
Timestamp:
2012-08-20T09:48:02Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
20840922
Parents:
86fe9d1
Message:

libdrv: Document client side audio pcm API.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/generic/remote_audio_pcm.c

    r86fe9d1 rad1aedc  
    5959 * CLIENT SIDE
    6060 */
     61
     62/**
     63 * Open audio session with device identified by location service string.
     64 *
     65 * @param name Location service string.
     66 * @return Pointer to a new audio device session, NULL on failure.
     67 */
    6168audio_pcm_sess_t *audio_pcm_open(const char *name)
    6269{
     
    6976}
    7077
     78/**
     79 * Open audio session with device identified by location service id
     80 *
     81 * @param name Location service id.
     82 * @return Pointer to a new audio device session, NULL on failure.
     83 */
    7184audio_pcm_sess_t *audio_pcm_open_service(service_id_t id)
    7285{
     
    7487}
    7588
     89/**
     90 * Close open audio device session.
     91 *
     92 * @param name Open audio device session.
     93 *
     94 * @note Calling this function on already closed or invalid session results
     95 * in undefined behavior.
     96 */
    7697void audio_pcm_close(audio_pcm_sess_t *sess)
    7798{
     
    80101}
    81102
     103/**
     104 * Get a short description string.
     105 *
     106 * @param sess Audio device session.
     107 * @param name Place to store newly allocated string.
     108 *
     109 * @return Error code.
     110 *
     111 * @note Caller is responsible for freeing newly allocated memory.
     112 */
    82113int audio_pcm_get_info_str(audio_pcm_sess_t *sess, const char **name)
    83114{
     
    109140}
    110141
     142
     143/**
     144 * Query value of specified capability.
     145 *
     146 * @param sess Audio device session.
     147 * @param cap  Audio device capability.
     148 * @param val  Place to store queried value.
     149 *
     150 * @return Error code.
     151 */
    111152int audio_pcm_query_cap(audio_pcm_sess_t *sess, audio_cap_t cap, unsigned *val)
    112153{
     
    124165}
    125166
     167/**
     168 * Query current position in device buffer.
     169 *
     170 * @param sess Audio device session.
     171 * @param pos Place to store the result.
     172 *
     173 * @return Error code.
     174 *
     175 * Works for both playback and capture.
     176 */
    126177int audio_pcm_get_buffer_pos(audio_pcm_sess_t *sess, size_t *pos)
    127178{
     
    139190}
    140191
     192/**
     193 * Test format parameters for device support.
     194 *
     195 * @param sess Audio device session.
     196 * @param channels Number of channels
     197 * @param rate Sampling rate.
     198 * @format Sample format.
     199 *
     200 * @return Error code.
     201 *
     202 * Works for both playback and capture. This function modifies provided
     203 * parameters to the nearest values supported by the device.
     204 */
    141205int audio_pcm_test_format(audio_pcm_sess_t *sess, unsigned *channels,
    142206    unsigned *rate, pcm_sample_format_t *format)
     
    168232}
    169233
     234/**
     235 * Get device accessible playback/capture buffer.
     236 *
     237 * @param sess Audio device session.
     238 * @param buffer Place to store pointer to the buffer.
     239 * @param size Place to store buffer size (bytes).
     240 * @param event_rec Event callback function.
     241 * @param arg Event callback custom parameter.
     242 *
     243 * @return Error code.
     244 */
    170245int audio_pcm_get_buffer(audio_pcm_sess_t *sess, void **buffer, size_t *size,
    171246    async_client_conn_t event_rec, void* arg)
     
    200275}
    201276
     277/**
     278 * Release device accessible playback/capture buffer.
     279 *
     280 * @param sess Audio device session.
     281 *
     282 * @return Error code.
     283 */
    202284int audio_pcm_release_buffer(audio_pcm_sess_t *sess)
    203285{
     
    210292}
    211293
     294/**
     295 * Start playback on buffer from position 0.
     296 *
     297 * @param sess Audio device session.
     298 * @param frames Size of fragment (in frames).
     299 * @param channels Number of channels.
     300 * @param sample_rate Sampling rate (for one channel).
     301 * @param format Sample format.
     302 *
     303 * @return Error code.
     304 *
     305 * Event will be generated after every fragment. Set fragment size to
     306 * 0 to turn off event generation.
     307 */
    212308int audio_pcm_start_playback(audio_pcm_sess_t *sess, unsigned frames,
    213309    unsigned channels, unsigned sample_rate, pcm_sample_format_t format)
     
    226322}
    227323
     324/**
     325 * Stop current playback.
     326 *
     327 * @param sess Audio device session.
     328 *
     329 * @return Error code.
     330 */
    228331int audio_pcm_stop_playback(audio_pcm_sess_t *sess)
    229332{
     
    236339}
    237340
     341/**
     342 * Start capture on buffer from position 0.
     343 *
     344 * @param sess Audio device session.
     345 * @param frames Size of fragment (in frames).
     346 * @param channels Number of channels.
     347 * @param sample_rate Sampling rate (for one channel).
     348 * @param format Sample format.
     349 *
     350 * @return Error code.
     351 *
     352 * Event will be generated after every fragment. Set fragment size to
     353 * 0 to turn off event generation.
     354 */
    238355int audio_pcm_start_capture(audio_pcm_sess_t *sess, unsigned frames,
    239356    unsigned channels, unsigned sample_rate, pcm_sample_format_t format)
     
    251368}
    252369
     370/**
     371 * Stop current playback.
     372 *
     373 * @param sess Audio device session.
     374 *
     375 * @return Error code.
     376 */
    253377int audio_pcm_stop_capture(audio_pcm_sess_t *sess)
    254378{
Note: See TracChangeset for help on using the changeset viewer.