diff src/echo_plugin/echo.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 3134a0987162
line wrap: on
line diff
--- 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;