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

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

libhound: Destroy streams on stream_exit

  • Property mode set to 100644
File size: 4.1 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_set_main_stream_format(hound_context_t *hound,
57 unsigned channels, unsigned rate, pcm_sample_format_t format);
58
59int hound_context_get_available_targets(hound_context_t *hound,
60 const char ***names, size_t *count);
61int hound_context_get_connected_targets(hound_context_t *hound,
62 const char ***names, size_t *count);
63
64int hound_context_connect_target(hound_context_t *hound, const char* target);
65int hound_context_disconnect_target(hound_context_t *hound, const char* target);
66
67hound_stream_t *hound_stream_create(hound_context_t *hound, unsigned flags,
68 pcm_format_t format, size_t bsize);
69void hound_stream_destroy(hound_stream_t *stream);
70
71int hound_stream_write(hound_stream_t *stream, const void *data, size_t size);
72int hound_stream_read(hound_stream_t *stream, void *data, size_t size);
73
74int hound_write_main_stream(hound_context_t *hound,
75 const void *data, size_t size);
76int hound_read_main_stream(hound_context_t *hound, void *data, size_t size);
77int hound_write_replace_main_stream(hound_context_t *hound,
78 const void *data, size_t size);
79int hound_write_immediate(hound_context_t *hound,
80 pcm_format_t format, const void *data, size_t size);
81
82
83
84
85
86typedef async_sess_t hound_sess_t;
87
88typedef void (*data_callback_t)(void *, void *, ssize_t);
89
90hound_sess_t *hound_get_session(void);
91void hound_release_session(hound_sess_t *sess);
92int hound_register_playback(hound_sess_t *sess, const char *name,
93 unsigned channels, unsigned rate, pcm_sample_format_t format,
94 data_callback_t data_callback, void *arg);
95int hound_register_recording(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_unregister_playback(hound_sess_t *sess, const char *name);
99int hound_unregister_recording(hound_sess_t *sess, const char *name);
100int hound_create_connection(hound_sess_t *sess, const char *source, const char *sink);
101int hound_destroy_connection(hound_sess_t *sess, const char *source, const char *sink);
102
103#endif
Note: See TracBrowser for help on using the repository browser.