~diwic/ubuntu/lucid/pulseaudio/bugfixes

« back to all changes in this revision

Viewing changes to src/pulse/volume.h

  • Committer: Bazaar Package Importer
  • Author(s): Luke Yelavich
  • Date: 2008-11-04 15:46:00 UTC
  • mfrom: (1.2.1 upstream) (1.1.6 lenny)
  • Revision ID: james.westby@ubuntu.com-20081104154600-hlzknpcazaam0nxm
Tags: 0.9.13-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Don't build against, and create jack package. Jack is not in main.
  - Remove --disable-per-user-esound-socket from configure flags, as we still
    want per user esound sockets.
  - Remove stop links from rc0 and rc6.
  - Change default resample algorithm and bubffer size.
  - Add alsa configuration files to route alsa applications via pulseaudio.
  - Move libasound2-plugins from Recommends to Depends.
* debian/pulseaudio.preinst: When upgrading from intrepid, remove
  /etc/X11/Xsession.d/70pulseaudio, as this was used to minimize a race
  condition when starting GNOME in intrepid. This race should not exist in
  jaunty once libcanberra is built to use pulseaudio as a backend.
* Do not spawn a pulseaudio server if clients fail to find a running server.
* Remove explicit version dependency for libspeex-dev to allow the package
  to be built for now.
* Regenerate autotools files to work with Ubuntu's newer libtool/libltdl.
* debian/control: libpulsecore5 -> libpulsecore8 to match the library
  soname.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#ifndef foovolumehfoo
2
2
#define foovolumehfoo
3
3
 
4
 
/* $Id: volume.h 1971 2007-10-28 19:13:50Z lennart $ */
5
 
 
6
4
/***
7
5
  This file is part of PulseAudio.
8
6
 
26
24
***/
27
25
 
28
26
#include <inttypes.h>
 
27
 
29
28
#include <pulse/cdecl.h>
 
29
#include <pulse/gccmacro.h>
30
30
#include <pulse/sample.h>
 
31
#include <pulse/channelmap.h>
31
32
 
32
33
/** \page volume Volume Control
33
34
 *
61
62
 *
62
63
 * The functions described above are only valid when used with
63
64
 * software volumes. Hence it is usually a better idea to treat all
64
 
 * volume values as opaque with a range from PA_VOLUME_MUTE (0%) to
 
65
 * volume values as opaque with a range from PA_VOLUME_MUTED (0%) to
65
66
 * PA_VOLUME_NORM (100%) and to refrain from any calculations with
66
67
 * them.
67
68
 *
101
102
typedef uint32_t pa_volume_t;
102
103
 
103
104
/** Normal volume (100%) */
104
 
#define PA_VOLUME_NORM (0x10000)
 
105
#define PA_VOLUME_NORM ((pa_volume_t) 0x10000U)
105
106
 
106
107
/** Muted volume (0%) */
107
 
#define PA_VOLUME_MUTED (0)
 
108
#define PA_VOLUME_MUTED ((pa_volume_t) 0U)
108
109
 
109
110
/** A structure encapsulating a per-channel volume */
110
111
typedef struct pa_cvolume {
115
116
/** Return non-zero when *a == *b */
116
117
int pa_cvolume_equal(const pa_cvolume *a, const pa_cvolume *b) PA_GCC_PURE;
117
118
 
 
119
/** Initialize the specified volume and return a pointer to
 
120
 * it. The sample spec will have a defined state but
 
121
 * pa_cvolume_valid() will fail for it. \since 0.9.13 */
 
122
pa_cvolume* pa_cvolume_init(pa_cvolume *a);
 
123
 
118
124
/** Set the volume of all channels to PA_VOLUME_NORM */
119
125
#define pa_cvolume_reset(a, n) pa_cvolume_set((a), (n), PA_VOLUME_NORM)
120
126
 
124
130
/** Set the volume of all channels to the specified parameter */
125
131
pa_cvolume* pa_cvolume_set(pa_cvolume *a, unsigned channels, pa_volume_t v);
126
132
 
127
 
/** Maximum length of the strings returned by pa_cvolume_snprint() */
128
 
#define PA_CVOLUME_SNPRINT_MAX 64
 
133
/** Maximum length of the strings returned by
 
134
 * pa_cvolume_snprint(). Please note that this value can change with
 
135
 * any release without warning and without being considered API or ABI
 
136
 * breakage. You should not use this definition anywhere where it
 
137
 * might become part of an ABI.*/
 
138
#define PA_CVOLUME_SNPRINT_MAX 320
129
139
 
130
140
/** Pretty print a volume structure */
131
141
char *pa_cvolume_snprint(char *s, size_t l, const pa_cvolume *c);
132
142
 
 
143
/** Maximum length of the strings returned by
 
144
 * pa_cvolume_snprint_dB(). Please note that this value can change with
 
145
 * any release without warning and without being considered API or ABI
 
146
 * breakage. You should not use this definition anywhere where it
 
147
 * might become part of an ABI. \since 0.9.13 */
 
148
#define PA_SW_CVOLUME_SNPRINT_DB_MAX 448
 
149
 
 
150
/** Pretty print a volume structure but show dB values. \since 0.9.13 */
 
151
char *pa_sw_cvolume_snprint_dB(char *s, size_t l, const pa_cvolume *c);
 
152
 
133
153
/** Return the average volume of all channels */
134
154
pa_volume_t pa_cvolume_avg(const pa_cvolume *a) PA_GCC_PURE;
135
155
 
 
156
/** Return the maximum volume of all channels. \since 0.9.12 */
 
157
pa_volume_t pa_cvolume_max(const pa_cvolume *a) PA_GCC_PURE;
 
158
 
136
159
/** Return TRUE when the passed cvolume structure is valid, FALSE otherwise */
137
160
int pa_cvolume_valid(const pa_cvolume *v) PA_GCC_PURE;
138
161
 
145
168
/** Return 1 if the specified volume has all channels on normal level */
146
169
#define pa_cvolume_is_norm(a) pa_cvolume_channels_equal_to((a), PA_VOLUME_NORM)
147
170
 
148
 
/** Multiply two volumes specifications, return the result. This uses PA_VOLUME_NORM as neutral element of multiplication. This is only valid for software volumes! */
 
171
/** Multiply two volume specifications, return the result. This uses
 
172
 * PA_VOLUME_NORM as neutral element of multiplication. This is only
 
173
 * valid for software volumes! */
149
174
pa_volume_t pa_sw_volume_multiply(pa_volume_t a, pa_volume_t b) PA_GCC_CONST;
150
175
 
151
 
/** Multiply to per-channel volumes and return the result in *dest. This is only valid for software volumes! */
152
 
pa_cvolume *pa_sw_cvolume_multiply(pa_cvolume *dest, const pa_cvolume *a, const pa_cvolume *b) PA_GCC_PURE;
153
 
 
154
 
/** Convert a decibel value to a volume. This is only valid for software volumes! \since 0.4 */
 
176
/** Multiply two per-channel volumes and return the result in
 
177
 * *dest. This is only valid for software volumes! */
 
178
pa_cvolume *pa_sw_cvolume_multiply(pa_cvolume *dest, const pa_cvolume *a, const pa_cvolume *b);
 
179
 
 
180
/** Divide two volume specifications, return the result. This uses
 
181
 * PA_VOLUME_NORM as neutral element of division. This is only valid
 
182
 * for software volumes! If a division by zero is tried the result
 
183
 * will be 0. \since 0.9.13 */
 
184
pa_volume_t pa_sw_volume_divide(pa_volume_t a, pa_volume_t b) PA_GCC_CONST;
 
185
 
 
186
/** Multiply to per-channel volumes and return the result in
 
187
 * *dest. This is only valid for software volumes! \since 0.9.13 */
 
188
pa_cvolume *pa_sw_cvolume_divide(pa_cvolume *dest, const pa_cvolume *a, const pa_cvolume *b);
 
189
 
 
190
/** Convert a decibel value to a volume. This is only valid for software volumes! */
155
191
pa_volume_t pa_sw_volume_from_dB(double f) PA_GCC_CONST;
156
192
 
157
 
/** Convert a volume to a decibel value. This is only valid for software volumes! \since 0.4 */
 
193
/** Convert a volume to a decibel value. This is only valid for software volumes! */
158
194
double pa_sw_volume_to_dB(pa_volume_t v) PA_GCC_CONST;
159
195
 
160
 
/** Convert a linear factor to a volume. This is only valid for software volumes! \since 0.8 */
 
196
/** Convert a linear factor to a volume. This is only valid for software volumes! */
161
197
pa_volume_t pa_sw_volume_from_linear(double v) PA_GCC_CONST;
162
198
 
163
 
/** Convert a volume to a linear factor. This is only valid for software volumes! \since 0.8 */
 
199
/** Convert a volume to a linear factor. This is only valid for software volumes! */
164
200
double pa_sw_volume_to_linear(pa_volume_t v) PA_GCC_CONST;
165
201
 
166
202
#ifdef INFINITY
167
 
#define PA_DECIBEL_MININFTY (-INFINITY)
 
203
#define PA_DECIBEL_MININFTY ((double) -INFINITY)
168
204
#else
169
 
/** This value is used as minus infinity when using pa_volume_{to,from}_dB(). \since 0.4 */
170
 
#define PA_DECIBEL_MININFTY (-200)
 
205
/** This value is used as minus infinity when using pa_volume_{to,from}_dB(). */
 
206
#define PA_DECIBEL_MININFTY ((double) -200.0)
171
207
#endif
172
208
 
 
209
/** Remap a volume from one channel mapping to a different channel mapping. \since 0.9.12 */
 
210
pa_cvolume *pa_cvolume_remap(pa_cvolume *v, pa_channel_map *from, pa_channel_map *to);
 
211
 
 
212
/** Return non-zero if the specified volume is compatible with
 
213
 * the specified sample spec. \since 0.9.13 */
 
214
int pa_cvolume_compatible(const pa_cvolume *v, const pa_sample_spec *ss) PA_GCC_PURE;
 
215
 
173
216
PA_C_DECL_END
174
217
 
175
218
#endif