Lines Matching refs:l_st

104   priv_t * l_st = (priv_t *)effp->priv;  in sox_ladspa_getopts()  local
114 case 'r': l_st->clone = sox_true; break; in sox_ladspa_getopts()
115 case 'l': l_st->latency_compensation = sox_true; break; in sox_ladspa_getopts()
124 l_st->name = argv[0]; in sox_ladspa_getopts()
134 || (l_st->lth = lt_dlopenext(l_st->name)) == NULL) { in sox_ladspa_getopts()
135 lsx_fail("could not open LADSPA plugin %s", l_st->name); in sox_ladspa_getopts()
140 if ((ltptr.ptr = lt_dlsym(l_st->lth, "ladspa_descriptor")) == NULL) { in sox_ladspa_getopts()
152 l_st->desc = ltptr.fn(0UL); in sox_ladspa_getopts()
153 assert(l_st->desc); /* We already know this will work */ in sox_ladspa_getopts()
158 while (l_st->desc && strcmp(l_st->desc->Label, argv[0]) != 0) in sox_ladspa_getopts()
159 l_st->desc = ltptr.fn(++index); in sox_ladspa_getopts()
160 if (l_st->desc == NULL) { in sox_ladspa_getopts()
168 l_st->control = lsx_calloc(l_st->desc->PortCount, sizeof(LADSPA_Data)); in sox_ladspa_getopts()
169 l_st->inputs = lsx_malloc(l_st->desc->PortCount * sizeof(unsigned long)); in sox_ladspa_getopts()
170 l_st->outputs = lsx_malloc(l_st->desc->PortCount * sizeof(unsigned long)); in sox_ladspa_getopts()
172 for (i = 0; i < l_st->desc->PortCount; i++) { in sox_ladspa_getopts()
173 const LADSPA_PortDescriptor port = l_st->desc->PortDescriptors[i]; in sox_ladspa_getopts()
187 l_st->inputs[l_st->input_count++] = i; in sox_ladspa_getopts()
189 l_st->outputs[l_st->output_count++] = i; in sox_ladspa_getopts()
192 if (l_st->latency_compensation && in sox_ladspa_getopts()
195 strcmp(l_st->desc->PortNames[i], "latency") == 0) { in sox_ladspa_getopts()
197 l_st->latency_control_port = &l_st->control[i]; in sox_ladspa_getopts()
198 assert(*l_st->latency_control_port == 0); in sox_ladspa_getopts()
201 if (!LADSPA_IS_HINT_HAS_DEFAULT(l_st->desc->PortRangeHints[i].HintDescriptor)) { in sox_ladspa_getopts()
205 l_st->control[i] = ladspa_default(&(l_st->desc->PortRangeHints[i])); in sox_ladspa_getopts()
206 lsx_debug("default argument for port %lu is %f", i, l_st->control[i]); in sox_ladspa_getopts()
210 l_st->control[i] = (LADSPA_Data)arg; in sox_ladspa_getopts()
211 lsx_debug("argument for port %lu is %f", i, l_st->control[i]); in sox_ladspa_getopts()
226 priv_t * l_st = (priv_t *)effp->priv; in sox_ladspa_start() local
234 if (l_st->input_count == 1 && l_st->output_count == 1 && in sox_ladspa_start()
238 if (!l_st->clone && effp->in_signal.channels > 1) { in sox_ladspa_start()
249 l_st->handles = lsx_malloc(effp->in_signal.channels * in sox_ladspa_start()
252 while (l_st->handle_count < effp->in_signal.channels) in sox_ladspa_start()
253 l_st->handles[l_st->handle_count++] = l_st->desc->instantiate(l_st->desc, rate); in sox_ladspa_start()
261 if (l_st->input_count < effp->in_signal.channels) { in sox_ladspa_start()
263 (unsigned)l_st->input_count, effp->in_signal.channels); in sox_ladspa_start()
268 if (l_st->input_count > effp->in_signal.channels) in sox_ladspa_start()
270 (unsigned)l_st->input_count, effp->in_signal.channels); in sox_ladspa_start()
276 if (l_st->output_count != effp->out_signal.channels) { in sox_ladspa_start()
278 effp->out_signal.channels, (unsigned)l_st->output_count); in sox_ladspa_start()
279 effp->out_signal.channels = l_st->output_count; in sox_ladspa_start()
282 l_st->handle_count = 1; in sox_ladspa_start()
283 l_st->handles = lsx_malloc(sizeof(LADSPA_Handle *)); in sox_ladspa_start()
284 l_st->handles[0] = l_st->desc->instantiate(l_st->desc, rate); in sox_ladspa_start()
288 for (h = 0; h < l_st->handle_count; h++) { in sox_ladspa_start()
289 if (l_st->handles[h] == NULL) { in sox_ladspa_start()
291 for (h = 0; l_st->desc->cleanup && h < l_st->handle_count; h++) { in sox_ladspa_start()
292 if (l_st->handles[h]) in sox_ladspa_start()
293 l_st->desc->cleanup(l_st->handles[h]); in sox_ladspa_start()
296 free(l_st->handles); in sox_ladspa_start()
297 l_st->handle_count = 0; in sox_ladspa_start()
303 for (i = 0; i < l_st->desc->PortCount; i++) { in sox_ladspa_start()
304 const LADSPA_PortDescriptor port = l_st->desc->PortDescriptors[i]; in sox_ladspa_start()
307 for (h = 0; h < l_st->handle_count; h++) in sox_ladspa_start()
308 l_st->desc->connect_port(l_st->handles[h], i, &(l_st->control[i])); in sox_ladspa_start()
313 if (l_st->desc->activate) { in sox_ladspa_start()
314 for (h = 0; h < l_st->handle_count; h++) in sox_ladspa_start()
315 l_st->desc->activate(l_st->handles[h]); in sox_ladspa_start()
327 priv_t * l_st = (priv_t *)effp->priv; in sox_ladspa_flow() local
331 const size_t total_input_count = l_st->input_count * l_st->handle_count; in sox_ladspa_flow()
332 const size_t total_output_count = l_st->output_count * l_st->handle_count; in sox_ladspa_flow()
363 handle = l_st->handles[j / l_st->input_count]; in sox_ladspa_flow()
364 port = l_st->inputs[j / l_st->handle_count]; in sox_ladspa_flow()
365 l_st->desc->connect_port(handle, port, buf + j * input_len); in sox_ladspa_flow()
370 handle = l_st->handles[j / l_st->output_count]; in sox_ladspa_flow()
371 port = l_st->outputs[j / l_st->handle_count]; in sox_ladspa_flow()
372 l_st->desc->connect_port(handle, port, outbuf + j * output_len); in sox_ladspa_flow()
376 for (h = 0; h < l_st->handle_count; h++) in sox_ladspa_flow()
377 l_st->desc->run(l_st->handles[h], input_len); in sox_ladspa_flow()
380 if (l_st->latency_control_port) { in sox_ladspa_flow()
381 lsx_debug("latency detected is %g", *l_st->latency_control_port); in sox_ladspa_flow()
382 l_st->in_latency = (unsigned long)floor(*l_st->latency_control_port); in sox_ladspa_flow()
385 l_st->out_latency = l_st->in_latency; in sox_ladspa_flow()
388 l_st->latency_control_port = NULL; in sox_ladspa_flow()
392 l = min(output_len, l_st->in_latency); in sox_ladspa_flow()
400 l_st->in_latency -= l; in sox_ladspa_flow()
415 priv_t * l_st = (priv_t *)effp->priv; in sox_ladspa_drain() local
420 if (l_st->out_latency == 0) { in sox_ladspa_drain()
426 isamp = l_st->out_latency * effp->in_signal.channels; in sox_ladspa_drain()
427 dsamp = l_st->out_latency * effp->out_signal.channels; in sox_ladspa_drain()
447 priv_t * l_st = (priv_t *)effp->priv; in sox_ladspa_stop() local
450 for (h = 0; h < l_st->handle_count; h++) { in sox_ladspa_stop()
452 if (l_st->desc->deactivate) in sox_ladspa_stop()
453 l_st->desc->deactivate(l_st->handles[h]); in sox_ladspa_stop()
454 if (l_st->desc->cleanup) in sox_ladspa_stop()
455 l_st->desc->cleanup(l_st->handles[h]); in sox_ladspa_stop()
457 free(l_st->handles); in sox_ladspa_stop()
458 l_st->handle_count = 0; in sox_ladspa_stop()
465 priv_t * l_st = (priv_t *)effp->priv; in sox_ladspa_kill() local
467 free(l_st->control); in sox_ladspa_kill()
468 free(l_st->inputs); in sox_ladspa_kill()
469 free(l_st->outputs); in sox_ladspa_kill()