Commit graph

74 commits

Author SHA1 Message Date
Lyndon Brown
d851021cf5 volume: pa_cvolume_get_position: constify 2018-06-21 06:30:25 +05:30
jnqnfe
7973dfd768 volume: slight simplification of code 2017-11-29 23:56:33 +02:00
jnqnfe
a049e7e8bd volume: pa_cvolume_scale_mask: constify param 2017-11-29 23:50:52 +02:00
Georg Chini
68203100ff volume: Fix overflow in percent calculation of pa_*volume_snprint*()
The percent calculation could overflow in the pa_*volume_snprint*() functions.
For large volumes, volume * 100 can exceed UINT32_MAX.

This patch adds appropriate type casts.
2017-04-29 10:38:05 +02:00
Georg Chini
be1276d816 volume: Print a warning when volume is clipped in pa_sw_volume_multiply/divide()
When the volume exceeds PA_VOLUME_MAX in pa_sw_volume_multiply() or
pa_sw_volume_divide(), volume settings are insanely high and the
user should be notified about it.

This patch adds volume clamping to pa_sw_volume_divide() and prints
a warning when the volume is clipped in both functions.
2017-04-29 10:12:01 +02:00
David Henningsson
9fecb6eb32 volume: Add LFE balance API
The gnome/unity-control-center UIs have a master volume slider, and
three sub-sliders: balance, fade, and subwoofer. Balance and fade
use PA's set_balance and set_fade APIs accordingly, but the subwoofer
slider sometimes does unintuitive things.

In order to make that slider behave better, let's add a LFE balance
API that these volume control UIs can use instead. With this API,
the UI can balance between "no subwoofer" and "only subwoofer" with
"equal balance" in the middle, which would make it more consistent
with the behaviour of the other sliders.

BugLink: https://bugzilla.gnome.org/show_bug.cgi?id=753847

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2015-10-30 09:13:10 +02:00
David Henningsson
387a244cd9 volume: Refactor get/set balance/fade
get/set balance and fade use very similar code, so refactor out
common parts.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2015-10-30 09:13:07 +02:00
Ondrej Holecek
5effc83479 update FSF addresses to FSF web page
FSF addresses used in PA sources are no longer valid and rpmlint
generates numerous warnings during packaging because of this.
This patch changes all FSF addresses to FSF web page according to
the GPL how-to: https://www.gnu.org/licenses/gpl-howto.en.html

Done automatically by sed-ing through sources.
2015-01-14 22:20:40 +02:00
Tanu Kaskinen
2747c96101 Add pa_channels_valid()
I think this makes the code a bit nicer to read and write. This also
reduces the chances of off-by-one errors when checking the bounds of
channel count values.
2013-12-15 11:44:35 +01:00
Tanu Kaskinen
596b2988a5 pulse: Add verbose volume printing functions
For more informative logging.
2013-07-09 17:20:28 +03:00
poljar (Damir Jelić)
d806b19714 Remove pa_bool_t and replace it with bool.
commands used for this (executed from the pulseaudio/src directory):
    find . -regex '\(.*\.[hc]\|.*\.cc\|.*\.m4\)' -not -name 'macro.h' \
        -a -not -name 'reserve.[ch]' -a -not -name 'reserve-monitor.[ch]' \
        -a -not -name 'glib-mainloop.c' -a -not -name 'gkt-test.c' \
        -a -not -name 'glib-mainloop.c' -a -not -name 'gkt-test.c' \
        -a -not -name 'poll-win32.c' -a -not -name 'thread-win32.c' \
        -a -not -name 'dllmain.c' -a -not -name 'gconf-helper.c' \
        -exec sed -i -e 's/\bpa_bool_t\b/bool/g' \
        -e 's/\bTRUE\b/true/g' -e 's/\bFALSE\b/false/g' {} \;

and:
    sed -i -e '181,194!s/\bpa_bool_t\b/bool/' \
        -e '181,194!s/\bTRUE\b/true/' -e \
        '181,194!s/\bFALSE\b/false/' pulsecore/macro.h
2013-07-04 12:25:30 +03:00
poljar (Damir Jelić)
cbd274676d Style fix: Add a space between the closing/opening bracket
This patch replaces every occurrence of '){' with ') {'.
The ffmpeg source tree was excluded since it will disappear anyways.

Command used for this:
    find . -type d \( -name ffmpeg \) -prune -o \
        -regex '\(.*\.[hc]\|.*\.cc\)' \
        -exec sed -i -e 's/){/) {/' {} \;
2013-06-24 16:56:24 +03:00
Maarten Bosmans
b4e938e194 Move i18n.[ch] to src/pulsecore
The header is used in files troughout the tree and is not included in the public api,
so it belongs in pulsecore, not in pulse.
2011-08-11 13:23:42 +02:00
Maarten Bosmans
dd9265ac78 Remove unnecessary #includes 2011-06-22 23:12:20 +01:00
Maarten Bosmans
684b89c639 Fix up some double spaces 2011-03-18 09:20:07 +00:00
Maarten Bosmans
9cbf19b59b Various fixes for build warnings 2011-03-02 15:02:42 +00:00
Arun Raghavan
49101fc540 volume: Clamp volume to PA_VOLUME_MAX
This ensures that we always clamp the volume to PA_VOLUME_MAX. While
this currently has no effect, it will be required for making sure we
don't exceed PA_VOLUME_MAX when its value changes in the future.
2010-10-15 01:10:00 +05:30
Arun Raghavan
1d2ef7923d volume: Use a macro to check if a volume is valid
This adds a PA_VOLUME_IS_VALID() macro for checking if a given
pa_volume_t is valid. This makes changes to the volume ranges simpler
(just change PA_VOLUME_MAX, for example, without needing to modify any
other code).
2010-10-15 01:10:00 +05:30
Vladimir Kokarev
d2c59354d5 volume: add pa_cvolume_inc_clamp function
added function to increase volume not exceeding specified limit
simply changed PA_VOLUME_MAX to 'limit' in pa_cvolume_inc
pa_cvolume_inc now calls pa_cvolume_inc_clamp with PA_VOLUME_MAX limit
2009-11-05 04:56:47 +01:00
Lennart Poettering
f5046759cd llvm-clang-analyzer: drop a few unnecessary assignments and other trivial fixes 2009-09-08 23:46:23 +02:00
Lennart Poettering
41a0dc1e99 volume: if pa_cvolume_set_{balance|fade}() is called with invalid fade/balance value log, but don't assert 2009-09-07 20:11:11 +02:00
Lennart Poettering
d000dd6f4b volume: when passing NULL as channel map to pa_cvolume_scale_mask() handle this the same way as pa_cvolume_scale() 2009-09-07 20:11:08 +02:00
Lennart Poettering
9755bfa58a volume: drop some redundant but expensive validity checks 2009-09-07 20:09:52 +02:00
Lennart Poettering
cc6c4fe91f volume: add a couple of validity checks for pa_volume_t arguments 2009-09-07 19:59:18 +02:00
Lennart Poettering
3bbc5e6a4d volume: fix definition of PA_VOLUME_MAX and introduce PA_VOLUME_INVALID and use it wherever applicable 2009-09-07 19:53:39 +02:00
Lennart Poettering
cfef930036 volume: introduce pa_cvolume_{inc|dec}() 2009-08-19 02:32:36 +02:00
Lennart Poettering
1421eff0b6 volume: use PA_VOLUME_MAX instead of (pa_volume_t) -1 2009-08-19 02:31:11 +02:00
Lennart Poettering
ef01baf613 volume: round properly when showing human readable volume percentages 2009-08-19 00:58:20 +02:00
Lennart Poettering
96f01b822a volume: simplify volume multiplifactions, do them in integer only 2009-08-19 00:57:58 +02:00
Lennart Poettering
d634555a3e volume: introduce pa_cvolume_min() and pa_cvolume_min_mask() 2009-08-19 00:56:16 +02:00
Lennart Poettering
caa7928972 libpulse: some minor optimizations when checking equality 2009-08-17 03:50:04 +02:00
Lennart Poettering
8208214882 volume: add pa_cvolume_merge() call 2009-08-17 03:40:36 +02:00
Lennart Poettering
0f2a4ed422 volume: guarantee dB/linear conversion is reversible 2009-08-14 20:03:30 +02:00
Lennart Poettering
083b17b28a volume,channelmap: reimplement a couple of calls based on channel masks 2009-06-17 03:09:28 +02:00
Lennart Poettering
64b0f38b67 volume: implement functions for multiplicating a cvolume with a scalar 2009-06-17 03:04:21 +02:00
Lennart Poettering
8b180b6368 volume: implement pa_cvolume_{scale|max|avg}_mask() 2009-05-25 23:55:44 +02:00
Lennart Poettering
000bdb8d25 volume: change pa_volume_t mapping to cubic 2009-05-22 01:30:54 +02:00
Lennart Poettering
905c8004a0 volume: introduce pa_cvolume_{get|set}_position() 2009-05-13 15:20:45 +02:00
Lennart Poettering
237a9e12f8 volume: increase dB range to -90dB
Increasing the volume range to -90dB has the benefit of corresponding
with a volume decrease from the full 16 bit signal to 0.

This also makes us a bit more like traditional stereos
2009-04-13 22:41:44 +02:00
Lennart Poettering
14e89d4ecd when calculating volume from dB use ceil() 2009-04-08 03:47:48 +02:00
Lennart Poettering
d612fbb802 compare with doubles, not integer 2009-04-07 04:02:25 +02:00
Colin Guthrie
86dee05aec Use LGPL 2.1 on all files previously using LGPL 2 2009-03-03 20:23:02 +00:00
Lennart Poettering
32e5e64921 add a lot of validity checking 2009-02-03 21:57:58 +01:00
Lennart Poettering
543115ae17 add new API pa_cvolume_compatible_with_channel_map() 2009-02-03 21:15:32 +01:00
Lennart Poettering
554c818d21 before applying balance/fade check it actually makes sense 2009-02-03 04:05:41 +01:00
Lennart Poettering
e412f1cde3 whitespace cleanup 2009-02-02 01:54:09 +01:00
Lennart Poettering
1b53f8297f implement pa_cvolume_{get|set}_fade 2009-01-30 00:22:59 +01:00
Lennart Poettering
9314db79db fix a bogus assert 2009-01-30 00:14:50 +01:00
Lennart Poettering
634afede7d properly deal with the case when l/r is silent when adjust balance 2009-01-30 00:14:28 +01:00
Lennart Poettering
ee17772cea add missing 'const' 2009-01-27 23:39:58 +01:00