source: mainline/uspace/lib/drv/include/audio_pcm_iface.h@ 57e8b3b

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 57e8b3b was 57e8b3b, checked in by Jan Vesely <jano.vesely@…>, 13 years ago

Add frame count to event report.

This enables applications to detect underruns.

  • Property mode set to 100644
File size: 3.1 KB
RevLine 
[c09ad29e]1/*
[90f05b0f]2 * Copyright (c) 2012 Jan Vesely
[c09ad29e]3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28/** @addtogroup libdrv
29 * @addtogroup usb
30 * @{
31 */
32/** @file
33 * @brief Audio PCM buffer interface.
34 */
35
[90f05b0f]36#ifndef LIBDRV_AUDIO_PCM_IFACE_H_
37#define LIBDRV_AUDIO_PCM_IFACE_H_
[c09ad29e]38
39#include <async.h>
40#include <bool.h>
[2cc5c835]41#include <loc.h>
[346643c]42#include <pcm_sample_format.h>
[c09ad29e]43
44#include "ddf/driver.h"
45
[1240bb9]46enum {
[57e8b3b]47 PCM_EVENT_FRAMES_PLAYED = IPC_FIRST_USER_METHOD,
48 PCM_EVENT_FRAMES_RECORDED,
[1240bb9]49 PCM_EVENT_PLAYBACK_TERMINATED,
50 PCM_EVENT_RECORDING_TERMINATED
51};
52
[2cc5c835]53typedef async_sess_t audio_pcm_sess_t;
[1240bb9]54
[2cc5c835]55audio_pcm_sess_t *audio_pcm_open(const char *);
56audio_pcm_sess_t *audio_pcm_open_service(service_id_t service);
57void audio_pcm_close(audio_pcm_sess_t *);
58
59int audio_pcm_get_info_str(audio_pcm_sess_t *, const char **);
60int audio_pcm_get_buffer(audio_pcm_sess_t *, void **, size_t *,
[8de7ef2]61 async_client_conn_t, void *);
[2cc5c835]62int audio_pcm_release_buffer(audio_pcm_sess_t *);
[c09ad29e]63
[2cc5c835]64int audio_pcm_start_playback(audio_pcm_sess_t *, unsigned,
[346643c]65 unsigned, unsigned, pcm_sample_format_t);
[2cc5c835]66int audio_pcm_stop_playback(audio_pcm_sess_t *);
[c09ad29e]67
[2cc5c835]68int audio_pcm_start_record(audio_pcm_sess_t *, unsigned,
[346643c]69 unsigned, unsigned, pcm_sample_format_t);
[2cc5c835]70int audio_pcm_stop_record(audio_pcm_sess_t *);
[c09ad29e]71
72/** Audio pcm communication interface. */
73typedef struct {
74 int (*get_info_str)(ddf_fun_t *, const char **);
[b497018]75 int (*get_buffer)(ddf_fun_t *, void **, size_t *);
76 int (*release_buffer)(ddf_fun_t *);
77 int (*set_event_session)(ddf_fun_t *, async_sess_t *);
78 int (*start_playback)(ddf_fun_t *, unsigned,
[346643c]79 unsigned, unsigned, pcm_sample_format_t);
[b497018]80 int (*stop_playback)(ddf_fun_t *);
81 int (*start_record)(ddf_fun_t *, unsigned,
[346643c]82 unsigned, unsigned, pcm_sample_format_t);
[b497018]83 int (*stop_record)(ddf_fun_t *);
[90f05b0f]84} audio_pcm_iface_t;
[c09ad29e]85
86#endif
87/**
88 * @}
89 */
Note: See TracBrowser for help on using the repository browser.