Mercurial > mplayer.hg
changeset 22127:c6c141ab4fcf
Experimental support for multichannel ladspa effects
author | reimar |
---|---|
date | Mon, 05 Feb 2007 17:09:25 +0000 |
parents | b49bc3a14c3c |
children | 1d9dffcddb07 |
files | libaf/af_ladspa.c |
diffstat | 1 files changed, 11 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/libaf/af_ladspa.c Mon Feb 05 14:17:33 2007 +0000 +++ b/libaf/af_ladspa.c Mon Feb 05 17:09:25 2007 +0000 @@ -253,12 +253,9 @@ af_msg(AF_MSG_VERBOSE, "%s: this is a mono effect\n", setup->myname); } else if (setup->ninputs == 2) { af_msg(AF_MSG_VERBOSE, "%s: this is a stereo effect\n", setup->myname); - } - - if (setup->ninputs > 2) { - af_msg(AF_MSG_ERROR, "%s: %s\n", setup->myname, - MSGTR_AF_LADSPA_ErrMultiChannel); - return AF_ERROR; + } else { + af_msg(AF_MSG_VERBOSE, "%s: this is a %i-channel effect," + "support is experimental\n", setup->myname, setup->ninputs); } if (setup->noutputs == 0) { @@ -704,11 +701,7 @@ } if (setup->chhandles) { - for(i=0; i<setup->nch; i++) { - if ( (setup->ninputs == 2) && (i & 1) ) { /* stereo effect */ - i++; - continue; - } + for(i=0; i<setup->nch; i+=setup->ninputs) { if (pdes->deactivate) pdes->deactivate(setup->chhandles[i]); if (pdes->cleanup) pdes->cleanup(setup->chhandles[i]); } @@ -837,7 +830,7 @@ for(i=0; i<nch; i++) { - if ( (setup->ninputs == 2) && (i & 1) ) { /* stereo effect */ + if (i % setup->ninputs) { /* stereo effect */ /* copy the handle from previous channel */ setup->chhandles[i] = setup->chhandles[i-1]; continue; @@ -854,10 +847,10 @@ for(i=0; i<nch; i++) { pdes->connect_port(setup->chhandles[i], - setup->inputs[ (setup->ninputs==2) ? i&1 : 0 ], + setup->inputs[i % setup->ninputs], setup->inbufs[i]); pdes->connect_port(setup->chhandles[i], - setup->outputs[ (setup->ninputs==2) ? i&1 : 0 ], + setup->outputs[i % setup->ninputs], setup->outbufs[i]); /* connect (input) controls */ @@ -888,12 +881,12 @@ * and right. connect it to the second port. */ - if( (setup->ninputs == 2) && (i&1) && (i >= 1) ) { + for (p = i; p % setup->ninputs; p++) { pdes->connect_port(setup->chhandles[i-1], - setup->inputs[ (setup->ninputs==2) ? i&1 : 0 ], + setup->inputs[p % setup->ninputs], setup->inbufs[i-1]); pdes->connect_port(setup->chhandles[i-1], - setup->outputs[ (setup->ninputs==2) ? i&1 : 0 ], + setup->outputs[p % setup->ninputs], setup->outbufs[i-1]); } /* done! */ @@ -917,10 +910,8 @@ /* Run filter(s) */ - for (i=0; i<nch; i++) { + for (i=0; i<nch; i+=setup->ninputs) { pdes->run(setup->chhandles[i], setup->bufsize); - if (setup->ninputs==2) // stereo effect just ran - i++; } /* Extract outbufs */