source: mainline/uspace/lib/hound/include/hound/client.h@ ec81221

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

libhound: Handle default target

  • Property mode set to 100644
File size: 4.2 KB
Line 
1/*
2 * Copyright (c) 2012 Jan Vesely
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 libhound
29 * @addtogroup audio
30 * @{
31 */
32/** @file
33 * @brief Audio PCM buffer interface.
34 */
35
36#ifndef LIBHOUND_CLIENT_H_
37#define LIBHOUND_CLIENT_H_
38
39#include <async.h>
40#include <stdbool.h>
41#include <pcm/format.h>
42
43#define HOUND_DEFAULT_TARGET "default"
44#define HOUND_ALL_TARGETS "all"
45#define DEFAULT_SINK "default" //DEPRECATED
46
47typedef struct hound_context hound_context_t;
48typedef struct hound_stream hound_stream_t;
49
50hound_context_t * hound_context_create_playback(const char *name,
51 pcm_format_t format, size_t bsize);
52hound_context_t * hound_context_create_capture(const char *name,
53 pcm_format_t format, size_t bsize);
54void hound_context_destroy(hound_context_t *hound);
55
56int hound_context_enable(hound_context_t *hound);
57int hound_context_disable(hound_context_t *hound);
58
59int hound_context_set_main_stream_format(hound_context_t *hound,
60 unsigned channels, unsigned rate, pcm_sample_format_t format);
61
62int hound_context_get_available_targets(hound_context_t *hound,
63 const char ***names, size_t *count);
64int hound_context_get_connected_targets(hound_context_t *hound,
65 const char ***names, size_t *count);
66
67int hound_context_connect_target(hound_context_t *hound, const char* target);
68int hound_context_disconnect_target(hound_context_t *hound, const char* target);
69
70hound_stream_t *hound_stream_create(hound_context_t *hound, unsigned flags,
71 pcm_format_t format, size_t bsize);
72void hound_stream_destroy(hound_stream_t *stream);
73
74int hound_stream_write(hound_stream_t *stream, const void *data, size_t size);
75int hound_stream_read(hound_stream_t *stream, void *data, size_t size);
76
77int hound_write_main_stream(hound_context_t *hound,
78 const void *data, size_t size);
79int hound_read_main_stream(hound_context_t *hound, void *data, size_t size);
80int hound_write_replace_main_stream(hound_context_t *hound,
81 const void *data, size_t size);
82int hound_write_immediate(hound_context_t *hound,
83 pcm_format_t format, const void *data, size_t size);
84
85
86
87
88
89typedef async_sess_t hound_sess_t;
90
91typedef void (*data_callback_t)(void *, void *, ssize_t);
92
93hound_sess_t *hound_get_session(void);
94void hound_release_session(hound_sess_t *sess);
95int hound_register_playback(hound_sess_t *sess, const char *name,
96 unsigned channels, unsigned rate, pcm_sample_format_t format,
97 data_callback_t data_callback, void *arg);
98int hound_register_recording(hound_sess_t *sess, const char *name,
99 unsigned channels, unsigned rate, pcm_sample_format_t format,
100 data_callback_t data_callback, void *arg);
101int hound_unregister_playback(hound_sess_t *sess, const char *name);
102int hound_unregister_recording(hound_sess_t *sess, const char *name);
103int hound_create_connection(hound_sess_t *sess, const char *source, const char *sink);
104int hound_destroy_connection(hound_sess_t *sess, const char *source, const char *sink);
105
106#endif
Note: See TracBrowser for help on using the repository browser.