]> code.delx.au - pulseaudio/blob - src/polypcore/sink.h
unhide padsp
[pulseaudio] / src / polypcore / sink.h
1 #ifndef foosinkhfoo
2 #define foosinkhfoo
3
4 /* $Id$ */
5
6 /***
7 This file is part of polypaudio.
8
9 polypaudio is free software; you can redistribute it and/or modify
10 it under the terms of the GNU Lesser General Public License as published
11 by the Free Software Foundation; either version 2 of the License,
12 or (at your option) any later version.
13
14 polypaudio is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public License
20 along with polypaudio; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 USA.
23 ***/
24
25 #include <inttypes.h>
26
27 typedef struct pa_sink pa_sink;
28
29 #include <polyp/sample.h>
30 #include <polyp/channelmap.h>
31 #include <polyp/volume.h>
32 #include <polypcore/core-def.h>
33 #include <polypcore/core.h>
34 #include <polypcore/idxset.h>
35 #include <polypcore/source.h>
36 #include <polypcore/module.h>
37
38 #define PA_MAX_INPUTS_PER_SINK 32
39
40 typedef enum pa_sink_state {
41 PA_SINK_RUNNING,
42 PA_SINK_DISCONNECTED
43 } pa_sink_state_t;
44
45 struct pa_sink {
46 int ref;
47 uint32_t index;
48 pa_core *core;
49 pa_sink_state_t state;
50
51 char *name, *description, *driver;
52 pa_module *owner;
53
54 pa_sample_spec sample_spec;
55 pa_channel_map channel_map;
56
57 pa_idxset *inputs;
58 pa_source *monitor_source;
59
60 pa_cvolume hw_volume, sw_volume;
61 int hw_muted, sw_muted;
62
63 void (*notify)(pa_sink*sink);
64 pa_usec_t (*get_latency)(pa_sink *s);
65 int (*set_hw_volume)(pa_sink *s);
66 int (*get_hw_volume)(pa_sink *s);
67 int (*set_hw_mute)(pa_sink *s);
68 int (*get_hw_mute)(pa_sink *s);
69
70 void *userdata;
71 };
72
73 pa_sink* pa_sink_new(
74 pa_core *core,
75 const char *driver,
76 const char *name,
77 int namereg_fail,
78 const pa_sample_spec *spec,
79 const pa_channel_map *map);
80
81 void pa_sink_disconnect(pa_sink* s);
82 void pa_sink_unref(pa_sink*s);
83 pa_sink* pa_sink_ref(pa_sink *s);
84
85 int pa_sink_render(pa_sink*s, size_t length, pa_memchunk *result);
86 void pa_sink_render_full(pa_sink *s, size_t length, pa_memchunk *result);
87 int pa_sink_render_into(pa_sink*s, pa_memchunk *target);
88 void pa_sink_render_into_full(pa_sink *s, pa_memchunk *target);
89
90 pa_usec_t pa_sink_get_latency(pa_sink *s);
91
92 void pa_sink_notify(pa_sink*s);
93
94 void pa_sink_set_owner(pa_sink *sink, pa_module *m);
95
96 void pa_sink_set_volume(pa_sink *sink, pa_mixer_t m, const pa_cvolume *volume);
97 const pa_cvolume *pa_sink_get_volume(pa_sink *sink, pa_mixer_t m);
98 void pa_sink_set_mute(pa_sink *sink, pa_mixer_t m, int mute);
99 int pa_sink_get_mute(pa_sink *sink, pa_mixer_t m);
100
101 #endif