Browse Source

Implement Plugin options on the GUI side

tags/1.9.4
falkTX 12 years ago
parent
commit
40df7bca3f
2 changed files with 260 additions and 206 deletions
  1. +204
    -192
      resources/ui/carla_edit.ui
  2. +56
    -14
      source/carla_shared.py

+ 204
- 192
resources/ui/carla_edit.ui View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>672</width>
<height>520</height>
<height>541</height>
</rect>
</property>
<property name="windowTitle">
@@ -302,28 +302,35 @@ Plugin Name
<item>
<widget class="QCheckBox" name="ch_force_stereo">
<property name="text">
<string>Force Stereo</string>
<string>Force stereo</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="ch_self_automation">
<widget class="QCheckBox" name="ch_map_program_changes">
<property name="text">
<string>Self-automation</string>
<string>Map Program changes</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="ch_use_chunks">
<property name="text">
<string>Use chunks</string>
<string>Use Chunks</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="ch_send_all_sound_off">
<widget class="QCheckBox" name="ch_send_control_changes">
<property name="text">
<string>Send All Sound/Notes Off</string>
<string>Send Control Changes</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="ch_send_channel_pressure">
<property name="text">
<string>Send Channel Pressure</string>
</property>
</widget>
</item>
@@ -341,6 +348,13 @@ Plugin Name
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="ch_send_all_sound_off">
<property name="text">
<string>Send All Sound/Notes Off</string>
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
@@ -349,203 +363,201 @@ Plugin Name
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<property name="topMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="PixmapDial" name="dial_vol">
<property name="minimumSize">
<size>
<width>34</width>
<height>34</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>34</width>
<height>34</height>
</size>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="statusTip">
<string>Output volume (100%)</string>
</property>
<property name="maximum">
<number>1270</number>
</property>
<property name="value">
<number>1000</number>
</property>
</widget>
</item>
<item>
<widget class="PixmapDial" name="dial_drywet">
<property name="minimumSize">
<size>
<width>34</width>
<height>34</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>34</width>
<height>34</height>
</size>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="statusTip">
<string>Output dry/wet (100%)</string>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="value">
<number>1000</number>
</property>
</widget>
</item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="PixmapDial" name="dial_b_left">
<property name="minimumSize">
<size>
<width>26</width>
<height>26</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>26</width>
<height>26</height>
</size>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="statusTip">
<string>Balance Left (0%)</string>
</property>
<property name="minimum">
<number>-1000</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="value">
<number>-1000</number>
</property>
</widget>
</item>
<item>
<widget class="PixmapDial" name="dial_b_right">
<property name="minimumSize">
<size>
<width>26</width>
<height>26</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>26</width>
<height>26</height>
</size>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="statusTip">
<string>Balance Right (0%)</string>
</property>
<property name="minimum">
<number>-1000</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="value">
<number>1000</number>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_ctrl_channel">
<property name="text">
<string>MIDI Control Channel:</string>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="PixmapDial" name="dial_vol">
<property name="minimumSize">
<size>
<width>34</width>
<height>34</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>34</width>
<height>34</height>
</size>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="statusTip">
<string>Output volume (100%)</string>
</property>
<property name="maximum">
<number>1270</number>
</property>
<property name="value">
<number>1000</number>
</property>
</widget>
</item>
<item>
<widget class="PixmapDial" name="dial_drywet">
<property name="minimumSize">
<size>
<width>34</width>
<height>34</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>34</width>
<height>34</height>
</size>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="statusTip">
<string>Output dry/wet (100%)</string>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="value">
<number>1000</number>
</property>
</widget>
</item>
<item>
<widget class="PixmapDial" name="dial_b_left">
<property name="minimumSize">
<size>
<width>26</width>
<height>26</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>26</width>
<height>26</height>
</size>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="statusTip">
<string>Balance Left (0%)</string>
</property>
<property name="minimum">
<number>-1000</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="value">
<number>-1000</number>
</property>
</widget>
</item>
<item>
<widget class="PixmapDial" name="dial_b_right">
<property name="minimumSize">
<size>
<width>26</width>
<height>26</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>26</width>
<height>26</height>
</size>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="statusTip">
<string>Balance Right (0%)</string>
</property>
<property name="minimum">
<number>-1000</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="value">
<number>1000</number>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_ctrl_channel">
<property name="text">
<string>MIDI Control Channel:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="sb_ctrl_channel">
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="specialValueText">
<string>N</string>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>16</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QSpinBox" name="sb_ctrl_channel">
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="specialValueText">
<string>N</string>
</property>
<property name="minimum">
<number>0</number>
<widget class="QTabWidget" name="tab_programs">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>16</number>
<property name="tabPosition">
<enum>QTabWidget::South</enum>
</property>
<property name="value">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="programs">
<attribute name="title">
<string>Programs</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QComboBox" name="cb_programs"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="midi_programs">
<attribute name="title">
<string>MIDI Programs</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QComboBox" name="cb_midi_programs"/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QTabWidget" name="tab_programs">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="tabPosition">
<enum>QTabWidget::South</enum>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="programs">
<attribute name="title">
<string>Programs</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QComboBox" name="cb_programs"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="midi_programs">
<attribute name="title">
<string>MIDI Programs</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QComboBox" name="cb_midi_programs"/>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">


+ 56
- 14
source/carla_shared.py View File

@@ -1462,6 +1462,17 @@ class PluginEdit(QDialog):
self.ui.b_load_state.setEnabled(False)
self.ui.b_save_state.setEnabled(False)

# Set options
self.connect(self.ui.ch_fixed_buffer, SIGNAL("clicked(bool)"), SLOT("slot_optionChanged(bool)"))
self.connect(self.ui.ch_force_stereo, SIGNAL("clicked(bool)"), SLOT("slot_optionChanged(bool)"))
self.connect(self.ui.ch_map_program_changes, SIGNAL("clicked(bool)"), SLOT("slot_optionChanged(bool)"))
self.connect(self.ui.ch_use_chunks, SIGNAL("clicked(bool)"), SLOT("slot_optionChanged(bool)"))
self.connect(self.ui.ch_send_control_changes, SIGNAL("clicked(bool)"), SLOT("slot_optionChanged(bool)"))
self.connect(self.ui.ch_send_channel_pressure, SIGNAL("clicked(bool)"), SLOT("slot_optionChanged(bool)"))
self.connect(self.ui.ch_send_note_aftertouch, SIGNAL("clicked(bool)"), SLOT("slot_optionChanged(bool)"))
self.connect(self.ui.ch_send_pitchbend, SIGNAL("clicked(bool)"), SLOT("slot_optionChanged(bool)"))
self.connect(self.ui.ch_send_all_sound_off, SIGNAL("clicked(bool)"), SLOT("slot_optionChanged(bool)"))

self.connect(self.ui.dial_drywet, SIGNAL("valueChanged(int)"), SLOT("slot_dryWetChanged(int)"))
self.connect(self.ui.dial_vol, SIGNAL("valueChanged(int)"), SLOT("slot_volumeChanged(int)"))
self.connect(self.ui.dial_b_left, SIGNAL("valueChanged(int)"), SLOT("slot_balanceLeftChanged(int)"))
@@ -1555,20 +1566,24 @@ class PluginEdit(QDialog):
self.ui.dial_b_right.setEnabled(pluginHints & PLUGIN_CAN_BALANCE)

# Set options
#self.ui.ch_fixed_buffer.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_FIXED_BUFFER)
#self.ui.ch_fixed_buffer.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_FIXED_BUFFER)
#self.ui.ch_force_stereo.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_FORCE_STEREO)
#self.ui.ch_force_stereo.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_FORCE_STEREO)
#self.ui.ch_self_automation.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_SELF_AUTOMATION)
#self.ui.ch_self_automation.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_SELF_AUTOMATION)
#self.ui.ch_use_chunks.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_USE_CHUNKS)
#self.ui.ch_use_chunks.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_USE_CHUNKS)
#self.ui.ch_send_all_sound_off.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
#self.ui.ch_send_all_sound_off.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
#self.ui.ch_send_note_aftertouch.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH)
#self.ui.ch_send_note_aftertouch.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH)
#self.ui.ch_send_pitchbend.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_SEND_PITCHBEND)
#self.ui.ch_send_pitchbend.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_SEND_PITCHBEND)
self.ui.ch_fixed_buffer.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_FIXED_BUFFER)
self.ui.ch_fixed_buffer.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_FIXED_BUFFER)
self.ui.ch_force_stereo.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_FORCE_STEREO)
self.ui.ch_force_stereo.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_FORCE_STEREO)
self.ui.ch_map_program_changes.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_MAP_PROGRAM_CHANGES)
self.ui.ch_map_program_changes.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_MAP_PROGRAM_CHANGES)
self.ui.ch_use_chunks.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_USE_CHUNKS)
self.ui.ch_use_chunks.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_USE_CHUNKS)
self.ui.ch_send_control_changes.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_SEND_CONTROL_CHANGES)
self.ui.ch_send_control_changes.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_SEND_CONTROL_CHANGES)
self.ui.ch_send_channel_pressure.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_SEND_CHANNEL_PRESSURE)
self.ui.ch_send_channel_pressure.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_SEND_CHANNEL_PRESSURE)
self.ui.ch_send_note_aftertouch.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH)
self.ui.ch_send_note_aftertouch.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH)
self.ui.ch_send_pitchbend.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_SEND_PITCHBEND)
self.ui.ch_send_pitchbend.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_SEND_PITCHBEND)
self.ui.ch_send_all_sound_off.setEnabled(self.fPluginInfo['optionsAvailable'] & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
self.ui.ch_send_all_sound_off.setChecked(self.fPluginInfo['optionsEnabled'] & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)

# Show/hide keyboard
showKeyboard = (pluginHints & PLUGIN_IS_SYNTH) != 0 or (midiCountInfo['ins'] > 0 < midiCountInfo['outs'])
@@ -1938,6 +1953,33 @@ class PluginEdit(QDialog):
self.fCurrentStateFilename = filenameTry
#self.loadState()

@pyqtSlot(bool)
def slot_optionChanged(self, clicked):
sender = self.sender()

if sender == self.ui.ch_fixed_buffer:
option = PLUGIN_OPTION_FIXED_BUFFER
elif sender == self.ui.ch_force_stereo:
option = PLUGIN_OPTION_FORCE_STEREO
elif sender == self.ui.ch_map_program_changes:
option = PLUGIN_OPTION_MAP_PROGRAM_CHANGES
elif sender == self.ui.ch_use_chunks:
option = PLUGIN_OPTION_USE_CHUNKS
elif sender == self.ui.ch_send_control_changes:
option = PLUGIN_OPTION_SEND_CONTROL_CHANGES
elif sender == self.ui.ch_send_channel_pressure:
option = PLUGIN_OPTION_SEND_CHANNEL_PRESSURE
elif sender == self.ui.ch_send_note_aftertouch:
option = PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH
elif sender == self.ui.ch_send_pitchbend:
option = PLUGIN_OPTION_SEND_PITCHBEND
elif sender == self.ui.ch_send_all_sound_off:
option = PLUGIN_OPTION_SEND_ALL_SOUND_OFF
else:
return

Carla.host.set_option(self.fPluginId, option, clicked)

@pyqtSlot(int)
def slot_dryWetChanged(self, value):
Carla.host.set_drywet(self.fPluginId, float(value)/1000)


Loading…
Cancel
Save