Browse Source

Initial GUI code for options support

tags/1.9.4
falkTX 12 years ago
parent
commit
07e3bfccf1
7 changed files with 108 additions and 39 deletions
  1. +10
    -28
      resources/ui/carla_edit.ui
  2. +3
    -0
      source/backend/plugin/CarlaPlugin.cpp
  3. +33
    -6
      source/backend/plugin/DssiPlugin.cpp
  4. +9
    -0
      source/backend/plugin/FluidSynthPlugin.cpp
  5. +7
    -0
      source/backend/plugin/LadspaPlugin.cpp
  6. +15
    -0
      source/backend/plugin/NativePlugin.cpp
  7. +31
    -5
      source/carla_shared.py

+ 10
- 28
resources/ui/carla_edit.ui View File

@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>697</width>
<width>672</width>
<height>520</height>
</rect>
</property>
@@ -294,9 +294,6 @@ Plugin Name
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QCheckBox" name="ch_fixed_buffer">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Fixed-size buffer</string>
</property>
@@ -304,9 +301,6 @@ Plugin Name
</item>
<item>
<widget class="QCheckBox" name="ch_force_stereo">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Force Stereo</string>
</property>
@@ -314,9 +308,6 @@ Plugin Name
</item>
<item>
<widget class="QCheckBox" name="ch_self_automation">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Self-automation</string>
</property>
@@ -324,9 +315,6 @@ Plugin Name
</item>
<item>
<widget class="QCheckBox" name="ch_use_chunks">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Use chunks</string>
</property>
@@ -334,9 +322,6 @@ Plugin Name
</item>
<item>
<widget class="QCheckBox" name="ch_send_all_sound_off">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Send All Sound/Notes Off</string>
</property>
@@ -344,9 +329,6 @@ Plugin Name
</item>
<item>
<widget class="QCheckBox" name="ch_send_note_aftertouch">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Send Note Aftertouch</string>
</property>
@@ -354,9 +336,6 @@ Plugin Name
</item>
<item>
<widget class="QCheckBox" name="ch_send_pitchbend">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Send Pitchbend</string>
</property>
@@ -504,9 +483,6 @@ Plugin Name
</item>
<item>
<widget class="QLabel" name="label_ctrl_channel">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>MIDI Control Channel:</string>
</property>
@@ -514,15 +490,21 @@ Plugin Name
</item>
<item>
<widget class="QSpinBox" name="sb_ctrl_channel">
<property name="enabled">
<bool>false</bool>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="specialValueText">
<string>N</string>
</property>
<property name="minimum">
<number>1</number>
<number>0</number>
</property>
<property name="maximum">
<number>16</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
</layout>


+ 3
- 0
source/backend/plugin/CarlaPlugin.cpp View File

@@ -85,6 +85,9 @@ CarlaPlugin::CarlaPlugin(CarlaEngine* const engine, const unsigned int id)
case PROCESS_MODE_BRIDGE:
break;
}

if (engine->getOptions().forceStereo)
fOptions |= PLUGIN_OPTION_FORCE_STEREO;
}

CarlaPlugin::~CarlaPlugin()


+ 33
- 6
source/backend/plugin/DssiPlugin.cpp View File

@@ -42,6 +42,9 @@ public:
fParamBuffers = nullptr;

carla_zeroMem(fMidiEvents, sizeof(snd_seq_event_t)*MAX_MIDI_EVENTS);

if (engine->getOptions().useDssiVstChunks)
fOptions |= PLUGIN_OPTION_USE_CHUNKS;
}

~DssiPlugin()
@@ -681,12 +684,6 @@ public:
if (mIns == 1 && aIns == 0 && aOuts > 0)
fHints |= PLUGIN_IS_SYNTH;

if (kData->engine->getOptions().useDssiVstChunks && QString(fFilename).endsWith("dssi-vst.so", Qt::CaseInsensitive))
{
if (fDssiDescriptor->get_custom_data != nullptr && fDssiDescriptor->set_custom_data != nullptr)
fHints |= PLUGIN_USES_CHUNKS;
}

if (aOuts > 0 && (aIns == aOuts || aIns == 1))
fHints |= PLUGIN_CAN_DRYWET;

@@ -699,6 +696,36 @@ public:
if (aIns <= 2 && aOuts <= 2 && (aIns == aOuts || aIns == 0 || aOuts == 0))
fHints |= PLUGIN_CAN_FORCE_STEREO;

// plugin options
kData->availOptions &= ~(PLUGIN_OPTION_FIXED_BUFFER | PLUGIN_OPTION_SELF_AUTOMATION | PLUGIN_OPTION_SEND_ALL_SOUND_OFF | PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH | PLUGIN_OPTION_SEND_PITCHBEND);

// always available if needed
kData->availOptions |= PLUGIN_OPTION_SELF_AUTOMATION;

// dssi-vst can do chunks, but needs fixed buffers
if (QString(fFilename).endsWith("dssi-vst.so", Qt::CaseInsensitive))
{
fOptions |= PLUGIN_OPTION_FIXED_BUFFER;

if (fOptions & PLUGIN_OPTION_USE_CHUNKS)
{
if (fDssiDescriptor->get_custom_data != nullptr && fDssiDescriptor->set_custom_data != nullptr)
fHints |= PLUGIN_USES_CHUNKS;
}
}
else
{
kData->availOptions |= PLUGIN_OPTION_FIXED_BUFFER;
}

// only for plugins with midi input
if (mIns > 0)
{
kData->availOptions |= PLUGIN_OPTION_SEND_ALL_SOUND_OFF;
kData->availOptions |= PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH;
kData->availOptions |= PLUGIN_OPTION_SEND_PITCHBEND;
}

// check latency
if (fHints & PLUGIN_CAN_DRYWET)
{


+ 9
- 0
source/backend/plugin/FluidSynthPlugin.cpp View File

@@ -759,6 +759,15 @@ public:
fHints |= PLUGIN_CAN_BALANCE;
fHints |= PLUGIN_CAN_FORCE_STEREO;

// plugin options
kData->availOptions &= ~(PLUGIN_OPTION_FIXED_BUFFER | PLUGIN_OPTION_SELF_AUTOMATION | PLUGIN_OPTION_SEND_ALL_SOUND_OFF | PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH | PLUGIN_OPTION_SEND_PITCHBEND);

// always available if needed
kData->availOptions |= PLUGIN_OPTION_SELF_AUTOMATION;
kData->availOptions |= PLUGIN_OPTION_SEND_ALL_SOUND_OFF;
kData->availOptions |= PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH;
kData->availOptions |= PLUGIN_OPTION_SEND_PITCHBEND;

bufferSizeChanged(kData->engine->getBufferSize());
reloadPrograms(true);



+ 7
- 0
source/backend/plugin/LadspaPlugin.cpp View File

@@ -681,6 +681,13 @@ public:
if (aIns <= 2 && aOuts <= 2 && (aIns == aOuts || aIns == 0 || aOuts == 0))
fHints |= PLUGIN_CAN_FORCE_STEREO;

// plugin options
kData->availOptions &= ~(PLUGIN_OPTION_FIXED_BUFFER | PLUGIN_OPTION_SELF_AUTOMATION | PLUGIN_OPTION_SEND_ALL_SOUND_OFF | PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH | PLUGIN_OPTION_SEND_PITCHBEND);

// always available if needed
kData->availOptions |= PLUGIN_OPTION_FIXED_BUFFER;
kData->availOptions |= PLUGIN_OPTION_SELF_AUTOMATION;

// check latency
if (fHints & PLUGIN_CAN_DRYWET)
{


+ 15
- 0
source/backend/plugin/NativePlugin.cpp View File

@@ -847,6 +847,21 @@ public:
if (fDescriptor->hints & ::PLUGIN_USES_SINGLE_THREAD)
fHints |= PLUGIN_USES_SINGLE_THREAD;

// plugin options
kData->availOptions &= ~(PLUGIN_OPTION_FIXED_BUFFER | PLUGIN_OPTION_SELF_AUTOMATION | PLUGIN_OPTION_SEND_ALL_SOUND_OFF | PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH | PLUGIN_OPTION_SEND_PITCHBEND);

// always available if needed
kData->availOptions |= PLUGIN_OPTION_FIXED_BUFFER;
kData->availOptions |= PLUGIN_OPTION_SELF_AUTOMATION;

// only for plugins with midi input
if (mIns > 0)
{
kData->availOptions |= PLUGIN_OPTION_SEND_ALL_SOUND_OFF;
kData->availOptions |= PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH;
kData->availOptions |= PLUGIN_OPTION_SEND_PITCHBEND;
}

bufferSizeChanged(kData->engine->getBufferSize());
reloadPrograms(true);



+ 31
- 5
source/carla_shared.py View File

@@ -243,7 +243,8 @@ PARAMETER_VOLUME = -4
PARAMETER_BALANCE_LEFT = -5
PARAMETER_BALANCE_RIGHT = -6
PARAMETER_PANNING = -7
PARAMETER_MAX = -8
PARAMETER_CTRL_CHANNEL = -8
PARAMETER_MAX = -9

# Options Type
OPTION_PROCESS_NAME = 0
@@ -1455,10 +1456,11 @@ class PluginEdit(QDialog):
self.ui.b_load_state.setEnabled(False)
self.ui.b_save_state.setEnabled(False)

self.connect(self.ui.dial_drywet, SIGNAL("sliderMoved(int)"), SLOT("slot_dryWetChanged(int)"))
self.connect(self.ui.dial_vol, SIGNAL("sliderMoved(int)"), SLOT("slot_volumeChanged(int)"))
self.connect(self.ui.dial_b_left, SIGNAL("sliderMoved(int)"), SLOT("slot_balanceLeftChanged(int)"))
self.connect(self.ui.dial_b_right, SIGNAL("sliderMoved(int)"), SLOT("slot_balanceRightChanged(int)"))
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)"))
self.connect(self.ui.dial_b_right, SIGNAL("valueChanged(int)"), SLOT("slot_balanceRightChanged(int)"))
self.connect(self.ui.sb_ctrl_channel, SIGNAL("valueChanged(int)"), SLOT("slot_ctrlChannelChanged(int)"))

#self.connect(self.ui.dial_drywet, SIGNAL("customContextMenuRequested(QPoint)"), SLOT("slot_showCustomDialMenu()"))
#self.connect(self.ui.dial_vol, SIGNAL("customContextMenuRequested(QPoint)"), SLOT("slot_showCustomDialMenu()"))
@@ -1546,6 +1548,22 @@ class PluginEdit(QDialog):
self.ui.dial_b_left.setEnabled(pluginHints & PLUGIN_CAN_BALANCE)
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)

# Show/hide keyboard
showKeyboard = (pluginHints & PLUGIN_IS_SYNTH) != 0 or (midiCountInfo['ins'] > 0 < midiCountInfo['outs'])
self.ui.scrollArea.setEnabled(showKeyboard)
@@ -1847,6 +1865,10 @@ class PluginEdit(QDialog):
#self.ui.dial_pan.blockSignals(True)
#self.ui.dial_pan.setValue(value * 1000, True, False)
#self.ui.dial_pan.blockSignals(False)
elif index == PARAMETER_CTRL_CHANNEL:
self.ui.sb_ctrl_channel.blockSignals(True)
self.ui.sb_ctrl_channel.setValue(value)
self.ui.sb_ctrl_channel.blockSignals(False)
elif index >= 0:
for paramType, paramId, paramWidget in self.fParameterList:
if paramId == index:
@@ -1920,6 +1942,10 @@ class PluginEdit(QDialog):
def slot_panningChanged(self, value):
Carla.host.set_panning(self.fPluginId, float(value)/1000)

@pyqtSlot(int)
def slot_ctrlChannelChanged(self, value):
Carla.host.set_ctrl_channel(self.fPluginId, value)

@pyqtSlot(int, float)
def slot_parameterValueChanged(self, parameterId, value):
Carla.host.set_parameter_value(self.fPluginId, parameterId, value)


Loading…
Cancel
Save