diff --git a/resources/ui/carla_add_jack.ui b/resources/ui/carla_add_jack.ui
index 6cff5942c..2a9853111 100644
--- a/resources/ui/carla_add_jack.ui
+++ b/resources/ui/carla_add_jack.ui
@@ -6,8 +6,8 @@
0
0
- 416
- 344
+ 468
+ 369
@@ -94,62 +94,113 @@
Setup
- -
-
+
-
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ false
+
+
+ Session Manager:
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+ false
+
+
-
+
+ None / Manual
+
+
+ -
+
+ LADISH (SIGUSR1)
+
+
+ -
+
+ Non Session Manager (OSC)
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
- MIDI inputs:
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+ Take control of main applicaton window
- -
-
-
- 1
+
-
+
+
+ Qt::Horizontal
-
-
- -
-
-
- 64
+
+ QSizePolicy::Fixed
-
+
+
+ 20
+ 1
+
+
+
- -
-
+
-
+
- MIDI outputs:
+ Audio inputs:
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
- -
-
+
-
+
- 1
+ 64
- -
-
-
- Qt::Horizontal
-
-
-
- 1
- 1
-
-
-
-
- -
-
+
-
+
Qt::Horizontal
@@ -161,34 +212,18 @@
- -
-
-
- Qt::Horizontal
+
-
+
+
+ 0
-
-
- 1
- 1
-
+
+ 1
-
-
- -
-
- Qt::Horizontal
-
-
- QSizePolicy::Fixed
-
-
-
- 20
- 1
-
+ Qt::Vertical
-
+
-
@@ -203,18 +238,25 @@
- -
-
+
-
+
- Audio inputs:
+ MIDI inputs:
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
- -
-
+
-
+
+
+ 1
+
+
+
+ -
+
Qt::Horizontal
@@ -226,26 +268,6 @@
- -
-
-
- 64
-
-
-
- -
-
-
- 0
-
-
- 1
-
-
- Qt::Vertical
-
-
-
-
@@ -272,6 +294,26 @@
+ -
+
+
+ 64
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 1
+ 1
+
+
+
+
-
@@ -285,47 +327,35 @@
- -
-
+
-
+
- Take control of main applicaton window
+ MIDI outputs:
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
- -
-
-
- false
+
-
+
+
+ 1
-
-
-
- None / Manual
-
-
- -
-
- LADISH (SIGUSR1)
-
-
- -
-
- Non Session Manager (OSC)
-
-
- -
-
-
- false
-
-
- Session Manager:
+
-
+
+
+ Qt::Horizontal
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+ 1
+ 1
+
-
+
@@ -336,6 +366,16 @@
Workarounds
+ -
+
+
+ false
+
+
+ Capture only the first X11 Window
+
+
+
-
@@ -365,13 +405,10 @@
- -
-
-
- false
-
+
-
+
- Capture only the first X11 Window
+ Use previous client output buffer as input for the next client
diff --git a/source/backend/plugin/CarlaPluginJack.cpp b/source/backend/plugin/CarlaPluginJack.cpp
index d1ca982a8..8d5461895 100644
--- a/source/backend/plugin/CarlaPluginJack.cpp
+++ b/source/backend/plugin/CarlaPluginJack.cpp
@@ -1279,9 +1279,9 @@ public:
// setup hints and options
// FIXME dryWet broken
- pData->hints = PLUGIN_IS_BRIDGE | PLUGIN_OPTION_FIXED_BUFFERS;
+ pData->hints = PLUGIN_IS_BRIDGE | PLUGIN_OPTION_FIXED_BUFFERS;
#ifndef BUILD_BRIDGE
- pData->options|= /*PLUGIN_CAN_DRYWET |*/ PLUGIN_CAN_VOLUME | PLUGIN_CAN_BALANCE;
+ pData->hints |= /*PLUGIN_CAN_DRYWET |*/ PLUGIN_CAN_VOLUME | PLUGIN_CAN_BALANCE;
#endif
//fInfo.optionsAvailable = optionAv;
diff --git a/source/carla_database.py b/source/carla_database.py
index c8f007efb..559d9a86b 100755
--- a/source/carla_database.py
+++ b/source/carla_database.py
@@ -1890,8 +1890,9 @@ class JackApplicationW(QDialog):
SESSION_MGR_LASH = 3
SESSION_MGR_NSM = 4
- FLAG_CONTROL_WINDOW = 0x1
- FLAG_CAPTURE_FIRST_WINDOW = 0x2
+ FLAG_CONTROL_WINDOW = 0x01
+ FLAG_CAPTURE_FIRST_WINDOW = 0x02
+ FLAG_BUFFERS_ADDITION_MODE = 0x10
def __init__(self, parent, host):
QDialog.__init__(self, parent)
@@ -1935,6 +1936,8 @@ class JackApplicationW(QDialog):
flags |= self.FLAG_CONTROL_WINDOW
if self.ui.cb_capture_first_window.isChecked():
flags |= self.FLAG_CAPTURE_FIRST_WINDOW
+ if self.ui.cb_buffers_addition_mode.isChecked():
+ flags |= self.FLAG_BUFFERS_ADDITION_MODE
baseIntVal = ord('0')
labelSetup = "%s%s%s%s%s%s" % (chr(baseIntVal+self.ui.sb_audio_ins.value()),
diff --git a/source/libjack/libjack.cpp b/source/libjack/libjack.cpp
index 4f62f122a..cd6e05025 100644
--- a/source/libjack/libjack.cpp
+++ b/source/libjack/libjack.cpp
@@ -558,9 +558,15 @@ bool CarlaJackAppClient::handleRtData()
{
CARLA_SAFE_ASSERT_BREAK(fShmAudioPool.data != nullptr);
+ // mixdown is default, do buffer addition (for multiple clients) if requested
+ const bool doBufferAddition = fSetupHints & 0x10;
+
// location to start of audio outputs (shm buffer)
float* const fdataRealOuts = fShmAudioPool.data+(fServer.bufferSize*fServer.numAudioIns);
+ if (doBufferAddition && fServer.numAudioOuts > 0)
+ FloatVectorOperations::clear(fdataRealOuts, fServer.bufferSize*fServer.numAudioOuts);
+
if (! fClients.isEmpty())
{
// save tranport for all clients
@@ -629,7 +635,11 @@ bool CarlaJackAppClient::handleRtData()
if (i++ < fServer.numAudioIns)
{
- jport->buffer = fdataReal;
+ if (numClientOutputsProcessed == 0 || ! doBufferAddition)
+ jport->buffer = fdataReal;
+ else
+ jport->buffer = fdataRealOuts + (i*fServer.bufferSize);
+
fdataReal += fServer.bufferSize;
fdataCopy += fServer.bufferSize;
}
@@ -639,11 +649,11 @@ bool CarlaJackAppClient::handleRtData()
needsTmpBufClear = true;
}
}
- // FIXME one single "if"
- for (; i++ < fServer.numAudioIns;)
+ if (i < fServer.numAudioIns)
{
- fdataReal += fServer.bufferSize;
- fdataCopy += fServer.bufferSize;
+ const std::size_t remainingBufferSize = fServer.bufferSize * (fServer.numAudioIns - i);
+ fdataReal += remainingBufferSize;
+ fdataCopy += remainingBufferSize;
}
// location to start of audio outputs
@@ -667,11 +677,11 @@ bool CarlaJackAppClient::handleRtData()
needsTmpBufClear = true;
}
}
- // FIXME one single "if"
- for (; i++ < fServer.numAudioOuts;)
+ if (i < fServer.numAudioOuts)
{
- FloatVectorOperations::clear(fdataCopy, fServer.bufferSize);
- fdataCopy += fServer.bufferSize;
+ const std::size_t remainingBufferSize = fServer.bufferSize * (fServer.numAudioOuts - i);
+ FloatVectorOperations::clear(fdataCopy, remainingBufferSize);
+ fdataCopy += remainingBufferSize;
}
// set midi inputs
@@ -718,6 +728,14 @@ bool CarlaJackAppClient::handleRtData()
// subsequent clients, add data (then divide by number of clients later on)
FloatVectorOperations::add(fdataRealOuts, fdataCopyOuts,
fServer.bufferSize*fServer.numAudioOuts);
+
+ if (doBufferAddition)
+ {
+ // for more than 1 client addition, we need to divide buffers now
+ FloatVectorOperations::multiply(fdataRealOuts,
+ 1.0f/static_cast(numClientOutputsProcessed),
+ fServer.bufferSize*fServer.numAudioOuts);
+ }
}
if (jclient->audioOuts.count() == 1 && fServer.numAudioOuts > 1)
@@ -733,7 +751,7 @@ bool CarlaJackAppClient::handleRtData()
}
}
- if (numClientOutputsProcessed > 1)
+ if (numClientOutputsProcessed > 1 && ! doBufferAddition)
{
// more than 1 client active, need to divide buffers
FloatVectorOperations::multiply(fdataRealOuts,