Browse Source

libjack: Implement basic session management via SIGUSR1 signal

tags/v2.1-alpha1-winvst
falkTX 6 years ago
parent
commit
81e9caa81a
4 changed files with 38 additions and 15 deletions
  1. +6
    -9
      resources/ui/carla_add_jack.ui
  2. +10
    -0
      source/backend/plugin/CarlaPluginJack.cpp
  3. +8
    -6
      source/frontend/carla_database.py
  4. +14
    -0
      source/libjack/libjack.cpp

+ 6
- 9
resources/ui/carla_add_jack.ui View File

@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>468</width>
<width>471</width>
<height>369</height>
</rect>
</property>
@@ -111,9 +111,6 @@
</item>
<item>
<widget class="QLabel" name="label_6">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Session Manager:</string>
</property>
@@ -124,22 +121,22 @@
</item>
<item>
<widget class="QComboBox" name="cb_session_mgr">
<property name="enabled">
<bool>false</bool>
<property name="currentIndex">
<number>1</number>
</property>
<item>
<property name="text">
<string>None / Manual</string>
<string>None</string>
</property>
</item>
<item>
<property name="text">
<string>LADISH (SIGUSR1)</string>
<string>Auto</string>
</property>
</item>
<item>
<property name="text">
<string>Non Session Manager (OSC)</string>
<string>LADISH (SIGUSR1)</string>
</property>
</item>
</widget>


+ 10
- 0
source/backend/plugin/CarlaPluginJack.cpp View File

@@ -325,6 +325,16 @@ public:
// -------------------------------------------------------------------
// Set data (state)

void prepareForSave() noexcept override
{
{
const CarlaMutexLocker _cml(fShmNonRtClientControl.mutex);

fShmNonRtClientControl.writeOpcode(kPluginBridgeNonRtClientPrepareForSave);
fShmNonRtClientControl.commitWrite();
}
}

// -------------------------------------------------------------------
// Set data (internal stuff)



+ 8
- 6
source/frontend/carla_database.py View File

@@ -1718,9 +1718,9 @@ class PluginDatabaseW(QDialog):

class JackApplicationW(QDialog):
SESSION_MGR_NONE = 0
SESSION_MGR_JACK = 1
SESSION_MGR_LADISH = 2
SESSION_MGR_LASH = 3
SESSION_MGR_AUTO = 1
SESSION_MGR_JACK = 2
SESSION_MGR_LADISH = 3
SESSION_MGR_NSM = 4

FLAG_CONTROL_WINDOW = 0x01
@@ -1762,9 +1762,11 @@ class JackApplicationW(QDialog):
name = os.path.basename(command.split(" ",1)[0])

# TODO finalize flag definitions
#uiSessionMgrIndex = self.ui.cb_session_mgr.currentIndex()
#if uiSessionMgrIndex == 1:
#smgr = self.SESSION_MGR_LADISH
uiSessionMgrIndex = self.ui.cb_session_mgr.currentIndex()
if uiSessionMgrIndex == 1:
smgr = self.SESSION_MGR_AUTO
elif uiSessionMgrIndex == 2:
smgr = self.SESSION_MGR_LADISH
#elif uiSessionMgrIndex == 2:
#smgr = self.SESSION_MGR_NSM



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

@@ -940,6 +940,20 @@ bool CarlaJackAppClient::handleNonRtData()

case kPluginBridgeNonRtClientPrepareForSave:
{
if (fSessionManager == 1) // auto
{
struct sigaction sig;
carla_zeroStruct(sig);

sigaction(SIGUSR1, nullptr, &sig);

if (sig.sa_handler != nullptr)
fSessionManager = 3;
}

if (fSessionManager == 3)
::kill(::getpid(), SIGUSR1);

const CarlaMutexLocker _cml(fShmNonRtServerControl.mutex);

fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerSaved);


Loading…
Cancel
Save