Mercurial > audlegacy
diff src/audacious/effect.c @ 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 | 96baf555b449 |
| children | 23fcb140ee13 |
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); +} +
