volume.h

Go to the documentation of this file.
00001 #ifndef foovolumehfoo
00002 #define foovolumehfoo
00003 
00004 /***
00005   This file is part of PulseAudio.
00006 
00007   Copyright 2004-2006 Lennart Poettering
00008   Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
00009 
00010   PulseAudio is free software; you can redistribute it and/or modify
00011   it under the terms of the GNU Lesser General Public License as published
00012   by the Free Software Foundation; either version 2 of the License,
00013   or (at your option) any later version.
00014 
00015   PulseAudio is distributed in the hope that it will be useful, but
00016   WITHOUT ANY WARRANTY; without even the implied warranty of
00017   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00018   General Public License for more details.
00019 
00020   You should have received a copy of the GNU Lesser General Public License
00021   along with PulseAudio; if not, write to the Free Software
00022   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023   USA.
00024 ***/
00025 
00026 #include <inttypes.h>
00027 
00028 #include <pulse/cdecl.h>
00029 #include <pulse/gccmacro.h>
00030 #include <pulse/sample.h>
00031 #include <pulse/channelmap.h>
00032 
00095 PA_C_DECL_BEGIN
00096 
00102 typedef uint32_t pa_volume_t;
00103 
00105 #define PA_VOLUME_NORM ((pa_volume_t) 0x10000U)
00106 
00108 #define PA_VOLUME_MUTED ((pa_volume_t) 0U)
00109 
00111 typedef struct pa_cvolume {
00112     uint8_t channels;                     
00113     pa_volume_t values[PA_CHANNELS_MAX];  
00114 } pa_cvolume;
00115 
00117 int pa_cvolume_equal(const pa_cvolume *a, const pa_cvolume *b) PA_GCC_PURE;
00118 
00120 #define pa_cvolume_reset(a, n) pa_cvolume_set((a), (n), PA_VOLUME_NORM)
00121 
00123 #define pa_cvolume_mute(a, n) pa_cvolume_set((a), (n), PA_VOLUME_MUTED)
00124 
00126 pa_cvolume* pa_cvolume_set(pa_cvolume *a, unsigned channels, pa_volume_t v);
00127 
00129 #define PA_CVOLUME_SNPRINT_MAX 64
00130 
00132 char *pa_cvolume_snprint(char *s, size_t l, const pa_cvolume *c);
00133 
00135 pa_volume_t pa_cvolume_avg(const pa_cvolume *a) PA_GCC_PURE;
00136 
00138 pa_volume_t pa_cvolume_max(const pa_cvolume *a) PA_GCC_PURE;
00139 
00141 int pa_cvolume_valid(const pa_cvolume *v) PA_GCC_PURE;
00142 
00144 int pa_cvolume_channels_equal_to(const pa_cvolume *a, pa_volume_t v) PA_GCC_PURE;
00145 
00147 #define pa_cvolume_is_muted(a) pa_cvolume_channels_equal_to((a), PA_VOLUME_MUTED)
00148 
00150 #define pa_cvolume_is_norm(a) pa_cvolume_channels_equal_to((a), PA_VOLUME_NORM)
00151 
00153 pa_volume_t pa_sw_volume_multiply(pa_volume_t a, pa_volume_t b) PA_GCC_CONST;
00154 
00156 pa_cvolume *pa_sw_cvolume_multiply(pa_cvolume *dest, const pa_cvolume *a, const pa_cvolume *b);
00157 
00159 pa_volume_t pa_sw_volume_from_dB(double f) PA_GCC_CONST;
00160 
00162 double pa_sw_volume_to_dB(pa_volume_t v) PA_GCC_CONST;
00163 
00165 pa_volume_t pa_sw_volume_from_linear(double v) PA_GCC_CONST;
00166 
00168 double pa_sw_volume_to_linear(pa_volume_t v) PA_GCC_CONST;
00169 
00170 #ifdef INFINITY
00171 #define PA_DECIBEL_MININFTY ((double) -INFINITY)
00172 #else
00173 
00174 #define PA_DECIBEL_MININFTY ((double) -200.0)
00175 #endif
00176 
00178 pa_cvolume *pa_cvolume_remap(pa_cvolume *v, pa_channel_map *from, pa_channel_map *to);
00179 
00180 PA_C_DECL_END
00181 
00182 #endif

Generated on Tue Sep 16 10:58:58 2008 for PulseAudio by  doxygen 1.5.4