Browse Source

Cleanly stop jackdbus before killing, fixes force-restart

tags/v0.9.0
falkTX 10 years ago
parent
commit
7ce46370a5
2 changed files with 26 additions and 5 deletions
  1. +10
    -2
      src/cadence.py
  2. +16
    -3
      src/shared_cadence.py

+ 10
- 2
src/cadence.py View File

@@ -1249,7 +1249,12 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW):
self.groupBox_bridges.setEnabled(False)

if gDBus.a2j:
if gDBus.a2j.is_started():
try:
started = gDBus.a2j.is_started()
except:
started = False

if started:
self.a2jStarted()
else:
self.a2jStopped()
@@ -1411,7 +1416,10 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW):
self.systray.setActionEnabled("alsa_stop", True)
self.label_bridge_alsa.setText(self.tr("Using Cadence snd-aloop daemon, started"))
else:
jackRunning = bool(gDBus.jack and gDBus.jack.IsStarted())
try:
jackRunning = bool(gDBus.jack and gDBus.jack.IsStarted())
except:
jackRunning = False
self.b_alsa_start.setEnabled(jackRunning)
self.b_alsa_stop.setEnabled(False)
self.systray.setActionEnabled("alsa_start", jackRunning)


+ 16
- 3
src/shared_cadence.py View File

@@ -115,10 +115,24 @@ def waitProcsEnd(procs, tries):
else:
break

# ------------------------------------------------------------------------------------------------------------
# Cleanly close the jack dbus service

def tryCloseJackDBus():
try:
import dbus
bus = dbus.SessionBus()
jack = bus.get_object("org.jackaudio.service", "/org/jackaudio/Controller")
jack.Exit()
except:
print("tryCloseJackDBus() failed")

# ------------------------------------------------------------------------------------------------------------
# Stop all audio processes, used for force-restart

def stopAllAudioProcesses():
tryCloseJackDBus()

if not (HAIKU or LINUX or MACOS):
print("stopAllAudioProcesses() - Not supported in this system")
return
@@ -131,13 +145,12 @@ def stopAllAudioProcesses():

procsTerm = ["a2j", "a2jmidid", "artsd", "jackd", "jackdmp", "knotify4", "lash", "ladishd", "ladiappd", "ladiconfd", "jmcore"]
procsKill = ["jackdbus", "pulseaudio"]
tries = 20
tries = 20

process.start("killall", procsTerm)
process.waitForFinished()
waitProcsEnd(procsTerm, tries)

process.start("killall", ["-KILL"] + procsKill)
process.waitForFinished()

waitProcsEnd(procsTerm, tries)
waitProcsEnd(procsKill, tries)

Loading…
Cancel
Save