volume.h

Go to the documentation of this file.
00001 #ifndef foovolumehfoo
00002 #define foovolumehfoo
00003 
00004 /* $Id: volume.h 1036 2006-06-19 22:11:49Z lennart $ */
00005 
00006 /***
00007   This file is part of PulseAudio.
00008  
00009   PulseAudio is free software; you can redistribute it and/or modify
00010   it under the terms of the GNU Lesser General Public License as published
00011   by the Free Software Foundation; either version 2 of the License,
00012   or (at your option) any later version.
00013  
00014   PulseAudio is distributed in the hope that it will be useful, but
00015   WITHOUT ANY WARRANTY; without even the implied warranty of
00016   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00017   General Public License for more details.
00018  
00019   You should have received a copy of the GNU Lesser General Public License
00020   along with PulseAudio; if not, write to the Free Software
00021   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00022   USA.
00023 ***/
00024 
00025 #include <inttypes.h>
00026 #include <pulse/cdecl.h>
00027 #include <pulse/sample.h>
00028 
00091 PA_C_DECL_BEGIN
00092 
00098 typedef uint32_t pa_volume_t;
00099 
00101 #define PA_VOLUME_NORM (0x10000)
00102 
00104 #define PA_VOLUME_MUTED (0)
00105 
00107 typedef struct pa_cvolume {
00108     uint8_t channels;                     
00109     pa_volume_t values[PA_CHANNELS_MAX];  
00110 } pa_cvolume;
00111 
00113 int pa_cvolume_equal(const pa_cvolume *a, const pa_cvolume *b);
00114 
00116 #define pa_cvolume_reset(a, n) pa_cvolume_set((a), (n), PA_VOLUME_NORM)
00117 
00119 #define pa_cvolume_mute(a, n) pa_cvolume_set((a), (n), PA_VOLUME_MUTED)
00120 
00122 pa_cvolume* pa_cvolume_set(pa_cvolume *a, unsigned channels, pa_volume_t v);
00123 
00125 #define PA_CVOLUME_SNPRINT_MAX 64
00126 
00128 char *pa_cvolume_snprint(char *s, size_t l, const pa_cvolume *c);
00129 
00131 pa_volume_t pa_cvolume_avg(const pa_cvolume *a);
00132 
00134 int pa_cvolume_valid(const pa_cvolume *v);
00135 
00137 int pa_cvolume_channels_equal_to(const pa_cvolume *a, pa_volume_t v);
00138 
00140 #define pa_cvolume_is_muted(a) pa_cvolume_channels_equal_to((a), PA_VOLUME_MUTED)
00141 
00143 #define pa_cvolume_is_norm(a) pa_cvolume_channels_equal_to((a), PA_VOLUME_NORM)
00144 
00146 pa_volume_t pa_sw_volume_multiply(pa_volume_t a, pa_volume_t b);
00147 
00149 pa_cvolume *pa_sw_cvolume_multiply(pa_cvolume *dest, const pa_cvolume *a, const pa_cvolume *b);
00150 
00152 pa_volume_t pa_sw_volume_from_dB(double f);
00153 
00155 double pa_sw_volume_to_dB(pa_volume_t v);
00156 
00158 pa_volume_t pa_sw_volume_from_linear(double v);
00159 
00161 double pa_sw_volume_to_linear(pa_volume_t v);
00162 
00163 #ifdef INFINITY
00164 #define PA_DECIBEL_MININFTY (-INFINITY)
00165 #else
00166 
00167 #define PA_DECIBEL_MININFTY (-200)
00168 #endif
00169 
00170 PA_C_DECL_END
00171 
00172 #endif

Generated on Wed May 30 19:36:31 2007 for PulseAudio by  doxygen 1.5.1