Browse Source

libjack: Implement basic session management via SIGUSR1 signal

tags/v1.9.12
falkTX 7 years ago
parent
commit
d9979d0c56
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> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>468</width>
<width>471</width>
<height>369</height> <height>369</height>
</rect> </rect>
</property> </property>
@@ -111,9 +111,6 @@
</item> </item>
<item> <item>
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="label_6">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text"> <property name="text">
<string>Session Manager:</string> <string>Session Manager:</string>
</property> </property>
@@ -124,22 +121,22 @@
</item> </item>
<item> <item>
<widget class="QComboBox" name="cb_session_mgr"> <widget class="QComboBox" name="cb_session_mgr">
<property name="enabled">
<bool>false</bool>
<property name="currentIndex">
<number>1</number>
</property> </property>
<item> <item>
<property name="text"> <property name="text">
<string>None / Manual</string>
<string>None</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>LADISH (SIGUSR1)</string>
<string>Auto</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Non Session Manager (OSC)</string>
<string>LADISH (SIGUSR1)</string>
</property> </property>
</item> </item>
</widget> </widget>


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

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


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

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

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




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

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


class JackApplicationW(QDialog): class JackApplicationW(QDialog):
SESSION_MGR_NONE = 0 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 SESSION_MGR_NSM = 4


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


# TODO finalize flag definitions # 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: #elif uiSessionMgrIndex == 2:
#smgr = self.SESSION_MGR_NSM #smgr = self.SESSION_MGR_NSM




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

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


case kPluginBridgeNonRtClientPrepareForSave: 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); const CarlaMutexLocker _cml(fShmNonRtServerControl.mutex);


fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerSaved); fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerSaved);


Loading…
Cancel
Save