From 1d972a8200b2a2891e80ce6cb9d1a43c07027942 Mon Sep 17 00:00:00 2001 From: falkTX Date: Tue, 8 Oct 2013 01:22:14 +0100 Subject: [PATCH] UI tweaks; Fix rack processing --- resources/ui/carla_edit.ui | 15 +++--- source/backend/engine/CarlaEngine.cpp | 38 +++++++------ source/backend/engine/CarlaEngineJack.cpp | 6 +-- source/carla_widgets.py | 65 +++++++++++++++++++---- 4 files changed, 81 insertions(+), 43 deletions(-) diff --git a/resources/ui/carla_edit.ui b/resources/ui/carla_edit.ui index 9b4d65204..9dd0c7cca 100644 --- a/resources/ui/carla_edit.ui +++ b/resources/ui/carla_edit.ui @@ -30,7 +30,7 @@ - Control? + Control @@ -655,7 +655,7 @@ Plugin Name - + Label/URI: @@ -665,7 +665,7 @@ Plugin Name - + Name: @@ -755,7 +755,7 @@ Plugin Name - + Type: @@ -765,7 +765,7 @@ Plugin Name - + Maker: @@ -775,7 +775,7 @@ Plugin Name - + Copyright: @@ -785,7 +785,7 @@ Plugin Name - + Unique ID: @@ -887,7 +887,6 @@ Plugin Name 64 - tabWidget diff --git a/source/backend/engine/CarlaEngine.cpp b/source/backend/engine/CarlaEngine.cpp index ec90f92f4..0b9abe1d0 100644 --- a/source/backend/engine/CarlaEngine.cpp +++ b/source/backend/engine/CarlaEngine.cpp @@ -1731,47 +1731,45 @@ void CarlaEngine::processRack(float* inBufReal[2], float* outBuf[2], const uint3 if (processed) { - // initialize inputs (from previous outputs) carla_copyFloat(inBuf0, outBuf[0], frames); carla_copyFloat(inBuf1, outBuf[1], frames); - std::memcpy(pData->bufEvents.in, pData->bufEvents.out, sizeof(EngineEvent)*kEngineMaxInternalEventCount); // initialize outputs (zero) carla_zeroFloat(outBuf[0], frames); carla_zeroFloat(outBuf[1], frames); - carla_zeroMem(pData->bufEvents.out, sizeof(EngineEvent)*kEngineMaxInternalEventCount); - } - - oldAudioInCount = plugin->getAudioInCount(); - oldMidiOutCount = plugin->getMidiOutCount(); - - // if plugin has no audio inputs, add input buffer - //if (oldAudioInCount == 0) - { - carla_addFloat(outBuf[0], inBuf0, frames); - carla_addFloat(outBuf[1], inBuf1, frames); - } // if plugin has no midi out, add previous events if (oldMidiOutCount == 0 && pData->bufEvents.in[0].type != CarlaBackend::kEngineEventTypeNull) { if (pData->bufEvents.out[0].type != CarlaBackend::kEngineEventTypeNull) { - // TODO: carefully add to output, sorted events - } - else - { - // nothing in output, can be replaced directly - std::memcpy(pData->bufEvents.out, pData->bufEvents.in, sizeof(EngineEvent)*kEngineMaxInternalEventCount); + // TODO: carefully add to input, sorted events } + // else nothing needed } + else + { + // initialize input from previous output and zero output + std::memcpy(pData->bufEvents.in, pData->bufEvents.out, sizeof(EngineEvent)*kEngineMaxInternalEventCount); + std::memset(pData->bufEvents.out, 0, sizeof(EngineEvent)*kEngineMaxInternalEventCount); + } + } + oldAudioInCount = plugin->getAudioInCount(); + oldMidiOutCount = plugin->getMidiOutCount(); // process plugin->initBuffers(); plugin->process(inBuf, outBuf, frames); plugin->unlock(); + // if plugin has no audio inputs, add input buffer + if (oldAudioInCount == 0) + { + carla_addFloat(outBuf[0], inBuf0, frames); + carla_addFloat(outBuf[1], inBuf1, frames); + } + // set peaks { float inPeak1 = 0.0f; diff --git a/source/backend/engine/CarlaEngineJack.cpp b/source/backend/engine/CarlaEngineJack.cpp index d64bcfa01..a2a4af84a 100644 --- a/source/backend/engine/CarlaEngineJack.cpp +++ b/source/backend/engine/CarlaEngineJack.cpp @@ -557,9 +557,6 @@ public: #ifdef BUILD_BRIDGE fHasQuit(false) #else -# ifdef CARLA_PROPER_CPP11_SUPPORT - fRackPorts{nullptr}, -# endif fLastGroupId(0), fLastPortId(0), fLastConnectionId(0) @@ -570,9 +567,7 @@ public: #ifdef BUILD_BRIDGE fOptions.processMode = PROCESS_MODE_MULTIPLE_CLIENTS; #else -# ifndef CARLA_PROPER_CPP11_SUPPORT carla_fill(fRackPorts, kRackPortCount, nullptr); -# endif #endif // FIXME: Always enable JACK transport for now @@ -724,6 +719,7 @@ public: jackbridge_port_unregister(fClient, fRackPorts[kRackPortAudioOut2]); jackbridge_port_unregister(fClient, fRackPorts[kRackPortEventIn]); jackbridge_port_unregister(fClient, fRackPorts[kRackPortEventOut]); + carla_fill(fRackPorts, kRackPortCount, nullptr); } if (jackbridge_client_close(fClient)) diff --git a/source/carla_widgets.py b/source/carla_widgets.py index 9f9b7daac..23c9eb0ae 100644 --- a/source/carla_widgets.py +++ b/source/carla_widgets.py @@ -547,16 +547,61 @@ class PluginEdit(QDialog): else: self.ui.le_type.setText(self.tr("Unknown")) - self.ui.le_name.setText(pluginName) - self.ui.le_name.setToolTip(pluginName) - self.ui.le_label.setText(self.fPluginInfo['label']) - self.ui.le_label.setToolTip(self.fPluginInfo['label']) - self.ui.le_maker.setText(self.fPluginInfo['maker']) - self.ui.le_maker.setToolTip(self.fPluginInfo['maker']) - self.ui.le_copyright.setText(self.fPluginInfo['copyright']) - self.ui.le_copyright.setToolTip(self.fPluginInfo['copyright']) - self.ui.le_unique_id.setText(str(self.fPluginInfo['uniqueId'])) - self.ui.le_unique_id.setToolTip(str(self.fPluginInfo['uniqueId'])) + if pluginName: + self.ui.label_name.setEnabled(True) + self.ui.le_name.setEnabled(True) + self.ui.le_name.setText(pluginName) + self.ui.le_name.setToolTip(pluginName) + else: + self.ui.label_name.setEnabled(False) + self.ui.le_name.setEnabled(False) + self.ui.le_name.setText("") + self.ui.le_name.setToolTip("") + + if self.fPluginInfo['label']: + self.ui.label_label.setEnabled(True) + self.ui.le_label.setEnabled(True) + self.ui.le_label.setText(self.fPluginInfo['label']) + self.ui.le_label.setToolTip(self.fPluginInfo['label']) + else: + self.ui.label_label.setEnabled(False) + self.ui.le_label.setEnabled(False) + self.ui.le_label.setText("") + self.ui.le_label.setToolTip("") + + if self.fPluginInfo['maker']: + self.ui.label_maker.setEnabled(True) + self.ui.le_maker.setEnabled(True) + self.ui.le_maker.setText(self.fPluginInfo['maker']) + self.ui.le_maker.setToolTip(self.fPluginInfo['maker']) + else: + self.ui.label_maker.setEnabled(False) + self.ui.le_maker.setEnabled(False) + self.ui.le_maker.setText("") + self.ui.le_maker.setToolTip("") + + if self.fPluginInfo['copyright']: + self.ui.label_copyright.setEnabled(True) + self.ui.le_copyright.setEnabled(True) + self.ui.le_copyright.setText(self.fPluginInfo['copyright']) + self.ui.le_copyright.setToolTip(self.fPluginInfo['copyright']) + else: + self.ui.label_copyright.setEnabled(False) + self.ui.le_copyright.setEnabled(False) + self.ui.le_copyright.setText("") + self.ui.le_copyright.setToolTip("") + + if self.fPluginInfo['uniqueId'] != 0: + self.ui.label_unique_id.setEnabled(True) + self.ui.le_unique_id.setEnabled(True) + self.ui.le_unique_id.setText(str(self.fPluginInfo['uniqueId'])) + self.ui.le_unique_id.setToolTip(str(self.fPluginInfo['uniqueId'])) + else: + self.ui.label_unique_id.setEnabled(False) + self.ui.le_unique_id.setEnabled(False) + self.ui.le_unique_id.setText("") + self.ui.le_unique_id.setToolTip("") + self.ui.label_plugin.setText("\n%s\n" % self.fPluginInfo['name']) self.setWindowTitle(self.fPluginInfo['name'])