volume.h

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

Generated on Wed Jan 23 11:06:29 2008 for PulseAudio by  doxygen 1.5.4