diff src/stereo_plugin/stereo.c @ 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 769e17da93dd
children bd3a24b39058
line wrap: on
line diff
--- 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;