bash-completion: Don't complete devices in the list commands

This fixes some wrong completion for the list commands for example:
    pactl list sinks _sink_name_
pactl: Add a command for setting the default sink/source.

This adds two new commands to pactl:
    set-default-sink
    set-default-source

This command has been part of the native protocol for a long time,
no reason not to expose it in pactl.
tests: Fix conversion typo in cpu-test

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
tests: Fix potential out-of-bound access violation in svolume cpu-test

nsamples should be forced to be a multiple of channels; do so correctly
and don't make nsamples larger than it actually is

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
remap_sse: More specific logging: SSE -> SSE2

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
tests: Test both, SSE and SSE2, sconv in cpu-test

SSE sconv was not tested before, only SSE2 was (on CPUs supporting both
instruction sets)

now both code path are tested on CPUs supporting both

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
tests: Add remap test code to cpu-test

v2 (comments by Paul Menzel):
* generate test samples from -1..1, -0x8000..0x7fff
* check all output samples (not just half of them)

the idea is to compare the output of the C (reference) implementation
against the output of the optimized code path; currently, there are MMX
and SSE implementation for the mono-to-stereo remapper for s16 and float
sample formats

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
Cc: Paul Menzel <paulepanter@users.sourceforge.net>
tests: Fix function argument wrapping style in cpu-test.c.
sconv: Check for SSE flag before initializing code

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
tests: Fix sconv sample correctness in cpu-test

do allow up to one sample difference
cleanup output of signed shorts (use 0xhx)

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
resampler: Drop redundant assignment in convert_from_work_format()

r->from_work_format_buf.length is set twice

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
resampler: Improve s16<-->s32 conversion, use s16 work format if input or output is s16

Problem: s16 to s32 conversion is performed as s16->float->s32 (via work
format float) for resamplers TRIVIAL, COPY, PEAKS.
Precision and efficiency suffers: e.g. 0x9fff results in 0x9ffe4001 (instead
of 0x9fff0000) and there are two sample format conversions instead of one
conversion.

Solution: If input or output format is s16, then choose the work format
to be s16 as well.

If remapping is to be performed, we could stick to work format float32ne for
precision reseans. This is debateable.

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
pactl: Document @DEFAULT_SINK@, @DEFAULT_SOURCE@ and @DEFAULT_MONITOR@

I went to implement the possibility to use the default sink/source
but found that it was already working. So I figured I'd update
the help text instead.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
sconv: Change/fix conversion to/from float32

use (1<<15) instead of 0x7fff as a factor when converting from s16 to float32
use (1<<31) instead of 0x7fffffff as a factor when converting from s32 to float32

the change is motivated by the following desireable properties:
* s16_from_f32(f32_from_s16(x)) == x for all possible s16 values
* x / (1.0f << 15) == x * (1.0f / (1 << 15)) for all x in s16

above changes enable easier optimization while guaranteeing bit-exact results

further, other audio sample conversion code (libavresample) does it the same way

v3 (comments Tanu):
* fix saturation in pa_sconv_s16le_from_f32ne_neon(), use vqrshrn
v2 (comments Tanu):
* fix comments in ARM NEON code
* use llrintf() in pa_sconv_s32le_from_float32ne()

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
Cc: Tanu Kaskinen <tanuk@iki.fi>
simple: Handle holes in recording streams.
padsp: Handle holes in recording streams.
pacat: Handle holes in recording streams.

pa_silence_memory() pulls sample-util as a dependency, so it had to
be moved from libpulsecore to libpulsecommon. sample-util in turn
pulls some more stuff.
alsa-sink/source: Better thread names

Now you can actually see *which* sink/source that sends a specific
message to the log, which is quite useful if you have more than
one sound card.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
combine: Stop rate adjustments if sink is supended
dbus: Fix connection cleanup when killing clients