Browse Source

More work for Carla-Control, still unfinished

tags/v0.9.0
falkTX 11 years ago
parent
commit
51d76821cf
6 changed files with 177 additions and 118 deletions
  1. +2
    -2
      c++/carla-backend/carla_engine.cpp
  2. +12
    -0
      c++/carla-backend/carla_osc.cpp
  3. +22
    -16
      c++/carla-backend/carla_plugin.h
  4. +125
    -94
      src/carla_control.py
  5. +4
    -1
      src/catarina.py
  6. +12
    -5
      src/shared_carla.py

+ 2
- 2
c++/carla-backend/carla_engine.cpp View File

@@ -1505,7 +1505,7 @@ void CarlaEngine::osc_send_control_note_off(const int32_t pluginId, const int32_

void CarlaEngine::osc_send_control_set_input_peak_value(const int32_t pluginId, const int32_t portId, const double value)
{
qDebug("CarlaEngine::osc_send_control_set_input_peak_value(%i, %i, %g)", pluginId, portId, value);
//qDebug("CarlaEngine::osc_send_control_set_input_peak_value(%i, %i, %g)", pluginId, portId, value);
Q_ASSERT(m_oscData);
Q_ASSERT(pluginId >= 0 && pluginId < m_maxPluginNumber);
Q_ASSERT(portId == 1 || portId == 2);
@@ -1521,7 +1521,7 @@ void CarlaEngine::osc_send_control_set_input_peak_value(const int32_t pluginId,

void CarlaEngine::osc_send_control_set_output_peak_value(const int32_t pluginId, const int32_t portId, const double value)
{
qDebug("CarlaEngine::osc_send_control_set_output_peak_value(%i, %i, %g)", pluginId, portId, value);
//qDebug("CarlaEngine::osc_send_control_set_output_peak_value(%i, %i, %g)", pluginId, portId, value);
Q_ASSERT(m_oscData);
Q_ASSERT(pluginId >= 0 && pluginId < m_maxPluginNumber);
Q_ASSERT(portId == 1 || portId == 2);


+ 12
- 0
c++/carla-backend/carla_osc.cpp View File

@@ -524,6 +524,12 @@ int CarlaOsc::handleMsgSetProgram(CARLA_OSC_HANDLE_ARGS2)
const int32_t index = argv[0]->i;
plugin->setProgram(index, true, false, true, true);

if (index >= 0)
{
for (uint32_t i=0; i < plugin->parameterCount(); i++)
engine->osc_send_control_set_parameter_value(plugin->id(), i, plugin->getParameterValue(i));
}

return 0;
}

@@ -535,6 +541,12 @@ int CarlaOsc::handleMsgSetMidiProgram(CARLA_OSC_HANDLE_ARGS2)
const int32_t index = argv[0]->i;
plugin->setMidiProgram(index, true, false, true, true);

if (index >= 0)
{
for (uint32_t i=0; i < plugin->parameterCount(); i++)
engine->osc_send_control_set_parameter_value(plugin->id(), i, plugin->getParameterValue(i));
}

return 0;
}



+ 22
- 16
c++/carla-backend/carla_plugin.h View File

@@ -1166,13 +1166,6 @@ public:
if (sendGui && index >= 0)
uiProgramChange(index);

#ifndef BUILD_BRIDGE
if (sendOsc)
x_engine->osc_send_control_set_program(m_id, index);
#else
Q_UNUSED(sendOsc);
#endif

// Change default parameter values
if (index >= 0)
{
@@ -1183,11 +1176,21 @@ public:

#ifndef BUILD_BRIDGE
if (sendOsc)
{
x_engine->osc_send_control_set_default_value(m_id, i, param.ranges[i].def);
x_engine->osc_send_control_set_parameter_value(m_id, i, param.ranges[i].def);
}
#endif
}
}

#ifndef BUILD_BRIDGE
if (sendOsc)
x_engine->osc_send_control_set_program(m_id, index);
#else
Q_UNUSED(sendOsc);
#endif

if (sendCallback)
x_engine->callback(CALLBACK_PROGRAM_CHANGED, m_id, index, 0, 0.0);

@@ -1220,13 +1223,6 @@ public:
if (sendGui && index >= 0)
uiMidiProgramChange(index);

#ifndef BUILD_BRIDGE
if (sendOsc)
x_engine->osc_send_control_set_midi_program(m_id, index);
#else
Q_UNUSED(sendOsc);
#endif

// Change default parameter values (sound banks never change defaults)
if (index >= 0 && m_type != PLUGIN_GIG && m_type != PLUGIN_SF2 && m_type != PLUGIN_SFZ)
{
@@ -1237,11 +1233,21 @@ public:

#ifndef BUILD_BRIDGE
if (sendOsc)
{
x_engine->osc_send_control_set_default_value(m_id, i, param.ranges[i].def);
x_engine->osc_send_control_set_parameter_value(m_id, i, param.ranges[i].def);
}
#endif
}
}

#ifndef BUILD_BRIDGE
if (sendOsc)
x_engine->osc_send_control_set_midi_program(m_id, index);
#else
Q_UNUSED(sendOsc);
#endif

if (sendCallback)
x_engine->callback(CALLBACK_MIDI_PROGRAM_CHANGED, m_id, index, 0, 0.0);

@@ -1466,6 +1472,8 @@ public:
#else
x_engine->osc_send_control_set_parameter_data(m_id, i, param.data[i].type, param.data[i].hints, bufName, bufUnit, getParameterValue(i));
x_engine->osc_send_control_set_parameter_ranges(m_id, i, param.ranges[i].min, param.ranges[i].max, param.ranges[i].def, param.ranges[i].step, param.ranges[i].stepSmall, param.ranges[i].stepLarge);
x_engine->osc_send_control_set_parameter_midi_cc(m_id, i, param.data[i].midiCC);
x_engine->osc_send_control_set_parameter_midi_channel(m_id, i, param.data[i].midiChannel);
x_engine->osc_send_control_set_parameter_value(m_id, i, getParameterValue(i));
#endif
}
@@ -1513,9 +1521,7 @@ public:

#ifndef BUILD_BRIDGE
x_engine->osc_send_control_add_plugin_end(m_id);
#endif

#ifndef BUILD_BRIDGE
// Internal Parameters
{
x_engine->osc_send_control_set_parameter_value(m_id, PARAMETER_ACTIVE, m_active ? 1.0 : 0.0);


+ 125
- 94
src/carla_control.py View File

@@ -109,8 +109,10 @@ class ControlPluginInfo(object):
'parameterRangeS',
'parameterValueS',
'programCount',
'programCurrent',
'programNameS',
'midiProgramCount',
'midiProgramCurrent',
'midiProgramDataS',
'inPeak',
'outPeak'
@@ -122,24 +124,29 @@ class Host(object):
object.__init__(self)

self.pluginInfo = []
for x in range(MAX_PLUGINS):
info = ControlPluginInfo()
info.pluginInfo = PluginInfo
info.pluginRealName = None
info.audioCountInfo = PortCountInfo
info.midiCountInfo = PortCountInfo
info.parameterCountInfo = PortCountInfo
info.parameterInfoS = []
info.parameterDataS = []
info.parameterRangeS = []
info.parameterValueS = []
info.programCount = 0
info.programNameS = []
info.midiProgramCount = 0
info.midiProgramDataS = []
info.inPeak = [0.0, 0.0]
info.outPeak = [0.0, 0.0]
self.pluginInfo.append(info)

for i in range(MAX_PLUGINS):
self.pluginInfo.append(ControlPluginInfo())
self._clear(i)

def _clear(self, index):
self.pluginInfo[index].pluginInfo = PluginInfo
self.pluginInfo[index].pluginRealName = None
self.pluginInfo[index].audioCountInfo = PortCountInfo
self.pluginInfo[index].midiCountInfo = PortCountInfo
self.pluginInfo[index].parameterCountInfo = PortCountInfo
self.pluginInfo[index].parameterInfoS = []
self.pluginInfo[index].parameterDataS = []
self.pluginInfo[index].parameterRangeS = []
self.pluginInfo[index].parameterValueS = []
self.pluginInfo[index].programCount = 0
self.pluginInfo[index].programCurrent = -1
self.pluginInfo[index].programNameS = []
self.pluginInfo[index].midiProgramCount = 0
self.pluginInfo[index].midiProgramCurrent = -1
self.pluginInfo[index].midiProgramDataS = []
self.pluginInfo[index].inPeak = [0.0, 0.0]
self.pluginInfo[index].outPeak = [0.0, 0.0]

def _set_pluginInfo(self, index, info):
self.pluginInfo[index].pluginInfo = info
@@ -171,6 +178,21 @@ class Host(object):
def _set_parameterValue(self, index, paramIndex, value):
self.pluginInfo[index].parameterValueS[paramIndex] = value

def _set_parameterDefaultValue(self, index, paramIndex, value):
self.pluginInfo[index].parameterRangeS[paramIndex]['def'] = value

def _set_parameterMidiCC(self, index, paramIndex, cc):
self.pluginInfo[index].parameterDataS[paramIndex]['midiCC'] = cc

def _set_parameterMidiChannel(self, index, paramIndex, channel):
self.pluginInfo[index].parameterDataS[paramIndex]['midiChannel'] = channel

def _set_currentProgram(self, index, pIndex):
self.pluginInfo[index].programCurrent = pIndex

def _set_currentMidiProgram(self, index, mpIndex):
self.pluginInfo[index].midiProgramCurrent = mpIndex

def _append_parameterInfoS(self, index, data):
self.pluginInfo[index].parameterInfoS.append(data)

@@ -250,10 +272,10 @@ class Host(object):
return self.pluginInfo[plugin_id].pluginRealName

def get_current_program_index(self, plugin_id):
return -1
return self.pluginInfo[plugin_id].programCurrent

def get_current_midi_program_index(self, plugin_id):
return -1
return self.pluginInfo[plugin_id].midiProgramCurrent

def get_default_parameter_value(self, plugin_id, parameter_id):
return self.pluginInfo[plugin_id].parameterRangeS[parameter_id]['def']
@@ -419,7 +441,7 @@ class ControlServer(ServerThread):
@make_method('/carla-control/set_midi_program_data', 'iiiiis')
def set_midi_program_data_callback(self, path, args):
pluginId, index, bank, program, name = args
self.parent.emit(SIGNAL("SetMidiProgramData(int, int, int, int, int, QString)"), pluginId, index, bank, program, name)
self.parent.emit(SIGNAL("SetMidiProgramData(int, int, int, int, QString)"), pluginId, index, bank, program, name)

@make_method('/carla-control/set_input_peak_value', 'iid')
def set_input_peak_value_callback(self, path, args):
@@ -461,7 +483,7 @@ class CarlaAboutW(QDialog, ui_carla_about.Ui_CarlaAboutW):
"<br>Copyright (C) 2011-2012 falkTX<br>"
"" % VERSION))

self.l_extended.setVisible(False)
self.l_extended.setVisible(False) # TODO - write about this special OSC version

self.tabWidget.removeTab(1)
self.tabWidget.removeTab(1)
@@ -532,7 +554,7 @@ class CarlaControlW(QMainWindow, ui_carla_control.Ui_CarlaControlW):
self.connect(self, SIGNAL("SetProgramName(int, int, QString)"), SLOT("slot_handleSetProgramName(int, int, QString)"))
self.connect(self, SIGNAL("SetMidiProgram(int, int)"), SLOT("slot_handleSetMidiProgram(int, int)"))
self.connect(self, SIGNAL("SetMidiProgramCount(int, int)"), SLOT("slot_handleSetMidiProgramCount(int, int)"))
self.connect(self, SIGNAL("SetMidiProgramData(int, int, int, int, int, QString)"), SLOT("slot_handleSetMidiProgramData(int, int, int, int, int, QString)"))
self.connect(self, SIGNAL("SetMidiProgramData(int, int, int, int, QString)"), SLOT("slot_handleSetMidiProgramData(int, int, int, int, QString)"))
self.connect(self, SIGNAL("SetInputPeakValue(int, int, double)"), SLOT("slot_handleSetInputPeakValue(int, int, double)"))
self.connect(self, SIGNAL("SetOutputPeakValue(int, int, double)"), SLOT("slot_handleSetOutputPeakValue(int, int, double)"))
self.connect(self, SIGNAL("NoteOn(int, int, int, int)"), SLOT("slot_handleNoteOn(int, int, int, int)"))
@@ -542,6 +564,11 @@ class CarlaControlW(QMainWindow, ui_carla_control.Ui_CarlaControlW):
self.TIMER_GUI_STUFF = self.startTimer(50) # Peaks
self.TIMER_GUI_STUFF2 = self.startTimer(50 * 2) # LEDs and edit dialog

#def func_remove_all(self):
#for i in range(MAX_PLUGINS):
#if (self.plugin_list[i] != None):
#self.handleRemovePluginCallback(i)

@pyqtSlot()
def slot_doConnect(self):
global lo_target, lo_targetName
@@ -549,7 +576,7 @@ class CarlaControlW(QMainWindow, ui_carla_control.Ui_CarlaControlW):
if lo_target and self.lo_server:
urlText = self.lo_address
else:
urlText = "osc.udp://falkTX-Laptop:16963/Carla" #"osc.udp://127.0.0.1:19000/Carla"
urlText = "osc.udp://falkTX-Laptop:16215/Carla" #"osc.udp://127.0.0.1:19000/Carla"

askValue = QInputDialog.getText(self, self.tr("Carla Control - Connect"), self.tr("Address"), text=urlText)

@@ -587,11 +614,6 @@ class CarlaControlW(QMainWindow, ui_carla_control.Ui_CarlaControlW):
def slot_aboutCarlaControl(self):
CarlaAboutW(self).exec_()

#def func_remove_all(self):
#for i in range(MAX_PLUGINS):
#if (self.plugin_list[i] != None):
#self.handleRemovePluginCallback(i)

@pyqtSlot(int, str)
def slot_handleAddPluginStart(self, pluginId, pluginName):
self.m_lastPluginName = pluginName
@@ -679,15 +701,22 @@ class CarlaControlW(QMainWindow, ui_carla_control.Ui_CarlaControlW):

Carla.Host._append_parameterRangeS(pluginId, ranges)

#@pyqtSlot(int, int, int)
#def slot_handleSetParameterMidiCC(self, pluginId, index, cc):
#info =
#Carla.Host._set_(pluginId, info)
@pyqtSlot(int, int, int)
def slot_handleSetParameterMidiCC(self, pluginId, index, cc):
Carla.Host._set_parameterMidiCC(pluginId, index, cc)

#@pyqtSlot(int, int, int)
#def slot_handleSetParameterMidiChannel(self, pluginId, index, channel):
#info =
#Carla.Host._set_(pluginId, info)
pwidget = self.m_plugin_list[pluginId]
if pwidget:
pwidget.edit_dialog.set_parameter_midi_cc(index, cc, True)

@pyqtSlot(int, int, int)
def slot_handleSetParameterMidiChannel(self, pluginId, index, channel):
channel += 1
Carla.Host._set_parameterMidiChannel(pluginId, index, channel)

pwidget = self.m_plugin_list[pluginId]
if pwidget:
pwidget.edit_dialog.set_parameter_midi_channel(index, channel, True)

@pyqtSlot(int, int, float)
def slot_handleSetParameterValue(self, pluginId, parameterId, value):
@@ -716,6 +745,50 @@ class CarlaControlW(QMainWindow, ui_carla_control.Ui_CarlaControlW):
Carla.Host._set_parameterValue(pluginId, parameterId, value)
pwidget.edit_dialog.set_parameter_to_update(parameterId)

@pyqtSlot(int, int, float)
def slot_handleSetDefaultValue(self, pluginId, parameterId, value):
Carla.Host._set_parameterDefaultValue(pluginId, parameterId, value)

#pwidget = self.m_plugin_list[pluginId]
#if pwidget:
#pwidget.edit_dialog.set_parameter_default_value(parameterId, value)

@pyqtSlot(int, int)
def slot_handleSetProgram(self, pluginId, index):
Carla.Host._set_currentProgram(pluginId, index)

pwidget = self.m_plugin_list[pluginId]
if pwidget:
pwidget.edit_dialog.set_program(index)

@pyqtSlot(int, int)
def slot_handleSetProgramCount(self, pluginId, count):
Carla.Host._set_programCount(pluginId, count)

@pyqtSlot(int, int, str)
def slot_handleSetProgramName(self, pluginId, index, name):
Carla.Host._append_programNameS(pluginId, name)

@pyqtSlot(int, int)
def slot_handleSetMidiProgram(self, pluginId, index):
Carla.Host._set_currentMidiProgram(pluginId, index)

pwidget = self.m_plugin_list[pluginId]
if pwidget:
pwidget.edit_dialog.set_midi_program(index)

@pyqtSlot(int, int)
def slot_handleSetMidiProgramCount(self, pluginId, count):
Carla.Host._set_midiProgramCount(pluginId, count)

@pyqtSlot(int, int, int, int, str)
def slot_handleSetMidiProgramData(self, pluginId, index, bank, program, name):
data = deepcopy(midi_program_t)
data['bank'] = bank
data['program'] = program
data['label'] = name
Carla.Host._append_midiProgramDataS(pluginId, data)

@pyqtSlot(int, int, float)
def slot_handleSetInputPeakValue(self, pluginId, portId, value):
Carla.Host._set_inPeak(pluginId, portId-1, value)
@@ -724,63 +797,21 @@ class CarlaControlW(QMainWindow, ui_carla_control.Ui_CarlaControlW):
def slot_handleSetOutputPeakValue(self, pluginId, portId, value):
Carla.Host._set_outPeak(pluginId, portId-1, value)

#self.connect(self, SIGNAL("SetParameterValue(int, int, double)"), SLOT("slot_handleSetParameterValue(int, int, double)"))
#self.connect(self, SIGNAL("SetDefaultValue(int, int, double)"), SLOT("slot_handleSetDefaultValue(int, int, double)"))
#self.connect(self, SIGNAL("SetProgram(int, int)"), SLOT("slot_handleSetProgram(int, int)"))
#self.connect(self, SIGNAL("SetProgramCount(int, int)"), SLOT("slot_handleSetProgramCount(int, int)"))
#self.connect(self, SIGNAL("SetProgramName(int, int, QString)"), SLOT("slot_handleSetProgramName(int, int, QString)"))
#self.connect(self, SIGNAL("SetMidiProgram(int, int)"), SLOT("slot_handleSetMidiProgram(int, int)"))
#self.connect(self, SIGNAL("SetMidiProgramCount(int, int)"), SLOT("slot_handleSetMidiProgramCount(int, int)"))
#self.connect(self, SIGNAL("SetMidiProgramData(int, int, int, int, int, QString)"), SLOT("slot_handleSetMidiProgramData(int, int, int, int, int, QString)"))

#self.connect(self, SIGNAL("NoteOn(int, int, int, int)"), SLOT("slot_handleNoteOn(int, int, int, int)"))
#self.connect(self, SIGNAL("NoteOff(int, int, int)"), SLOT("slot_handleNoteOff(int, int, int)"))
#self.connect(self, SIGNAL("Exit()"), SLOT("slot_handleExit()"))

#def handleSetDefaultValueCallback(self, plugin_id, param_id, value):
#pwidget = self.plugin_list[plugin_id]
#if (pwidget):
#pwidget.edit_dialog.set_parameter_default_value(param_id, value)

#def handleSetProgramCallback(self, plugin_id, program_id):
#pwidget = self.plugin_list[plugin_id]
#if (pwidget):
#pwidget.edit_dialog.set_program(program_id)

#def handleSetProgramCountCallback(self, plugin_id, program_count):
#pwidget = self.plugin_list[plugin_id]
#if (pwidget):
#pwidget.edit_dialog.set_program_count(program_count)

#def handleSetProgramNameCallback(self, plugin_id, program_id, program_name):
#pwidget = self.plugin_list[plugin_id]
#if (pwidget):
#pwidget.edit_dialog.set_program_name(program_id, program_name)

#def handleSetMidiProgramCallback(self, plugin_id, midi_program_id):
#pwidget = self.plugin_list[plugin_id]
#if (pwidget):
#pwidget.edit_dialog.set_midi_program(midi_program_id)

#def handleSetMidiProgramCountCallback(self, plugin_id, midi_program_count):
#pwidget = self.plugin_list[plugin_id]
#if (pwidget):
#pwidget.edit_dialog.set_midi_program_count(midi_program_count)

#def handleSetMidiProgramDataCallback(self, plugin_id, midi_program_id, bank_id, program_id, midi_program_name):
#pwidget = self.plugin_list[plugin_id]
#if (pwidget):
#pwidget.edit_dialog.set_midi_program_data(midi_program_id, bank_id, program_id, midi_program_name)

#def handleNoteOnCallback(self, plugin_id, note, velo):
#pwidget = self.plugin_list[plugin_id]
#if (pwidget):
#pwidget.edit_dialog.keyboard.noteOn(note, False)

#def handleNoteOffCallback(self, plugin_id, note, velo):
#pwidget = self.plugin_list[plugin_id]
#if (pwidget):
#pwidget.edit_dialog.keyboard.noteOff(note, False)
@pyqtSlot(int, int, int, int)
def slot_handleNoteOn(self, pluginId, channel, note, velo):
pwidget = self.m_plugin_list[pluginId]
if pwidget:
pwidget.edit_dialog.keyboard.sendNoteOn(note, False)

@pyqtSlot(int, int, int)
def slot_handleNoteOff(self, pluginId, channel, note):
pwidget = self.m_plugin_list[pluginId]
if pwidget:
pwidget.edit_dialog.keyboard.sendNoteOff(note, False)

@pyqtSlot()
def slot_handleExit(self):
pass

#def handleExitCallback(self):
#self.func_remove_all()


+ 4
- 1
src/catarina.py View File

@@ -1275,7 +1275,10 @@ if __name__ == '__main__':
gui.show()

if len(app.arguments()) > 1:
gui.loadFile(app.arguments()[1])
if not app.arguments()[0].endswith("Python.exe"):
gui.loadFile(app.arguments()[1])
elif len(app.arguments()) > 2:
gui.loadFile(app.arguments()[2])

# App-Loop
sys.exit(app.exec_())

+ 12
- 5
src/shared_carla.py View File

@@ -512,7 +512,7 @@ class PluginParameter(QWidget, ui_carla_parameter.Ui_PluginParameter):

def set_parameter_midi_channel(self, channel):
self.m_midiChannel = channel
self.sb_channel.setValue(channel - 1)
self.sb_channel.setValue(channel)

def add_MIDI_CCs_to_ComboBox(self):
for MIDI_CC in MIDI_CC_LIST:
@@ -929,16 +929,23 @@ class PluginEdit(QDialog, ui_carla_edit.Ui_PluginEdit):
if index not in self.m_parameterIdsToUpdate:
self.m_parameterIdsToUpdate.append(index)

def set_parameter_midi_channel(self, index, midiChannel):
#def set_parameter_default_value(self, index, value):
#self.m_parameterList[index].set_default_value(value)

def set_parameter_midi_channel(self, index, midiChannel, blockSignals = False):
for paramType, paramId, paramWidget in self.m_parameterList:
if paramId == index:
if (blockSignals): paramWidget.blockSignals(True)
paramWidget.set_parameter_midi_channel(midiChannel)
if (blockSignals): paramWidget.blockSignals(False)
break

def set_parameter_midi_cc(self, index, midiCC):
def set_parameter_midi_cc(self, index, midiCC, blockSignals = False):
for paramType, paramId, paramWidget in self.m_parameterList:
if paramId == index:
if (blockSignals): paramWidget.blockSignals(True)
paramWidget.set_parameter_midi_cc(midiCC)
if (blockSignals): paramWidget.blockSignals(False)
break

def set_program(self, index):
@@ -1114,7 +1121,7 @@ class PluginEdit(QDialog, ui_carla_edit.Ui_PluginEdit):

@pyqtSlot(int, int)
def slot_parameterMidiChannelChanged(self, parameter_id, channel):
Carla.Host.set_parameter_midi_channel(self.m_pluginId, parameter_id, channel - 1)
Carla.Host.set_parameter_midi_channel(self.m_pluginId, parameter_id, channel)

@pyqtSlot(int, int)
def slot_parameterMidiCcChanged(self, parameter_id, cc_index):
@@ -1789,7 +1796,7 @@ class PluginWidget(QFrame, ui_carla_plugin.Ui_PluginWidget):

Carla.Host.set_parameter_value(self.m_pluginId, index, parameter['value'])
Carla.Host.set_parameter_midi_cc(self.m_pluginId, index, parameter['midiCC'])
Carla.Host.set_parameter_midi_channel(self.m_pluginId, index, parameter['midiChannel'] - 1)
Carla.Host.set_parameter_midi_channel(self.m_pluginId, index, parameter['midiChannel'])

else:
print("Could not set parameter data for '%s')" % parameter['name'])


Loading…
Cancel
Save