Browse Source

Jack apps can't do CV (need full info on register); Other tweaks

tags/1.9.8
falkTX 7 years ago
parent
commit
c779471442
4 changed files with 218 additions and 156 deletions
  1. +175
    -89
      resources/ui/carla_add_jack.ui
  2. +11
    -47
      source/backend/plugin/CarlaPluginJack.cpp
  3. +23
    -6
      source/carla_database.py
  4. +9
    -14
      source/libjack/libjack.cpp

+ 175
- 89
resources/ui/carla_add_jack.ui View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>626</width>
<height>274</height>
<width>414</width>
<height>306</height>
</rect>
</property>
<property name="windowTitle">
@@ -89,6 +89,13 @@
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_9">
<property name="text">
<string>Note: Features not implemented yet are greyed out</string>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="group_command">
<property name="title">
@@ -114,15 +121,54 @@
<bool>false</bool>
</property>
<property name="text">
<string>Save trigger:</string>
<string>Session Manager:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="cb_save_trigger">
<item row="2" column="3">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Ignored</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>87</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1" colspan="3">
<widget class="QLineEdit" name="le_name"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Name:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="1" colspan="3">
<widget class="QCheckBox" name="cb_manage_window">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Take control of main applicaton window</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QComboBox" name="cb_session_mgr">
<property name="enabled">
<bool>false</bool>
</property>
@@ -133,49 +179,32 @@
</item>
<item>
<property name="text">
<string>SIGUSR1</string>
<string>LADISH (SIGUSR1)</string>
</property>
</item>
<item>
<property name="text">
<string>NSM</string>
<string>Non Session Manager (OSC)</string>
</property>
</item>
</widget>
</item>
<item row="2" column="3">
<spacer name="horizontalSpacer_3">
<item row="3" column="0">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Ignored</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>274</width>
<width>1</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="2">
<widget class="QLabel" name="label_9">
<property name="text">
<string>(Not Implemented Yet)</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Name:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1" colspan="3">
<widget class="QLineEdit" name="le_name"/>
</item>
</layout>
</widget>
</item>
@@ -185,58 +214,99 @@
<string>Setup</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Audio inputs:</string>
<item row="1" column="0">
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<property name="sizeHint" stdset="0">
<size>
<width>1</width>
<height>1</height>
</size>
</property>
</widget>
</spacer>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="sb_audio_ins">
<property name="maximum">
<number>64</number>
<item row="1" column="8">
<spacer name="horizontalSpacer_16">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="value">
<number>2</number>
<property name="sizeHint" stdset="0">
<size>
<width>1</width>
<height>1</height>
</size>
</property>
</widget>
</spacer>
</item>
<item row="0" column="2" rowspan="2">
<widget class="Line" name="line">
<item row="1" column="3">
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Horizontal</enum>
</property>
</widget>
<property name="sizeHint" stdset="0">
<size>
<width>1</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="3">
<widget class="QLabel" name="label_5">
<property name="enabled">
<bool>false</bool>
<item row="0" column="0">
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>1</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="5">
<spacer name="horizontalSpacer_13">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>1</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_3">
<property name="text">
<string>CV inputs:</string>
<string>Audio inputs:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QSpinBox" name="sb_cv_ins">
<property name="enabled">
<bool>false</bool>
</property>
<item row="0" column="2">
<widget class="QSpinBox" name="sb_audio_ins">
<property name="maximum">
<number>64</number>
</property>
<property name="value">
<number>2</number>
</property>
</widget>
</item>
<item row="0" column="5" rowspan="2">
<widget class="Line" name="line_2">
<item row="0" column="4" rowspan="2">
<widget class="Line" name="line">
<property name="lineWidth">
<number>0</number>
</property>
<property name="midLineWidth">
<number>1</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@@ -245,7 +315,7 @@
<item row="0" column="6">
<widget class="QLabel" name="label_7">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="text">
<string>MIDI inputs:</string>
@@ -258,14 +328,14 @@
<item row="0" column="7">
<widget class="QSpinBox" name="sb_midi_ins">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="maximum">
<number>16</number>
<number>1</number>
</property>
</widget>
</item>
<item row="1" column="0">
<item row="1" column="1">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Audio outputs:</string>
@@ -275,7 +345,7 @@
</property>
</widget>
</item>
<item row="1" column="1">
<item row="1" column="2">
<widget class="QSpinBox" name="sb_audio_outs">
<property name="maximum">
<number>64</number>
@@ -285,51 +355,67 @@
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLabel" name="label_2">
<item row="1" column="6">
<widget class="QLabel" name="label_8">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="text">
<string>CV outputs:</string>
<string>MIDI outputs:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QSpinBox" name="sb_cv_outs">
<item row="1" column="7">
<widget class="QSpinBox" name="sb_midi_outs">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="maximum">
<number>64</number>
<number>1</number>
</property>
</widget>
</item>
<item row="1" column="6">
<widget class="QLabel" name="label_8">
<property name="enabled">
<bool>false</bool>
<item row="0" column="3">
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="text">
<string>MIDI outputs:</string>
<property name="sizeHint" stdset="0">
<size>
<width>1</width>
<height>1</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</spacer>
</item>
<item row="0" column="8">
<spacer name="horizontalSpacer_15">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<property name="sizeHint" stdset="0">
<size>
<width>1</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="7">
<widget class="QSpinBox" name="sb_midi_outs">
<property name="enabled">
<bool>false</bool>
<item row="1" column="5">
<spacer name="horizontalSpacer_14">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="maximum">
<number>16</number>
<property name="sizeHint" stdset="0">
<size>
<width>1</width>
<height>1</height>
</size>
</property>
</widget>
</spacer>
</item>
</layout>
</widget>


+ 11
- 47
source/backend/plugin/CarlaPluginJack.cpp View File

@@ -126,7 +126,7 @@ protected:

carla_setenv("CARLA_FRONTEND_WIN_ID", strBuf);
carla_setenv("CARLA_SHM_IDS", fShmIds.buffer());
carla_setenv("CARLA_NUM_PORTS", fNumPorts.buffer());
carla_setenv("CARLA_LIBJACK_SETUP", fNumPorts.buffer());

started = fProcess->start(arguments);
}
@@ -413,8 +413,6 @@ public:
// cleanup of previous data
pData->audioIn.clear();
pData->audioOut.clear();
pData->cvIn.clear();
pData->cvOut.clear();
pData->event.clear();

bool needsCtrlIn, needsCtrlOut;
@@ -431,16 +429,6 @@ public:
needsCtrlIn = true;
}

if (fInfo.cvIns > 0)
{
pData->cvIn.createNew(fInfo.cvIns);
}

if (fInfo.cvOuts > 0)
{
pData->cvOut.createNew(fInfo.cvOuts);
}

if (fInfo.mIns > 0)
needsCtrlIn = true;

@@ -504,10 +492,6 @@ public:
pData->audioOut.ports[j].rindex = j;
}

// TODO - MIDI

// TODO - CV

if (needsCtrlIn)
{
portName.clear();
@@ -605,7 +589,7 @@ public:
} CARLA_SAFE_EXCEPTION("deactivate - waitForClient");
}

void process(const float** const audioIn, float** const audioOut, const float** const cvIn, float** const cvOut, const uint32_t frames) override
void process(const float** const audioIn, float** const audioOut, const float**, float**, const uint32_t frames) override
{
// --------------------------------------------------------------------------------------------------------
// Check if active
@@ -615,8 +599,6 @@ public:
// disable any output sound
for (uint32_t i=0; i < pData->audioOut.count; ++i)
FloatVectorOperations::clear(audioOut[i], static_cast<int>(frames));
for (uint32_t i=0; i < pData->cvOut.count; ++i)
FloatVectorOperations::clear(cvOut[i], static_cast<int>(frames));
return;
}

@@ -835,7 +817,7 @@ public:

} // End of Event Input

if (! processSingle(audioIn, audioOut, cvIn, cvOut, frames))
if (! processSingle(audioIn, audioOut, frames))
return;

// --------------------------------------------------------------------------------------------------------
@@ -877,8 +859,7 @@ public:
} // End of Control and MIDI Output
}

bool processSingle(const float** const audioIn, float** const audioOut,
const float** const cvIn, float** const cvOut, const uint32_t frames)
bool processSingle(const float** const audioIn, float** const audioOut, const uint32_t frames)
{
CARLA_SAFE_ASSERT_RETURN(! fTimedError, false);
CARLA_SAFE_ASSERT_RETURN(frames > 0, false);
@@ -891,14 +872,6 @@ public:
{
CARLA_SAFE_ASSERT_RETURN(audioOut != nullptr, false);
}
if (pData->cvIn.count > 0)
{
CARLA_SAFE_ASSERT_RETURN(cvIn != nullptr, false);
}
if (pData->cvOut.count > 0)
{
CARLA_SAFE_ASSERT_RETURN(cvOut != nullptr, false);
}

const int iframes(static_cast<int>(frames));

@@ -913,8 +886,6 @@ public:
{
for (uint32_t i=0; i < pData->audioOut.count; ++i)
FloatVectorOperations::clear(audioOut[i], iframes);
for (uint32_t i=0; i < pData->cvOut.count; ++i)
FloatVectorOperations::clear(cvOut[i], iframes);
return false;
}

@@ -1230,28 +1201,24 @@ public:
// ---------------------------------------------------------------
// check setup

if (std::strlen(label) != 6)
if (std::strlen(label) != 5)
{
pData->engine->setLastError("invalid application setup received");
return false;
}

for (int i=6; --i >= 0;) {
CARLA_SAFE_ASSERT_RETURN(label[i] >= '0' && label[i] < '0'+64, false);
for (int i=4; --i >= 0;) {
CARLA_SAFE_ASSERT_RETURN(label[i] >= '0' && label[i] <= '0'+64, false);
}
CARLA_SAFE_ASSERT_RETURN(label[4] >= '0' && label[4] < '0'+0x4f, false);

fInfo.aIns = label[0] - '0';
fInfo.aOuts = label[1] - '0';
fInfo.cvIns = label[2] - '0';
fInfo.cvOuts = label[3] - '0';
fInfo.mIns = label[4] - '0';
fInfo.mOuts = label[5] - '0';
fInfo.mIns = carla_minPositive(label[4] - '0', 1);
fInfo.mOuts = carla_minPositive(label[5] - '0', 1);

fInfo.setupLabel = label;

// TODO
fInfo.cvIns = fInfo.cvOuts = fInfo.mIns = fInfo.mOuts = 0;

// ---------------------------------------------------------------
// set info

@@ -1351,7 +1318,6 @@ private:

struct Info {
uint32_t aIns, aOuts;
uint32_t cvIns, cvOuts;
uint32_t mIns, mOuts;
PluginCategory category;
uint optionsAvailable;
@@ -1361,8 +1327,6 @@ private:
Info()
: aIns(0),
aOuts(0),
cvIns(0),
cvOuts(0),
mIns(0),
mOuts(0),
category(PLUGIN_CATEGORY_NONE),
@@ -1375,7 +1339,7 @@ private:

void resizeAudioPool(const uint32_t bufferSize)
{
fShmAudioPool.resize(bufferSize, fInfo.aIns+fInfo.aOuts, fInfo.cvIns+fInfo.cvOuts);
fShmAudioPool.resize(bufferSize, fInfo.aIns+fInfo.aOuts, 0);

fShmRtClientControl.writeOpcode(kPluginBridgeRtClientSetAudioPool);
fShmRtClientControl.writeULong(static_cast<uint64_t>(fShmAudioPool.dataSize));


+ 23
- 6
source/carla_database.py View File

@@ -1884,6 +1884,13 @@ class PluginDatabaseW(QDialog):
# Jack Application Dialog

class JackApplicationW(QDialog):
# TODO complete this
FLAG_SESSION_MGR_JACK = 0x01
FLAG_SESSION_MGR_LADISH = 0x02
FLAG_SESSION_MGR_LASH = 0x04
FLAG_SESSION_MGR_NSM = 0x08
FLAG_CONTROL_WINDOW = 0x10

def __init__(self, parent, host):
QDialog.__init__(self, parent)
self.host = host
@@ -1898,15 +1905,25 @@ class JackApplicationW(QDialog):
def getCommandAndFlags(self):
name = self.ui.le_name.text()
command = self.ui.le_command.text()
flags = 0x0
if not name:
name = command.split(" ",1)[0]

# TODO finalize flag definitions
sessionMgrIndex = self.ui.cb_session_mgr.currentIndex()
if sessionMgrIndex == 1:
flags |= self.FLAG_SESSION_MGR_LADISH
elif sessionMgrIndex == 2:
flags |= self.FLAG_SESSION_MGR_NSM
if self.ui.cb_manage_window.isChecked():
flags |= self.FLAG_CONTROL_WINDOW

baseIntVal = ord('0')
labelSetup = "%s%s%s%s%s%s" % (chr(baseIntVal+self.ui.sb_audio_ins.value()),
chr(baseIntVal+self.ui.sb_audio_outs.value()),
chr(baseIntVal+self.ui.sb_cv_ins.value()),
chr(baseIntVal+self.ui.sb_cv_outs.value()),
chr(baseIntVal+self.ui.sb_midi_ins.value()),
chr(baseIntVal+self.ui.sb_midi_outs.value()))
labelSetup = "%s%s%s%s%s" % (chr(baseIntVal+self.ui.sb_audio_ins.value()),
chr(baseIntVal+self.ui.sb_audio_outs.value()),
chr(baseIntVal+self.ui.sb_midi_ins.value()),
chr(baseIntVal+self.ui.sb_midi_outs.value()),
chr(baseIntVal+flags))
return (command, name, labelSetup)

# --------------------------------------------------------------------------------------------------------


+ 9
- 14
source/libjack/libjack.cpp View File

@@ -46,12 +46,13 @@ public:
const char* const shmIds(std::getenv("CARLA_SHM_IDS"));
CARLA_SAFE_ASSERT_RETURN(shmIds != nullptr && std::strlen(shmIds) == 6*4,);

const char* const numPortsStr(std::getenv("CARLA_NUM_PORTS"));
CARLA_SAFE_ASSERT_RETURN(numPortsStr != nullptr && std::strlen(numPortsStr) == 3*2,);
const char* const libjackSetup(std::getenv("CARLA_LIBJACK_SETUP"));
CARLA_SAFE_ASSERT_RETURN(libjackSetup != nullptr && std::strlen(libjackSetup) == 5,);

for (int i=6; --i >= 0;) {
CARLA_SAFE_ASSERT_RETURN(numPortsStr[i] >= '0' && numPortsStr[i] < '0'+64,);
for (int i=4; --i >= 0;) {
CARLA_SAFE_ASSERT_RETURN(libjackSetup[i] >= '0' && libjackSetup[i] <= '0'+64,);
}
CARLA_SAFE_ASSERT_RETURN(libjackSetup[4] >= '0' && libjackSetup[4] < '0'+0x4f,);

std::memcpy(fBaseNameAudioPool, shmIds+6*0, 6);
std::memcpy(fBaseNameRtClientControl, shmIds+6*1, 6);
@@ -63,12 +64,10 @@ public:
fBaseNameNonRtClientControl[6] = '\0';
fBaseNameNonRtServerControl[6] = '\0';

fNumPorts.audioIns = numPortsStr[0] - '0';
fNumPorts.audioOuts = numPortsStr[1] - '0';
fNumPorts.cvIns = numPortsStr[2] - '0';
fNumPorts.cvOuts = numPortsStr[3] - '0';
fNumPorts.midiIns = numPortsStr[4] - '0';
fNumPorts.midiOuts = numPortsStr[5] - '0';
fNumPorts.audioIns = libjackSetup[0] - '0';
fNumPorts.audioOuts = libjackSetup[1] - '0';
fNumPorts.midiIns = libjackSetup[2] - '0';
fNumPorts.midiOuts = libjackSetup[3] - '0';

startThread(10);
}
@@ -143,16 +142,12 @@ private:
struct NumPorts {
uint32_t audioIns;
uint32_t audioOuts;
uint32_t cvIns;
uint32_t cvOuts;
uint32_t midiIns;
uint32_t midiOuts;

NumPorts()
: audioIns(0),
audioOuts(0),
cvIns(0),
cvOuts(0),
midiIns(0),
midiOuts(0) {}
} fNumPorts;


Loading…
Cancel
Save