1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460
|
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include <qwidget.h>
#include <qstring.h>
#include <qslider.h>
#include <qcheckbox.h>
#include <qlabel.h>
#include <qvbox.h>
#include <qhbox.h>
#include <qspinbox.h>
#include <qradiobutton.h>
#include <qpushbutton.h>
#include <qdialog.h>
#include <qpainter.h>
#include <alsa/asoundlib.h>
#include <ladspa.h>
#include "synthdata.h"
#include "m_ladspa.h"
#include "port.h"
M_ladspa::M_ladspa(QWidget* parent, const char *name, SynthData *p_synthdata, int p_ladspaDesFuncIndex, int p_n, bool poly, bool extCtrlPorts)
: Module(MAX_OUTPORTS, parent, name, p_synthdata) {
QString qs;
int l1, l2, itmp, port_ofs;
int audio_in_index, audio_out_index, ctrl_in_index, ctrl_out_index, control_port_count;
float control_min, control_max;
bool tabMode;
QVBox *ladspaTab;
M_type = M_type_ladspa;
ladspaDesFuncIndex = p_ladspaDesFuncIndex;
n = p_n;
isPoly = poly;
ladspaTab = 0;
hasExtCtrlPorts = extCtrlPorts;
// fprintf(stderr, "new LADSPA module, Poly: %d\n", (int)isPoly);
rate_factor = 1.0;
ladspa_dsc = synthdata->ladspa_dsc_func_list[ladspaDesFuncIndex](n);
ladspa_audio_in_count = 0;
ladspa_audio_out_count = 0;
ladspa_ctrl_in_count = 0;
ladspa_ctrl_out_count = 0;
ctrl_in_index = 0;
ctrl_out_index = 0;
for (l1 = 0; l1 < ladspa_dsc->PortCount; l1++) {
if (LADSPA_IS_PORT_AUDIO(ladspa_dsc->PortDescriptors[l1])) {
if (LADSPA_IS_PORT_INPUT(ladspa_dsc->PortDescriptors[l1])) {
ladspa_audio_in_count++;
}
if (LADSPA_IS_PORT_OUTPUT(ladspa_dsc->PortDescriptors[l1])) {
ladspa_audio_out_count++;
}
}
if (LADSPA_IS_PORT_CONTROL(ladspa_dsc->PortDescriptors[l1])) {
if (LADSPA_IS_PORT_INPUT(ladspa_dsc->PortDescriptors[l1])) {
ladspa_ctrl_in_count++;
}
if (LADSPA_IS_PORT_OUTPUT(ladspa_dsc->PortDescriptors[l1])) {
ladspa_ctrl_out_count++;
}
}
}
if (ladspa_audio_in_count > MAX_AUDIOPORTS) ladspa_audio_in_count = MAX_AUDIOPORTS;
if (ladspa_audio_out_count > MAX_AUDIOPORTS) ladspa_audio_out_count = MAX_AUDIOPORTS;
if (ladspa_ctrl_in_count > MAX_CONTROLPORTS) ladspa_ctrl_in_count = MAX_CONTROLPORTS;
if (ladspa_ctrl_out_count > MAX_CONTROLPORTS) ladspa_ctrl_out_count = MAX_CONTROLPORTS;
tabMode = ladspa_ctrl_in_count > MAX_LADPSA_CONTROLS_PER_TAB;
if (isPoly) {
for (l1 = 0; l1 < synthdata->poly; l1++) {
for (l2 = 0; l2 < ladspa_audio_in_count; l2++) {
ladspaDataIn[l2][l1] = (LADSPA_Data *)malloc(synthdata->periodsize * sizeof(LADSPA_Data));
memset(ladspaDataIn[l2][l1], 0, synthdata->periodsize * sizeof(LADSPA_Data));
}
for (l2 = 0; l2 < ladspa_audio_out_count; l2++) {
ladspaDataOut[l2][l1] = (LADSPA_Data *)malloc(synthdata->periodsize * sizeof(LADSPA_Data));
memset(ladspaDataOut[l2][l1], 0, synthdata->periodsize * sizeof(LADSPA_Data));
}
ladspa_handle[l1] = ladspa_dsc->instantiate(ladspa_dsc, synthdata->rate);
}
if (ladspa_dsc->activate) {
for (l1 = 0; l1 < synthdata->poly; l1++) {
ladspa_dsc->activate(ladspa_handle[l1]);
}
}
} else {
for (l2 = 0; l2 < ladspa_audio_in_count; l2++) {
ladspaDataIn[l2][0] = (LADSPA_Data *)malloc(synthdata->periodsize * sizeof(LADSPA_Data));
memset(ladspaDataIn[l2][0], 0, synthdata->periodsize * sizeof(LADSPA_Data));
}
for (l2 = 0; l2 < ladspa_audio_out_count; l2++) {
ladspaDataOut[l2][0] = (LADSPA_Data *)malloc(synthdata->periodsize * sizeof(LADSPA_Data));
memset(ladspaDataOut[l2][0], 0, synthdata->periodsize * sizeof(LADSPA_Data));
ladspa_handle[0] = ladspa_dsc->instantiate(ladspa_dsc, synthdata->rate);
if (ladspa_dsc->activate) {
ladspa_dsc->activate(ladspa_handle[0]);
}
}
}
configDialog->addLabel(QString("Name: ")+QString(ladspa_dsc->Name));
configDialog->addLabel(QString("Author: ")+QString(ladspa_dsc->Maker));
configDialog->addLabel(QString("Copyright: ")+QString(ladspa_dsc->Copyright));
if (tabMode) {
configDialog->initTabWidget();
}
port_ofs = 35;
audio_in_index = 0;
audio_out_index = 0;
control_port_count = 0;
for (l1 = 0; l1 < ladspa_dsc->PortCount; l1++) {
if (LADSPA_IS_PORT_AUDIO(ladspa_dsc->PortDescriptors[l1])) {
if (LADSPA_IS_PORT_INPUT(ladspa_dsc->PortDescriptors[l1])) {
Port *audio_in_port = new Port(ladspa_dsc->PortNames[l1], PORT_IN, in_port_list.count() + in_ctrl_port_list.count(), this, synthdata, 90);
audio_in_port->move(0, port_ofs + 20 * (in_port_list.count() + in_ctrl_port_list.count()));
audio_in_port->outTypeAcceptList.append(outType_audio);
in_port_list.append(audio_in_port);
portList.append(audio_in_port);
if (isPoly) {
for (l2 = 0; l2 < synthdata->poly; l2++) {
ladspa_dsc->connect_port(ladspa_handle[l2], l1, ladspaDataIn[audio_in_index][l2]);
}
} else {
ladspa_dsc->connect_port(ladspa_handle[0], l1, ladspaDataIn[audio_in_index][0]);
}
audio_in_index++;
}
if (LADSPA_IS_PORT_OUTPUT(ladspa_dsc->PortDescriptors[l1])) {
Port *audio_out_port = new Port(ladspa_dsc->PortNames[l1], PORT_OUT, out_port_list.count() + out_ctrl_port_list.count(), this, synthdata, 90);
audio_out_port->move(MODULE_LADSPA_WIDTH - audio_out_port->width(),
port_ofs + 20 * (out_port_list.count() + out_ctrl_port_list.count()));
audio_out_port->outType = outType_audio;
out_port_list.append(audio_out_port);
portList.append(audio_out_port);
if (isPoly) {
for (l2 = 0; l2 < synthdata->poly; l2++) {
ladspa_dsc->connect_port(ladspa_handle[l2], l1, ladspaDataOut[audio_out_index][l2]);
}
} else {
ladspa_dsc->connect_port(ladspa_handle[0], l1, ladspaDataOut[audio_out_index][0]);
}
audio_index[audio_out_index] = out_port_list.count() + out_ctrl_port_list.count() - 1;
// fprintf(stderr, "audio_index[audio_out_index] = audio_index[%d] = %d\n", audio_out_index, audio_index[audio_out_index]);
audio_out_index++;
}
}
if (LADSPA_IS_PORT_CONTROL(ladspa_dsc->PortDescriptors[l1])) {
controlPortRate[control_port_count] = false;
if (hasExtCtrlPorts) {
if (LADSPA_IS_PORT_INPUT(ladspa_dsc->PortDescriptors[l1])) {
Port *ctrl_in_port = new Port(ladspa_dsc->PortNames[l1], PORT_IN, in_port_list.count() + in_ctrl_port_list.count(), this, synthdata, 160, 1);
ctrl_in_port->move(0, port_ofs + 20 * (in_port_list.count() + in_ctrl_port_list.count()));
ctrl_in_port->outTypeAcceptList.append(outType_audio);
in_ctrl_port_list.append(ctrl_in_port);
portList.append(ctrl_in_port);
// fprintf(stderr, "input: %s\n", ladspa_dsc->PortNames[l1]);
}
if (LADSPA_IS_PORT_OUTPUT(ladspa_dsc->PortDescriptors[l1])) {
Port *ctrl_out_port = new Port(ladspa_dsc->PortNames[l1], PORT_OUT, out_port_list.count() + out_ctrl_port_list.count(), this, synthdata, 110, 1);
ctrl_out_port->move(MODULE_LADSPA_WIDTH - ctrl_out_port->width(),
port_ofs + 20 * (out_port_list.count() + out_ctrl_port_list.count()));
ctrl_out_port->outType = outType_audio;
out_ctrl_port_list.append(ctrl_out_port);
portList.append(ctrl_out_port);
if (LADSPA_IS_HINT_SAMPLE_RATE(ladspa_dsc->PortRangeHints[l1].HintDescriptor)) {
controlPortRate[ctrl_out_index] = true;
}
if (isPoly) {
for (l2 = 0; l2 < synthdata->poly; l2++) {
ladspa_dsc->connect_port(ladspa_handle[l2], l1, &control_out[ctrl_out_index]);
}
} else {
ladspa_dsc->connect_port(ladspa_handle[0], l1, &control_out[ctrl_out_index]);
}
// fprintf(stderr, "output: %s\n", ladspa_dsc->PortNames[l1]);
ctrl_index[ctrl_out_index] = out_port_list.count() + out_ctrl_port_list.count() - 1;
ctrl_out_index++;
}
} else {
if (LADSPA_IS_PORT_OUTPUT(ladspa_dsc->PortDescriptors[l1])) {
if (isPoly) {
for (l2 = 0; l2 < synthdata->poly; l2++) {
ladspa_dsc->connect_port(ladspa_handle[l2], l1, &control_out[ctrl_out_index]);
}
} else {
ladspa_dsc->connect_port(ladspa_handle[0], l1, &control_out[ctrl_out_index]);
}
ctrl_out_index++;
}
}
if (LADSPA_IS_PORT_INPUT(ladspa_dsc->PortDescriptors[l1])) {
if (tabMode && ((ctrl_in_index % MAX_LADPSA_CONTROLS_PER_TAB) == 0)) {
ladspaTab = new QVBox(configDialog->tabWidget);
if (ctrl_in_index + MAX_LADPSA_CONTROLS_PER_TAB < ladspa_ctrl_in_count) {
qs.sprintf("%d-%d", ctrl_in_index + 1, ctrl_in_index + MAX_LADPSA_CONTROLS_PER_TAB);
} else {
qs.sprintf("%d-%d", ctrl_in_index + 1, ladspa_ctrl_in_count);
}
configDialog->addTab(ladspaTab, qs);
}
if (LADSPA_IS_HINT_TOGGLED(ladspa_dsc->PortRangeHints[l1].HintDescriptor)) {
configDialog->addCheckBox(0, ladspa_dsc->PortNames[l1], &control_gui[ctrl_in_index], ladspaTab);
control_data[ctrl_in_index] = 0;
if (isPoly) {
for (l2 = 0; l2 < synthdata->poly; l2++) {
ladspa_dsc->connect_port(ladspa_handle[l2], l1, &control_data[ctrl_in_index]);
}
} else {
ladspa_dsc->connect_port(ladspa_handle[0], l1, &control_data[ctrl_in_index]);
}
ctrl_in_index++;
} else {
control_min = 0;
control_max = 1;
if (LADSPA_IS_HINT_BOUNDED_BELOW(ladspa_dsc->PortRangeHints[l1].HintDescriptor)) {
control_min = ladspa_dsc->PortRangeHints[l1].LowerBound;
}
if (LADSPA_IS_HINT_BOUNDED_ABOVE(ladspa_dsc->PortRangeHints[l1].HintDescriptor)) {
control_max = ladspa_dsc->PortRangeHints[l1].UpperBound;
}
if (LADSPA_IS_HINT_SAMPLE_RATE(ladspa_dsc->PortRangeHints[l1].HintDescriptor)) { // TODO implement this
rate_factor = synthdata->rate;
controlPortRate[ctrl_in_index] = true;
} else {
rate_factor = 1.0;
}
control_gui[ctrl_in_index] = control_min * rate_factor;
control_data[ctrl_in_index] = control_min * rate_factor;
control_data_min[ctrl_in_index] = control_min * rate_factor;
control_data_max[ctrl_in_index] = control_max * rate_factor;
if (LADSPA_IS_HINT_DEFAULT_MAXIMUM(ladspa_dsc->PortRangeHints[l1].HintDescriptor)) {
control_gui[ctrl_in_index] = control_max * rate_factor;
control_data[ctrl_in_index] = control_max * rate_factor;
}
if (LADSPA_IS_HINT_LOGARITHMIC(ladspa_dsc->PortRangeHints[l1].HintDescriptor)) {
if (LADSPA_IS_HINT_DEFAULT_LOW(ladspa_dsc->PortRangeHints[l1].HintDescriptor)) {
if (control_min <=0 ) control_min = 1e-4;
if (control_max <=0 ) control_max = 1e-4;
control_gui[ctrl_in_index] = exp(log(control_min) * 0.75 + log(control_max) * 0.25) * rate_factor;
control_data[ctrl_in_index] = exp(log(control_min) * 0.75 + log(control_max) * 0.25) * rate_factor;
}
if (LADSPA_IS_HINT_DEFAULT_MIDDLE(ladspa_dsc->PortRangeHints[l1].HintDescriptor)) {
if (control_min <=0 ) control_min = 1e-4;
if (control_max <=0 ) control_max = 1e-4;
control_gui[ctrl_in_index] = exp(log(control_min) * 0.5 + log(control_max) * 0.5) * rate_factor;
control_data[ctrl_in_index] = exp(log(control_min) * 0.5 + log(control_max) * 0.5) * rate_factor;
}
if (LADSPA_IS_HINT_DEFAULT_HIGH(ladspa_dsc->PortRangeHints[l1].HintDescriptor)) {
if (control_min <=0 ) control_min = 1e-4;
if (control_max <=0 ) control_max = 1e-4;
control_gui[ctrl_in_index] = exp(log(control_min) * 0.25 + log(control_max) * 0.75) * rate_factor;
control_data[ctrl_in_index] = exp(log(control_min) * 0.25 + log(control_max) * 0.75) * rate_factor;
}
} else {
if (LADSPA_IS_HINT_DEFAULT_LOW(ladspa_dsc->PortRangeHints[l1].HintDescriptor)) {
control_gui[ctrl_in_index] = (control_min * 0.75 + control_max * 0.25) * rate_factor;
control_data[ctrl_in_index] = (control_min * 0.75 + control_max * 0.25) * rate_factor;
}
if (LADSPA_IS_HINT_DEFAULT_MIDDLE(ladspa_dsc->PortRangeHints[l1].HintDescriptor)) {
control_gui[ctrl_in_index] = (control_min * 0.5 + control_max * 0.5) * rate_factor;
control_data[ctrl_in_index] = (control_min * 0.5 + control_max * 0.5) * rate_factor;
}
if (LADSPA_IS_HINT_DEFAULT_HIGH(ladspa_dsc->PortRangeHints[l1].HintDescriptor)) {
control_gui[ctrl_in_index] = (control_min * 0.25 + control_max * 0.75) * rate_factor;
control_data[ctrl_in_index] = (control_min * 0.25 + control_max * 0.75) * rate_factor;
}
}
if (LADSPA_IS_HINT_DEFAULT_0(ladspa_dsc->PortRangeHints[l1].HintDescriptor)) {
control_gui[ctrl_in_index] = 0;
control_data[ctrl_in_index] = 0;
}
if (LADSPA_IS_HINT_DEFAULT_1(ladspa_dsc->PortRangeHints[l1].HintDescriptor)) {
control_gui[ctrl_in_index] = rate_factor;
control_data[ctrl_in_index] = rate_factor;
}
if (LADSPA_IS_HINT_DEFAULT_100(ladspa_dsc->PortRangeHints[l1].HintDescriptor)) {
control_gui[ctrl_in_index] = 100.0 * rate_factor;
control_data[ctrl_in_index] = 100.0 * rate_factor;
}
if (LADSPA_IS_HINT_DEFAULT_440(ladspa_dsc->PortRangeHints[l1].HintDescriptor)) {
control_gui[ctrl_in_index] = 440.0 * rate_factor;
control_data[ctrl_in_index] = 440.0 * rate_factor;
}
if (LADSPA_IS_HINT_LOGARITHMIC(ladspa_dsc->PortRangeHints[l1].HintDescriptor)) {
configDialog->addSlider(control_min * rate_factor, control_max * rate_factor, control_min * rate_factor,
ladspa_dsc->PortNames[l1], &control_gui[ctrl_in_index], true, ladspaTab);
} else {
if (LADSPA_IS_HINT_INTEGER(ladspa_dsc->PortRangeHints[l1].HintDescriptor)) {
// fprintf(stderr, "LADSPA_IS_HINT_INTEGER %s\n", ladspa_dsc->PortNames[l1]);
configDialog->addFloatIntSlider(control_min * rate_factor, control_max * rate_factor, control_min * rate_factor,
ladspa_dsc->PortNames[l1], &control_gui[ctrl_in_index], ladspaTab);
} else {
configDialog->addSlider(control_min * rate_factor, control_max * rate_factor, control_min * rate_factor,
ladspa_dsc->PortNames[l1], &control_gui[ctrl_in_index], false, ladspaTab);
}
}
if (isPoly) {
for (l2 = 0; l2 < synthdata->poly; l2++) {
ladspa_dsc->connect_port(ladspa_handle[l2], l1, &control_data[ctrl_in_index]);
}
} else {
ladspa_dsc->connect_port(ladspa_handle[0], l1, &control_data[ctrl_in_index]);
}
ctrl_in_index++;
}
}
}
}
itmp = ((out_port_list.count() + out_ctrl_port_list.count()) > (in_port_list.count() + in_ctrl_port_list.count()))
? (out_port_list.count() + out_ctrl_port_list.count()) : (in_port_list.count() + in_ctrl_port_list.count());
setGeometry(MODULE_NEW_X, MODULE_NEW_Y, MODULE_LADSPA_WIDTH,
MODULE_LADSPA_HEIGHT + 20 * itmp);
pluginName.sprintf("%s", ladspa_dsc->Label);
// fprintf(stderr, "--> isPoly: %d ladspa_dsc->Label: %s moduleID: %d\n", isPoly, ladspa_dsc->Label, moduleID);
if (isPoly) {
qs.sprintf("Poly %s ID %d", ladspa_dsc->Label, moduleID);
} else {
qs.sprintf("%s ID %d", ladspa_dsc->Label, moduleID);
}
// fprintf(stderr, "m_ladspa setCaption %s\n", qs.latin1());
configDialog->setCaption(qs);
}
M_ladspa::~M_ladspa() {
int l1, l2;
if (isPoly) {
for (l1 = 0; l1 < synthdata->poly; l1++) {
for (l2 = 0; l2 < ladspa_audio_in_count; l2++) {
free(ladspaDataIn[l2][l1]);
}
for (l2 = 0; l2 < ladspa_audio_out_count; l2++) {
free(ladspaDataOut[l2][l1]);
}
if (ladspa_dsc->deactivate) {
ladspa_dsc->deactivate(ladspa_handle[l1]);
}
}
for (l1 = 0; l1 < synthdata->poly; l1++) {
ladspa_dsc->cleanup(ladspa_handle[l1]);
}
} else {
for (l2 = 0; l2 < ladspa_audio_in_count; l2++) {
free(ladspaDataIn[l2][0]);
}
for (l2 = 0; l2 < ladspa_audio_out_count; l2++) {
free(ladspaDataOut[l2][0]);
}
if (ladspa_dsc->deactivate) {
ladspa_dsc->deactivate(ladspa_handle[0]);
}
ladspa_dsc->cleanup(ladspa_handle[0]);
}
}
void M_ladspa::paintEvent(QPaintEvent *ev) {
QPainter p(this);
int i;
QString qs;
p.setPen(colorBorder);
for (int i = 0; i < 4; i++) {
p.setPen(colorBorder.light(100 + 15 * i));
p.drawRect(i, i, width() - 2 * i, height() - 2 * i);
}
p.setPen(colorFont);
p.setFont(QFont("Helvetica", 10));
qs.sprintf("LADSPA %s", synthdata->ladspa_dsc_func_list[ladspaDesFuncIndex](n)->Label);
p.drawText(10, 20, qs);
p.setFont(QFont("Helvetica", 8));
qs.sprintf("ID %d", moduleID);
p.drawText(10, 32, qs);
}
void M_ladspa::generateCycle() {
int l1, l2, l3;
float ctrlVal;
if (!cycleReady) {
cycleProcessing = true;
for (l3 = 0; l3 < in_port_list.count(); l3++) inData [l3] = in_port_list.at(l3)->getinputdata();
if (hasExtCtrlPorts)
{
for (l3 = 0; l3 < in_ctrl_port_list.count(); l3++) inData_ctrl [l3] = in_ctrl_port_list.at(l3)->getinputdata();
}
if (isPoly) {
for (l3 = 0; l3 < in_port_list.count(); l3++) {
for (l1 = 0; l1 < synthdata->poly; l1++) {
for (l2 = 0; l2 < synthdata->cyclesize; l2++) {
ladspaDataIn[l3][l1][l2] = inData[l3][l1][l2];
}
}
}
} else {
for (l3 = 0; l3 < in_port_list.count(); l3++) {
for (l2 = 0; l2 < synthdata->cyclesize; l2++) {
ladspaDataIn[l3][0][l2] = inData[l3][0][l2];
}
for (l1 = 1; l1 < synthdata->poly; l1++) {
for (l2 = 0; l2 < synthdata->cyclesize; l2++) {
ladspaDataIn[l3][0][l2] += inData[l3][l1][l2];
}
}
}
}
if (hasExtCtrlPorts) {
for (l3 = 0; l3 < in_ctrl_port_list.count(); l3++) {
if (controlPortRate[l3]) {
ctrlVal = synthdata->rate * inData_ctrl[l3][0][0] + control_gui[l3];
} else {
ctrlVal = inData_ctrl[l3][0][0] + control_gui[l3];
}
if (ctrlVal < control_data_min[l3]) ctrlVal = control_data_min[l3];
if (ctrlVal > control_data_max[l3]) ctrlVal = control_data_max[l3];
control_data[l3] = ctrlVal;
}
for (l1 = 0; l1 < synthdata->poly; l1++) {
for (l3 = 0; l3 < out_ctrl_port_list.count(); l3++) {
for (l2 = 0; l2 < synthdata->cyclesize; l2++) {
data[ctrl_index[l3]][l1][l2] = control_out[l3];
}
}
}
} else {
for (l3 = 0; l3 < ladspa_ctrl_in_count; l3++) {
control_data[l3] = control_gui[l3];
}
}
if (isPoly) {
for (l1 = 0; l1 < synthdata->poly; l1++) {
ladspa_dsc->run(ladspa_handle[l1], synthdata->cyclesize);
for (l3 = 0; l3 < out_port_list.count(); l3++) {
for (l2 = 0; l2 < synthdata->cyclesize; l2++) {
data[audio_index[l3]][l1][l2] = ladspaDataOut[l3][l1][l2];
}
}
}
} else {
ladspa_dsc->run(ladspa_handle[0], synthdata->cyclesize);
for (l3 = 0; l3 < out_port_list.count(); l3++) {
for (l1 = 0; l1 < synthdata->poly; l1++) {
for (l2 = 0; l2 < synthdata->cyclesize; l2++) {
data[audio_index[l3]][l1][l2] = ladspaDataOut[l3][0][l2];
}
}
}
}
}
cycleProcessing = false;
cycleReady = true;
}
void M_ladspa::showConfigDialog() {
}
|