From 3fbbfb52ae5576b559bafd4803d63b2db7cbd783 Mon Sep 17 00:00:00 2001 From: falkTX Date: Thu, 8 Mar 2012 01:01:26 +0000 Subject: [PATCH] Fix carla-control related issues --- src/carla_control.py | 40 +++++++++++++++++++++++----------------- src/digitalpeakmeter.py | 2 +- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/src/carla_control.py b/src/carla_control.py index 14977ea..df17388 100644 --- a/src/carla_control.py +++ b/src/carla_control.py @@ -20,11 +20,12 @@ MAX_MIDI_EVENTS = 512 # plugin hints PLUGIN_HAS_GUI = 0x01 -PLUGIN_IS_SYNTH = 0x02 -PLUGIN_USES_CHUNKS = 0x04 -PLUGIN_CAN_DRYWET = 0x08 -PLUGIN_CAN_VOL = 0x10 -PLUGIN_CAN_BALANCE = 0x20 +PLUGIN_IS_BRIDGE = 0x02 +PLUGIN_IS_SYNTH = 0x04 +PLUGIN_USES_CHUNKS = 0x08 +PLUGIN_CAN_DRYWET = 0x10 +PLUGIN_CAN_VOL = 0x20 +PLUGIN_CAN_BALANCE = 0x40 # parameter hints PARAMETER_IS_ENABLED = 0x01 @@ -40,6 +41,7 @@ PLUGIN_DSSI = 2 PLUGIN_LV2 = 3 PLUGIN_VST = 4 PLUGIN_WINVST = 5 +PLUGIN_SF2 = 6 # enum ParameterType PARAMETER_UNKNOWN = 0 @@ -174,7 +176,7 @@ class ControlServer(ServerThread): self.parent.emit(SIGNAL("SetMidiProgramCountCallback(int, int)"), plugin_id, midi_program_count) @make_method('/carla-control/set_midi_program_data', 'iiiiis') - def set_program_name_callback(self, path, args): + def set_midi_program_data(self, path, args): plugin_id, midi_program_id, bank_id, program_id, program_name = args q_program_name = QString(program_name) self.parent.emit(SIGNAL("SetMidiProgramNameCallback(int, int, int, int, int, QString)"), plugin_id, midi_program_id, bank_id, program_id, q_program_name) @@ -247,7 +249,7 @@ class Host(object): osc_control = "/%s/%i/note_on" % (carla_name, plugin_id) lo_send(lo_target, osc_control, note, velo) - def note_off(self, plugin_id, param_id, value): + def note_off(self, plugin_id, note, velo): global carla_name, to_target osc_control = "/%s/%i/note_off" % (carla_name, plugin_id) lo_send(lo_target, osc_control, note, velo) @@ -617,11 +619,11 @@ class PluginEdit(QDialog, ui_carla_edit.Ui_PluginEdit): for i in range(midi_program_count): self.cb_midi_programs.addItem("") - if (midi_old_current < 0): - midi_old_current = 0 + if (old_midi_current < 0): + old_midi_current = 0 - self.cur_midi_program_index = old_current - self.set_midi_program(old_current) + self.cur_midi_program_index = old_midi_current + self.set_midi_program(old_midi_current) else: self.cb_midi_programs.setEnabled(False) @@ -647,10 +649,10 @@ class PluginEdit(QDialog, ui_carla_edit.Ui_PluginEdit): self.cur_midi_program_index = index def handleNoteOn(self, note): - NativeHost.send_midi_note(self.plugin_id, True, note, 100) + NativeHost.note_on(self.plugin_id, note, 100) def handleNoteOff(self, note): - NativeHost.send_midi_note(self.plugin_id, False, note, 100) + NativeHost.note_off(self.plugin_id, note, 100) def handleNotesOn(self): self.parent().led_midi.setChecked(True) @@ -741,6 +743,8 @@ class PluginWidget(QFrame, ui_carla_plugin.Ui_PluginWidget): self.parameter_activity_timer = None self.ptype = PLUGIN_NONE + self.ains = 0 + self.aouts = 0 self.atotals = 0 # Fake effect @@ -859,6 +863,8 @@ class PluginWidget(QFrame, ui_carla_plugin.Ui_PluginWidget): def set_ports(self, ains, aouts, mins, mouts, cins, couts, ctotals): self.edit_dialog.set_ports(ains, aouts, mins, mouts, cins, couts, ctotals) + self.ains = ains + self.aouts = aouts self.atotals = ains+aouts peaks_in = ains @@ -941,25 +947,25 @@ class PluginWidget(QFrame, ui_carla_plugin.Ui_PluginWidget): self.led_control.setChecked(False) self.parameter_activity_timer = None - if (self.peak_in_values[0] != None): + if (self.peak_in_values[0] != None and self.ains >= 1): peak1_in = self.peak_in_values[0] self.peak_in.displayMeter(1, peak1_in) else: peak1_in = 0.0 - if (self.peak_in_values[1] != None): + if (self.peak_in_values[1] != None and self.ains >= 2): peak2_in = self.peak_in_values[1] self.peak_in.displayMeter(2, peak2_in) else: peak2_in = 0.0 - if (self.peak_out_values[0] != None): + if (self.peak_out_values[0] != None and self.aouts >= 1): peak1_out = self.peak_out_values[0] self.peak_out.displayMeter(1, peak1_out) else: peak1_out = 0.0 - if (self.peak_out_values[1] != None): + if (self.peak_out_values[1] != None and self.aouts >= 2): peak2_out = self.peak_out_values[1] self.peak_out.displayMeter(2, peak2_out) else: diff --git a/src/digitalpeakmeter.py b/src/digitalpeakmeter.py index fc6a459..1685c56 100644 --- a/src/digitalpeakmeter.py +++ b/src/digitalpeakmeter.py @@ -89,7 +89,7 @@ class DigitalPeakMeter(QWidget): def displayMeter(self, meter_n, level): if (meter_n > self.n_channels): - qCritical("DigitalPeakMeter::displayMeter(%i, %f) - Invalid meter number", meter_n, level) + qCritical("DigitalPeakMeter::displayMeter(%i, %f) - Invalid meter number" % (meter_n, level)) return if (level < 0.0): -- 2.11.4.GIT