Commit graph

5782 commits

Author SHA1 Message Date
Maarten Bosmans
b3721a12c5 Fixup #include directives according to Coding Style
Use #include "header.h" if functionality of header.h is implemented
and #include <header.h> if functionality of header.h is used.
2011-03-11 11:49:39 +00:00
Maarten Bosmans
ecf09f2cd6 Fix up according to Coding Style
Only whitespace changes in here
2011-03-11 11:49:35 +00:00
Tanu Kaskinen
5715b2af30 alsa-mixer: When figuring out the max_dB of a path, use only channels that are used by the path elements.
Without this, p->max_dB could never be less than 0 dB, because the loop at the
end of pa_alsa_path_probe() would reset p->max_dB to 0 as soon as the loop
encountered a channel that wasn't touched by any element.

There was a similar issue for p->min_dB too (it could never be more than 0 dB),
which is also fixed by this patch.
2011-03-11 13:41:28 +02:00
Tanu Kaskinen
064780d9de alsa-mixer: Implement support for setting element specific upper limits for volume.
This feature is mainly useful in embedded systems that have built-in speakers.
In such situations the full audio path is known beforehand, so it's possible to
know what is the maximum sensible volume, and any higher volume can be
disabled.

The volume limit is set in path configuration files in the [Element] section,
using option "volume-limit". The value is the desired maximum volume step of
the volume element.
2011-03-11 13:40:51 +02:00
Tanu Kaskinen
68e6340394 dbus: Always accept mono volumes when setting device or stream volume.
pa_sink_set_volume() and friends accept mono volumes too, so no need to impose
unneeded restrictions in the D-Bus API.
2011-03-11 13:40:34 +02:00
Tanu Kaskinen
6c5e3af275 dbusiface-stream: Fix crash when there's no resampling used. 2011-03-11 13:40:20 +02:00
Tanu Kaskinen
973813485f alsa-card: Print the profile set configuration when loading the card. 2011-03-11 13:39:50 +02:00
Tanu Kaskinen
00a05a8272 alsa-mixer: Add a default case for a switch, so that the compiler won't complain about unhandled cases. 2011-03-11 13:38:05 +02:00
Tanu Kaskinen
983d4c238d pacat: Fix memory leak when draining the context. 2011-03-11 13:37:49 +02:00
Tanu Kaskinen
e01a28cd53 alsa-mixer: Use decibel fixes when getting and setting decibel volumes. 2011-03-11 13:37:17 +02:00
Tanu Kaskinen
4842077a1e alsa-mixer: Add DecibelFix section to the profile set config file format.
This commit only implements the parser, the decibel fix data is not yet used
for anything.
2011-03-11 13:34:24 +02:00
Arun Raghavan
4cd90d9e32 volume: Add Orc-based optimised volume scaling
This adds volume scaling for 1- and 2-channel software volume scaling
using Orc. While testing the MMX and SSE backends on a Core2, I see an
~2x performance benefit over the hand-rolled MMX and SSE code. Since I
haven't been able to test on other architectures, the Orc code is only
used when MMX/SSE* is present. This can be changed in the future after
testing on AMD and ARM machines.
2011-03-05 14:38:28 +05:30
Arun Raghavan
516dd169b4 volume: Fix sample array size for tests
Somewhere in the history of the MMX tests, the number of channels was
changed from 1 to 2, but the number of samples was not increased to make
it even (multiple of the frame size).
2011-03-05 13:18:01 +05:30
Arun Raghavan
50448e1130 volume: Make tests use only valid volumes 2011-03-05 13:18:01 +05:30
Colin Guthrie
f4a2a8ebfe alsa-mixer: Fix a git-am cockup in b0f72311
It seems git managed to mess up a git-am with a patch from
David which moved where this function was called element_probe
to within itself (recursive which could normally lead to an
infinite loop, but as it was now never called from anywhere else,
this didn't happen).

Thank you to Maarten for spotting and following up the issue.
2011-03-04 09:50:27 +00:00
Colin Guthrie
82a84eb1bd volume: Add a PA_VOLUME_UI_MAX define for the recommended max volume to show in UIs
This value is not a technical upper limit, it's just a 'sensible'
value that is not crazy high, but also allows software amplification
above 0dB (aka 100%) for very quiet audio sources.

We recommend that a comprehensive volume control UI should allow
users to set volumes up to this limit, although of course should
deal gracefully if the user has set the volume even higher than this
without resulting in a feedback loop that effectively limits the
upper volume.

The value chosen is +11dB. This was selected somewhat subjectively
and is very similar to the current 150% that gnome-volume-control
uses (which is ~+10.57dB).

On the plus side, we now recommend that everyone allows
'Volumes up to 11' which is pretty awesome.
http://en.wikipedia.org/wiki/Up_to_eleven

https://tango.0pointer.de/pipermail/pulseaudio-discuss/2010-April/006945.html
https://tango.0pointer.de/pipermail/pulseaudio-discuss/2010-April/006950.html
2011-03-03 13:28:39 +00:00
Colin Guthrie
8c012a676d conf: Make system.pa use udev-detect and not hal-detect.
Also fix a left over reference to HAL in default.pa
2011-03-03 09:37:16 +00:00
Maarten Bosmans
33d1de487a configure: Drop some warnings
Drop -Winline and set -Wstrict-aliasing level to its default.
2011-03-02 15:03:18 +00:00
Maarten Bosmans
9cbf19b59b Various fixes for build warnings 2011-03-02 15:02:42 +00:00
Maarten Bosmans
53695b83dc Get rid of some unused-function compiler warnings 2011-03-02 14:52:46 +00:00
Arun Raghavan
3f6eb652cb introspect: Client-side implementation for has_volume/read_only_volume
This completes the client-side changes to the protocol extension
introduced by commit 99ddca89cd
2011-03-02 11:17:32 +00:00
Colin Guthrie
0d1e53e30a x11: Make pax11publish -r remove PULSE_SESSION_ID
This is not set by pax11publish, but module-x11-publish does so this tool
should tidy that up. It is only removed when passing -r and is
ignored when actually setting up it's own properties from the conf
files/guesswork.
2011-03-01 18:15:28 +00:00
Maarten Bosmans
38d0f4d15f Include <time.h> where necessary 2011-03-01 18:06:28 +01:00
Colin Guthrie
f834150ace Merge remote-tracking branch 'arun/no-ramping' 2011-02-28 19:39:10 +00:00
David Henningsson
7b366a52c3 alsa-mixer: Add support for "Line Boost" element
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2011-02-28 13:30:51 +00:00
Arun Raghavan
aa78853d72 Remove remaining ramping/envelope references
(part of a patch series removing all ramping code)
2011-02-28 17:13:13 +05:30
Arun Raghavan
50e289d52a Revert "Add new subsystem for applying envelopes (such as volume ramps) to audio signals"
This reverts commit 95a98fe6f2.

Conflicts:

	src/Makefile.am
	src/pulsecore/envelope.c
	src/pulsecore/envelope.h
	src/tests/envelope-test.c

(part of a patch series removing all ramping code)
2011-02-28 17:13:13 +05:30
Arun Raghavan
79616c012e Revert "Add volume ramping feature - envelop fix"
This reverts commit 8eaa40b6f4.

Conflicts:

	src/pulsecore/envelope.c

(part of a patch series removing all ramping code)
2011-02-28 17:13:13 +05:30
Arun Raghavan
8401572fd5 Revert "Add volume ramping feature - sink-input modification"
This reverts commit 5318eb35ef.

Conflicts:

	src/pulsecore/sink-input.c

(part of a patch series removing all ramping code)
2011-02-28 17:13:13 +05:30
Arun Raghavan
241dd91583 Revert "Add volume ramping feature - sink modification"
This reverts commit 897ef86b7f.

Conflicts:

	src/pulsecore/sink.c

(part of a patch series removing all ramping code)
2011-02-28 17:12:25 +05:30
Arun Raghavan
4cf12b91a4 Revert "ramping: minor cleanups"
This reverts commit f202af17b7.

(part of a patch series removing all ramping code)
2011-02-28 17:11:31 +05:30
Arun Raghavan
8745eccb45 Revert "core: volume ramping fix"
This reverts commit aa9348441d.

(part of a patch series removing all ramping code)
2011-02-28 17:11:31 +05:30
Tanu Kaskinen
bed4b73cfe Add src/*-symdef.h to .gitignore.
Also remove src/module/.gitignore as this is no longer needed
as pointed out by Arun Raghavan
2011-02-28 09:56:08 +00:00
Tanu Kaskinen
59f2b4436a sink: Add casts to some printf arguments to get rid of compiler warnings. 2011-02-28 09:56:08 +00:00
Tanu Kaskinen
0d8bbaf40d sink: Don't send unnecessary PA_SINK_MESSAGE_SET_SHARED_VOLUME messages.
If send_msg is false, the message will be sent by the caller.
2011-02-28 09:55:01 +00:00
Tanu Kaskinen
6bd34156b1 virtual-sink: Fix a crash when moving the sink to a new master right after setup.
If the virtual sink is moved to a new master right after it has been created,
then the virtual sink input's memblockq can be rewound to a negative read
index. The data written prior to the move starts from index zero, so after the
rewind there's a bit of silence. If the memblockq doesn't have a silence
memchunk set, then pa_memblockq_peek() will return zero in such case, and the
returned memchunk's memblock pointer will be NULL.

That scenario wasn't taken into account in the implementation of
sink_input_pop_cb. Setting a silence memchunk for the memblockq solves this
problem, because pa_memblock_peek() will now return a valid memblock if the
read index happens to point to a hole in the memblockq.

I believe this isn't the best possible solution, though. It doesn't really make
sense to rewind the sink input's memblockq beyond index 0 in the first place,
because now when the stream starts to play to the new master sink, there's some
unnecessary silence before the actual data starts. This is a small problem,
though, and I don't grok the rewinding system well enough to know how to fix
this issue properly.

I went through all files that call pa_memblockq_peek() to see if there are more
similar bugs. play-memblockq.c was the only one that looked to me like it might
be broken in the same way. I didn't try reproducing the bug with
play-memblockq.c, though, so I just added a FIXME comment there.
2011-02-26 10:40:06 +00:00
Tanu Kaskinen
b3644c1bcd virtual-sink/source: Remove an unused variable. 2011-02-26 10:39:53 +00:00
Tanu Kaskinen
1fda23c02c virtual-sink/source: Use a more descriptive stream name. 2011-02-26 10:39:38 +00:00
Tanu Kaskinen
d2d36beb80 virtual-sink: Add a modarg for forcing flat volume. 2011-02-26 10:38:28 +00:00
Tanu Kaskinen
8702d15d03 virtual-sink: Add a modarg for enabling volume sharing. 2011-02-26 10:38:15 +00:00
Tanu Kaskinen
c9c88fb8dc Implement the "volume sharing" feature.
When we have a filter sink that does some processing, currently the
benefits of the flat volume feature are not really available. That's
because if you have a music player that is connected to the filter sink,
the hardware sink doesn't have any idea of the music player's stream
volume.

This problem is solved by this "volume sharing" feature. The volume
sharing feature works so that the filter sinks that want to avoid the
previously described problem declare that they don't want to have
independent volume, but they follow the master sink volume instead.
The PA_SINK_SHARE_VOLUME_WITH_MASTER sink flag is used for that
declaration. Then the volume logic is changed so that the hardware
sink calculates its real volume using also the streams connected to the
filter sink in addition to the streams that are connected directly to
the hardware sink. Basically we're trying to create an illusion that
from volume point of view all streams are connected directly to the
hardware sink.

For that illusion to work, the volumes of the filter sinks and their
virtual streams have to be managed carefully according to a set of
rules:

If a filter sink follows the hardware sink volume, then the filter sink's
 * reference_volume always equals the hw sink's reference_volume
 * real_volume always equals the hw sink's real_volume
 * soft_volume is always 0dB (ie. no soft volume)

If a filter sink doesn't follow the hardware sink volume, then the filter
sink's
 * reference_volume can be whatever (completely independent from the hw sink)
 * real_volume always equals reference_volume
 * soft_volume always equals real_volume (and reference_volume)

If a filter sink follows the hardware sink volume, and the hardware sink
supports flat volume, then the filter sink's virtual stream's
 * volume always equals the hw sink's real_volume
 * reference_ratio is calculated normally from the stream volume and the hw
   sink's reference_volume
 * real_ratio always equals 0dB (follows from the first point)
 * soft_volume always equals volume_factor (follows from the previous point)

If a filter sink follows the hardware sink volume, and the hardware sink
doesn't support flat volume, then the filter sink's virtual stream's
 * volume is always 0dB
 * reference_ratio is always 0dB
 * real_ratio is always 0dB
 * soft_volume always equals volume_factor

If a filter sink doesn't follow the hardware sink volume, then the filter
sink's virtual stream is handled as a regular stream.

Since the volumes of the virtual streams are controlled by a set of rules,
the user is not allowed to change the virtual streams' volumes. It would
probably also make sense to forbid changing the filter sinks' volume, but
that's not strictly necessary, and currently changing a filter sink's volume
changes actually the hardware sink's volume, and from there it propagates to
all filter sinks ("funny" effects are expected when adjusting a single
channel in cases where all sinks don't have the same channel maps).

This patch is based on the work of Marc-André Lureau, who did the
initial implementation for Pulseaudio 0.9.15.
2011-02-26 10:37:20 +00:00
David Henningsson
dbdb4607b0 alsa-mixer: Make sure capture source and input source use right path
Make sure that mic and line (with common names) use the specific
path instead of the analog-input one.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2011-02-25 15:55:55 +00:00
David Henningsson
65317c8241 alsa-mixer: Fixup "Mic"/"Line"/"analog-input" paths to work with the new paths
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2011-02-25 15:55:39 +00:00
David Henningsson
3618268757 alsa-mixer: Add new paths for Internal Mic, Front Mic, Rear Mic and Dock Mic
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2011-02-25 15:54:59 +00:00
David Henningsson
ade0a6f884 alsa-mixer: always round towards 0 dB
Always round towards 0 dB. Also add a few debug comments to aid
troubleshooting.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2011-02-25 15:54:48 +00:00
David Henningsson
b0f72311cf alsa-mixer: add required-any and required-* for enum options
Now you can add required-any to elements in a path and the path
will be valid as long as at least one of the elements are present.
Also you can have required, required-any and required-absent in
element options, causing a path to be unsupported if an option is
(not) present (simplified example: to skip line in path if
"Capture source" doesn't have a "Line In" option).

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2011-02-25 15:48:11 +00:00
David Henningsson
0ce3017b74 alsa-mixer: Add a few well-known descriptions
Add front mic, rear mic, and docking line-in. These are likely to be
present on modern hda chips, for reference see
linux-2.6/sound/pci/hda/hda_codec.c:hda_get_input_pin_label

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2011-02-25 15:47:56 +00:00
Tanu Kaskinen
624152dac3 alsa-card: Add a new modarg "profile_set" for giving the card a custom profile set configuration file. 2011-02-25 15:44:57 +00:00
Tanu Kaskinen
46359043c4 alsa-mixer: Fix path set building when using the element-output or element-input mapping options in profile set configuration.
When creating synthesized paths, pa_alsa_path_set_new() created duplicate
elements for each path, and one of the duplicate elements would be marked as
required absent. That made path probing fail. While debugging this, I noticed
also that pa_alsa_path_synthesize() didn't initialize p->last_element properly.
2011-02-25 15:44:44 +00:00
Colin Guthrie
3153b60a62 core: Add a new hook PA_CORE_HOOK_CARD_PROFILE_CHANGED
This will allow modules to know when a card profile has changed
and take appropriate action. This might prove useful when developing
UCM so that the appropriate verb can be set.
2011-02-25 11:28:01 +00:00