[MPlayer-cvslog] r22145 - trunk/libaf/af_ladspa.c
reimar
subversion at mplayerhq.hu
Mon Feb 5 18:09:25 CET 2007
Author: reimar
Date: Mon Feb 5 18:09:25 2007
New Revision: 22145
Modified:
trunk/libaf/af_ladspa.c
Log:
Experimental support for multichannel ladspa effects
Modified: trunk/libaf/af_ladspa.c
==============================================================================
--- trunk/libaf/af_ladspa.c (original)
+++ trunk/libaf/af_ladspa.c Mon Feb 5 18:09:25 2007
@@ -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 */
More information about the MPlayer-cvslog
mailing list