|
|
@@ -1063,7 +1063,6 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): |
|
|
|
self.systray.addMenu("a2j", self.tr("ALSA MIDI Bridge")) |
|
|
|
self.systray.addMenuAction("a2j", "a2j_start", self.tr("Start")) |
|
|
|
self.systray.addMenuAction("a2j", "a2j_stop", self.tr("Stop")) |
|
|
|
self.systray.addMenuAction("a2j", "a2j_export_hw", self.tr("Export Hardware Ports...")) |
|
|
|
self.systray.addMenu("pulse", self.tr("PulseAudio Bridge")) |
|
|
|
self.systray.addMenuAction("pulse", "pulse_start", self.tr("Start")) |
|
|
|
self.systray.addMenuAction("pulse", "pulse_stop", self.tr("Stop")) |
|
|
@@ -1085,7 +1084,6 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): |
|
|
|
self.systray.connect("alsa_stop", self.slot_AlsaBridgeStop) |
|
|
|
self.systray.connect("a2j_start", self.slot_A2JBridgeStart) |
|
|
|
self.systray.connect("a2j_stop", self.slot_A2JBridgeStop) |
|
|
|
self.systray.connect("a2j_export_hw", self.slot_A2JBridgeExportHW) |
|
|
|
self.systray.connect("pulse_start", self.slot_PulseAudioBridgeStart) |
|
|
|
self.systray.connect("pulse_stop", self.slot_PulseAudioBridgeStop) |
|
|
|
|
|
|
@@ -1130,7 +1128,6 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): |
|
|
|
|
|
|
|
self.b_a2j_start.clicked.connect(self.slot_A2JBridgeStart) |
|
|
|
self.b_a2j_stop.clicked.connect(self.slot_A2JBridgeStop) |
|
|
|
self.b_a2j_export_hw.clicked.connect(self.slot_A2JBridgeExportHW) |
|
|
|
self.b_pulse_start.clicked.connect(self.slot_PulseAudioBridgeStart) |
|
|
|
self.b_pulse_stop.clicked.connect(self.slot_PulseAudioBridgeStop) |
|
|
|
self.tb_pulse_options.clicked.connect(self.slot_PulseAudioBridgeOptions) |
|
|
@@ -1189,6 +1186,7 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): |
|
|
|
# org.gna.home.a2jmidid.control |
|
|
|
self.DBusA2JBridgeStartedCallback.connect(self.slot_DBusA2JBridgeStartedCallback) |
|
|
|
self.DBusA2JBridgeStoppedCallback.connect(self.slot_DBusA2JBridgeStoppedCallback) |
|
|
|
self.cb_a2j_autoexport.stateChanged[int].connect(self.slot_A2JBridgeExportHW) |
|
|
|
|
|
|
|
# ------------------------------------------------------------- |
|
|
|
|
|
|
@@ -1342,21 +1340,12 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): |
|
|
|
if GlobalSettings.value("A2J/AutoStart", True, type=bool): |
|
|
|
if not portsExported and GlobalSettings.value("A2J/AutoExport", True, type=bool): |
|
|
|
gDBus.a2j.set_hw_export(True) |
|
|
|
self.systray.setActionEnabled("a2j_start", False) |
|
|
|
portsExported = True |
|
|
|
gDBus.a2j.start() |
|
|
|
else: |
|
|
|
self.b_a2j_start.setEnabled(True) |
|
|
|
self.b_a2j_export_hw.setEnabled(True) |
|
|
|
self.systray.setActionEnabled("a2j_start", True) |
|
|
|
|
|
|
|
if portsExported: |
|
|
|
self.b_a2j_export_hw.setText('Ports exported!') |
|
|
|
|
|
|
|
# It is only needed to export the ports initially, new ones will appear automatically |
|
|
|
self.b_a2j_export_hw.setEnabled(not portsExported) |
|
|
|
self.systray.setActionEnabled("a2j_export_hw", not portsExported) |
|
|
|
|
|
|
|
self.checkAlsaAudio() |
|
|
|
self.checkPulseAudio() |
|
|
|
|
|
|
@@ -1388,10 +1377,7 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): |
|
|
|
|
|
|
|
if gDBus.a2j: |
|
|
|
self.b_a2j_start.setEnabled(False) |
|
|
|
self.b_a2j_export_hw.setEnabled(False) |
|
|
|
self.systray.setActionEnabled("a2j_start", False) |
|
|
|
if bool(gDBus.a2j.get_hw_export()): |
|
|
|
self.b_a2j_export_hw.setText('Ports exported!') |
|
|
|
|
|
|
|
global jackClientIdALSA, jackClientIdPulse |
|
|
|
jackClientIdALSA = -1 |
|
|
@@ -1406,17 +1392,17 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): |
|
|
|
self.b_a2j_stop.setEnabled(True) |
|
|
|
self.systray.setActionEnabled("a2j_start", False) |
|
|
|
self.systray.setActionEnabled("a2j_stop", True) |
|
|
|
self.label_bridge_a2j.setText(self.tr("ALSA MIDI Bridge is running")) |
|
|
|
if bool(gDBus.a2j.get_hw_export()): |
|
|
|
self.label_bridge_a2j.setText(self.tr("ALSA MIDI Bridge is running, ports are exported")) |
|
|
|
else : |
|
|
|
self.label_bridge_a2j.setText(self.tr("ALSA MIDI Bridge is running")) |
|
|
|
|
|
|
|
def a2jStopped(self): |
|
|
|
jackRunning = bool(gDBus.jack and gDBus.jack.IsStarted()) |
|
|
|
needExport = bool(not gDBus.a2j.get_hw_export() and jackRunning) |
|
|
|
self.b_a2j_start.setEnabled(jackRunning) |
|
|
|
self.b_a2j_stop.setEnabled(False) |
|
|
|
self.systray.setActionEnabled("a2j_start", jackRunning) |
|
|
|
self.systray.setActionEnabled("a2j_stop", False) |
|
|
|
self.systray.setActionEnabled("a2j_export_hw", needExport) |
|
|
|
self.b_a2j_export_hw.setEnabled(needExport) |
|
|
|
self.label_bridge_a2j.setText(self.tr("ALSA MIDI Bridge is stopped")) |
|
|
|
|
|
|
|
def checkAlsaAudio(self): |
|
|
@@ -1788,17 +1774,14 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): |
|
|
|
def slot_A2JBridgeStop(self): |
|
|
|
gDBus.a2j.stop() |
|
|
|
|
|
|
|
@pyqtSlot() |
|
|
|
def slot_A2JBridgeExportHW(self): |
|
|
|
@pyqtSlot(int) |
|
|
|
def slot_A2JBridgeExportHW(self, state): |
|
|
|
a2jWasStarted = bool(gDBus.a2j.is_started()) |
|
|
|
|
|
|
|
if a2jWasStarted: |
|
|
|
gDBus.a2j.stop() |
|
|
|
|
|
|
|
gDBus.a2j.set_hw_export(True) |
|
|
|
self.b_a2j_export_hw.setText('Ports exported!') |
|
|
|
self.b_a2j_export_hw.setEnabled(False) |
|
|
|
self.systray.setActionEnabled("a2j_export_hw", False) |
|
|
|
gDBus.a2j.set_hw_export(bool(state)) |
|
|
|
|
|
|
|
if a2jWasStarted: |
|
|
|
gDBus.a2j.start() |
|
|
|