comparison src/voice_removal/voice_removal.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 6acf1bda788b
children 3134a0987162
comparison
equal deleted inserted replaced
2574:8da9705862e5 2575:1e67df1a1edc
26 #include <audacious/plugin.h> 26 #include <audacious/plugin.h>
27 27
28 28
29 static int apply_effect (gpointer *d, gint length, AFormat afmt, 29 static int apply_effect (gpointer *d, gint length, AFormat afmt,
30 gint srate, gint nch); 30 gint srate, gint nch);
31 static void query_format (AFormat *fmt, gint *rate, gint *nch);
31 32
32 static EffectPlugin xmms_plugin = { 33 static EffectPlugin xmms_plugin = {
33 .description = "Voice Removal Plugin", 34 .description = "Voice Removal Plugin",
34 .mod_samples = apply_effect, 35 .mod_samples = apply_effect,
36 .query_format = query_format
35 }; 37 };
36 38
37 EffectPlugin *voice_eplist[] = { &xmms_plugin, NULL }; 39 EffectPlugin *voice_eplist[] = { &xmms_plugin, NULL };
38 40
39 DECLARE_PLUGIN(voice_removal, NULL, NULL, NULL, NULL, voice_eplist, NULL, NULL, NULL); 41 DECLARE_PLUGIN(voice_removal, NULL, NULL, NULL, NULL, voice_eplist, NULL, NULL, NULL);
42
43 static void query_format (AFormat *fmt, gint *rate, gint *nch)
44 {
45 if (!((*fmt == FMT_S16_NE) ||
46 (*fmt == FMT_S16_LE && G_BYTE_ORDER == G_LITTLE_ENDIAN) ||
47 (*fmt == FMT_S16_BE && G_BYTE_ORDER == G_BIG_ENDIAN)))
48 *fmt = FMT_S16_NE;
49
50 if (*nch != 2)
51 *nch = 2;
52 }
40 53
41 static int apply_effect (gpointer *d, gint length, AFormat afmt, 54 static int apply_effect (gpointer *d, gint length, AFormat afmt,
42 gint srate, gint nch) { 55 gint srate, gint nch) {
43 int x; 56 int x;
44 int left, right; 57 int left, right;