@@ -325,8 +325,8 @@ public: | |||
// Delete old data | |||
deleteBuffers(); | |||
uint32_t ains, aouts, mins, params, j; | |||
ains = aouts = mins = params = 0; | |||
uint32_t aIns, aOuts, mIns, params, j; | |||
aIns = aOuts = mIns = params = 0; | |||
const double sampleRate = x_engine->getSampleRate(); | |||
const unsigned long PortCount = ldescriptor->PortCount; | |||
@@ -337,30 +337,30 @@ public: | |||
if (LADSPA_IS_PORT_AUDIO(PortType)) | |||
{ | |||
if (LADSPA_IS_PORT_INPUT(PortType)) | |||
ains += 1; | |||
aIns += 1; | |||
else if (LADSPA_IS_PORT_OUTPUT(PortType)) | |||
aouts += 1; | |||
aOuts += 1; | |||
} | |||
else if (LADSPA_IS_PORT_CONTROL(PortType)) | |||
params += 1; | |||
} | |||
if (carlaOptions.forceStereo && (ains == 1 || aouts == 1) && ! h2) | |||
if (carlaOptions.forceStereo && (aIns == 1 || aOuts == 1) && ! h2) | |||
h2 = ldescriptor->instantiate(ldescriptor, sampleRate); | |||
if (descriptor->run_synth || descriptor->run_multiple_synths) | |||
mins = 1; | |||
mIns = 1; | |||
if (ains > 0) | |||
if (aIns > 0) | |||
{ | |||
ain.ports = new CarlaEngineAudioPort*[ains]; | |||
ain.rindexes = new uint32_t[ains]; | |||
aIn.ports = new CarlaEngineAudioPort*[aIns]; | |||
aIn.rindexes = new uint32_t[aIns]; | |||
} | |||
if (aouts > 0) | |||
if (aOuts > 0) | |||
{ | |||
aout.ports = new CarlaEngineAudioPort*[aouts]; | |||
aout.rindexes = new uint32_t[aouts]; | |||
aOut.ports = new CarlaEngineAudioPort*[aOuts]; | |||
aOut.rindexes = new uint32_t[aOuts]; | |||
} | |||
if (params > 0) | |||
@@ -395,15 +395,15 @@ public: | |||
if (LADSPA_IS_PORT_INPUT(PortType)) | |||
{ | |||
j = ain.count++; | |||
ain.ports[j] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, true); | |||
ain.rindexes[j] = i; | |||
j = aIn.count++; | |||
aIn.ports[j] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, true); | |||
aIn.rindexes[j] = i; | |||
} | |||
else if (LADSPA_IS_PORT_OUTPUT(PortType)) | |||
{ | |||
j = aout.count++; | |||
aout.ports[j] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, false); | |||
aout.rindexes[j] = i; | |||
j = aOut.count++; | |||
aOut.ports[j] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, false); | |||
aOut.rindexes[j] = i; | |||
needsCin = true; | |||
} | |||
else | |||
@@ -639,7 +639,7 @@ public: | |||
param.portCout = (CarlaEngineControlPort*)x_client->addPort(CarlaEnginePortTypeControl, portName, false); | |||
} | |||
if (mins > 0) | |||
if (mIns > 0) | |||
{ | |||
#ifndef BUILD_BRIDGE | |||
if (carlaOptions.processMode != PROCESS_MODE_MULTIPLE_CLIENTS) | |||
@@ -654,14 +654,14 @@ public: | |||
midi.portMin = (CarlaEngineMidiPort*)x_client->addPort(CarlaEnginePortTypeMIDI, portName, true); | |||
} | |||
ain.count = ains; | |||
aout.count = aouts; | |||
aIn.count = aIns; | |||
aOut.count = aOuts; | |||
param.count = params; | |||
// plugin checks | |||
m_hints &= ~(PLUGIN_IS_SYNTH | PLUGIN_USES_CHUNKS | PLUGIN_CAN_DRYWET | PLUGIN_CAN_VOLUME | PLUGIN_CAN_BALANCE); | |||
if (midi.portMin && aout.count > 0) | |||
if (midi.portMin && aOut.count > 0) | |||
m_hints |= PLUGIN_IS_SYNTH; | |||
#ifndef BUILD_BRIDGE | |||
@@ -672,13 +672,13 @@ public: | |||
} | |||
#endif | |||
if (aouts > 0 && (ains == aouts || ains == 1)) | |||
if (aOuts > 0 && (aIns == aOuts || aIns == 1)) | |||
m_hints |= PLUGIN_CAN_DRYWET; | |||
if (aouts > 0) | |||
if (aOuts > 0) | |||
m_hints |= PLUGIN_CAN_VOLUME; | |||
if ((aouts >= 2 && aouts%2 == 0) || h2) | |||
if ((aOuts >= 2 && aOuts%2 == 0) || h2) | |||
m_hints |= PLUGIN_CAN_BALANCE; | |||
reloadPrograms(true); | |||
@@ -794,9 +794,9 @@ public: | |||
// -------------------------------------------------------------------------------------------------------- | |||
// Input VU | |||
if (ain.count > 0) | |||
if (aIn.count > 0) | |||
{ | |||
uint32_t count = h2 ? 2 : ain.count; | |||
uint32_t count = h2 ? 2 : aIn.count; | |||
if (count == 1) | |||
{ | |||
@@ -858,7 +858,7 @@ public: | |||
double value; | |||
// Control backend stuff | |||
if (cinEvent->channel == cin_channel) | |||
if (cinEvent->channel == m_ctrlInChannel) | |||
{ | |||
if (MIDI_IS_CONTROL_BREATH_CONTROLLER(cinEvent->controller) && (m_hints & PLUGIN_CAN_DRYWET) > 0) | |||
{ | |||
@@ -938,12 +938,12 @@ public: | |||
} | |||
case CarlaEngineEventMidiBankChange: | |||
if (cinEvent->channel == cin_channel) | |||
if (cinEvent->channel == m_ctrlInChannel) | |||
nextBankId = rint(cinEvent->value); | |||
break; | |||
case CarlaEngineEventMidiProgramChange: | |||
if (cinEvent->channel == cin_channel) | |||
if (cinEvent->channel == m_ctrlInChannel) | |||
{ | |||
uint32_t nextProgramId = rint(cinEvent->value); | |||
@@ -960,7 +960,7 @@ public: | |||
break; | |||
case CarlaEngineEventAllSoundOff: | |||
if (cinEvent->channel == cin_channel) | |||
if (cinEvent->channel == m_ctrlInChannel) | |||
{ | |||
if (midi.portMin && ! allNotesOffSent) | |||
sendMidiAllNotesOff(); | |||
@@ -982,7 +982,7 @@ public: | |||
break; | |||
case CarlaEngineEventAllNotesOff: | |||
if (cinEvent->channel == cin_channel) | |||
if (cinEvent->channel == m_ctrlInChannel) | |||
{ | |||
if (midi.portMin && ! allNotesOffSent) | |||
sendMidiAllNotesOff(); | |||
@@ -999,7 +999,7 @@ public: | |||
// -------------------------------------------------------------------------------------------------------- | |||
// MIDI Input (External) | |||
if (midi.portMin && cin_channel >= 0 && cin_channel < 16 && m_active && m_activeBefore) | |||
if (midi.portMin && m_ctrlInChannel >= 0 && m_ctrlInChannel < 16 && m_active && m_activeBefore) | |||
{ | |||
engineMidiLock(); | |||
@@ -1012,7 +1012,7 @@ public: | |||
memset(midiEvent, 0, sizeof(snd_seq_event_t)); | |||
midiEvent->type = extMidiNotes[i].velo ? SND_SEQ_EVENT_NOTEON : SND_SEQ_EVENT_NOTEOFF; | |||
midiEvent->data.note.channel = cin_channel; | |||
midiEvent->data.note.channel = m_ctrlInChannel; | |||
midiEvent->data.note.note = extMidiNotes[i].note; | |||
midiEvent->data.note.velocity = extMidiNotes[i].velo; | |||
@@ -1066,7 +1066,7 @@ public: | |||
midiEvent->data.note.channel = channel; | |||
midiEvent->data.note.note = note; | |||
if (channel == cin_channel) | |||
if (channel == m_ctrlInChannel) | |||
postponeEvent(PluginPostEventNoteOff, channel, note, 0.0); | |||
} | |||
else if (MIDI_IS_STATUS_NOTE_ON(status)) | |||
@@ -1079,7 +1079,7 @@ public: | |||
midiEvent->data.note.note = note; | |||
midiEvent->data.note.velocity = velo; | |||
if (channel == cin_channel) | |||
if (channel == m_ctrlInChannel) | |||
postponeEvent(PluginPostEventNoteOn, channel, note, velo); | |||
} | |||
else if (MIDI_IS_STATUS_POLYPHONIC_AFTERTOUCH(status)) | |||
@@ -1140,16 +1140,16 @@ public: | |||
{ | |||
if (! m_activeBefore) | |||
{ | |||
if (midi.portMin && cin_channel >= 0 && cin_channel < 16) | |||
if (midi.portMin && m_ctrlInChannel >= 0 && m_ctrlInChannel < 16) | |||
{ | |||
memset(&midiEvents[0], 0, sizeof(snd_seq_event_t)); | |||
midiEvents[0].type = SND_SEQ_EVENT_CONTROLLER; | |||
midiEvents[0].data.control.channel = cin_channel; | |||
midiEvents[0].data.control.channel = m_ctrlInChannel; | |||
midiEvents[0].data.control.param = MIDI_CONTROL_ALL_SOUND_OFF; | |||
memset(&midiEvents[1], 0, sizeof(snd_seq_event_t)); | |||
midiEvents[1].type = SND_SEQ_EVENT_CONTROLLER; | |||
midiEvents[1].data.control.channel = cin_channel; | |||
midiEvents[1].data.control.channel = m_ctrlInChannel; | |||
midiEvents[1].data.control.param = MIDI_CONTROL_ALL_NOTES_OFF; | |||
midiEventCount = 2; | |||
@@ -1162,16 +1162,16 @@ public: | |||
} | |||
} | |||
for (i=0; i < ain.count; i++) | |||
for (i=0; i < aIn.count; i++) | |||
{ | |||
ldescriptor->connect_port(handle, ain.rindexes[i], inBuffer[i]); | |||
if (h2 && i == 0) ldescriptor->connect_port(h2, ain.rindexes[i], inBuffer[1]); | |||
ldescriptor->connect_port(handle, aIn.rindexes[i], inBuffer[i]); | |||
if (h2 && i == 0) ldescriptor->connect_port(h2, aIn.rindexes[i], inBuffer[1]); | |||
} | |||
for (i=0; i < aout.count; i++) | |||
for (i=0; i < aOut.count; i++) | |||
{ | |||
ldescriptor->connect_port(handle, aout.rindexes[i], outBuffer[i]); | |||
if (h2 && i == 0) ldescriptor->connect_port(h2, aout.rindexes[i], outBuffer[1]); | |||
ldescriptor->connect_port(handle, aOut.rindexes[i], outBuffer[i]); | |||
if (h2 && i == 0) ldescriptor->connect_port(h2, aOut.rindexes[i], outBuffer[1]); | |||
} | |||
if (descriptor->run_synth) | |||
@@ -1211,14 +1211,14 @@ public: | |||
if (m_active) | |||
{ | |||
bool do_drywet = (m_hints & PLUGIN_CAN_DRYWET) > 0 && x_drywet != 1.0; | |||
bool do_volume = (m_hints & PLUGIN_CAN_VOLUME) > 0 && x_vol != 1.0; | |||
bool do_balance = (m_hints & PLUGIN_CAN_BALANCE) > 0 && (x_bal_left != -1.0 || x_bal_right != 1.0); | |||
bool do_drywet = (m_hints & PLUGIN_CAN_DRYWET) > 0 && x_dryWet != 1.0; | |||
bool do_volume = (m_hints & PLUGIN_CAN_VOLUME) > 0 && x_volume != 1.0; | |||
bool do_balance = (m_hints & PLUGIN_CAN_BALANCE) > 0 && (x_balanceLeft != -1.0 || x_balanceRight != 1.0); | |||
double bal_rangeL, bal_rangeR; | |||
float oldBufLeft[do_balance ? frames : 0]; | |||
uint32_t count = h2 ? 2 : aout.count; | |||
uint32_t count = h2 ? 2 : aOut.count; | |||
for (i=0; i < count; i++) | |||
{ | |||
@@ -1227,10 +1227,10 @@ public: | |||
{ | |||
for (k=0; k < frames; k++) | |||
{ | |||
if (aout.count == 1 && ! h2) | |||
outBuffer[i][k] = (outBuffer[i][k]*x_drywet)+(inBuffer[0][k]*(1.0-x_drywet)); | |||
if (aOut.count == 1 && ! h2) | |||
outBuffer[i][k] = (outBuffer[i][k]*x_dryWet)+(inBuffer[0][k]*(1.0-x_dryWet)); | |||
else | |||
outBuffer[i][k] = (outBuffer[i][k]*x_drywet)+(inBuffer[i][k]*(1.0-x_drywet)); | |||
outBuffer[i][k] = (outBuffer[i][k]*x_dryWet)+(inBuffer[i][k]*(1.0-x_dryWet)); | |||
} | |||
} | |||
@@ -1240,8 +1240,8 @@ public: | |||
if (i%2 == 0) | |||
memcpy(&oldBufLeft, outBuffer[i], sizeof(float)*frames); | |||
bal_rangeL = (x_bal_left+1.0)/2; | |||
bal_rangeR = (x_bal_right+1.0)/2; | |||
bal_rangeL = (x_balanceLeft+1.0)/2; | |||
bal_rangeR = (x_balanceRight+1.0)/2; | |||
for (k=0; k < frames; k++) | |||
{ | |||
@@ -1264,7 +1264,7 @@ public: | |||
if (do_volume) | |||
{ | |||
for (k=0; k < frames; k++) | |||
outBuffer[i][k] *= x_vol; | |||
outBuffer[i][k] *= x_volume; | |||
} | |||
// Output VU | |||
@@ -1278,7 +1278,7 @@ public: | |||
else | |||
{ | |||
// disable any output sound if not active | |||
for (i=0; i < aout.count; i++) | |||
for (i=0; i < aOut.count; i++) | |||
memset(outBuffer[i], 0.0f, sizeof(float)*frames); | |||
aouts_peak_tmp[0] = 0.0; | |||
@@ -359,7 +359,7 @@ public: | |||
{ | |||
Q_ASSERT(index < (int32_t)midiprog.count); | |||
if (cin_channel < 0 || cin_channel > 15) | |||
if (m_ctrlInChannel < 0 || m_ctrlInChannel > 15) | |||
return; | |||
if (index >= 0) | |||
@@ -367,12 +367,12 @@ public: | |||
if (x_engine->isOffline()) | |||
{ | |||
const CarlaEngine::ScopedLocker m(x_engine, block); | |||
fluid_synth_program_select(f_synth, cin_channel, f_id, midiprog.data[index].bank, midiprog.data[index].program); | |||
fluid_synth_program_select(f_synth, m_ctrlInChannel, f_id, midiprog.data[index].bank, midiprog.data[index].program); | |||
} | |||
else | |||
{ | |||
const ScopedDisabler m(this, block); | |||
fluid_synth_program_select(f_synth, cin_channel, f_id, midiprog.data[index].bank, midiprog.data[index].program); | |||
fluid_synth_program_select(f_synth, m_ctrlInChannel, f_id, midiprog.data[index].bank, midiprog.data[index].program); | |||
} | |||
} | |||
@@ -398,12 +398,12 @@ public: | |||
// Delete old data | |||
deleteBuffers(); | |||
uint32_t aouts, params, j; | |||
aouts = 2; | |||
uint32_t aOuts, params, j; | |||
aOuts = 2; | |||
params = FluidSynthParametersMax; | |||
aout.ports = new CarlaEngineAudioPort*[aouts]; | |||
aout.rindexes = new uint32_t[aouts]; | |||
aOut.ports = new CarlaEngineAudioPort*[aOuts]; | |||
aOut.rindexes = new uint32_t[aOuts]; | |||
param.data = new ParameterData[params]; | |||
param.ranges = new ParameterRanges[params]; | |||
@@ -424,8 +424,8 @@ public: | |||
#endif | |||
strcpy(portName, "out-left"); | |||
aout.ports[0] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, false); | |||
aout.rindexes[0] = 0; | |||
aOut.ports[0] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, false); | |||
aOut.rindexes[0] = 0; | |||
#ifndef BUILD_BRIDGE | |||
if (carlaOptions.processMode != PROCESS_MODE_MULTIPLE_CLIENTS) | |||
@@ -437,8 +437,8 @@ public: | |||
#endif | |||
strcpy(portName, "out-right"); | |||
aout.ports[1] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, false); | |||
aout.rindexes[1] = 1; | |||
aOut.ports[1] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, false); | |||
aOut.rindexes[1] = 1; | |||
// --------------------------------------- | |||
// MIDI Input | |||
@@ -708,7 +708,7 @@ public: | |||
// --------------------------------------- | |||
aout.count = aouts; | |||
aOut.count = aOuts; | |||
param.count = params; | |||
// plugin checks | |||
@@ -827,8 +827,8 @@ public: | |||
unsigned char nextBankIds[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0 }; | |||
if (midiprog.current >= 0 && midiprog.count > 0 && cin_channel >= 0 && cin_channel < 16) | |||
nextBankIds[cin_channel] = midiprog.data[midiprog.current].bank; | |||
if (midiprog.current >= 0 && midiprog.count > 0 && m_ctrlInChannel >= 0 && m_ctrlInChannel < 16) | |||
nextBankIds[m_ctrlInChannel] = midiprog.data[midiprog.current].bank; | |||
for (i=0; i < nEvents; i++) | |||
{ | |||
@@ -853,7 +853,7 @@ public: | |||
double value; | |||
// Control backend stuff | |||
if (cinEvent->channel == cin_channel) | |||
if (cinEvent->channel == m_ctrlInChannel) | |||
{ | |||
if (MIDI_IS_CONTROL_BREATH_CONTROLLER(cinEvent->controller) && (m_hints & PLUGIN_CAN_DRYWET) > 0) | |||
{ | |||
@@ -947,7 +947,7 @@ public: | |||
{ | |||
if (midiprog.data[k].bank == bankId && midiprog.data[k].program == progId) | |||
{ | |||
if (cinEvent->channel == cin_channel) | |||
if (cinEvent->channel == m_ctrlInChannel) | |||
{ | |||
setMidiProgram(k, false, false, false, false); | |||
postponeEvent(PluginPostEventMidiProgramChange, k, 0, 0.0); | |||
@@ -962,7 +962,7 @@ public: | |||
break; | |||
case CarlaEngineEventAllSoundOff: | |||
if (cinEvent->channel == cin_channel) | |||
if (cinEvent->channel == m_ctrlInChannel) | |||
{ | |||
if (! allNotesOffSent) | |||
sendMidiAllNotesOff(); | |||
@@ -970,8 +970,8 @@ public: | |||
allNotesOffSent = true; | |||
#ifdef FLUIDSYNTH_VERSION_NEW_API | |||
fluid_synth_all_notes_off(f_synth, cin_channel); | |||
fluid_synth_all_sounds_off(f_synth, cin_channel); | |||
fluid_synth_all_notes_off(f_synth, m_ctrlInChannel); | |||
fluid_synth_all_sounds_off(f_synth, m_ctrlInChannel); | |||
} | |||
else if (cinEvent->channel < 16) | |||
{ | |||
@@ -982,7 +982,7 @@ public: | |||
break; | |||
case CarlaEngineEventAllNotesOff: | |||
if (cinEvent->channel == cin_channel) | |||
if (cinEvent->channel == m_ctrlInChannel) | |||
{ | |||
if (! allNotesOffSent) | |||
sendMidiAllNotesOff(); | |||
@@ -990,7 +990,7 @@ public: | |||
allNotesOffSent = true; | |||
#ifdef FLUIDSYNTH_VERSION_NEW_API | |||
fluid_synth_all_notes_off(f_synth, cin_channel); | |||
fluid_synth_all_notes_off(f_synth, m_ctrlInChannel); | |||
} | |||
else if (cinEvent->channel < 16) | |||
{ | |||
@@ -1007,7 +1007,7 @@ public: | |||
// -------------------------------------------------------------------------------------------------------- | |||
// MIDI Input (External) | |||
if (cin_channel >= 0 && cin_channel < 16 && m_active && m_activeBefore) | |||
if (m_ctrlInChannel >= 0 && m_ctrlInChannel < 16 && m_active && m_activeBefore) | |||
{ | |||
engineMidiLock(); | |||
@@ -1017,9 +1017,9 @@ public: | |||
break; | |||
if (extMidiNotes[i].velo) | |||
fluid_synth_noteon(f_synth, cin_channel, extMidiNotes[i].note, extMidiNotes[i].velo); | |||
fluid_synth_noteon(f_synth, m_ctrlInChannel, extMidiNotes[i].note, extMidiNotes[i].velo); | |||
else | |||
fluid_synth_noteoff(f_synth, cin_channel, extMidiNotes[i].note); | |||
fluid_synth_noteoff(f_synth, m_ctrlInChannel, extMidiNotes[i].note); | |||
extMidiNotes[i].channel = -1; | |||
midiEventCount += 1; | |||
@@ -1064,7 +1064,7 @@ public: | |||
fluid_synth_noteoff(f_synth, channel, note); | |||
if (channel == cin_channel) | |||
if (channel == m_ctrlInChannel) | |||
postponeEvent(PluginPostEventNoteOff, channel, note, 0.0); | |||
} | |||
else if (MIDI_IS_STATUS_NOTE_ON(status)) | |||
@@ -1074,7 +1074,7 @@ public: | |||
fluid_synth_noteon(f_synth, channel, note, velo); | |||
if (channel == cin_channel) | |||
if (channel == m_ctrlInChannel) | |||
postponeEvent(PluginPostEventNoteOn, channel, note, velo); | |||
} | |||
else if (MIDI_IS_STATUS_AFTERTOUCH(status)) | |||
@@ -1106,10 +1106,10 @@ public: | |||
{ | |||
if (! m_activeBefore) | |||
{ | |||
if (cin_channel >= 0 && cin_channel < 16) | |||
if (m_ctrlInChannel >= 0 && m_ctrlInChannel < 16) | |||
{ | |||
fluid_synth_cc(f_synth, cin_channel, MIDI_CONTROL_ALL_SOUND_OFF, 0); | |||
fluid_synth_cc(f_synth, cin_channel, MIDI_CONTROL_ALL_NOTES_OFF, 0); | |||
fluid_synth_cc(f_synth, m_ctrlInChannel, MIDI_CONTROL_ALL_SOUND_OFF, 0); | |||
fluid_synth_cc(f_synth, m_ctrlInChannel, MIDI_CONTROL_ALL_NOTES_OFF, 0); | |||
} | |||
#ifdef FLUIDSYNTH_VERSION_NEW_API | |||
@@ -1131,12 +1131,12 @@ public: | |||
if (m_active) | |||
{ | |||
bool do_balance = (x_bal_left != -1.0 || x_bal_right != 1.0); | |||
bool do_balance = (x_balanceLeft != -1.0 || x_balanceRight != 1.0); | |||
double bal_rangeL, bal_rangeR; | |||
float oldBufLeft[do_balance ? frames : 0]; | |||
for (i=0; i < aout.count; i++) | |||
for (i=0; i < aOut.count; i++) | |||
{ | |||
// Balance | |||
if (do_balance) | |||
@@ -1144,8 +1144,8 @@ public: | |||
if (i%2 == 0) | |||
memcpy(&oldBufLeft, outBuffer[i], sizeof(float)*frames); | |||
bal_rangeL = (x_bal_left+1.0)/2; | |||
bal_rangeR = (x_bal_right+1.0)/2; | |||
bal_rangeL = (x_balanceLeft+1.0)/2; | |||
bal_rangeR = (x_balanceRight+1.0)/2; | |||
for (k=0; k < frames; k++) | |||
{ | |||
@@ -1165,7 +1165,7 @@ public: | |||
} | |||
// Volume, using fluidsynth internals | |||
fluid_synth_set_gain(f_synth, x_vol); | |||
fluid_synth_set_gain(f_synth, x_volume); | |||
// Output VU | |||
for (k=0; i < 2 && k < frames; k++) | |||
@@ -1178,7 +1178,7 @@ public: | |||
else | |||
{ | |||
// disable any output sound if not active | |||
for (i=0; i < aout.count; i++) | |||
for (i=0; i < aOut.count; i++) | |||
memset(outBuffer[i], 0.0f, sizeof(float)*frames); | |||
aouts_peak_tmp[0] = 0.0; | |||
@@ -35,14 +35,15 @@ CARLA_BACKEND_START_NAMESPACE | |||
class LadspaPlugin : public CarlaPlugin | |||
{ | |||
public: | |||
LadspaPlugin(CarlaEngine* const engine, unsigned short id) : CarlaPlugin(engine, id) | |||
LadspaPlugin(CarlaEngine* const engine, const unsigned short id) | |||
: CarlaPlugin(engine, id) | |||
{ | |||
qDebug("LadspaPlugin::LadspaPlugin()"); | |||
m_type = PLUGIN_LADSPA; | |||
handle = h2 = nullptr; | |||
descriptor = nullptr; | |||
descriptor = nullptr; | |||
rdf_descriptor = nullptr; | |||
param_buffers = nullptr; | |||
@@ -82,34 +83,34 @@ public: | |||
{ | |||
if (rdf_descriptor) | |||
{ | |||
LADSPA_Properties Category = rdf_descriptor->Type; | |||
const LADSPA_Properties category = rdf_descriptor->Type; | |||
// Specific Types | |||
if (Category & (LADSPA_CLASS_DELAY|LADSPA_CLASS_REVERB)) | |||
if (category & (LADSPA_CLASS_DELAY|LADSPA_CLASS_REVERB)) | |||
return PLUGIN_CATEGORY_DELAY; | |||
if (Category & (LADSPA_CLASS_PHASER|LADSPA_CLASS_FLANGER|LADSPA_CLASS_CHORUS)) | |||
if (category & (LADSPA_CLASS_PHASER|LADSPA_CLASS_FLANGER|LADSPA_CLASS_CHORUS)) | |||
return PLUGIN_CATEGORY_MODULATOR; | |||
if (Category & (LADSPA_CLASS_AMPLIFIER)) | |||
if (category & (LADSPA_CLASS_AMPLIFIER)) | |||
return PLUGIN_CATEGORY_DYNAMICS; | |||
if (Category & (LADSPA_CLASS_UTILITY|LADSPA_CLASS_SPECTRAL|LADSPA_CLASS_FREQUENCY_METER)) | |||
if (category & (LADSPA_CLASS_UTILITY|LADSPA_CLASS_SPECTRAL|LADSPA_CLASS_FREQUENCY_METER)) | |||
return PLUGIN_CATEGORY_UTILITY; | |||
// Pre-set LADSPA Types | |||
if (LADSPA_IS_PLUGIN_DYNAMICS(Category)) | |||
if (LADSPA_IS_PLUGIN_DYNAMICS(category)) | |||
return PLUGIN_CATEGORY_DYNAMICS; | |||
if (LADSPA_IS_PLUGIN_AMPLITUDE(Category)) | |||
if (LADSPA_IS_PLUGIN_AMPLITUDE(category)) | |||
return PLUGIN_CATEGORY_MODULATOR; | |||
if (LADSPA_IS_PLUGIN_EQ(Category)) | |||
if (LADSPA_IS_PLUGIN_EQ(category)) | |||
return PLUGIN_CATEGORY_EQ; | |||
if (LADSPA_IS_PLUGIN_FILTER(Category)) | |||
if (LADSPA_IS_PLUGIN_FILTER(category)) | |||
return PLUGIN_CATEGORY_FILTER; | |||
if (LADSPA_IS_PLUGIN_FREQUENCY(Category)) | |||
if (LADSPA_IS_PLUGIN_FREQUENCY(category)) | |||
return PLUGIN_CATEGORY_UTILITY; | |||
if (LADSPA_IS_PLUGIN_SIMULATOR(Category)) | |||
if (LADSPA_IS_PLUGIN_SIMULATOR(category)) | |||
return PLUGIN_CATEGORY_OTHER; | |||
if (LADSPA_IS_PLUGIN_TIME(Category)) | |||
if (LADSPA_IS_PLUGIN_TIME(category)) | |||
return PLUGIN_CATEGORY_DELAY; | |||
if (LADSPA_IS_PLUGIN_GENERATOR(Category)) | |||
if (LADSPA_IS_PLUGIN_GENERATOR(category)) | |||
return PLUGIN_CATEGORY_SYNTH; | |||
} | |||
@@ -118,19 +119,27 @@ public: | |||
long uniqueId() | |||
{ | |||
Q_ASSERT(descriptor); | |||
return descriptor->UniqueID; | |||
} | |||
// ------------------------------------------------------------------- | |||
// Information (count) | |||
uint32_t parameterScalePointCount(uint32_t parameterId) | |||
uint32_t parameterScalePointCount(const uint32_t parameterId) | |||
{ | |||
Q_ASSERT(parameterId < param.count); | |||
int32_t rindex = param.data[parameterId].rindex; | |||
if (rdf_descriptor && rindex < (int32_t)rdf_descriptor->PortCount) | |||
return rdf_descriptor->Ports[rindex].ScalePointCount; | |||
{ | |||
const LADSPA_RDF_Port* const port = &rdf_descriptor->Ports[rindex]; | |||
if (port) | |||
return port->ScalePointCount; | |||
} | |||
return 0; | |||
} | |||
@@ -138,24 +147,31 @@ public: | |||
// ------------------------------------------------------------------- | |||
// Information (per-plugin data) | |||
double getParameterValue(uint32_t parameterId) | |||
double getParameterValue(const uint32_t parameterId) | |||
{ | |||
Q_ASSERT(parameterId < param.count); | |||
return param_buffers[parameterId]; | |||
} | |||
double getParameterScalePointValue(uint32_t parameterId, uint32_t scalePointId) | |||
double getParameterScalePointValue(const uint32_t parameterId, const uint32_t scalePointId) | |||
{ | |||
Q_ASSERT(parameterId < param.count); | |||
Q_ASSERT(scalePointId < parameterScalePointCount(parameterId)); | |||
int32_t rindex = param.data[parameterId].rindex; | |||
if (rdf_descriptor && rindex < (int32_t)rdf_descriptor->PortCount) | |||
{ | |||
const LADSPA_RDF_ScalePoint* const scalePoint = &rdf_descriptor->Ports[rindex].ScalePoints[scalePointId]; | |||
const LADSPA_RDF_Port* const port = &rdf_descriptor->Ports[rindex]; | |||
if (port && scalePointId < port->ScalePointCount) | |||
{ | |||
const LADSPA_RDF_ScalePoint* const scalePoint = &port->ScalePoints[scalePointId]; | |||
if (scalePoint) | |||
return rdf_descriptor->Ports[rindex].ScalePoints[scalePointId].Value; | |||
if (scalePoint) | |||
return scalePoint->Value; | |||
} | |||
} | |||
return 0.0; | |||
@@ -163,7 +179,9 @@ public: | |||
void getLabel(char* const strBuf) | |||
{ | |||
if (descriptor->Label) | |||
Q_ASSERT(descriptor); | |||
if (descriptor && descriptor->Label) | |||
strncpy(strBuf, descriptor->Label, STR_MAX); | |||
else | |||
CarlaPlugin::getLabel(strBuf); | |||
@@ -171,9 +189,11 @@ public: | |||
void getMaker(char* const strBuf) | |||
{ | |||
Q_ASSERT(descriptor); | |||
if (rdf_descriptor && rdf_descriptor->Creator) | |||
strncpy(strBuf, rdf_descriptor->Creator, STR_MAX); | |||
else if (descriptor->Maker) | |||
else if (descriptor && descriptor->Maker) | |||
strncpy(strBuf, descriptor->Maker, STR_MAX); | |||
else | |||
CarlaPlugin::getMaker(strBuf); | |||
@@ -181,7 +201,9 @@ public: | |||
void getCopyright(char* const strBuf) | |||
{ | |||
if (descriptor->Copyright) | |||
Q_ASSERT(descriptor); | |||
if (descriptor && descriptor->Copyright) | |||
strncpy(strBuf, descriptor->Copyright, STR_MAX); | |||
else | |||
CarlaPlugin::getCopyright(strBuf); | |||
@@ -189,53 +211,62 @@ public: | |||
void getRealName(char* const strBuf) | |||
{ | |||
Q_ASSERT(descriptor); | |||
if (rdf_descriptor && rdf_descriptor->Title) | |||
strncpy(strBuf, rdf_descriptor->Title, STR_MAX); | |||
else if (descriptor->Name) | |||
else if (descriptor && descriptor->Name) | |||
strncpy(strBuf, descriptor->Name, STR_MAX); | |||
else | |||
CarlaPlugin::getRealName(strBuf); | |||
} | |||
void getParameterName(uint32_t parameterId, char* const strBuf) | |||
void getParameterName(const uint32_t parameterId, char* const strBuf) | |||
{ | |||
Q_ASSERT(descriptor); | |||
Q_ASSERT(parameterId < param.count); | |||
int32_t rindex = param.data[parameterId].rindex; | |||
strncpy(strBuf, descriptor->PortNames[rindex], STR_MAX); | |||
if (descriptor && rindex < (int32_t)descriptor->PortCount) | |||
strncpy(strBuf, descriptor->PortNames[rindex], STR_MAX); | |||
else | |||
CarlaPlugin::getParameterName(parameterId, strBuf); | |||
} | |||
void getParameterSymbol(uint32_t parameterId, char* const strBuf) | |||
void getParameterSymbol(const uint32_t parameterId, char* const strBuf) | |||
{ | |||
Q_ASSERT(parameterId < param.count); | |||
int32_t rindex = param.data[parameterId].rindex; | |||
if (rdf_descriptor && rindex < (int32_t)rdf_descriptor->PortCount) | |||
{ | |||
const LADSPA_RDF_Port* const Port = &rdf_descriptor->Ports[rindex]; | |||
const LADSPA_RDF_Port* const port = &rdf_descriptor->Ports[rindex]; | |||
if (LADSPA_PORT_HAS_LABEL(Port->Hints) && Port->Label) | |||
if (LADSPA_PORT_HAS_LABEL(port->Hints) && port->Label) | |||
{ | |||
strncpy(strBuf, Port->Label, STR_MAX); | |||
strncpy(strBuf, port->Label, STR_MAX); | |||
return; | |||
} | |||
} | |||
*strBuf = 0; | |||
CarlaPlugin::getParameterSymbol(parameterId, strBuf); | |||
} | |||
void getParameterUnit(uint32_t parameterId, char* const strBuf) | |||
void getParameterUnit(const uint32_t parameterId, char* const strBuf) | |||
{ | |||
Q_ASSERT(parameterId < param.count); | |||
int32_t rindex = param.data[parameterId].rindex; | |||
if (rdf_descriptor && rindex < (int32_t)rdf_descriptor->PortCount) | |||
{ | |||
const LADSPA_RDF_Port* const Port = &rdf_descriptor->Ports[rindex]; | |||
const LADSPA_RDF_Port* const port = &rdf_descriptor->Ports[rindex]; | |||
if (LADSPA_PORT_HAS_UNIT(Port->Hints)) | |||
if (LADSPA_PORT_HAS_UNIT(port->Hints)) | |||
{ | |||
switch (Port->Unit) | |||
switch (port->Unit) | |||
{ | |||
case LADSPA_UNIT_DB: | |||
strncpy(strBuf, "dB", STR_MAX); | |||
@@ -259,36 +290,41 @@ public: | |||
} | |||
} | |||
*strBuf = 0; | |||
CarlaPlugin::getParameterUnit(parameterId, strBuf); | |||
} | |||
void getParameterScalePointLabel(uint32_t parameterId, uint32_t scalePointId, char* const strBuf) | |||
void getParameterScalePointLabel(const uint32_t parameterId, const uint32_t scalePointId, char* const strBuf) | |||
{ | |||
Q_ASSERT(parameterId < param.count); | |||
Q_ASSERT(scalePointId < parameterScalePointCount(parameterId)); | |||
int32_t rindex = param.data[parameterId].rindex; | |||
if (rdf_descriptor && rindex < (int32_t)rdf_descriptor->PortCount) | |||
{ | |||
const LADSPA_RDF_ScalePoint* const scalePoint = &rdf_descriptor->Ports[rindex].ScalePoints[scalePointId]; | |||
const LADSPA_RDF_Port* const port = &rdf_descriptor->Ports[rindex]; | |||
if (scalePoint && scalePoint->Label) | |||
if (port && scalePointId < port->ScalePointCount) | |||
{ | |||
strncpy(strBuf, rdf_descriptor->Ports[rindex].ScalePoints[scalePointId].Label, STR_MAX); | |||
return; | |||
const LADSPA_RDF_ScalePoint* const scalePoint = &port->ScalePoints[scalePointId]; | |||
if (scalePoint && scalePoint->Label) | |||
strncpy(strBuf, scalePoint->Label, STR_MAX); | |||
} | |||
} | |||
*strBuf = 0; | |||
CarlaPlugin::getParameterScalePointLabel(parameterId, scalePointId, strBuf); | |||
} | |||
// ------------------------------------------------------------------- | |||
// Set data (plugin-specific stuff) | |||
void setParameterValue(uint32_t parameterId, double value, bool sendGui, bool sendOsc, bool sendCallback) | |||
void setParameterValue(const uint32_t parameterId, double value, const bool sendGui, const bool sendOsc, const bool sendCallback) | |||
{ | |||
Q_ASSERT(parameterId < param.count); | |||
param_buffers[parameterId] = fixParameterValue(value, param.ranges[parameterId]); | |||
CarlaPlugin::setParameterValue(parameterId, value, sendGui, sendOsc, sendCallback); | |||
} | |||
@@ -311,39 +347,57 @@ public: | |||
// Delete old data | |||
deleteBuffers(); | |||
uint32_t ains, aouts, params, j; | |||
ains = aouts = params = 0; | |||
uint32_t aIns, aOuts, params, j; | |||
aIns = aOuts = params = 0; | |||
const double sampleRate = x_engine->getSampleRate(); | |||
const unsigned long PortCount = descriptor->PortCount; | |||
const unsigned long portCount = descriptor->PortCount; | |||
bool forcedStereoIn, forcedStereoOut; | |||
forcedStereoIn = forcedStereoOut = false; | |||
for (unsigned long i=0; i < PortCount; i++) | |||
for (unsigned long i=0; i < portCount; i++) | |||
{ | |||
const LADSPA_PortDescriptor PortType = descriptor->PortDescriptors[i]; | |||
if (LADSPA_IS_PORT_AUDIO(PortType)) | |||
const LADSPA_PortDescriptor portType = descriptor->PortDescriptors[i]; | |||
if (LADSPA_IS_PORT_AUDIO(portType)) | |||
{ | |||
if (LADSPA_IS_PORT_INPUT(PortType)) | |||
ains += 1; | |||
else if (LADSPA_IS_PORT_OUTPUT(PortType)) | |||
aouts += 1; | |||
if (LADSPA_IS_PORT_INPUT(portType)) | |||
aIns += 1; | |||
else if (LADSPA_IS_PORT_OUTPUT(portType)) | |||
aOuts += 1; | |||
} | |||
else if (LADSPA_IS_PORT_CONTROL(PortType)) | |||
else if (LADSPA_IS_PORT_CONTROL(portType)) | |||
params += 1; | |||
} | |||
if (carlaOptions.forceStereo && (ains == 1 || aouts == 1) && ! h2) | |||
if (carlaOptions.forceStereo && (aIns == 1 || aOuts == 1) && ! h2) | |||
{ | |||
h2 = descriptor->instantiate(descriptor, sampleRate); | |||
if (ains > 0) | |||
if (aIns == 1) | |||
{ | |||
aIns = 2; | |||
forcedStereoIn = true; | |||
} | |||
if (aOuts == 1) | |||
{ | |||
aOuts = 2; | |||
forcedStereoOut = true; | |||
} | |||
} | |||
if (aIns > 0) | |||
{ | |||
ain.ports = new CarlaEngineAudioPort*[ains]; | |||
ain.rindexes = new uint32_t[ains]; | |||
aIn.ports = new CarlaEngineAudioPort*[aIns]; | |||
aIn.rindexes = new uint32_t[aIns]; | |||
} | |||
if (aouts > 0) | |||
if (aOuts > 0) | |||
{ | |||
aout.ports = new CarlaEngineAudioPort*[aouts]; | |||
aout.rindexes = new uint32_t[aouts]; | |||
aOut.ports = new CarlaEngineAudioPort*[aOuts]; | |||
aOut.rindexes = new uint32_t[aOuts]; | |||
} | |||
if (params > 0) | |||
@@ -355,16 +409,16 @@ public: | |||
const int portNameSize = CarlaEngine::maxPortNameSize() - 1; | |||
char portName[portNameSize]; | |||
bool needsCin = false; | |||
bool needsCout = false; | |||
bool needsCtrlIn = false; | |||
bool needsCtrlOut = false; | |||
for (unsigned long i=0; i<PortCount; i++) | |||
for (unsigned long i=0; i < portCount; i++) | |||
{ | |||
const LADSPA_PortDescriptor PortType = descriptor->PortDescriptors[i]; | |||
const LADSPA_PortRangeHint PortHint = descriptor->PortRangeHints[i]; | |||
const bool HasPortRDF = (rdf_descriptor && i < rdf_descriptor->PortCount); | |||
const LADSPA_PortDescriptor portType = descriptor->PortDescriptors[i]; | |||
const LADSPA_PortRangeHint portHints = descriptor->PortRangeHints[i]; | |||
const bool hasPortRDF = (rdf_descriptor && i < rdf_descriptor->PortCount); | |||
if (LADSPA_IS_PORT_AUDIO(PortType)) | |||
if (LADSPA_IS_PORT_AUDIO(portType)) | |||
{ | |||
#ifndef BUILD_BRIDGE | |||
if (carlaOptions.processMode != PROCESS_MODE_MULTIPLE_CLIENTS) | |||
@@ -377,23 +431,37 @@ public: | |||
#endif | |||
strncpy(portName, descriptor->PortNames[i], portNameSize); | |||
if (LADSPA_IS_PORT_INPUT(PortType)) | |||
if (LADSPA_IS_PORT_INPUT(portType)) | |||
{ | |||
j = ain.count++; | |||
ain.ports[j] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, true); | |||
ain.rindexes[j] = i; | |||
j = aIn.count++; | |||
aIn.ports[j] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, true); | |||
aIn.rindexes[j] = i; | |||
if (forcedStereoIn) | |||
{ | |||
strcat(portName, "-2"); | |||
aIn.ports[1] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, true); | |||
aIn.rindexes[1] = i; | |||
} | |||
} | |||
else if (LADSPA_IS_PORT_OUTPUT(PortType)) | |||
else if (LADSPA_IS_PORT_OUTPUT(portType)) | |||
{ | |||
j = aout.count++; | |||
aout.ports[j] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, false); | |||
aout.rindexes[j] = i; | |||
needsCin = true; | |||
j = aOut.count++; | |||
aOut.ports[j] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, false); | |||
aOut.rindexes[j] = i; | |||
needsCtrlIn = true; | |||
if (forcedStereoOut) | |||
{ | |||
strcat(portName, "-2"); | |||
aOut.ports[1] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, false); | |||
aOut.rindexes[1] = i; | |||
} | |||
} | |||
else | |||
qWarning("WARNING - Got a broken Port (Audio, but not input or output)"); | |||
} | |||
else if (LADSPA_IS_PORT_CONTROL(PortType)) | |||
else if (LADSPA_IS_PORT_CONTROL(portType)) | |||
{ | |||
j = param.count++; | |||
param.data[j].index = j; | |||
@@ -402,17 +470,17 @@ public: | |||
param.data[j].midiChannel = 0; | |||
param.data[j].midiCC = -1; | |||
double min, max, def, step, step_small, step_large; | |||
double min, max, def, step, stepSmall, stepLarge; | |||
// min value | |||
if (LADSPA_IS_HINT_BOUNDED_BELOW(PortHint.HintDescriptor)) | |||
min = PortHint.LowerBound; | |||
if (LADSPA_IS_HINT_BOUNDED_BELOW(portHints.HintDescriptor)) | |||
min = portHints.LowerBound; | |||
else | |||
min = 0.0; | |||
// max value | |||
if (LADSPA_IS_HINT_BOUNDED_ABOVE(PortHint.HintDescriptor)) | |||
max = PortHint.UpperBound; | |||
if (LADSPA_IS_HINT_BOUNDED_ABOVE(portHints.HintDescriptor)) | |||
max = portHints.UpperBound; | |||
else | |||
max = 1.0; | |||
@@ -428,72 +496,17 @@ public: | |||
} | |||
// default value | |||
if (HasPortRDF && LADSPA_PORT_HAS_DEFAULT(rdf_descriptor->Ports[i].Hints)) | |||
if (hasPortRDF && LADSPA_PORT_HAS_DEFAULT(rdf_descriptor->Ports[i].Hints)) | |||
def = rdf_descriptor->Ports[i].Default; | |||
else if (LADSPA_IS_HINT_HAS_DEFAULT(PortHint.HintDescriptor)) | |||
{ | |||
switch (PortHint.HintDescriptor & LADSPA_HINT_DEFAULT_MASK) | |||
{ | |||
case LADSPA_HINT_DEFAULT_MINIMUM: | |||
def = min; | |||
break; | |||
case LADSPA_HINT_DEFAULT_MAXIMUM: | |||
def = max; | |||
break; | |||
case LADSPA_HINT_DEFAULT_0: | |||
def = 0.0; | |||
break; | |||
case LADSPA_HINT_DEFAULT_1: | |||
def = 1.0; | |||
break; | |||
case LADSPA_HINT_DEFAULT_100: | |||
def = 100.0; | |||
break; | |||
case LADSPA_HINT_DEFAULT_440: | |||
def = 440.0; | |||
break; | |||
case LADSPA_HINT_DEFAULT_LOW: | |||
if (LADSPA_IS_HINT_LOGARITHMIC(PortHint.HintDescriptor)) | |||
def = exp((log(min)*0.75) + (log(max)*0.25)); | |||
else | |||
def = (min*0.75) + (max*0.25); | |||
break; | |||
case LADSPA_HINT_DEFAULT_MIDDLE: | |||
if (LADSPA_IS_HINT_LOGARITHMIC(PortHint.HintDescriptor)) | |||
def = sqrt(min*max); | |||
else | |||
def = (min+max)/2; | |||
break; | |||
case LADSPA_HINT_DEFAULT_HIGH: | |||
if (LADSPA_IS_HINT_LOGARITHMIC(PortHint.HintDescriptor)) | |||
def = exp((log(min)*0.25) + (log(max)*0.75)); | |||
else | |||
def = (min*0.25) + (max*0.75); | |||
break; | |||
default: | |||
if (min < 0.0 && max > 0.0) | |||
def = 0.0; | |||
else | |||
def = min; | |||
break; | |||
} | |||
} | |||
else | |||
{ | |||
// no default value | |||
if (min < 0.0 && max > 0.0) | |||
def = 0.0; | |||
else | |||
def = min; | |||
} | |||
def = get_default_ladspa_port_value(portHints.HintDescriptor, min, max); | |||
if (def < min) | |||
def = min; | |||
else if (def > max) | |||
def = max; | |||
if (LADSPA_IS_HINT_SAMPLE_RATE(PortHint.HintDescriptor)) | |||
if (LADSPA_IS_HINT_SAMPLE_RATE(portHints.HintDescriptor)) | |||
{ | |||
min *= sampleRate; | |||
max *= sampleRate; | |||
@@ -501,36 +514,36 @@ public: | |||
param.data[j].hints |= PARAMETER_USES_SAMPLERATE; | |||
} | |||
if (LADSPA_IS_HINT_TOGGLED(PortHint.HintDescriptor)) | |||
if (LADSPA_IS_HINT_TOGGLED(portHints.HintDescriptor)) | |||
{ | |||
step = max - min; | |||
step_small = step; | |||
step_large = step; | |||
stepSmall = step; | |||
stepLarge = step; | |||
param.data[j].hints |= PARAMETER_IS_BOOLEAN; | |||
} | |||
else if (LADSPA_IS_HINT_INTEGER(PortHint.HintDescriptor)) | |||
else if (LADSPA_IS_HINT_INTEGER(portHints.HintDescriptor)) | |||
{ | |||
step = 1.0; | |||
step_small = 1.0; | |||
step_large = 10.0; | |||
stepSmall = 1.0; | |||
stepLarge = 10.0; | |||
param.data[j].hints |= PARAMETER_IS_INTEGER; | |||
} | |||
else | |||
{ | |||
double range = max - min; | |||
step = range/100.0; | |||
step_small = range/1000.0; | |||
step_large = range/10.0; | |||
stepSmall = range/1000.0; | |||
stepLarge = range/10.0; | |||
} | |||
if (LADSPA_IS_PORT_INPUT(PortType)) | |||
if (LADSPA_IS_PORT_INPUT(portType)) | |||
{ | |||
param.data[j].type = PARAMETER_INPUT; | |||
param.data[j].hints |= PARAMETER_IS_ENABLED; | |||
param.data[j].hints |= PARAMETER_IS_AUTOMABLE; | |||
needsCin = true; | |||
needsCtrlIn = true; | |||
} | |||
else if (LADSPA_IS_PORT_OUTPUT(PortType)) | |||
else if (LADSPA_IS_PORT_OUTPUT(portType)) | |||
{ | |||
if (strcmp(descriptor->PortNames[i], "latency") == 0 || strcmp(descriptor->PortNames[i], "_latency") == 0) | |||
{ | |||
@@ -538,18 +551,27 @@ public: | |||
max = sampleRate; | |||
def = 0.0; | |||
step = 1.0; | |||
step_small = 1.0; | |||
step_large = 1.0; | |||
stepSmall = 1.0; | |||
stepLarge = 1.0; | |||
param.data[j].type = PARAMETER_LATENCY; | |||
param.data[j].hints = 0; | |||
} | |||
else if (strcmp(descriptor->PortNames[i], "_sample-rate") == 0) | |||
{ | |||
step = 1.0; | |||
stepSmall = 1.0; | |||
stepLarge = 1.0; | |||
param.data[j].type = PARAMETER_SAMPLE_RATE; | |||
param.data[j].hints = 0; | |||
} | |||
else | |||
{ | |||
param.data[j].type = PARAMETER_OUTPUT; | |||
param.data[j].hints |= PARAMETER_IS_ENABLED; | |||
param.data[j].hints |= PARAMETER_IS_AUTOMABLE; | |||
needsCout = true; | |||
needsCtrlOut = true; | |||
} | |||
} | |||
else | |||
@@ -559,19 +581,19 @@ public: | |||
} | |||
// extra parameter hints | |||
if (LADSPA_IS_HINT_LOGARITHMIC(PortHint.HintDescriptor)) | |||
if (LADSPA_IS_HINT_LOGARITHMIC(portHints.HintDescriptor)) | |||
param.data[j].hints |= PARAMETER_IS_LOGARITHMIC; | |||
// check for scalepoints, require at least 2 to make it useful | |||
if (HasPortRDF && rdf_descriptor->Ports[i].ScalePointCount > 1) | |||
if (hasPortRDF && rdf_descriptor->Ports[i].ScalePointCount > 1) | |||
param.data[j].hints |= PARAMETER_USES_SCALEPOINTS; | |||
param.ranges[j].min = min; | |||
param.ranges[j].max = max; | |||
param.ranges[j].def = def; | |||
param.ranges[j].step = step; | |||
param.ranges[j].stepSmall = step_small; | |||
param.ranges[j].stepLarge = step_large; | |||
param.ranges[j].stepSmall = stepSmall; | |||
param.ranges[j].stepLarge = stepLarge; | |||
// Start parameters in their default values | |||
param_buffers[j] = def; | |||
@@ -588,7 +610,7 @@ public: | |||
} | |||
} | |||
if (needsCin) | |||
if (needsCtrlIn) | |||
{ | |||
#ifndef BUILD_BRIDGE | |||
if (carlaOptions.processMode != PROCESS_MODE_MULTIPLE_CLIENTS) | |||
@@ -603,7 +625,7 @@ public: | |||
param.portCin = (CarlaEngineControlPort*)x_client->addPort(CarlaEnginePortTypeControl, portName, true); | |||
} | |||
if (needsCout) | |||
if (needsCtrlOut) | |||
{ | |||
#ifndef BUILD_BRIDGE | |||
if (carlaOptions.processMode != PROCESS_MODE_MULTIPLE_CLIENTS) | |||
@@ -618,20 +640,20 @@ public: | |||
param.portCout = (CarlaEngineControlPort*)x_client->addPort(CarlaEnginePortTypeControl, portName, false); | |||
} | |||
ain.count = ains; | |||
aout.count = aouts; | |||
aIn.count = aIns; | |||
aOut.count = aOuts; | |||
param.count = params; | |||
// plugin checks | |||
m_hints &= ~(PLUGIN_IS_SYNTH | PLUGIN_USES_CHUNKS | PLUGIN_CAN_DRYWET | PLUGIN_CAN_VOLUME | PLUGIN_CAN_BALANCE); | |||
if (aouts > 0 && (ains == aouts || ains == 1)) | |||
if (aOuts > 0 && (aIns == aOuts || aIns == 1)) | |||
m_hints |= PLUGIN_CAN_DRYWET; | |||
if (aouts > 0) | |||
if (aOuts > 0) | |||
m_hints |= PLUGIN_CAN_VOLUME; | |||
if ((aouts >= 2 && aouts%2 == 0) || h2) | |||
if ((aOuts >= 2 && aOuts%2 == 0) || h2) | |||
m_hints |= PLUGIN_CAN_BALANCE; | |||
x_client->activate(); | |||
@@ -642,39 +664,39 @@ public: | |||
// ------------------------------------------------------------------- | |||
// Plugin processing | |||
void process(float** inBuffer, float** outBuffer, uint32_t frames, uint32_t framesOffset) | |||
void process(float* const* const inBuffer, float* const* const outBuffer, const uint32_t frames, const uint32_t framesOffset) | |||
{ | |||
uint32_t i, k; | |||
double ains_peak_tmp[2] = { 0.0 }; | |||
double aouts_peak_tmp[2] = { 0.0 }; | |||
double aInsPeak[2] = { 0.0 }; | |||
double aOutsPeak[2] = { 0.0 }; | |||
CARLA_PROCESS_CONTINUE_CHECK; | |||
// -------------------------------------------------------------------------------------------------------- | |||
// Input VU | |||
if (ain.count > 0) | |||
if (aIn.count > 0) | |||
{ | |||
uint32_t count = h2 ? 2 : ain.count; | |||
uint32_t count = h2 ? 2 : aIn.count; | |||
if (count == 1) | |||
{ | |||
for (k=0; k < frames; k++) | |||
{ | |||
if (abs(inBuffer[0][k]) > ains_peak_tmp[0]) | |||
ains_peak_tmp[0] = abs(inBuffer[0][k]); | |||
if (abs(inBuffer[0][k]) > aInsPeak[0]) | |||
aInsPeak[0] = abs(inBuffer[0][k]); | |||
} | |||
} | |||
else if (count > 1) | |||
{ | |||
for (k=0; k < frames; k++) | |||
{ | |||
if (abs(inBuffer[0][k]) > ains_peak_tmp[0]) | |||
ains_peak_tmp[0] = abs(inBuffer[0][k]); | |||
if (abs(inBuffer[0][k]) > aInsPeak[0]) | |||
aInsPeak[0] = abs(inBuffer[0][k]); | |||
if (abs(inBuffer[1][k]) > ains_peak_tmp[1]) | |||
ains_peak_tmp[1] = abs(inBuffer[1][k]); | |||
if (abs(inBuffer[1][k]) > aInsPeak[1]) | |||
aInsPeak[1] = abs(inBuffer[1][k]); | |||
} | |||
} | |||
} | |||
@@ -704,12 +726,15 @@ public: | |||
// Control change | |||
switch (cinEvent->type) | |||
{ | |||
case CarlaEngineEventNull: | |||
break; | |||
case CarlaEngineEventControlChange: | |||
{ | |||
double value; | |||
// Control backend stuff | |||
if (cinEvent->channel == cin_channel) | |||
if (cinEvent->channel == m_ctrlInChannel) | |||
{ | |||
if (MIDI_IS_CONTROL_BREATH_CONTROLLER(cinEvent->controller) && (m_hints & PLUGIN_CAN_DRYWET) > 0) | |||
{ | |||
@@ -732,12 +757,12 @@ public: | |||
double left, right; | |||
value = cinEvent->value/0.5 - 1.0; | |||
if (value < 0) | |||
if (value < 0.0) | |||
{ | |||
left = -1.0; | |||
right = (value*2)+1.0; | |||
} | |||
else if (value > 0) | |||
else if (value > 0.0) | |||
{ | |||
left = (value*2)-1.0; | |||
right = 1.0; | |||
@@ -788,8 +813,12 @@ public: | |||
break; | |||
} | |||
case CarlaEngineEventMidiBankChange: | |||
case CarlaEngineEventMidiProgramChange: | |||
break; | |||
case CarlaEngineEventAllSoundOff: | |||
if (cinEvent->channel == cin_channel) | |||
if (cinEvent->channel == m_ctrlInChannel) | |||
{ | |||
if (descriptor->deactivate) | |||
{ | |||
@@ -805,7 +834,7 @@ public: | |||
} | |||
break; | |||
default: | |||
case CarlaEngineEventAllNotesOff: | |||
break; | |||
} | |||
} | |||
@@ -842,16 +871,16 @@ public: | |||
} | |||
} | |||
for (i=0; i < ain.count; i++) | |||
for (i=0; i < aIn.count; i++) | |||
{ | |||
descriptor->connect_port(handle, ain.rindexes[i], inBuffer[i]); | |||
if (h2 && i == 0) descriptor->connect_port(h2, ain.rindexes[i], inBuffer[1]); | |||
if (i == 0 || ! h2) descriptor->connect_port(handle, aIn.rindexes[i], inBuffer[i]); | |||
if (i == 1 && h2) descriptor->connect_port(h2, aIn.rindexes[i], inBuffer[i]); | |||
} | |||
for (i=0; i < aout.count; i++) | |||
for (i=0; i < aOut.count; i++) | |||
{ | |||
descriptor->connect_port(handle, aout.rindexes[i], outBuffer[i]); | |||
if (h2 && i == 0) descriptor->connect_port(h2, aout.rindexes[i], outBuffer[1]); | |||
if (i == 0 || ! h2) descriptor->connect_port(handle, aOut.rindexes[i], outBuffer[i]); | |||
if (i == 1 && h2) descriptor->connect_port(h2, aOut.rindexes[i], outBuffer[i]); | |||
} | |||
descriptor->run(handle, frames); | |||
@@ -876,14 +905,14 @@ public: | |||
if (m_active) | |||
{ | |||
bool do_drywet = (m_hints & PLUGIN_CAN_DRYWET) > 0 && x_drywet != 1.0; | |||
bool do_volume = (m_hints & PLUGIN_CAN_VOLUME) > 0 && x_vol != 1.0; | |||
bool do_balance = (m_hints & PLUGIN_CAN_BALANCE) > 0 && (x_bal_left != -1.0 || x_bal_right != 1.0); | |||
bool do_drywet = (m_hints & PLUGIN_CAN_DRYWET) > 0 && x_dryWet != 1.0; | |||
bool do_volume = (m_hints & PLUGIN_CAN_VOLUME) > 0 && x_volume != 1.0; | |||
bool do_balance = (m_hints & PLUGIN_CAN_BALANCE) > 0 && (x_balanceLeft != -1.0 || x_balanceRight != 1.0); | |||
double bal_rangeL, bal_rangeR; | |||
float oldBufLeft[do_balance ? frames : 0]; | |||
uint32_t count = h2 ? 2 : aout.count; | |||
uint32_t count = h2 ? 2 : aOut.count; | |||
for (i=0; i < count; i++) | |||
{ | |||
@@ -892,10 +921,10 @@ public: | |||
{ | |||
for (k=0; k < frames; k++) | |||
{ | |||
if (aout.count == 1 && ! h2) | |||
outBuffer[i][k] = (outBuffer[i][k]*x_drywet)+(inBuffer[0][k]*(1.0-x_drywet)); | |||
if (aOut.count == 1 && ! h2) | |||
outBuffer[i][k] = (outBuffer[i][k]*x_dryWet)+(inBuffer[0][k]*(1.0-x_dryWet)); | |||
else | |||
outBuffer[i][k] = (outBuffer[i][k]*x_drywet)+(inBuffer[i][k]*(1.0-x_drywet)); | |||
outBuffer[i][k] = (outBuffer[i][k]*x_dryWet)+(inBuffer[i][k]*(1.0-x_dryWet)); | |||
} | |||
} | |||
@@ -905,8 +934,8 @@ public: | |||
if (i%2 == 0) | |||
memcpy(&oldBufLeft, outBuffer[i], sizeof(float)*frames); | |||
bal_rangeL = (x_bal_left+1.0)/2; | |||
bal_rangeR = (x_bal_right+1.0)/2; | |||
bal_rangeL = (x_balanceLeft+1.0)/2; | |||
bal_rangeR = (x_balanceRight+1.0)/2; | |||
for (k=0; k < frames; k++) | |||
{ | |||
@@ -929,25 +958,25 @@ public: | |||
if (do_volume) | |||
{ | |||
for (k=0; k < frames; k++) | |||
outBuffer[i][k] *= x_vol; | |||
outBuffer[i][k] *= x_volume; | |||
} | |||
// Output VU | |||
for (k=0; i < 2 && k < frames; k++) | |||
{ | |||
if (abs(outBuffer[i][k]) > aouts_peak_tmp[i]) | |||
aouts_peak_tmp[i] = abs(outBuffer[i][k]); | |||
if (abs(outBuffer[i][k]) > aOutsPeak[i]) | |||
aOutsPeak[i] = abs(outBuffer[i][k]); | |||
} | |||
} | |||
} | |||
else | |||
{ | |||
// disable any output sound if not active | |||
for (i=0; i < aout.count; i++) | |||
for (i=0; i < aOut.count; i++) | |||
memset(outBuffer[i], 0.0f, sizeof(float)*frames); | |||
aouts_peak_tmp[0] = 0.0; | |||
aouts_peak_tmp[1] = 0.0; | |||
aOutsPeak[0] = 0.0; | |||
aOutsPeak[1] = 0.0; | |||
} // End of Post-processing | |||
@@ -980,10 +1009,10 @@ public: | |||
// -------------------------------------------------------------------------------------------------------- | |||
// Peak Values | |||
x_engine->setInputPeak(m_id, 0, ains_peak_tmp[0]); | |||
x_engine->setInputPeak(m_id, 1, ains_peak_tmp[1]); | |||
x_engine->setOutputPeak(m_id, 0, aouts_peak_tmp[0]); | |||
x_engine->setOutputPeak(m_id, 1, aouts_peak_tmp[1]); | |||
x_engine->setInputPeak(m_id, 0, aInsPeak[0]); | |||
x_engine->setInputPeak(m_id, 1, aInsPeak[1]); | |||
x_engine->setOutputPeak(m_id, 0, aOutsPeak[0]); | |||
x_engine->setOutputPeak(m_id, 1, aOutsPeak[1]); | |||
m_activeBefore = m_active; | |||
} | |||
@@ -147,11 +147,11 @@ public: | |||
// Delete old data | |||
deleteBuffers(); | |||
uint32_t aouts; | |||
aouts = 2; | |||
uint32_t aOuts; | |||
aOuts = 2; | |||
aout.ports = new CarlaEngineAudioPort*[aouts]; | |||
aout.rindexes = new uint32_t[aouts]; | |||
aOut.ports = new CarlaEngineAudioPort*[aOuts]; | |||
aOut.rindexes = new uint32_t[aOuts]; | |||
char portName[STR_MAX]; | |||
@@ -168,8 +168,8 @@ public: | |||
#endif | |||
strcpy(portName, "out-left"); | |||
aout.ports[0] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, false); | |||
aout.rindexes[0] = 0; | |||
aOut.ports[0] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, false); | |||
aOut.rindexes[0] = 0; | |||
#ifndef BUILD_BRIDGE | |||
if (carlaOptions.processMode != PROCESS_MODE_MULTIPLE_CLIENTS) | |||
@@ -181,8 +181,8 @@ public: | |||
#endif | |||
strcpy(portName, "out-right"); | |||
aout.ports[1] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, false); | |||
aout.rindexes[1] = 1; | |||
aOut.ports[1] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, false); | |||
aOut.rindexes[1] = 1; | |||
// --------------------------------------- | |||
// MIDI Input | |||
@@ -201,7 +201,7 @@ public: | |||
// --------------------------------------- | |||
aout.count = aouts; | |||
aOut.count = aOuts; | |||
// plugin checks | |||
m_hints &= ~(PLUGIN_IS_SYNTH | PLUGIN_USES_CHUNKS | PLUGIN_CAN_DRYWET | PLUGIN_CAN_VOLUME | PLUGIN_CAN_BALANCE); | |||
@@ -283,7 +283,7 @@ public: | |||
// -------------------------------------------------------------------------------------------------------- | |||
// MIDI Input (External) | |||
if (cin_channel >= 0 && cin_channel < 16 && m_active && m_activeBefore) | |||
if (m_ctrlInChannel >= 0 && m_ctrlInChannel < 16 && m_active && m_activeBefore) | |||
{ | |||
engineMidiLock(); | |||
@@ -293,9 +293,9 @@ public: | |||
break; | |||
if (extMidiNotes[i].velo) | |||
midiInputPort->DispatchNoteOn(extMidiNotes[i].note, extMidiNotes[i].velo, cin_channel, 0); | |||
midiInputPort->DispatchNoteOn(extMidiNotes[i].note, extMidiNotes[i].velo, m_ctrlInChannel, 0); | |||
else | |||
midiInputPort->DispatchNoteOff(extMidiNotes[i].note, extMidiNotes[i].velo, cin_channel, 0); | |||
midiInputPort->DispatchNoteOff(extMidiNotes[i].note, extMidiNotes[i].velo, m_ctrlInChannel, 0); | |||
extMidiNotes[i].channel = -1; | |||
midiEventCount += 1; | |||
@@ -340,7 +340,7 @@ public: | |||
midiInputPort->DispatchNoteOff(note, 0, channel, time); | |||
if (channel == cin_channel) | |||
if (channel == m_ctrlInChannel) | |||
postponeEvent(PluginPostEventNoteOff, channel, note, 0.0); | |||
} | |||
else if (MIDI_IS_STATUS_NOTE_ON(status)) | |||
@@ -350,7 +350,7 @@ public: | |||
midiInputPort->DispatchNoteOn(note, velo, channel, time); | |||
if (channel == cin_channel) | |||
if (channel == m_ctrlInChannel) | |||
postponeEvent(PluginPostEventNoteOn, channel, note, velo); | |||
} | |||
else if (MIDI_IS_STATUS_AFTERTOUCH(status)) | |||
@@ -382,10 +382,10 @@ public: | |||
{ | |||
if (! m_activeBefore) | |||
{ | |||
if (cin_channel >= 0 && cin_channel < 16) | |||
if (m_ctrlInChannel >= 0 && m_ctrlInChannel < 16) | |||
{ | |||
midiInputPort->DispatchControlChange(MIDI_CONTROL_ALL_SOUND_OFF, 0, cin_channel); | |||
midiInputPort->DispatchControlChange(MIDI_CONTROL_ALL_NOTES_OFF, 0, cin_channel); | |||
midiInputPort->DispatchControlChange(MIDI_CONTROL_ALL_SOUND_OFF, 0, m_ctrlInChannel); | |||
midiInputPort->DispatchControlChange(MIDI_CONTROL_ALL_NOTES_OFF, 0, m_ctrlInChannel); | |||
} | |||
} | |||
@@ -402,13 +402,13 @@ public: | |||
if (m_active) | |||
{ | |||
bool do_volume = x_vol != 1.0; | |||
bool do_balance = (x_bal_left != -1.0 || x_bal_right != 1.0); | |||
bool do_volume = x_volume != 1.0; | |||
bool do_balance = (x_balanceLeft != -1.0 || x_balanceRight != 1.0); | |||
double bal_rangeL, bal_rangeR; | |||
float oldBufLeft[do_balance ? frames : 0]; | |||
for (i=0; i < aout.count; i++) | |||
for (i=0; i < aOut.count; i++) | |||
{ | |||
// Balance | |||
if (do_balance) | |||
@@ -416,8 +416,8 @@ public: | |||
if (i%2 == 0) | |||
memcpy(&oldBufLeft, outBuffer[i], sizeof(float)*frames); | |||
bal_rangeL = (x_bal_left+1.0)/2; | |||
bal_rangeR = (x_bal_right+1.0)/2; | |||
bal_rangeL = (x_balanceLeft+1.0)/2; | |||
bal_rangeR = (x_balanceRight+1.0)/2; | |||
for (k=0; k < frames; k++) | |||
{ | |||
@@ -440,7 +440,7 @@ public: | |||
if (do_volume) | |||
{ | |||
for (k=0; k < frames; k++) | |||
outBuffer[i][k] *= x_vol; | |||
outBuffer[i][k] *= x_volume; | |||
} | |||
// Output VU | |||
@@ -454,7 +454,7 @@ public: | |||
else | |||
{ | |||
// disable any output sound if not active | |||
for (i=0; i < aout.count; i++) | |||
for (i=0; i < aOut.count; i++) | |||
memset(outBuffer[i], 0.0f, sizeof(float)*frames); | |||
aouts_peak_tmp[0] = 0.0; | |||
@@ -921,13 +921,16 @@ public: | |||
// Delete old data | |||
deleteBuffers(); | |||
uint32_t ains, aouts, cvIns, cvOuts, params, j; | |||
ains = aouts = cvIns = cvOuts = params = 0; | |||
uint32_t aIns, aOuts, cvIns, cvOuts, params, j; | |||
aIns = aOuts = cvIns = cvOuts = params = 0; | |||
std::vector<unsigned int> evIns, evOuts; | |||
const double sampleRate = x_engine->getSampleRate(); | |||
const uint32_t PortCount = rdf_descriptor->PortCount; | |||
bool forcedStereoIn, forcedStereoOut; | |||
forcedStereoIn = forcedStereoOut = false; | |||
for (uint32_t i=0; i < PortCount; i++) | |||
{ | |||
const LV2_Property PortType = rdf_descriptor->Ports[i].Type; | |||
@@ -935,9 +938,9 @@ public: | |||
if (LV2_IS_PORT_AUDIO(PortType)) | |||
{ | |||
if (LV2_IS_PORT_INPUT(PortType)) | |||
ains += 1; | |||
aIns += 1; | |||
else if (LV2_IS_PORT_OUTPUT(PortType)) | |||
aouts += 1; | |||
aOuts += 1; | |||
} | |||
else if (LV2_IS_PORT_CV(PortType)) | |||
{ | |||
@@ -971,36 +974,33 @@ public: | |||
params += 1; | |||
} | |||
bool forcedStereoIn, forcedStereoOut; | |||
forcedStereoIn = forcedStereoOut = true; | |||
if (carlaOptions.forceStereo && (ains == 1 || aouts == 1) && ! h2) | |||
if (carlaOptions.forceStereo && (aIns == 1 || aOuts == 1) && ! h2) | |||
{ | |||
h2 = descriptor->instantiate(descriptor, sampleRate, rdf_descriptor->Bundle, features); | |||
if (ains == 1) | |||
if (aIns == 1) | |||
{ | |||
ains = 2; | |||
aIns = 2; | |||
forcedStereoIn = true; | |||
} | |||
if (aouts == 1) | |||
if (aOuts == 1) | |||
{ | |||
aouts = 2; | |||
aOuts = 2; | |||
forcedStereoOut = true; | |||
} | |||
} | |||
if (ains > 0) | |||
if (aIns > 0) | |||
{ | |||
ain.ports = new CarlaEngineAudioPort*[ains]; | |||
ain.rindexes = new uint32_t[ains]; | |||
aIn.ports = new CarlaEngineAudioPort*[aIns]; | |||
aIn.rindexes = new uint32_t[aIns]; | |||
} | |||
if (aouts > 0) | |||
if (aOuts > 0) | |||
{ | |||
aout.ports = new CarlaEngineAudioPort*[aouts]; | |||
aout.rindexes = new uint32_t[aouts]; | |||
aOut.ports = new CarlaEngineAudioPort*[aOuts]; | |||
aOut.rindexes = new uint32_t[aOuts]; | |||
} | |||
if (evIns.size() > 0) | |||
@@ -1105,29 +1105,29 @@ public: | |||
{ | |||
if (LV2_IS_PORT_INPUT(PortType)) | |||
{ | |||
j = ain.count++; | |||
ain.ports[j] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, true); | |||
ain.rindexes[j] = i; | |||
j = aIn.count++; | |||
aIn.ports[j] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, true); | |||
aIn.rindexes[j] = i; | |||
if (forcedStereoIn) | |||
{ | |||
strcat(portName, "2"); | |||
ain.ports[1] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, true); | |||
ain.rindexes[1] = i; | |||
aIn.ports[1] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, true); | |||
aIn.rindexes[1] = i; | |||
} | |||
} | |||
else if (LV2_IS_PORT_OUTPUT(PortType)) | |||
{ | |||
j = aout.count++; | |||
aout.ports[j] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, false); | |||
aout.rindexes[j] = i; | |||
j = aOut.count++; | |||
aOut.ports[j] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, false); | |||
aOut.rindexes[j] = i; | |||
needsCin = true; | |||
if (forcedStereoOut) | |||
{ | |||
strcat(portName, "2"); | |||
aout.ports[1] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, false); | |||
aout.rindexes[1] = i; | |||
aOut.ports[1] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, false); | |||
aOut.rindexes[1] = i; | |||
} | |||
} | |||
else | |||
@@ -1451,8 +1451,8 @@ public: | |||
param.portCout = (CarlaEngineControlPort*)x_client->addPort(CarlaEnginePortTypeControl, portName, false); | |||
} | |||
ain.count = ains; | |||
aout.count = aouts; | |||
aIn.count = aIns; | |||
aOut.count = aOuts; | |||
evin.count = evIns.size(); | |||
evout.count = evOuts.size(); | |||
param.count = params; | |||
@@ -1463,13 +1463,13 @@ public: | |||
if (LV2_IS_GENERATOR(rdf_descriptor->Type)) | |||
m_hints |= PLUGIN_IS_SYNTH; | |||
if (aouts > 0 && (ains == aouts || ains == 1)) | |||
if (aOuts > 0 && (aIns == aOuts || aIns == 1)) | |||
m_hints |= PLUGIN_CAN_DRYWET; | |||
if (aouts > 0) | |||
if (aOuts > 0) | |||
m_hints |= PLUGIN_CAN_VOLUME; | |||
if (aouts >= 2 && aouts%2 == 0) | |||
if (aOuts >= 2 && aOuts%2 == 0) | |||
m_hints |= PLUGIN_CAN_BALANCE; | |||
// check extensions | |||
@@ -1657,9 +1657,9 @@ public: | |||
// -------------------------------------------------------------------------------------------------------- | |||
// Input VU | |||
if (ain.count > 0) | |||
if (aIn.count > 0) | |||
{ | |||
uint32_t count = h2 ? 2 : ain.count; | |||
uint32_t count = h2 ? 2 : aIn.count; | |||
if (count == 1) | |||
{ | |||
@@ -1721,7 +1721,7 @@ public: | |||
double value; | |||
// Control backend stuff | |||
if (cinEvent->channel == cin_channel) | |||
if (cinEvent->channel == m_ctrlInChannel) | |||
{ | |||
if (MIDI_IS_CONTROL_BREATH_CONTROLLER(cinEvent->controller) && (m_hints & PLUGIN_CAN_DRYWET) > 0) | |||
{ | |||
@@ -1801,12 +1801,12 @@ public: | |||
} | |||
case CarlaEngineEventMidiBankChange: | |||
if (cinEvent->channel == cin_channel) | |||
if (cinEvent->channel == m_ctrlInChannel) | |||
nextBankId = rint(cinEvent->value); | |||
break; | |||
case CarlaEngineEventMidiProgramChange: | |||
if (cinEvent->channel == cin_channel) | |||
if (cinEvent->channel == m_ctrlInChannel) | |||
{ | |||
uint32_t nextProgramId = rint(cinEvent->value); | |||
@@ -1823,7 +1823,7 @@ public: | |||
break; | |||
case CarlaEngineEventAllSoundOff: | |||
if (cinEvent->channel == cin_channel) | |||
if (cinEvent->channel == m_ctrlInChannel) | |||
{ | |||
if (midi.portMin && ! allNotesOffSent) | |||
sendMidiAllNotesOff(); | |||
@@ -1845,7 +1845,7 @@ public: | |||
break; | |||
case CarlaEngineEventAllNotesOff: | |||
if (cinEvent->channel == cin_channel) | |||
if (cinEvent->channel == m_ctrlInChannel) | |||
{ | |||
if (midi.portMin && ! allNotesOffSent) | |||
sendMidiAllNotesOff(); | |||
@@ -1862,7 +1862,7 @@ public: | |||
// -------------------------------------------------------------------------------------------------------- | |||
// MIDI Input (External) | |||
if (evin.count > 0 && cin_channel >= 0 && cin_channel < 16 && m_active && m_activeBefore) | |||
if (evin.count > 0 && m_ctrlInChannel >= 0 && m_ctrlInChannel < 16 && m_active && m_activeBefore) | |||
{ | |||
engineMidiLock(); | |||
@@ -1872,7 +1872,7 @@ public: | |||
break; | |||
uint8_t midiEvent[4] = { 0 }; | |||
midiEvent[0] = cin_channel + extMidiNotes[i].velo ? MIDI_STATUS_NOTE_ON : MIDI_STATUS_NOTE_OFF; | |||
midiEvent[0] = m_ctrlInChannel + extMidiNotes[i].velo ? MIDI_STATUS_NOTE_ON : MIDI_STATUS_NOTE_OFF; | |||
midiEvent[1] = extMidiNotes[i].note; | |||
midiEvent[2] = extMidiNotes[i].velo; | |||
@@ -1964,7 +1964,7 @@ public: | |||
else if (evin.data[i].type & CARLA_EVENT_DATA_MIDI_LL) | |||
lv2midi_put_event(&evinMidiStates[i], time, minEvent->size, minEvent->data); | |||
if (channel == cin_channel) | |||
if (channel == m_ctrlInChannel) | |||
{ | |||
if (MIDI_IS_STATUS_NOTE_OFF(status)) | |||
postponeEvent(PluginPostEventNoteOff, channel, minEvent->data[1], 0.0); | |||
@@ -2057,16 +2057,16 @@ public: | |||
} | |||
} | |||
for (i=0; i < ain.count; i++) | |||
for (i=0; i < aIn.count; i++) | |||
{ | |||
if (i == 0 || ! h2) descriptor->connect_port(handle, ain.rindexes[i], inBuffer[i]); | |||
if (h2 && i == 1) descriptor->connect_port(h2, ain.rindexes[i], inBuffer[1]); | |||
if (i == 0 || ! h2) descriptor->connect_port(handle, aIn.rindexes[i], inBuffer[i]); | |||
if (i == 1 && h2) descriptor->connect_port(h2, aIn.rindexes[i], inBuffer[i]); | |||
} | |||
for (i=0; i < aout.count; i++) | |||
for (i=0; i < aOut.count; i++) | |||
{ | |||
if (i == 0 || ! h2) descriptor->connect_port(handle, aout.rindexes[i], outBuffer[i]); | |||
if (h2 && i == 1) descriptor->connect_port(h2, aout.rindexes[i], outBuffer[1]); | |||
if (i == 0 || ! h2) descriptor->connect_port(handle, aOut.rindexes[i], outBuffer[i]); | |||
if (i == 1 && h2) descriptor->connect_port(h2, aOut.rindexes[i], outBuffer[i]); | |||
} | |||
descriptor->run(handle, frames); | |||
@@ -2091,14 +2091,14 @@ public: | |||
if (m_active) | |||
{ | |||
bool do_drywet = (m_hints & PLUGIN_CAN_DRYWET) > 0 && x_drywet != 1.0; | |||
bool do_volume = (m_hints & PLUGIN_CAN_VOLUME) > 0 && x_vol != 1.0; | |||
bool do_balance = (m_hints & PLUGIN_CAN_BALANCE) > 0 && (x_bal_left != -1.0 || x_bal_right != 1.0); | |||
bool do_drywet = (m_hints & PLUGIN_CAN_DRYWET) > 0 && x_dryWet != 1.0; | |||
bool do_volume = (m_hints & PLUGIN_CAN_VOLUME) > 0 && x_volume != 1.0; | |||
bool do_balance = (m_hints & PLUGIN_CAN_BALANCE) > 0 && (x_balanceLeft != -1.0 || x_balanceRight != 1.0); | |||
double bal_rangeL, bal_rangeR; | |||
float oldBufLeft[do_balance ? frames : 0]; | |||
uint32_t count = h2 ? 2 : aout.count; | |||
uint32_t count = h2 ? 2 : aOut.count; | |||
for (i=0; i < count; i++) | |||
{ | |||
@@ -2107,10 +2107,10 @@ public: | |||
{ | |||
for (k=0; k < frames; k++) | |||
{ | |||
if (aout.count == 1 && ! h2) | |||
outBuffer[i][k] = (outBuffer[i][k]*x_drywet)+(inBuffer[0][k]*(1.0-x_drywet)); | |||
if (aOut.count == 1 && ! h2) | |||
outBuffer[i][k] = (outBuffer[i][k]*x_dryWet)+(inBuffer[0][k]*(1.0-x_dryWet)); | |||
else | |||
outBuffer[i][k] = (outBuffer[i][k]*x_drywet)+(inBuffer[i][k]*(1.0-x_drywet)); | |||
outBuffer[i][k] = (outBuffer[i][k]*x_dryWet)+(inBuffer[i][k]*(1.0-x_dryWet)); | |||
} | |||
} | |||
@@ -2120,8 +2120,8 @@ public: | |||
if (i%2 == 0) | |||
memcpy(&oldBufLeft, outBuffer[i], sizeof(float)*frames); | |||
bal_rangeL = (x_bal_left+1.0)/2; | |||
bal_rangeR = (x_bal_right+1.0)/2; | |||
bal_rangeL = (x_balanceLeft+1.0)/2; | |||
bal_rangeR = (x_balanceRight+1.0)/2; | |||
for (k=0; k < frames; k++) | |||
{ | |||
@@ -2144,7 +2144,7 @@ public: | |||
if (do_volume) | |||
{ | |||
for (k=0; k < frames; k++) | |||
outBuffer[i][k] *= x_vol; | |||
outBuffer[i][k] *= x_volume; | |||
} | |||
// Output VU | |||
@@ -2158,7 +2158,7 @@ public: | |||
else | |||
{ | |||
// disable any output sound if not active | |||
for (i=0; i < aout.count; i++) | |||
for (i=0; i < aOut.count; i++) | |||
memset(outBuffer[i], 0.0f, sizeof(float)*frames); | |||
aouts_peak_tmp[0] = 0.0; | |||
@@ -333,29 +333,29 @@ public: | |||
// Delete old data | |||
deleteBuffers(); | |||
uint32_t ains, aouts, mins, mouts, params, j; | |||
ains = aouts = mins = mouts = params = 0; | |||
uint32_t aIns, aOuts, mIns, mOuts, params, j; | |||
aIns = aOuts = mIns = mOuts = params = 0; | |||
ains = effect->numInputs; | |||
aouts = effect->numOutputs; | |||
aIns = effect->numInputs; | |||
aOuts = effect->numOutputs; | |||
params = effect->numParams; | |||
if (VstPluginCanDo(effect, "receiveVstEvents") || VstPluginCanDo(effect, "receiveVstMidiEvent") || (effect->flags & effFlagsIsSynth) > 0 || (m_hints & PLUGIN_WANTS_MIDI_INPUT)) | |||
mins = 1; | |||
mIns = 1; | |||
if (VstPluginCanDo(effect, "sendVstEvents") || VstPluginCanDo(effect, "sendVstMidiEvent")) | |||
mouts = 1; | |||
mOuts = 1; | |||
if (ains > 0) | |||
if (aIns > 0) | |||
{ | |||
ain.ports = new CarlaEngineAudioPort*[ains]; | |||
ain.rindexes = new uint32_t[ains]; | |||
aIn.ports = new CarlaEngineAudioPort*[aIns]; | |||
aIn.rindexes = new uint32_t[aIns]; | |||
} | |||
if (aouts > 0) | |||
if (aOuts > 0) | |||
{ | |||
aout.ports = new CarlaEngineAudioPort*[aouts]; | |||
aout.rindexes = new uint32_t[aouts]; | |||
aOut.ports = new CarlaEngineAudioPort*[aOuts]; | |||
aOut.rindexes = new uint32_t[aOuts]; | |||
} | |||
if (params > 0) | |||
@@ -366,9 +366,9 @@ public: | |||
const int portNameSize = CarlaEngine::maxPortNameSize() - 1; | |||
char portName[portNameSize]; | |||
bool needsCin = (aouts > 0 || params > 0); | |||
bool needsCin = (aOuts > 0 || params > 0); | |||
for (j=0; j<ains; j++) | |||
for (j=0; j < aIns; j++) | |||
{ | |||
#ifndef BUILD_BRIDGE | |||
if (carlaOptions.processMode != PROCESS_MODE_MULTIPLE_CLIENTS) | |||
@@ -377,11 +377,11 @@ public: | |||
#endif | |||
sprintf(portName, "input_%02i", j+1); | |||
ain.ports[j] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, true); | |||
ain.rindexes[j] = j; | |||
aIn.ports[j] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, true); | |||
aIn.rindexes[j] = j; | |||
} | |||
for (j=0; j<aouts; j++) | |||
for (j=0; j < aOuts; j++) | |||
{ | |||
#ifndef BUILD_BRIDGE | |||
if (carlaOptions.processMode != PROCESS_MODE_MULTIPLE_CLIENTS) | |||
@@ -390,8 +390,8 @@ public: | |||
#endif | |||
sprintf(portName, "output_%02i", j+1); | |||
aout.ports[j] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, false); | |||
aout.rindexes[j] = j; | |||
aOut.ports[j] = (CarlaEngineAudioPort*)x_client->addPort(CarlaEnginePortTypeAudio, portName, false); | |||
aOut.rindexes[j] = j; | |||
} | |||
for (j=0; j<params; j++) | |||
@@ -524,7 +524,7 @@ public: | |||
param.portCin = (CarlaEngineControlPort*)x_client->addPort(CarlaEnginePortTypeControl, portName, true); | |||
} | |||
if (mins == 1) | |||
if (mIns == 1) | |||
{ | |||
#ifndef BUILD_BRIDGE | |||
if (carlaOptions.processMode != PROCESS_MODE_MULTIPLE_CLIENTS) | |||
@@ -539,7 +539,7 @@ public: | |||
midi.portMin = (CarlaEngineMidiPort*)x_client->addPort(CarlaEnginePortTypeMIDI, portName, true); | |||
} | |||
if (mouts == 1) | |||
if (mOuts == 1) | |||
{ | |||
#ifndef BUILD_BRIDGE | |||
if (carlaOptions.processMode != PROCESS_MODE_MULTIPLE_CLIENTS) | |||
@@ -554,8 +554,8 @@ public: | |||
midi.portMout = (CarlaEngineMidiPort*)x_client->addPort(CarlaEnginePortTypeMIDI, portName, false); | |||
} | |||
ain.count = ains; | |||
aout.count = aouts; | |||
aIn.count = aIns; | |||
aOut.count = aOuts; | |||
param.count = params; | |||
// plugin checks | |||
@@ -569,13 +569,13 @@ public: | |||
if (effect->flags & effFlagsProgramChunks) | |||
m_hints |= PLUGIN_USES_CHUNKS; | |||
if (aouts > 0 && (ains == aouts || ains == 1)) | |||
if (aOuts > 0 && (aIns == aOuts || aIns == 1)) | |||
m_hints |= PLUGIN_CAN_DRYWET; | |||
if (aouts > 0) | |||
if (aOuts > 0) | |||
m_hints |= PLUGIN_CAN_VOLUME; | |||
if (aouts >= 2 && aouts%2 == 0) | |||
if (aOuts >= 2 && aOuts%2 == 0) | |||
m_hints |= PLUGIN_CAN_BALANCE; | |||
reloadPrograms(true); | |||
@@ -701,9 +701,9 @@ public: | |||
// -------------------------------------------------------------------------------------------------------- | |||
// Input VU | |||
if (ain.count > 0) | |||
if (aIn.count > 0) | |||
{ | |||
if (ain.count == 1) | |||
if (aIn.count == 1) | |||
{ | |||
for (k=0; k < frames; k++) | |||
{ | |||
@@ -711,7 +711,7 @@ public: | |||
ains_peak_tmp[0] = abs(inBuffer[0][k]); | |||
} | |||
} | |||
else if (ain.count >= 1) | |||
else if (aIn.count >= 1) | |||
{ | |||
for (k=0; k < frames; k++) | |||
{ | |||
@@ -759,7 +759,7 @@ public: | |||
double value; | |||
// Control backend stuff | |||
if (cinEvent->channel == cin_channel) | |||
if (cinEvent->channel == m_ctrlInChannel) | |||
{ | |||
if (MIDI_IS_CONTROL_BREATH_CONTROLLER(cinEvent->controller) && (m_hints & PLUGIN_CAN_DRYWET) > 0) | |||
{ | |||
@@ -842,7 +842,7 @@ public: | |||
break; | |||
case CarlaEngineEventMidiProgramChange: | |||
if (cinEvent->channel == cin_channel) | |||
if (cinEvent->channel == m_ctrlInChannel) | |||
{ | |||
uint32_t progId = rint(cinEvent->value); | |||
@@ -855,7 +855,7 @@ public: | |||
break; | |||
case CarlaEngineEventAllSoundOff: | |||
if (cinEvent->channel == cin_channel) | |||
if (cinEvent->channel == m_ctrlInChannel) | |||
{ | |||
if (midi.portMin && ! allNotesOffSent) | |||
sendMidiAllNotesOff(); | |||
@@ -871,7 +871,7 @@ public: | |||
break; | |||
case CarlaEngineEventAllNotesOff: | |||
if (cinEvent->channel == cin_channel) | |||
if (cinEvent->channel == m_ctrlInChannel) | |||
{ | |||
if (midi.portMin && ! allNotesOffSent) | |||
sendMidiAllNotesOff(); | |||
@@ -888,7 +888,7 @@ public: | |||
// -------------------------------------------------------------------------------------------------------- | |||
// MIDI Input (External) | |||
if (midi.portMin && cin_channel >= 0 && cin_channel < 16 && m_active && m_activeBefore) | |||
if (midi.portMin && m_ctrlInChannel >= 0 && m_ctrlInChannel < 16 && m_active && m_activeBefore) | |||
{ | |||
engineMidiLock(); | |||
@@ -902,7 +902,7 @@ public: | |||
midiEvent->type = kVstMidiType; | |||
midiEvent->byteSize = sizeof(VstMidiEvent); | |||
midiEvent->midiData[0] = cin_channel + extMidiNotes[i].velo ? MIDI_STATUS_NOTE_ON : MIDI_STATUS_NOTE_OFF; | |||
midiEvent->midiData[0] = m_ctrlInChannel + extMidiNotes[i].velo ? MIDI_STATUS_NOTE_ON : MIDI_STATUS_NOTE_OFF; | |||
midiEvent->midiData[1] = extMidiNotes[i].note; | |||
midiEvent->midiData[2] = extMidiNotes[i].velo; | |||
@@ -957,7 +957,7 @@ public: | |||
midiEvent->midiData[0] = status; | |||
midiEvent->midiData[1] = note; | |||
if (channel == cin_channel) | |||
if (channel == m_ctrlInChannel) | |||
postponeEvent(PluginPostEventNoteOff, channel, note, 0.0); | |||
} | |||
else if (MIDI_IS_STATUS_NOTE_ON(status)) | |||
@@ -969,7 +969,7 @@ public: | |||
midiEvent->midiData[1] = note; | |||
midiEvent->midiData[2] = velo; | |||
if (channel == cin_channel) | |||
if (channel == m_ctrlInChannel) | |||
postponeEvent(PluginPostEventNoteOn, channel, note, velo); | |||
} | |||
else if (MIDI_IS_STATUS_POLYPHONIC_AFTERTOUCH(status)) | |||
@@ -1013,18 +1013,18 @@ public: | |||
{ | |||
if (! m_activeBefore) | |||
{ | |||
if (midi.portMin && cin_channel >= 0 && cin_channel < 16) | |||
if (midi.portMin && m_ctrlInChannel >= 0 && m_ctrlInChannel < 16) | |||
{ | |||
memset(&midiEvents[0], 0, sizeof(VstMidiEvent)); | |||
midiEvents[0].type = kVstMidiType; | |||
midiEvents[0].byteSize = sizeof(VstMidiEvent); | |||
midiEvents[0].midiData[0] = MIDI_STATUS_CONTROL_CHANGE + cin_channel; | |||
midiEvents[0].midiData[0] = MIDI_STATUS_CONTROL_CHANGE + m_ctrlInChannel; | |||
midiEvents[0].midiData[1] = MIDI_CONTROL_ALL_SOUND_OFF; | |||
memset(&midiEvents[1], 0, sizeof(VstMidiEvent)); | |||
midiEvents[1].type = kVstMidiType; | |||
midiEvents[1].byteSize = sizeof(VstMidiEvent); | |||
midiEvents[1].midiData[0] = MIDI_STATUS_CONTROL_CHANGE + cin_channel; | |||
midiEvents[1].midiData[0] = MIDI_STATUS_CONTROL_CHANGE + m_ctrlInChannel; | |||
midiEvents[1].midiData[1] = MIDI_CONTROL_ALL_NOTES_OFF; | |||
midiEventCount = 2; | |||
@@ -1051,7 +1051,7 @@ public: | |||
} | |||
else | |||
{ | |||
for (i=0; i < aout.count; i++) | |||
for (i=0; i < aOut.count; i++) | |||
memset(outBuffer[i], 0, sizeof(float)*frames); | |||
#if ! VST_FORCE_DEPRECATED | |||
@@ -1076,24 +1076,24 @@ public: | |||
if (m_active) | |||
{ | |||
bool do_drywet = (m_hints & PLUGIN_CAN_DRYWET) > 0 && x_drywet != 1.0; | |||
bool do_volume = (m_hints & PLUGIN_CAN_VOLUME) > 0 && x_vol != 1.0; | |||
bool do_balance = (m_hints & PLUGIN_CAN_BALANCE) > 0 && (x_bal_left != -1.0 || x_bal_right != 1.0); | |||
bool do_drywet = (m_hints & PLUGIN_CAN_DRYWET) > 0 && x_dryWet != 1.0; | |||
bool do_volume = (m_hints & PLUGIN_CAN_VOLUME) > 0 && x_volume != 1.0; | |||
bool do_balance = (m_hints & PLUGIN_CAN_BALANCE) > 0 && (x_balanceLeft != -1.0 || x_balanceRight != 1.0); | |||
double bal_rangeL, bal_rangeR; | |||
float oldBufLeft[do_balance ? frames : 0]; | |||
for (i=0; i < aout.count; i++) | |||
for (i=0; i < aOut.count; i++) | |||
{ | |||
// Dry/Wet | |||
if (do_drywet || do_volume) | |||
{ | |||
for (k=0; k < frames; k++) | |||
{ | |||
if (aout.count == 1) | |||
outBuffer[i][k] = (outBuffer[i][k]*x_drywet)+(inBuffer[0][k]*(1.0-x_drywet)); | |||
if (aOut.count == 1) | |||
outBuffer[i][k] = (outBuffer[i][k]*x_dryWet)+(inBuffer[0][k]*(1.0-x_dryWet)); | |||
else | |||
outBuffer[i][k] = (outBuffer[i][k]*x_drywet)+(inBuffer[i][k]*(1.0-x_drywet)); | |||
outBuffer[i][k] = (outBuffer[i][k]*x_dryWet)+(inBuffer[i][k]*(1.0-x_dryWet)); | |||
} | |||
} | |||
@@ -1103,8 +1103,8 @@ public: | |||
if (i%2 == 0) | |||
memcpy(&oldBufLeft, outBuffer[i], sizeof(float)*frames); | |||
bal_rangeL = (x_bal_left+1.0)/2; | |||
bal_rangeR = (x_bal_right+1.0)/2; | |||
bal_rangeL = (x_balanceLeft+1.0)/2; | |||
bal_rangeR = (x_balanceRight+1.0)/2; | |||
for (k=0; k < frames; k++) | |||
{ | |||
@@ -1127,7 +1127,7 @@ public: | |||
if (do_volume) | |||
{ | |||
for (k=0; k < frames; k++) | |||
outBuffer[i][k] *= x_vol; | |||
outBuffer[i][k] *= x_volume; | |||
} | |||
// Output VU | |||
@@ -1141,7 +1141,7 @@ public: | |||
else | |||
{ | |||
// disable any output sound if not active | |||
for (i=0; i < aout.count; i++) | |||
for (i=0; i < aOut.count; i++) | |||
memset(outBuffer[i], 0.0f, sizeof(float)*frames); | |||
aouts_peak_tmp[0] = 0.0; | |||
@@ -150,6 +150,22 @@ void osc_send_midi(const CarlaOscData* const oscData, const uint8_t buf[4]) | |||
} | |||
} | |||
static inline | |||
void osc_send_sample_rate(const CarlaOscData* const oscData, const float sampleRate) | |||
{ | |||
Q_ASSERT(oscData && oscData->path); | |||
Q_ASSERT(sampleRate >= 0.0f); | |||
qDebug("osc_send_sample_rate(path:\"%s\", %f)", oscData->path, sampleRate); | |||
if (oscData->target) | |||
{ | |||
char targetPath[strlen(oscData->path)+12]; | |||
strcpy(targetPath, oscData->path); | |||
strcat(targetPath, "/sample_rate"); | |||
lo_send(oscData->target, targetPath, "f", sampleRate); | |||
} | |||
} | |||
#ifdef BUILD_BRIDGE | |||
static inline | |||
void osc_send_update(const CarlaOscData* const oscData, const char* const url) | |||
@@ -1298,23 +1298,23 @@ class CarlaMainW(QMainWindow, ui_carla.Ui_CarlaMainW): | |||
print("DEBUG :: %i, %i, %i, %f)" % (plugin_id, value1, value2, value3)) | |||
@pyqtSlot(int, int, float) | |||
def slot_handleParameterCallback(self, plugin_id, parameter_id, value): | |||
pwidget = self.m_plugin_list[plugin_id] | |||
def slot_handleParameterCallback(self, pluginId, parameterId, value): | |||
pwidget = self.m_plugin_list[pluginId] | |||
if pwidget: | |||
pwidget.parameter_activity_timer = ICON_STATE_ON | |||
pwidget.m_parameterIconTimer = ICON_STATE_ON | |||
if parameter_id == PARAMETER_ACTIVE: | |||
if parameterId == PARAMETER_ACTIVE: | |||
pwidget.set_active((value > 0.0), True, False) | |||
elif parameter_id == PARAMETER_DRYWET: | |||
elif parameterId == PARAMETER_DRYWET: | |||
pwidget.set_drywet(value * 1000, True, False) | |||
elif parameter_id == PARAMETER_VOLUME: | |||
elif parameterId == PARAMETER_VOLUME: | |||
pwidget.set_volume(value * 1000, True, False) | |||
elif parameter_id == PARAMETER_BALANCE_LEFT: | |||
elif parameterId == PARAMETER_BALANCE_LEFT: | |||
pwidget.set_balance_left(value * 1000, True, False) | |||
elif parameter_id == PARAMETER_BALANCE_RIGHT: | |||
elif parameterId == PARAMETER_BALANCE_RIGHT: | |||
pwidget.set_balance_right(value * 1000, True, False) | |||
elif parameter_id >= 0: | |||
pwidget.edit_dialog.set_parameter_to_update(parameter_id) | |||
elif parameterId >= 0: | |||
pwidget.edit_dialog.set_parameter_to_update(parameterId) | |||
@pyqtSlot(int, int) | |||
def slot_handleProgramCallback(self, plugin_id, program_id): | |||