[xmp] Port to Audacious 3.1 Preferences API. Rebuild for Audacious 3.1-beta1 generic plugin API/ABI bump.

Michael Schwendt mschwendt at fedoraproject.org
Wed Oct 12 19:44:47 UTC 2011


commit 78b0091d111aa3a57b0a28fff3fc73f449625437
Author: Michael Schwendt <mschwendt at fedoraproject.org>
Date:   Wed Oct 12 21:44:42 2011 +0200

    Port to Audacious 3.1 Preferences API.
    Rebuild for Audacious 3.1-beta1 generic plugin API/ABI bump.
    Depend on audacious(plugin-api)%{?_isa}.

 xmp-3.4.0-audacious-3.1.patch |  173 +++++++++++++++++++++++++++++++++++++++++
 xmp.spec                      |    5 +
 2 files changed, 178 insertions(+), 0 deletions(-)
---
diff --git a/xmp-3.4.0-audacious-3.1.patch b/xmp-3.4.0-audacious-3.1.patch
new file mode 100644
index 0000000..fe451e4
--- /dev/null
+++ b/xmp-3.4.0-audacious-3.1.patch
@@ -0,0 +1,173 @@
+diff -Nur xmp-3.4.0-orig/src/plugin/audacious3.c xmp-3.4.0/src/plugin/audacious3.c
+--- xmp-3.4.0-orig/src/plugin/audacious3.c	2011-08-07 15:24:27.000000000 +0200
++++ xmp-3.4.0/src/plugin/audacious3.c	2011-10-12 21:30:52.000000000 +0200
+@@ -16,8 +16,8 @@
+ #include <unistd.h>
+ #include <ctype.h>
+ 
+-#include <audacious/configdb.h>
+ #include <audacious/plugin.h>
++#include <audacious/misc.h>
+ #include <audacious/preferences.h>
+ #include <libaudgui/libaudgui-gtk.h>
+ #include <gtk/gtk.h>
+@@ -66,6 +66,19 @@
+ 
+ XMPConfig xmp_cfg;
+ 
++static const gchar* const plugin_defaults[] = {
++    "mixing_freq", "0",
++    "convert8bit", "0",
++    "fixloops", "0",
++    "modrange", "0",
++    "force8bit", "0",
++    "force_mono", "0",
++    "interpolation", "TRUE",
++    "filter", "TRUE",
++    "pan_amplitude", "80",
++    NULL
++};
++
+ extern struct xmp_drv_info drv_smix;
+ 
+ 
+@@ -158,8 +171,6 @@
+ 
+ static gboolean init(void)
+ {
+-	mcs_handle_t *cfg;
+-
+ 	_D("Plugin init");
+ 	xmp_drv_register(&drv_smix);
+ 	ctx = xmp_create_context();
+@@ -168,19 +179,10 @@
+ 	seek_mutex = g_mutex_new();
+ 	seek_cond = g_cond_new();
+ 
+-	xmp_cfg.mixing_freq = 0;
+-	xmp_cfg.convert8bit = 0;
+-	xmp_cfg.fixloops = 0;
+-	xmp_cfg.modrange = 0;
+-	xmp_cfg.force8bit = 0;
+-	xmp_cfg.force_mono = 0;
+-	xmp_cfg.interpolation = TRUE;
+-	xmp_cfg.filter = TRUE;
+-	xmp_cfg.pan_amplitude = 80;
++    aud_config_set_defaults("XMP",plugin_defaults);
+ 
+-#define CFGREADINT(x) aud_cfg_db_get_int (cfg, "XMP", #x, &xmp_cfg.x)
++#define CFGREADINT(x) xmp_cfg.x = aud_get_int ("XMP", #x)
+ 
+-	if ((cfg = aud_cfg_db_open())) {
+ 		CFGREADINT(mixing_freq);
+ 		CFGREADINT(force8bit);
+ 		CFGREADINT(convert8bit);
+@@ -191,9 +193,6 @@
+ 		CFGREADINT(filter);
+ 		CFGREADINT(pan_amplitude);
+ 
+-		aud_cfg_db_close(cfg);
+-	}
+-
+ 	configure_init();
+ 
+ 	xmp_init(ctx, 0, NULL);
+@@ -412,7 +411,6 @@
+ 
+ static void configure_apply()
+ {
+-	mcs_handle_t *cfg;
+ 	struct xmp_options *opt;
+ 
+ 	/* transfer Preferences UI config values back into XMPConfig */
+@@ -435,9 +433,7 @@
+ 	opt = xmp_get_options(ctx);
+ 	opt->mix = xmp_cfg.pan_amplitude;
+ 
+-	cfg = aud_cfg_db_open();
+-
+-#define CFGWRITEINT(x) aud_cfg_db_set_int (cfg, "XMP", #x, xmp_cfg.x)
++#define CFGWRITEINT(x) aud_set_int ("XMP", #x, xmp_cfg.x)
+ 
+ 	CFGWRITEINT(mixing_freq);
+ 	CFGWRITEINT(force8bit);
+@@ -448,8 +444,6 @@
+ 	CFGWRITEINT(interpolation);
+ 	CFGWRITEINT(filter);
+ 	CFGWRITEINT(pan_amplitude);
+-
+-	aud_cfg_db_close(cfg);
+ }
+ 
+ static void configure_init(void)
+@@ -532,22 +526,23 @@
+ 		NULL, NULL, FALSE, .cfg_type = VALUE_BOOLEAN},
+ 	{ WIDGET_LABEL, "Pan amplitude (%)", NULL, NULL, NULL, FALSE },
+ 	{ WIDGET_SPIN_BTN, "", &guicfg.panamp, NULL, NULL, FALSE,
+-		{ .spin_btn = { 0.0, 100.0, 1.0, "" } },
+-		.cfg_type = VALUE_FLOAT},
++      .cfg_type = VALUE_FLOAT, NULL, NULL,
++      { .spin_btn = { 0.0, 100.0, 1.0, "" } }
++    },
+ };
+ 
+ static PreferencesWidget prefs_opts_tab[] = {
+-	{ WIDGET_BOX, NULL, NULL, NULL, NULL, FALSE,
++	{ WIDGET_BOX, NULL, NULL, NULL, NULL, FALSE, VALUE_NULL, NULL, NULL,
+ 		{.box = { prefs_opts, G_N_ELEMENTS(prefs_opts), FALSE, FALSE}}},
+ };
+ 
+ static PreferencesWidget prefs_qual_row1[] = {
+-	{ WIDGET_BOX, "Resolution", NULL, NULL, NULL, FALSE,
++	{ WIDGET_BOX, "Resolution", NULL, NULL, NULL, FALSE, VALUE_NULL, NULL, NULL,
+ 		{ .box = { prefs_precision, G_N_ELEMENTS(prefs_precision),
+ 			FALSE, TRUE }
+ 		}
+ 	},
+-	{ WIDGET_BOX, "Channels", NULL, NULL, NULL, FALSE,
++	{ WIDGET_BOX, "Channels", NULL, NULL, NULL, FALSE, VALUE_NULL, NULL, NULL,
+ 		{ .box = { prefs_channels, G_N_ELEMENTS(prefs_channels),
+ 			FALSE, TRUE }
+ 		}
+@@ -555,7 +550,7 @@
+ };
+ 
+ static PreferencesWidget prefs_qual_row2[] = {
+-	{ WIDGET_BOX, "Sampling rate", NULL, NULL, NULL, FALSE,
++	{ WIDGET_BOX, "Sampling rate", NULL, NULL, NULL, FALSE, VALUE_NULL, NULL, NULL,
+ 		{ .box = { prefs_frequency, G_N_ELEMENTS(prefs_frequency),
+ 			FALSE, TRUE }
+ 		}
+@@ -563,12 +558,12 @@
+ };
+ 
+ static PreferencesWidget prefs_qual_box1[] = {
+-	{ WIDGET_BOX, NULL, NULL, NULL, NULL, FALSE,
++	{ WIDGET_BOX, NULL, NULL, NULL, NULL, FALSE, VALUE_NULL, NULL, NULL,
+ 		{ .box = { prefs_qual_row1, G_N_ELEMENTS(prefs_qual_row1),
+ 			TRUE, TRUE }
+ 		}
+ 	},
+-	{ WIDGET_BOX, NULL, NULL, NULL, NULL, FALSE,
++	{ WIDGET_BOX, NULL, NULL, NULL, NULL, FALSE, VALUE_NULL, NULL, NULL,
+ 		{ .box = { prefs_qual_row2, G_N_ELEMENTS(prefs_qual_row2),
+ 			FALSE, TRUE }
+ 		}
+@@ -576,7 +571,7 @@
+ };
+ 
+ static PreferencesWidget prefs_qual_tab[] = {
+-	{ WIDGET_BOX, NULL, NULL, NULL, NULL, FALSE,
++	{ WIDGET_BOX, NULL, NULL, NULL, NULL, FALSE, VALUE_NULL, NULL, NULL,
+ 		{ .box = { prefs_qual_box1, G_N_ELEMENTS(prefs_qual_box1),
+ 			FALSE, TRUE }
+ 		}
+@@ -589,7 +584,7 @@
+ };
+ 
+ static PreferencesWidget prefs[] = {
+-	{WIDGET_NOTEBOOK, NULL, NULL, NULL, NULL, FALSE,
++	{WIDGET_NOTEBOOK, NULL, NULL, NULL, NULL, FALSE, VALUE_NULL, NULL, NULL,
+ 		{ .notebook = { prefs_tabs, G_N_ELEMENTS(prefs_tabs) } },
+ 	},
+ };
diff --git a/xmp.spec b/xmp.spec
index 123392e..045df1d 100644
--- a/xmp.spec
+++ b/xmp.spec
@@ -24,6 +24,10 @@ BuildRequires: pulseaudio-libs-devel
 Buildrequires: xmms-devel
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -u -n)
 
+# port to Audacious 3.1 Preferences API, albeit without connecting
+# any GUI elements with config section/name pairs directly
+Patch0: xmp-3.4.0-audacious-3.1.patch
+
 %description
 The Extended Module Player is a modplayer for Unix-like systems that plays
 over 80 mainstream and obscure module formats from Amiga, Atari, Acorn,
@@ -105,6 +109,7 @@ rm -rf %{buildroot}
 
 %changelog
 * Wed Oct 12 2011 Michael Schwendt <mschwendt at fedoraproject.org> - 3.4.0-2
+- Port to Audacious 3.1 Preferences API.
 - Rebuild for Audacious 3.1-beta1 generic plugin API/ABI bump.
 - Depend on audacious(plugin-api)%%{?_isa}.
 


More information about the scm-commits mailing list