aboutsummaryrefslogtreecommitdiffhomepage
path: root/libaf
diff options
context:
space:
mode:
authorGravatar reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-02-05 17:09:25 +0000
committerGravatar reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-02-05 17:09:25 +0000
commit5df7bb377fc44e64788529257ae4fb0fad8d00fc (patch)
tree1609078e60873bd4d3bbc260b402aa9a84aa0978 /libaf
parent50b3a7af5eb92edfda8d9a894e9b650e9f4f8748 (diff)
Experimental support for multichannel ladspa effects
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22145 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libaf')
-rw-r--r--libaf/af_ladspa.c31
1 files changed, 11 insertions, 20 deletions
diff --git a/libaf/af_ladspa.c b/libaf/af_ladspa.c
index af9f7cbc21..0bf3fc0820 100644
--- a/libaf/af_ladspa.c
+++ b/libaf/af_ladspa.c
@@ -253,12 +253,9 @@ static int af_ladspa_parse_plugin(af_ladspa_t *setup) {
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 @@ static void uninit(struct af_instance_s *af) {
}
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 @@ static af_data_t* play(struct af_instance_s *af, af_data_t *data) {
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 @@ static af_data_t* play(struct af_instance_s *af, af_data_t *data) {
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 @@ static af_data_t* play(struct af_instance_s *af, af_data_t *data) {
* 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 @@ static af_data_t* play(struct af_instance_s *af, af_data_t *data) {
/* 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 */