Settings

digraph inheritance { rankdir=LR; GObject -> WpObject; WpObject -> WpSettings; }

struct WpSettings

WpSettings loads and parses the “sm-settings” (default value) metadata, which contains wireplumber settings, and provides APIs to its clients (modules, lua scripts etc) to access them.

Being a WpObject subclass, the settings inherits WpObject’s activation system.

enum WpSettingsFeatures

Flags to be used as WpObjectFeatures on WpSettings subclasses.

Values:

enumerator WP_SETTINGS_LOADED = (1 << 0)

Loads the settings

typedef void (*WpSettingsChangedCallback)(WpSettings *obj, const gchar *setting, WpSpaJson *value, gpointer user_data)

callback conveying the changed setting and its json value

Param obj:

the wpsettings object

Param setting:

the changed setting

Param value:

json value of the the changed setting

Param user_data:

data passed in the wp_settings_subscribe

guintptr wp_settings_subscribe(WpSettings *self, const gchar *pattern, WpSettingsChangedCallback callback, gpointer user_data)

Subscribes callback for a given setting pattern(a glob-style pattern matched using g_pattern_match_simple), this allows clients to look for any changes made in settings through metadata.

Parameters:
  • self – the settings object

  • pattern – name of the pattern to match the settings with

  • callback – (scope async): the callback triggered when the settings change.

  • user_data – data to pass to callback

Returns:

the subscription ID (always greater than 0 for successful subscriptions)

guintptr wp_settings_subscribe_closure(WpSettings *self, const gchar *pattern, GClosure *closure)

Subscribes callback for a given setting pattern(a glob-style pattern matched using g_pattern_match_simple), this allows clients to look for any changes made in settings through metadata.

Parameters:
  • self – the settings object

  • pattern – name of the pattern to match the settings with

  • closure – (nullable): a GAsyncReadyCallback wrapped in a GClosure

Returns:

the subscription ID (always greater than 0 for success)

gboolean wp_settings_unsubscribe(WpSettings *self, guintptr subscription_id)

Unsubscribes callback for a given subscription_id.

Parameters:
  • self – the settings object

  • subscription_id – identifies the callback

Returns:

TRUE if success, FALSE otherwise

WpSpaJson *wp_settings_get(WpSettings *self, const gchar *setting)

Gets the WpSpaJson of a setting.

Parameters:
  • self – the settings object

  • setting – name of the setting

Returns:

(transfer full) (nullable): The WpSpaJson of the setting, or NULL if the setting does not exist

WpSettings *wp_settings_get_instance(WpCore *core, const gchar *metadata_name)

Returns the WpSettings instance that is associated with the given core.

This method will also create the instance and register it with the core if it had not been created before.

Parameters:
  • core – the core

  • metadata_name – (nullable): the name of the metadata with which this object is associated. sm-settings is the default value picked if NULL is supplied.

Returns:

(transfer full): the WpSettings instance

WP_TYPE_SETTINGS (wp_settings_get_type ())

The WpSettings GType.