Mercurial > audlegacy
changeset 3555:a73951b8cd9f trunk
effect processing -> flow manager API / attached to postproc_flow.
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Tue, 18 Sep 2007 13:21:08 -0500 |
parents | 3ff87aafe1a4 |
children | 23fcb140ee13 |
files | src/audacious/effect.c src/audacious/effect.h src/audacious/output.c |
diffstat | 3 files changed, 38 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/audacious/effect.c Tue Sep 18 13:20:44 2007 -0500 +++ b/src/audacious/effect.c Tue Sep 18 13:21:08 2007 -0500 @@ -157,3 +157,37 @@ } g_strfreev(plugins); } + +void +effect_flow(FlowContext *context) +{ + AFormat new_format; + gint new_rate; + gint new_nch; + + new_format = context->fmt; + new_rate = context->srate; + new_nch = context->channels; + + effect_do_query_format(&new_format, &new_rate, &new_nch); + + if (new_format != context->fmt || + new_rate != context->srate || + new_nch != context->channels) + { + /* + * The effect plugin changes the stream format. Reopen the + * audio device. + */ + if (!output_open_audio(new_format, new_rate, new_nch)) + return; + + context->fmt = new_format; + context->srate = new_rate; + context->channels = new_nch; + } + + context->length = effect_do_mod_samples(&context->data, context->length, + context->fmt, context->srate, context->channels); +} +
--- a/src/audacious/effect.h Tue Sep 18 13:20:44 2007 -0500 +++ b/src/audacious/effect.h Tue Sep 18 13:21:08 2007 -0500 @@ -27,6 +27,8 @@ #define EFFECT_H #include <glib.h> + +#include "audacious/flow.h" #include "audacious/output.h" typedef struct _EffectPluginData EffectPluginData; @@ -44,6 +46,7 @@ gint effect_do_mod_samples(gpointer * data, gint length, AFormat fmt, gint srate, gint nch); void effect_do_query_format(AFormat * fmt, gint * rate, gint * nch); +void effect_flow(FlowContext *context); extern EffectPluginData ep_data;
--- a/src/audacious/output.c Tue Sep 18 13:20:44 2007 -0500 +++ b/src/audacious/output.c Tue Sep 18 13:21:08 2007 -0500 @@ -444,6 +444,7 @@ if (postproc_flow == NULL) { postproc_flow = flow_new(); + flow_link_element(postproc_flow, effect_flow); flow_link_element(postproc_flow, volumecontrol_flow); }