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

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

Creates a new WpSettings object.

Parameters:
  • core – the WpCore

  • metadata_name – (nullable): the name of the metadata object to associate with the settings object; NULL means the default “sm-settings”

Returns:

(transfer full): a new WpSettings object

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

Finds a registered WpSettings object by its metadata name.

Parameters:
  • core – the WpCore

  • metadata_name – (nullable): the name of the metadata object that the settings object is associated with; NULL means the default “sm-settings”

Returns:

(transfer full) (nullable): the WpSettings object, or NULL if not found

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

WP_TYPE_SETTINGS (wp_settings_get_type ())

The WpSettings GType.