@@ -519,13 +519,13 @@ def __init__(self, parent):
519
519
QThread .__init__ (self , parent )
520
520
521
521
self .m_wasStarted = False
522
- self .m_a2jExportHW = False
523
522
524
523
def wasJackStarted (self ):
525
524
return self .m_wasStarted
526
525
527
526
def startA2J (self ):
528
- gDBus .a2j .set_hw_export (self .m_a2jExportHW )
527
+ if not gDBus .a2j .get_hw_export () and GlobalSettings .value ("A2J/AutoExport" , True , type = bool ):
528
+ gDBus .a2j .set_hw_export (True )
529
529
gDBus .a2j .start ()
530
530
531
531
def run (self ):
@@ -574,8 +574,7 @@ def run(self):
574
574
self .progressChanged .emit (94 )
575
575
576
576
# ALSA-MIDI
577
- if GlobalSettings .value ("A2J/AutoStart" , True , type = bool ) and gDBus .a2j and not bool (gDBus .a2j .is_started ()):
578
- self .m_a2jExportHW = GlobalSettings .value ("A2J/ExportHW" , True , type = bool )
577
+ if GlobalSettings .value ("A2J/AutoStart" , True , type = bool ) and not bool (gDBus .a2j .is_started ()):
579
578
runFunctionInMainThread (self .startA2J )
580
579
581
580
self .progressChanged .emit (96 )
@@ -718,24 +717,6 @@ def done(self, r):
718
717
QDialog .done (self , r )
719
718
self .close ()
720
719
721
- # Additional ALSA MIDI options
722
- class ToolBarA2JDialog (QDialog , ui_cadence_tb_a2j .Ui_Dialog ):
723
- def __init__ (self , parent ):
724
- QDialog .__init__ (self , parent )
725
- self .setupUi (self )
726
-
727
- self .cb_export_hw .setChecked (GlobalSettings .value ("A2J/ExportHW" , True , type = bool ))
728
-
729
- self .accepted .connect (self .slot_setOptions )
730
-
731
- @pyqtSlot ()
732
- def slot_setOptions (self ):
733
- GlobalSettings .setValue ("A2J/ExportHW" , self .cb_export_hw .isChecked ())
734
-
735
- def done (self , r ):
736
- QDialog .done (self , r )
737
- self .close ()
738
-
739
720
# Additional PulseAudio options
740
721
class ToolBarPADialog (QDialog , ui_cadence_tb_pa .Ui_Dialog ):
741
722
def __init__ (self , parent ):
@@ -1104,7 +1085,6 @@ def __init__(self, parent=None):
1104
1085
self .systray .connect ("alsa_stop" , self .slot_AlsaBridgeStop )
1105
1086
self .systray .connect ("a2j_start" , self .slot_A2JBridgeStart )
1106
1087
self .systray .connect ("a2j_stop" , self .slot_A2JBridgeStop )
1107
- self .systray .connect ("a2j_export_hw" , self .slot_A2JBridgeExportHW )
1108
1088
self .systray .connect ("pulse_start" , self .slot_PulseAudioBridgeStart )
1109
1089
self .systray .connect ("pulse_stop" , self .slot_PulseAudioBridgeStop )
1110
1090
@@ -1150,8 +1130,6 @@ def __init__(self, parent=None):
1150
1130
self .b_a2j_start .clicked .connect (self .slot_A2JBridgeStart )
1151
1131
self .b_a2j_stop .clicked .connect (self .slot_A2JBridgeStop )
1152
1132
self .b_a2j_export_hw .clicked .connect (self .slot_A2JBridgeExportHW )
1153
- self .tb_a2j_options .clicked .connect (self .slot_A2JBridgeOptions )
1154
-
1155
1133
self .b_pulse_start .clicked .connect (self .slot_PulseAudioBridgeStart )
1156
1134
self .b_pulse_stop .clicked .connect (self .slot_PulseAudioBridgeStop )
1157
1135
self .tb_pulse_options .clicked .connect (self .slot_PulseAudioBridgeOptions )
@@ -1290,6 +1268,7 @@ def DBusReconnect(self):
1290
1268
else :
1291
1269
self .toolBox_alsamidi .setEnabled (False )
1292
1270
self .cb_a2j_autostart .setChecked (False )
1271
+ self .cb_a2j_autoexport .setChecked (False )
1293
1272
self .label_bridge_a2j .setText ("ALSA MIDI Bridge is not installed" )
1294
1273
self .settings .setValue ("A2J/AutoStart" , False )
1295
1274
@@ -1358,8 +1337,13 @@ def jackStarted(self):
1358
1337
self .m_timer500 = self .startTimer (500 )
1359
1338
1360
1339
if gDBus .a2j and not gDBus .a2j .is_started ():
1361
- self .b_a2j_start .setEnabled (True )
1362
- self .systray .setActionEnabled ("a2j_start" , True )
1340
+ if GlobalSettings .value ("A2J/AutoStart" , True , type = bool ):
1341
+ if not gDBus .a2j .get_hw_export () and GlobalSettings .value ("A2J/AutoExport" , True , type = bool ):
1342
+ gDBus .a2j .set_hw_export (True )
1343
+ gDBus .a2j .start ()
1344
+ else :
1345
+ self .b_a2j_start .setEnabled (True )
1346
+ self .systray .setActionEnabled ("a2j_start" , True )
1363
1347
1364
1348
self .checkAlsaAudio ()
1365
1349
self .checkPulseAudio ()
@@ -1405,7 +1389,6 @@ def jackStopped(self):
1405
1389
def a2jStarted (self ):
1406
1390
self .b_a2j_start .setEnabled (False )
1407
1391
self .b_a2j_stop .setEnabled (True )
1408
- self .b_a2j_export_hw .setEnabled (False )
1409
1392
self .systray .setActionEnabled ("a2j_start" , False )
1410
1393
self .systray .setActionEnabled ("a2j_stop" , True )
1411
1394
self .systray .setActionEnabled ("a2j_export_hw" , False )
@@ -1415,7 +1398,6 @@ def a2jStopped(self):
1415
1398
jackRunning = bool (gDBus .jack and gDBus .jack .IsStarted ())
1416
1399
self .b_a2j_start .setEnabled (jackRunning )
1417
1400
self .b_a2j_stop .setEnabled (False )
1418
- self .b_a2j_export_hw .setEnabled (True )
1419
1401
self .systray .setActionEnabled ("a2j_start" , jackRunning )
1420
1402
self .systray .setActionEnabled ("a2j_stop" , False )
1421
1403
self .systray .setActionEnabled ("a2j_export_hw" , True )
@@ -1790,16 +1772,10 @@ def slot_A2JBridgeStop(self):
1790
1772
1791
1773
@pyqtSlot ()
1792
1774
def slot_A2JBridgeExportHW (self ):
1793
- ask = QMessageBox .question (self , self .tr ("ALSA MIDI Hardware Export" ), self .tr ("Enable Hardware Export on the ALSA MIDI Bridge?" ), QMessageBox .Yes | QMessageBox .No | QMessageBox .Cancel , QMessageBox .Yes )
1794
-
1795
- if ask == QMessageBox .Yes :
1796
- gDBus .a2j .set_hw_export (True )
1797
- elif ask == QMessageBox .No :
1798
- gDBus .a2j .set_hw_export (False )
1799
-
1800
- @pyqtSlot ()
1801
- def slot_A2JBridgeOptions (self ):
1802
- ToolBarA2JDialog (self ).exec_ ()
1775
+ if bool (gDBus .a2j .is_started ()):
1776
+ gDBus .a2j .stop ()
1777
+ gDBus .a2j .set_hw_export (True )
1778
+ gDBus .a2j .start ()
1803
1779
1804
1780
@pyqtSlot ()
1805
1781
def slot_PulseAudioBridgeStart (self ):
@@ -2304,6 +2280,7 @@ def saveSettings(self):
2304
2280
GlobalSettings .setValue ("JACK/AutoStart" , self .cb_jack_autostart .isChecked ())
2305
2281
GlobalSettings .setValue ("ALSA-Audio/BridgeIndexType" , self .cb_alsa_type .currentIndex ())
2306
2282
GlobalSettings .setValue ("A2J/AutoStart" , self .cb_a2j_autostart .isChecked ())
2283
+ GlobalSettings .setValue ("A2J/AutoExport" , self .cb_a2j_autoexport .isChecked ())
2307
2284
GlobalSettings .setValue ("Pulse2JACK/AutoStart" , (havePulseAudio and self .cb_pulse_autostart .isChecked ()))
2308
2285
2309
2286
def loadSettings (self , geometry ):
@@ -2314,6 +2291,7 @@ def loadSettings(self, geometry):
2314
2291
2315
2292
self .cb_jack_autostart .setChecked (GlobalSettings .value ("JACK/AutoStart" , wantJackStart , type = bool ))
2316
2293
self .cb_a2j_autostart .setChecked (GlobalSettings .value ("A2J/AutoStart" , True , type = bool ))
2294
+ self .cb_a2j_autoexport .setChecked (GlobalSettings .value ("A2J/AutoExport" , True , type = bool ))
2317
2295
self .cb_pulse_autostart .setChecked (GlobalSettings .value ("Pulse2JACK/AutoStart" , havePulseAudio and not usingAlsaLoop , type = bool ))
2318
2296
2319
2297
def timerEvent (self , event ):
0 commit comments