Mercurial > audlegacy-plugins
changeset 2575:1e67df1a1edc
Implemented query_format() callback in all effect plugins
author | Stefano D'Angelo <zanga.mail@gmail.com> |
---|---|
date | Mon, 19 May 2008 01:52:11 +0200 |
parents | 8da9705862e5 |
children | bd3a24b39058 |
files | src/audiocompress/audacious-glue.c src/crystalizer/crystalizer.c src/echo_plugin/echo.c src/stereo_plugin/stereo.c src/voice_removal/voice_removal.c |
diffstat | 5 files changed, 58 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/audiocompress/audacious-glue.c Sun May 18 16:59:05 2008 +0200 +++ b/src/audiocompress/audacious-glue.c Mon May 19 01:52:11 2008 +0200 @@ -37,6 +37,7 @@ static void myPrefs(void); static int myModify(gpointer * data, gint length, AFormat fmt, gint srate, gint nch); +static void myQueryFormat(AFormat * fmt, gint * rate, gint * nch); static int inited = 0; @@ -48,6 +49,7 @@ .about = myAbout, .configure = myPrefs, .mod_samples = myModify, + .query_format = myQueryFormat, }; EffectPlugin *audiocompress_eplist[] = { &xmms_plugin, NULL }; @@ -76,6 +78,14 @@ inited = 0; } +void myQueryFormat(AFormat * fmt, gint * rate, gint * nch) +{ + if ((*fmt != FMT_S16_NE) || + (*fmt != FMT_S16_LE && G_BYTE_ORDER == G_LITTLE_ENDIAN) || + (*fmt != FMT_S16_BE && G_BYTE_ORDER == G_BIG_ENDIAN)) + *fmt = FMT_S16_NE; +} + int myModify(gpointer * data, gint length, AFormat fmt, gint srate, gint nch) { if (fmt == FMT_S16_NE ||
--- a/src/crystalizer/crystalizer.c Sun May 18 16:59:05 2008 +0200 +++ b/src/crystalizer/crystalizer.c Mon May 19 01:52:11 2008 +0200 @@ -27,13 +27,15 @@ static void init(void); static void configure(void); static int mod_samples(gpointer *d, gint length, AFormat afmt, gint srate, gint nch); +static void query_format(AFormat * fmt, gint * rate, gint * nch); EffectPlugin crystalizer_ep = { .description = "Crystalizer", /* Description */ .init = init, .configure = configure, - .mod_samples = mod_samples + .mod_samples = mod_samples, + .query_format = query_format }; static GtkWidget *conf_dialog = NULL; @@ -138,6 +140,14 @@ gtk_widget_show(conf_dialog); } +static void query_format(AFormat * fmt, gint * rate, gint * nch) +{ + if (!(*fmt == FMT_S16_NE || + (*fmt == FMT_S16_LE && G_BYTE_ORDER == G_LITTLE_ENDIAN) || + (*fmt == FMT_S16_BE && G_BYTE_ORDER == G_BIG_ENDIAN))) + *fmt = FMT_S16_NE; +} + static int mod_samples(gpointer *d, gint length, AFormat afmt, gint srate, gint nch) { gint i;
--- a/src/echo_plugin/echo.c Sun May 18 16:59:05 2008 +0200 +++ b/src/echo_plugin/echo.c Mon May 19 01:52:11 2008 +0200 @@ -11,6 +11,7 @@ static void init(void); static void cleanup(void); static int mod_samples(gpointer * d, gint length, AFormat afmt, gint srate, gint nch); +static void query_format(AFormat * fmt, gint * rate, gint * nch); #define MAX_SRATE 50000 #define MAX_CHANNELS 2 @@ -27,6 +28,7 @@ .about = echo_about, .configure = echo_configure, .mod_samples = mod_samples, + .query_format = query_format, }; static gint16 *buffer = NULL; @@ -59,6 +61,14 @@ buffer = NULL; } +static void query_format(AFormat * fmt, gint * rate, gint * nch) +{ + if (!(*fmt == FMT_S16_NE || + (*fmt == FMT_S16_LE && G_BYTE_ORDER == G_LITTLE_ENDIAN) || + (*fmt == FMT_S16_BE && G_BYTE_ORDER == G_BIG_ENDIAN))) + *fmt = FMT_S16_NE; +} + static int mod_samples(gpointer * d, gint length, AFormat afmt, gint srate, gint nch) { gint i, in, out, buf, r_ofs, fb_div;
--- a/src/stereo_plugin/stereo.c Sun May 18 16:59:05 2008 +0200 +++ b/src/stereo_plugin/stereo.c Mon May 19 01:52:11 2008 +0200 @@ -9,6 +9,7 @@ static void about(void); static void configure(void); static int mod_samples(gpointer *d, gint length, AFormat afmt, gint srate, gint nch); +static void query_format(AFormat * fmt, gint * rate, gint * nch); @@ -18,7 +19,8 @@ .init = init, .about = about, .configure = configure, - .mod_samples = mod_samples + .mod_samples = mod_samples, + .query_format = query_format }; static const char *about_text = N_("Extra Stereo Plugin\n\n" @@ -140,6 +142,17 @@ gtk_widget_show(conf_dialog); } +static void query_format(AFormat * fmt, gint * rate, gint * nch) +{ + if (!(*fmt == FMT_S16_NE || + (*fmt == FMT_S16_LE && G_BYTE_ORDER == G_LITTLE_ENDIAN) || + (*fmt == FMT_S16_BE && G_BYTE_ORDER == G_BIG_ENDIAN))) + *fmt = FMT_S16_NE; + + if (*nch != 2) + *nch = 2; +} + static int mod_samples(gpointer *d, gint length, AFormat afmt, gint srate, gint nch) { gint i;
--- a/src/voice_removal/voice_removal.c Sun May 18 16:59:05 2008 +0200 +++ b/src/voice_removal/voice_removal.c Mon May 19 01:52:11 2008 +0200 @@ -28,16 +28,29 @@ static int apply_effect (gpointer *d, gint length, AFormat afmt, gint srate, gint nch); +static void query_format (AFormat *fmt, gint *rate, gint *nch); static EffectPlugin xmms_plugin = { .description = "Voice Removal Plugin", .mod_samples = apply_effect, + .query_format = query_format }; EffectPlugin *voice_eplist[] = { &xmms_plugin, NULL }; DECLARE_PLUGIN(voice_removal, NULL, NULL, NULL, NULL, voice_eplist, NULL, NULL, NULL); +static void query_format (AFormat *fmt, gint *rate, gint *nch) +{ + if (!((*fmt == FMT_S16_NE) || + (*fmt == FMT_S16_LE && G_BYTE_ORDER == G_LITTLE_ENDIAN) || + (*fmt == FMT_S16_BE && G_BYTE_ORDER == G_BIG_ENDIAN))) + *fmt = FMT_S16_NE; + + if (*nch != 2) + *nch = 2; +} + static int apply_effect (gpointer *d, gint length, AFormat afmt, gint srate, gint nch) { int x;