mirror of https://github.com/mpv-player/mpv
Experimental support for multichannel ladspa effects
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22145 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
50b3a7af5e
commit
5df7bb377f
|
@ -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);
|
af_msg(AF_MSG_VERBOSE, "%s: this is a mono effect\n", setup->myname);
|
||||||
} else if (setup->ninputs == 2) {
|
} else if (setup->ninputs == 2) {
|
||||||
af_msg(AF_MSG_VERBOSE, "%s: this is a stereo effect\n", setup->myname);
|
af_msg(AF_MSG_VERBOSE, "%s: this is a stereo effect\n", setup->myname);
|
||||||
}
|
} else {
|
||||||
|
af_msg(AF_MSG_VERBOSE, "%s: this is a %i-channel effect,"
|
||||||
if (setup->ninputs > 2) {
|
"support is experimental\n", setup->myname, setup->ninputs);
|
||||||
af_msg(AF_MSG_ERROR, "%s: %s\n", setup->myname,
|
|
||||||
MSGTR_AF_LADSPA_ErrMultiChannel);
|
|
||||||
return AF_ERROR;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setup->noutputs == 0) {
|
if (setup->noutputs == 0) {
|
||||||
|
@ -704,11 +701,7 @@ static void uninit(struct af_instance_s *af) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setup->chhandles) {
|
if (setup->chhandles) {
|
||||||
for(i=0; i<setup->nch; i++) {
|
for(i=0; i<setup->nch; i+=setup->ninputs) {
|
||||||
if ( (setup->ninputs == 2) && (i & 1) ) { /* stereo effect */
|
|
||||||
i++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (pdes->deactivate) pdes->deactivate(setup->chhandles[i]);
|
if (pdes->deactivate) pdes->deactivate(setup->chhandles[i]);
|
||||||
if (pdes->cleanup) pdes->cleanup(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++) {
|
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 */
|
/* copy the handle from previous channel */
|
||||||
setup->chhandles[i] = setup->chhandles[i-1];
|
setup->chhandles[i] = setup->chhandles[i-1];
|
||||||
continue;
|
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++) {
|
for(i=0; i<nch; i++) {
|
||||||
pdes->connect_port(setup->chhandles[i],
|
pdes->connect_port(setup->chhandles[i],
|
||||||
setup->inputs[ (setup->ninputs==2) ? i&1 : 0 ],
|
setup->inputs[i % setup->ninputs],
|
||||||
setup->inbufs[i]);
|
setup->inbufs[i]);
|
||||||
pdes->connect_port(setup->chhandles[i],
|
pdes->connect_port(setup->chhandles[i],
|
||||||
setup->outputs[ (setup->ninputs==2) ? i&1 : 0 ],
|
setup->outputs[i % setup->ninputs],
|
||||||
setup->outbufs[i]);
|
setup->outbufs[i]);
|
||||||
|
|
||||||
/* connect (input) controls */
|
/* 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.
|
* 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],
|
pdes->connect_port(setup->chhandles[i-1],
|
||||||
setup->inputs[ (setup->ninputs==2) ? i&1 : 0 ],
|
setup->inputs[p % setup->ninputs],
|
||||||
setup->inbufs[i-1]);
|
setup->inbufs[i-1]);
|
||||||
pdes->connect_port(setup->chhandles[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]);
|
setup->outbufs[i-1]);
|
||||||
} /* done! */
|
} /* done! */
|
||||||
|
|
||||||
|
@ -917,10 +910,8 @@ static af_data_t* play(struct af_instance_s *af, af_data_t *data) {
|
||||||
|
|
||||||
/* Run filter(s) */
|
/* Run filter(s) */
|
||||||
|
|
||||||
for (i=0; i<nch; i++) {
|
for (i=0; i<nch; i+=setup->ninputs) {
|
||||||
pdes->run(setup->chhandles[i], setup->bufsize);
|
pdes->run(setup->chhandles[i], setup->bufsize);
|
||||||
if (setup->ninputs==2) // stereo effect just ran
|
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Extract outbufs */
|
/* Extract outbufs */
|
||||||
|
|
Loading…
Reference in New Issue