[mod_ladspa] Add activate/deactivate support.

Without these -- especially activate() -- stateful plugins will not be
set up correctly.

For example, the low-pass filter "lpf" in the CMT library may produce
a pop when starting since its state is not zeroed out.
This commit is contained in:
Jordan Yelloz 2022-12-16 12:35:27 -07:00
parent 27c0287bd6
commit 9fd214fcbb
No known key found for this signature in database
1 changed files with 9 additions and 0 deletions

View File

@ -370,6 +370,11 @@ static switch_bool_t ladspa_callback(switch_media_bug_t *bug, void *user_data, s
}
}
}
if (pvt->ldesc->activate) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session), SWITCH_LOG_DEBUG, "ACTIVATE\n");
pvt->ldesc->activate(pvt->handle);
}
}
break;
@ -382,6 +387,10 @@ static switch_bool_t ladspa_callback(switch_media_bug_t *bug, void *user_data, s
}
if (pvt->handle && pvt->ldesc) {
if (pvt->ldesc->deactivate) {
pvt->ldesc->deactivate(pvt->handle);
}
pvt->ldesc->cleanup(pvt->handle);
}