[3457] | 1 | //volume.c: |
---|
| 2 | |
---|
| 3 | /* |
---|
| 4 | * Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010 |
---|
| 5 | * The code (may) include prototypes and comments (and maybe |
---|
| 6 | * other code fragements) from libpulse*. They are mostly copyrighted by: |
---|
| 7 | * Lennart Poettering <poettering@users.sourceforge.net> and |
---|
| 8 | * Pierre Ossman <drzeus@drzeus.cx> |
---|
| 9 | * |
---|
| 10 | * This file is part of libroarpulse a part of RoarAudio, |
---|
| 11 | * a cross-platform sound system for both, home and professional use. |
---|
| 12 | * See README for details. |
---|
| 13 | * |
---|
| 14 | * This file is free software; you can redistribute it and/or modify |
---|
| 15 | * it under the terms of the GNU General Public License version 3 |
---|
| 16 | * as published by the Free Software Foundation. |
---|
| 17 | * |
---|
| 18 | * RoarAudio is distributed in the hope that it will be useful, |
---|
| 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 21 | * GNU General Public License for more details. |
---|
| 22 | * |
---|
| 23 | * You should have received a copy of the GNU General Public License |
---|
| 24 | * along with this software; see the file COPYING. If not, write to |
---|
| 25 | * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
| 26 | * |
---|
| 27 | * NOTE for everyone want's to change something and send patches: |
---|
| 28 | * read README and HACKING! There a addition information on |
---|
| 29 | * the license of this document you need to read before you send |
---|
| 30 | * any patches. |
---|
| 31 | * |
---|
| 32 | * NOTE for uses of non-GPL (LGPL,...) software using libesd, libartsc |
---|
| 33 | * or libpulse*: |
---|
| 34 | * The libs libroaresd, libroararts and libroarpulse link this libroar |
---|
| 35 | * and are therefore GPL. Because of this it may be illigal to use |
---|
| 36 | * them with any software that uses libesd, libartsc or libpulse*. |
---|
| 37 | */ |
---|
| 38 | |
---|
| 39 | #include <libroarpulse/libroarpulse.h> |
---|
| 40 | |
---|
[3458] | 41 | /** Return non-zero when *a == *b */ |
---|
| 42 | int pa_cvolume_equal(const pa_cvolume *a, const pa_cvolume *b); |
---|
| 43 | |
---|
| 44 | /** Set the volume of all channels to the specified parameter */ |
---|
| 45 | pa_cvolume* pa_cvolume_set(pa_cvolume *a, unsigned channels, pa_volume_t v); |
---|
| 46 | |
---|
| 47 | /** Pretty print a volume structure */ |
---|
| 48 | char *pa_cvolume_snprint(char *s, size_t l, const pa_cvolume *c); |
---|
| 49 | |
---|
| 50 | /** Return the average volume of all channels */ |
---|
| 51 | pa_volume_t pa_cvolume_avg(const pa_cvolume *a); |
---|
| 52 | |
---|
| 53 | /** Return TRUE when the passed cvolume structure is valid, FALSE otherwise */ |
---|
| 54 | int pa_cvolume_valid(const pa_cvolume *v); |
---|
| 55 | |
---|
| 56 | /** Return non-zero if the volume of all channels is equal to the specified value */ |
---|
| 57 | int pa_cvolume_channels_equal_to(const pa_cvolume *a, pa_volume_t v); |
---|
| 58 | |
---|
| 59 | /** Multiply two volumes specifications, return the result. This uses PA_VOLUME_NORM as neutral element of multiplication. This is only valid for software volumes! */ |
---|
| 60 | pa_volume_t pa_sw_volume_multiply(pa_volume_t a, pa_volume_t b); |
---|
| 61 | |
---|
| 62 | /** Multiply to per-channel volumes and return the result in *dest. This is only valid for software volumes! */ |
---|
| 63 | pa_cvolume *pa_sw_cvolume_multiply(pa_cvolume *dest, const pa_cvolume *a, const pa_cvolume *b); |
---|
| 64 | |
---|
| 65 | /** Convert a decibel value to a volume. This is only valid for software volumes! \since 0.4 */ |
---|
| 66 | pa_volume_t pa_sw_volume_from_dB(double f); |
---|
| 67 | |
---|
| 68 | /** Convert a volume to a decibel value. This is only valid for software volumes! \since 0.4 */ |
---|
| 69 | double pa_sw_volume_to_dB(pa_volume_t v); |
---|
| 70 | |
---|
| 71 | /** Convert a linear factor to a volume. This is only valid for software volumes! \since 0.8 */ |
---|
| 72 | pa_volume_t pa_sw_volume_from_linear(double v); |
---|
| 73 | |
---|
| 74 | /** Convert a volume to a linear factor. This is only valid for software volumes! \since 0.8 */ |
---|
| 75 | double pa_sw_volume_to_linear(pa_volume_t v); |
---|
| 76 | |
---|
[3457] | 77 | //ll |
---|