18 Commits

Author SHA1 Message Date
Julian Bouzas
9da732d88c m-mixer-api: use gboolean instead of bool
The WpSpaPodParser always expects gboolean for boolean values. We should never
use bool in WirePlumber unless strictly necessary.

Fixes #584
2024-03-04 17:22:03 +00:00
Stefan Ursella
72edbb1ba4 m-mixer-api: track monitorMute and allow modifying them 2023-07-31 13:26:28 +02:00
George Kiagiadakis
5c3032c064 core: change the component arguments to be WpSpaJson instead of GVariant
This allows us to pass entire JSON objects from the config file
down to the modules / scripts without any conversion
2023-05-25 18:29:58 +03:00
George Kiagiadakis
4f27d18bd3 log: rename "message" level to "notice" and print criticals with "E"
Syslog calls this level "notice" and I prefer it because we use it
to display significant messages that are not warnings, but they
are not really "standard", as GLib wants them to be. There is nothing
"standard" about log messages in general.

Also, make these notice messages be enabled at debug level 2, together
with warnings. The default log.level is 2 and it is a good idea to show
notices by default too.

Finally, show them in the log with "N" and also change criticals to be
shown with "E", meaning "error"... Then promote G_LOG_LEVEL_ERROR
messages to be shown with "F", meaning "fatal", because in fact these
messages are always fatal and always call abort(). Still, keep the term
"critical" in the functions to make sure that whoever uses them is aware
that this level is only for critical conditions and not suitable to
display any kind of error.
2023-05-18 16:19:49 +03:00
George Kiagiadakis
4736d56557 log: implement a log topics system, like pipewire
The intention is to make checks for enabled log topics faster.

Every topic has its own structure that is statically defined in the file
where the logs are printed from. The structure is initialized transparently
when it is first used and it contains all the log level flags for the levels
that this topic should print messages. It is then checked on the wp_log()
macro before printing the message.

Topics from SPA/PipeWire are also handled natively, so messages are printed
directly without checking if the topic is enabled, since the PipeWire and SPA
macros do the checking themselves.

Messages coming from GLib are checked inside the handler.

An internal WpLogFields object is used to manage the state of each log
message, populating all the fields appropriately from the place they
are coming from (wp_log, spa_log, glib log), formatting the message and
then printing it. For printing to the journald, we still use the glib
message handler, converting all the needed fields to GLogField on demand.
That message handler does not do any checks for the topic or the level, so
we can just call it to send the message.
2023-05-16 20:42:28 +03:00
Julian Bouzas
c61d1e4245 component-loader: make wp_core_load_component() API asynchronous
This change completely refactors the way components are loaded in wireplumber:
- The module_init() function must return a GObject now. This object is either
a WpPlugin or a WpSiFactory in the current modules.
- When the component loader initializes a module, it automatically registers
the WpPlugin or WpSiFactory with their respective methods. There is no need
to register the WpPlugin or WpSiFactory in the module now.
- The wp_core_load_component() API has been refactored to be asynchronows. This
allows the component loader to automatically activate WpPlugin objects, and
therefore allows the application to directly get the WpPlugin without having
to find it. This simplifies a lot of things.
- The 'ifexists' and 'nofail' component flags now work even if the respective
WpPlugin could not be activated.
- The code that loads components in main.c has also been simplified a lot,
and the option to load dangling components has also been removed.
2023-04-17 07:48:18 -04:00
George Kiagiadakis
7b8e3e8088 m-mixer-api: fix channelVolumes array iteration in set-volume
Fixes: #250
2022-05-02 11:02:40 +03:00
Julian Bouzas
86d85584b2 m-mixer-api: unset iterator value before breaking or returning from loop 2021-12-20 09:54:05 +00:00
Julian Bouzas
7abd3728e7 build: fix volatile compatible-pointer-types warnings
Happens when compiling with GCC 11
2021-08-18 09:17:05 -04:00
Julian Bouzas
51128f0521 m-mixer-api: only add 'mute' if correctly parsed 2021-06-25 08:50:08 -04:00
George Kiagiadakis
7355215cf1 pipewire-object: change params-changed signal to take a string param name
To be consistent with the rest of the API where strings are used
to identify param types
2021-06-09 13:29:34 +03:00
Julian Bouzas
fc41af5c98 m-mixer-api: make sure the enum param iterator is valid
Some audio nodes such as null-audio-sink nodes don't support Props or Route enum
params.
2021-05-19 18:26:17 -04:00
George Kiagiadakis
07a8b5035e m-mixer-api: track monitorVolumes and allow modifying them
This only applies to non-device nodes, because monitorVolumes
are not exposed on device Routes
2021-04-26 17:35:32 +03:00
George Kiagiadakis
8861595d55 m-mixer-api: allow calling the action signals even when the plugin is not enabled 2021-04-15 17:00:15 +03:00
George Kiagiadakis
c7e32a638a m-mixer-api: add configurable support for the cubic volume scale
This is also what pulseaudio uses, so now the volumes in wpctl match what
pulseaudio tools report and they make a lot more sense from the user's POV
2021-04-09 15:52:17 +03:00
George Kiagiadakis
010cd308da m-mixer-api: also add channel-independent volume for ease of use 2021-04-09 15:52:17 +03:00
George Kiagiadakis
0aefd52593 m-mixer-api: fix getting volume info from nodes that don't have volumeBase & step
and optimize a little bit so that can stop iterating params
as soon as the info is known
2021-04-09 15:52:17 +03:00
George Kiagiadakis
523bc7a36d modules: add module-mixer-api
This module provides an API to get/set volume controls on nodes,
using the same logic as pipewire-pulse, which means it will use
the device Route props when a node is associated with a device
that has this capability
2021-04-09 15:52:17 +03:00