source: mainline/uspace/srv/audio/hound/audio_source.h@ 992ef56

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

hound: Move mixing to audio_source.

  • Property mode set to 100644
File size: 2.7 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
29/** @addtogroup audio
30 * @brief HelenOS sound server
31 * @{
32 */
33/** @file
34 */
35
36#ifndef AUDIO_SOURCE_H_
37#define AUDIO_SOURCE_H_
38
39#include <adt/list.h>
40#include <bool.h>
41#include <pcm_sample_format.h>
42
43#include "audio_format.h"
44
45
46typedef struct {
47 link_t link;
48 char *name;
49 struct {
50 int (*hook)(void* arg, const audio_format_t *f);
51 void *arg;
52 } connected_change;
53 struct {
54 int (*hook)(void* arg);
55 void *arg;
56 } get_data;
57 struct {
58 void *base;
59 size_t size;
60 } available;
61 audio_format_t format;
62} audio_source_t;
63
64static inline audio_source_t * audio_source_list_instance(link_t *l)
65{
66 return list_get_instance(l, audio_source_t, link);
67}
68
69int audio_source_init(audio_source_t *source, const char *name);
70static inline void audio_source_set_connected_callback(audio_source_t *source,
71 int (*hook)(void* arg, const audio_format_t *f), void* arg)
72{
73 assert(source);
74 source->connected_change.arg = arg;
75 source->connected_change.hook = hook;
76}
77int audio_source_connected(audio_source_t *source, const audio_format_t *f);
78int audio_source_add_self(audio_source_t *source, void *buffer, size_t size,
79 const audio_format_t *f);
80static inline const audio_format_t *audio_source_format(const audio_source_t *s)
81{
82 assert(s);
83 return &s->format;
84}
85#endif
86
87/**
88 * @}
89 */
Note: See TracBrowser for help on using the repository browser.