Commit graph

83 commits

Author SHA1 Message Date
Tanu Kaskinen
37429cb07e Pass the profile object instead of the profile name to pa_card_set_profile()
When setting attribute foo, or in this case the card profile, in my
opinion the thing passed to the set_foo() function should be of the
type of foo, not a string identifier that can be used to search for
the actual foo in set_foo().

This is mostly a question of taste, but there's at least some small
benefit from passing the actual object: often the profile object is
already available when calling pa_card_set_profile(), so passing the
card name would cause unnecessary searching when pa_card_set_profile()
needs to look up the profile from the hashmap.
2013-12-05 16:00:58 +02:00
Tanu Kaskinen
ee5e245afa Use pa_(c)volume_snprint_verbose() everywhere
All pa_cvolume_snprint(), pa_volume_snprint(),
pa_sw_cvolume_snprint_dB() and pa_sw_volume_snprint_dB() calls have
been replaced with pa_cvolume_snprint_verbose() and
pa_volume_snprint_verbose() calls, making the log output more
informative and the code sometimes simpler.
2013-07-09 17:37:04 +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
Tanu Kaskinen
0f2840f4c6 dynarray: Reimplement with nicer semantics
A dynamic array is a nice simple container, but the old interface
wasn't quite what I wanted it to be. I like GLib's way of providing
the free callback at the container creation time, because that way
the free callback doesn't have to be given every time something is
removed from the array.

The allocation pattern was changed too: instead of increasing the
array size always by 25 when the array gets full, the size gets
doubled now (the lowest non-zero size is still 25).

The array can't store NULL pointers anymore, and pa_dynarray_get() was
changed so that it's forbidden to try to access elements outside the
valid range.

The set of supported operations may seem a bit arbitrary. The
operation set is by no means complete at this point. I have included
only those operations that are required by the current code and some
unpublished code of mine.
2013-06-27 11:45:41 +03:00
poljar (Damir Jelić)
97da92d894 Whitespace cleanup: Remove all multiple newlines
This patch removes all occurrences of double and triple
newlines.

Command used for this:
find .  -type d \( -name ffmpeg \) -prune -o \
        -regex '\(.*\.[hc]\|.*\.cc\)' \
        -a -not -name 'adrian-aec.*' -a -not \
        -name reserve.c -a -not -name 'rtkit.*' \
        -exec sed -i -e '/^$/{N;s/^\n$//}' {} \;

Two passes were needed to remove triple newlines.
The excluded files are mirrored files from external sources.
2013-06-24 16:56:24 +03:00
Shuai Fan
b0bf132f8f cli, log: Improve the set-log-target functionality
Add a new log target 'newfile:PATH', and refactoring 'pa_log_target_type'.

Signed-off-by: Shuai Fan <shuai900217@126.com>
2013-06-20 16:34:57 +03:00
Arun Raghavan
3d7bc637c4 daemon: Fix dlsearchpath while running from build tree
It appears that, libltdl will find the .la file in the builddir and
figure out where the real .so is.

This also requires .ifexists to be fixed up to correspondingly search in
<dlsearchpath>/.libs.
2013-04-20 10:04:32 +05:30
Tanu Kaskinen
19c058dd08 Fix pa_parse_boolean() return value checking.
pa_parse_boolean() return value shouldn't be stored in
pa_bool_t, because 1 and -1 need to be distinguished.
2012-12-19 12:31:50 +02:00
Tanu Kaskinen
0f44b1e820 Log the reason for every suspend/resume.
I was looking at a log that showed that a suspend happened (at
a strange time), but the log didn't tell me why the suspend was done.
This patch tries to make sure that that won't happen again.
2012-12-19 12:31:47 +02:00
Tanu Kaskinen
12af302ac7 card: Ensure that there's always at least one profile.
In practice there is always at least one profile, and I
don't think there will ever be cards without profiles.
Therefore, I added assertions to pa_card_new() stating that
the card new data must always contain at least one profile.
Now a lot of code can be simplified, because it's guaranteed
that the profiles hashmap and the active_profile field are
always non-NULL.
2012-06-29 14:24:43 +03:00
poljar (Damir Jelić)
bf4091dcf8 device-port: Change the latency offset type to a signed int.
The latency offset type should be signed (int64_t) so we can also add
a negative latency offset.

This also includes changing the type of the sink/source
offsets and updating pacmd so it handles negative numbers.
2012-06-28 16:33:14 +03:00
poljar
7688e64739 pacmd: Add functions to handle the latency offset
pacmd was extended so it can handle the new latency offset.

A new function was added so we can set the latency also the list
commands were extended to print the latency offset on the ports.
2012-06-27 14:24:56 +03:00
poljar
23432d39ee pacmd: Add unloading modules by name.
pacmd should allow unloading modules by name.
The command_unload() function was expanded to handle names while
unloading modules.

If there are multiple modules with the same name all
of them will be unloaded.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=48289
2012-06-04 19:02:53 +03:00
Deng Zhengrong
9d40957c79 cli: Add set-log-target command for pacmd 2012-05-29 08:35:58 +05:30
Colin Guthrie
29e4b187a3 cli: Allow source-output volumes/mute to be set via CLI
This should have been done a long time ago but it brings symmetry to the API
2012-04-10 09:49:27 +01:00
Colin Guthrie
aa19646d34 man: Document the cli inteface a little.
This just documents the cli interface syntax. Mostly a lift from
http://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/CLI
with some minor editing and bringing up to date.

Also document a few undocumented commands.

Shuffle around the order in 'pacmd help' output to match the order
in the new docs for consistency.

https://bugs.freedesktop.org/show_bug.cgi?id=45029
2012-04-10 09:49:27 +01:00
Maarten Bosmans
e45b02de55 Use simple free function in pa_dynarray_free 2011-11-27 15:42:52 +00:00
Arun Raghavan
0a238f69ad cli: Add a dump-volumes command
The purpose of this command is to print all the internal volume
variables for sinks/sources and all corresponding
sink-inputs/source-outputs  to make debugging and reasoning about
volume-related issues easier.
2011-11-04 15:32:13 +05:30
Maarten Bosmans
c5dca7cf2b More spelling fixes 2011-08-25 11:27:47 +01:00
Maarten Bosmans
5818a2c63e win32: Make some unused-variable warnings go away 2011-06-24 00:34:05 +01:00
Maarten Bosmans
dd9265ac78 Remove unnecessary #includes 2011-06-22 23:12:20 +01:00
Colin Guthrie
dffc4d18d3 capture: Implement per-stream volume control for capture streams.
This piggy backs onto the previous changes for protocol 22 and
thus does not bump the version. This and the previous commits should be
seen as mostly atomic. Apologies for any bisecting issues this causes
(although I would expect these to be minimal)
2011-06-22 22:45:27 +01:00
Tanu Kaskinen
e72e75570c sink-input: Add volume_writable to pa_sink_input.
This is pretty cosmetic change; there's no actual functionality added.
Previously the volume_writable information was available through the
pa_sink_input_is_volume_writable() function, but I find it cleaner to have a
real variable.

The sink input introspection variable name was also changed from
read_only_volume to volume_writable for consistency.
2011-03-29 21:18:06 +01:00
Maarten Bosmans
38d0f4d15f Include <time.h> where necessary 2011-03-01 18:06:28 +01:00
Tanu Kaskinen
99ddca89cd Allow read-only or non-existing sink input volume.
There are two known cases where read-only or non-existing sink input volume is
relevant: passthrough streams and the planned volume sharing logic.
Passthrough streams don't have volume at all, and the volume sharing logic
requires read-only sink input volume. This commit is primarily working towards
the volume sharing feature, but support for non-existing sink input volume is
also added, because it is so closely related to read-only volume.

Some unrelated refactoring in iface-stream.c creeped into this commit too (new
function: stream_to_string()).
2011-02-22 20:12:31 +00:00
Arun Raghavan
0edbb2c6aa cli: Validate volume before setting
This causes an error to be generated if an invalid volume is provided to
commands that set sink/sink-input/source volume.
2010-10-15 01:10:00 +05:30
Colin Guthrie
d0f91b1cf7 cli: Allow .include on directories as well as files.
When .including a directory, all files with the extension '.pa'
in that folder will be parsed in alphabetical order.
2010-09-04 17:07:23 +01:00
Tanu Kaskinen
2dcf378741 cli: Increase the command maximum length from 1024 to 2048. 2010-05-10 14:08:04 +03:00
Lennart Poettering
168be3830a use pa_fopen_cloexec() where applicable 2009-10-30 04:54:19 +01:00
Lennart Poettering
3c9a09bc45 cli-command: don't necessarily ovveride failure code of files (llvm-clang-analyzer) 2009-09-08 23:51:00 +02:00
Lennart Poettering
5fd751fc2e cli-command: modernizations 2009-09-08 23:50:14 +02:00
Lennart Poettering
e6a666d8d5 libpulse: introduce PA_BYTES_SNPRINT_MAX and make use of it wherever applicable 2009-09-06 22:33:04 +02:00
Lennart Poettering
e20d9068a3 cli: make sure 'dump' uses pa_cvolume_max() to deduce a single-channel volume from a multi-channel volume 2009-08-31 21:42:09 +02:00
Lennart Poettering
7c6a0ec66c cli: apply single-channel volume changes equally to all channels 2009-08-31 21:41:36 +02:00
Lennart Poettering
8c31974f56 sink: volume handling rework, new flat volume logic
- We now implement a logic where the sink maintains two distinct
  volumes: the 'reference' volume which is shown to the users, and the
  'real' volume, which is configured to the hardware. The latter is
  configured to the max of all streams. Volume changes on sinks are
  propagated back to the streams proportional to the reference volume
  change. Volume changes on sink inputs are forwarded to the sink by
  'pushing' the volume if necessary.

  This renames the old 'virtual_volume' to 'real_volume'. The
  'reference_volume' is now the one exposed to users.

  By this logic the sink volume visible to the user, will always be the
  "upper" boundary for everything that is played. Saved/restored stream
  volumes are measured relative to this boundary, the factor here is
  always < 1.0.

- introduce accuracy for sink volumes, similar to the accuracy we
  already have for source volumes.

- other cleanups.
2009-08-19 02:55:02 +02:00
Lennart Poettering
31575f7766 alsa: rework mixer logic
Completely rework mixer logic. This now allows controlling a full set of
elements from a single sink's volume slider/mute button.

This also introduces sink and source "ports" that can be used to choose
different input or output ports with the UI. (i.e. "mic"/"line-in" or
"speaker"/"headphones".

The mixer paths and device maps are now configered in external
configuration files and can be tweaked as necessary.
2009-06-17 03:45:14 +02:00
Lennart Poettering
00797b8b6e core: add a suspend cause flags field 2009-06-05 19:05:07 +02:00
Lennart Poettering
c224aace42 modules: introduce PA_MODULE_DEPRECATED() macro for marking modules deprecated 2009-05-28 02:47:36 +02:00
Lennart Poettering
fe8b10cc05 core: introduce new 'reference' volume for sinks
The reference volume is to be used as reference volume for stored stream
volumes. Previously if a new stream was created the relative volume was
taken relatively to the virtual device volume. Due to the flat volume
logic this could then be fed back to the virtual device volume.
Repeating the whole story over and over would result in a device volume
that would go lower, and lower and lower.

This patch introduces a 'reference' volume for each sink which stays
unmodified by stream volume changes even if flat volumes are used. It is
only modified if the sink volumes are modified directly by the user.

For further explanations see http://pulseaudio.org/wiki/InternalVolumes
2009-04-13 22:56:25 +02:00
Maarten Bosmans
4a40aed9c0 handle failure to parse proplist in cli-command gracefully 2009-03-31 00:43:48 +02:00
Lennart Poettering
db714bfea6 fix typo 2009-03-27 00:06:15 +01:00
Lennart Poettering
08154554b0 only store card profile if flagged for that 2009-03-23 19:31:36 +01:00
Lennart Poettering
ec1c92347d print error code when suspend/resume fails 2009-03-04 05:32:26 +01: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
77779ead6d rework logging to make it more modular 2009-02-21 22:45:56 +01:00
Lennart Poettering
4505bc9cc6 introduce default channel map in addition to the default sample spec 2009-02-21 16:32:42 +01:00
Marc-André Lureau
927e501920 pulsecore: remove unused variable from cli_command_load() 2009-02-19 04:54:45 +01:00
Lennart Poettering
a5401a50a6 store the default sink/source in proper pa_sink*/pa_source* pointers instead of a string 2009-01-28 01:46:27 +01:00
Lennart Poettering
64b0543588 when changing volume, store whether it is worth remembering or no 2009-01-27 23:40:03 +01:00
Lennart Poettering
d5f46e824e move flat volume logic into the core. while doing so add n_volume_steps field to sinks/sources 2009-01-27 04:39:07 +01:00