Browse Source

Force update of UI paramters when a program changes, FIXME later

tags/1.9.5
falkTX 10 years ago
parent
commit
ba3c0323be
2 changed files with 42 additions and 5 deletions
  1. +20
    -0
      source/carla_skin.py
  2. +22
    -5
      source/carla_widgets.py

+ 20
- 0
source/carla_skin.py View File

@@ -224,6 +224,7 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta):
if self.fPluginId == pluginId: if self.fPluginId == pluginId:
self.setProgram(index, True) self.setProgram(index, True)



@pyqtSlot(int, int) @pyqtSlot(int, int)
def slot_handleMidiProgramChangedCallback(self, pluginId, index): def slot_handleMidiProgramChangedCallback(self, pluginId, index):
if self.fPluginId == pluginId: if self.fPluginId == pluginId:
@@ -410,6 +411,8 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta):
self.fParameterIconTimer = ICON_STATE_ON self.fParameterIconTimer = ICON_STATE_ON
self.editDialogProgramChanged(self.fPluginId, index) self.editDialogProgramChanged(self.fPluginId, index)


self.updateParameterValues()

def setMidiProgram(self, index, sendCallback): def setMidiProgram(self, index, sendCallback):
self.fEditDialog.setMidiProgram(index) self.fEditDialog.setMidiProgram(index)


@@ -417,6 +420,8 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta):
self.fParameterIconTimer = ICON_STATE_ON self.fParameterIconTimer = ICON_STATE_ON
self.editDialogMidiProgramChanged(self.fPluginId, index) self.editDialogMidiProgramChanged(self.fPluginId, index)


self.updateParameterValues()

#------------------------------------------------------------------ #------------------------------------------------------------------


def setOption(self, option, yesNo): def setOption(self, option, yesNo):
@@ -506,6 +511,9 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta):
self.cb_presets.setCurrentIndex(index) self.cb_presets.setCurrentIndex(index)
self.cb_presets.blockSignals(False) self.cb_presets.blockSignals(False)


# FIXME
self.updateParameterValues()

def editDialogMidiProgramChanged(self, pluginId, index): def editDialogMidiProgramChanged(self, pluginId, index):
if self.cb_presets is None: if self.cb_presets is None:
return return
@@ -514,6 +522,9 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta):
self.cb_presets.setCurrentIndex(index) self.cb_presets.setCurrentIndex(index)
self.cb_presets.blockSignals(False) self.cb_presets.blockSignals(False)


# FIXME
self.updateParameterValues()

def editDialogNotePressed(self, pluginId, note): def editDialogNotePressed(self, pluginId, note):
pass pass


@@ -678,6 +689,15 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta):
CustomMessageBox(self, QMessageBox.Warning, self.tr("Error"), self.tr("Operation failed"), CustomMessageBox(self, QMessageBox.Warning, self.tr("Error"), self.tr("Operation failed"),
self.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok) self.host.get_last_error(), QMessageBox.Ok, QMessageBox.Ok)


def updateParameterValues(self):
for paramIndex, paramWidget in self.fParameterList:
if paramIndex < 0:
continue

paramWidget.blockSignals(True)
paramWidget.setValue(self.host.get_current_parameter_value(self.fPluginId, paramIndex))
paramWidget.blockSignals(False)

#------------------------------------------------------------------ #------------------------------------------------------------------


@pyqtSlot(bool) @pyqtSlot(bool)


+ 22
- 5
source/carla_widgets.py View File

@@ -584,6 +584,8 @@ class PluginEdit(QDialog):
self.ui.b_save_state.clicked.connect(self.slot_stateSave) self.ui.b_save_state.clicked.connect(self.slot_stateSave)
self.ui.b_load_state.clicked.connect(self.slot_stateLoad) self.ui.b_load_state.clicked.connect(self.slot_stateLoad)


#host.ProgramChangedCallback.connect(self.slot_handleProgramChangedCallback)
#host.MidiProgramChangedCallback.connect(self.slot_handleMidiProgramChangedCallback)
host.NoteOnCallback.connect(self.slot_handleNoteOnCallback) host.NoteOnCallback.connect(self.slot_handleNoteOnCallback)
host.NoteOffCallback.connect(self.slot_handleNoteOffCallback) host.NoteOffCallback.connect(self.slot_handleNoteOffCallback)
host.UpdateCallback.connect(self.slot_handleUpdateCallback) host.UpdateCallback.connect(self.slot_handleUpdateCallback)
@@ -671,8 +673,9 @@ class PluginEdit(QDialog):


# Update all parameter values # Update all parameter values
for paramType, paramId, paramWidget in self.fParameterList: for paramType, paramId, paramWidget in self.fParameterList:
paramWidget.blockSignals(True)
paramWidget.setValue(self.host.get_current_parameter_value(self.fPluginId, paramId)) paramWidget.setValue(self.host.get_current_parameter_value(self.fPluginId, paramId))
paramWidget.update()
paramWidget.blockSignals(False)


self.fParametersToUpdate = [] self.fParametersToUpdate = []


@@ -1041,11 +1044,13 @@ class PluginEdit(QDialog):
self.ui.cb_programs.blockSignals(True) self.ui.cb_programs.blockSignals(True)
self.ui.cb_programs.setCurrentIndex(index) self.ui.cb_programs.setCurrentIndex(index)
self.ui.cb_programs.blockSignals(False) self.ui.cb_programs.blockSignals(False)
self._updateParameterValues()


def setMidiProgram(self, index): def setMidiProgram(self, index):
self.ui.cb_midi_programs.blockSignals(True) self.ui.cb_midi_programs.blockSignals(True)
self.ui.cb_midi_programs.setCurrentIndex(index) self.ui.cb_midi_programs.setCurrentIndex(index)
self.ui.cb_midi_programs.blockSignals(False) self.ui.cb_midi_programs.blockSignals(False)
self._updateParameterValues()


def setOption(self, option, yesNo): def setOption(self, option, yesNo):
if option == PLUGIN_OPTION_USE_CHUNKS: if option == PLUGIN_OPTION_USE_CHUNKS:
@@ -1155,11 +1160,13 @@ class PluginEdit(QDialog):
self.fParametersToUpdate = [] self.fParametersToUpdate = []


# Update parameter outputs # Update parameter outputs
for paramType, paramId, paramWidget in self.fParameterList:
if paramType != PARAMETER_OUTPUT:
continue
#for paramType, paramId, paramWidget in self.fParameterList:
#if paramType != PARAMETER_OUTPUT:
#continue


paramWidget.setValue(self.host.get_current_parameter_value(self.fPluginId, paramId))
#paramWidget.blockSignals(True)
#paramWidget.setValue(self.host.get_current_parameter_value(self.fPluginId, paramId))
#paramWidget.blockSignals(False)


#------------------------------------------------------------------ #------------------------------------------------------------------


@@ -1346,6 +1353,8 @@ class PluginEdit(QDialog):
if self.fParent is not None: if self.fParent is not None:
self.fParent.editDialogProgramChanged(self.fPluginId, index) self.fParent.editDialogProgramChanged(self.fPluginId, index)


self._updateParameterValues()

@pyqtSlot(int) @pyqtSlot(int)
def slot_midiProgramIndexChanged(self, index): def slot_midiProgramIndexChanged(self, index):
self.host.set_midi_program(self.fPluginId, index) self.host.set_midi_program(self.fPluginId, index)
@@ -1353,6 +1362,8 @@ class PluginEdit(QDialog):
if self.fParent is not None: if self.fParent is not None:
self.fParent.editDialogMidiProgramChanged(self.fPluginId, index) self.fParent.editDialogMidiProgramChanged(self.fPluginId, index)


self._updateParameterValues()

#------------------------------------------------------------------ #------------------------------------------------------------------


@pyqtSlot(int) @pyqtSlot(int)
@@ -1537,6 +1548,12 @@ class PluginEdit(QDialog):
if self.ui.cb_midi_programs.currentIndex() != mpIndex: if self.ui.cb_midi_programs.currentIndex() != mpIndex:
self.setMidiProgram(mpIndex) self.setMidiProgram(mpIndex)


def _updateParameterValues(self):
for paramType, paramId, paramWidget in self.fParameterList:
paramWidget.blockSignals(True)
paramWidget.setValue(self.host.get_current_parameter_value(self.fPluginId, paramId))
paramWidget.blockSignals(False)

#------------------------------------------------------------------ #------------------------------------------------------------------


def testTimer(self): def testTimer(self):


Loading…
Cancel
Save