@@ -43,38 +43,66 @@ else | |||
fi | |||
# ---------------------------------------------- | |||
wanted_capture_ports=0 # -1 means default | |||
wanted_playback_ports=0 # -1 means default | |||
PLAY_ONLY="no" | |||
arg_is_for="" | |||
case $1 in | |||
-h|--h|--help) | |||
echo "usage: $0 [command] | |||
for arg in "$@";do | |||
case "$arg" in | |||
-h|--h|--help) | |||
echo "usage: $0 [command] | |||
-p Playback only with default number of channels | |||
-p <NUMBER> Number of playback channels | |||
-c Capture only with default number of channels | |||
-c <NUMBER> Number of capture channels | |||
-p, --play Playback mode only | |||
-h, --help Show this help menu | |||
--dummy Don't do anything, just create the needed files | |||
-h, --help Show this help menu | |||
--dummy Don't do anything, just create the needed files | |||
NOTE: | |||
When runned with no arguments, $(basename "$0") will | |||
activate PulseAudio with both playback and record modes with default number of channels. | |||
" | |||
exit | |||
;; | |||
--dummy) | |||
exit | |||
;; | |||
-c|--capture) | |||
arg_is_for="capture" | |||
wanted_capture_ports=-1 # -1 means default, if no (correct) argument is given. | |||
;; | |||
-p|--play|--playback) | |||
arg_is_for="playback" | |||
wanted_playback_ports=-1 | |||
;; | |||
* ) | |||
case "$arg_is_for" in | |||
"capture") | |||
[ "$arg" -ge 0 ] 2>/dev/null && wanted_capture_ports="$arg" | |||
;; | |||
"playback") | |||
[ "$arg" -ge 0 ] 2>/dev/null && wanted_playback_ports="$arg" | |||
;; | |||
esac | |||
;; | |||
esac | |||
done | |||
NOTE: | |||
When runned with no arguments, pulse2jack will | |||
activate PulseAudio with both playback and record modes. | |||
" | |||
exit | |||
;; | |||
--dummy) | |||
exit | |||
;; | |||
if [ $wanted_capture_ports == 0 ] && [ $wanted_playback_ports == 0 ];then | |||
#no sense to want to start/bridge pulseaudio without ports, set as default | |||
capture_ports=-1 # -1 means default | |||
playback_ports=-1 # -1 means default | |||
fi | |||
-p|--p|--play) | |||
PLAY_ONLY="yes" | |||
FILE=$INSTALL_PREFIX/share/cadence/pulse2jack/play.pa | |||
;; | |||
str_capture="channels=$wanted_capture_ports" #used for pulseaudio commands | |||
str_playback="channels=$wanted_playback_ports" ## | |||
*) | |||
FILE=$INSTALL_PREFIX/share/cadence/pulse2jack/play+rec.pa | |||
;; | |||
esac | |||
[ $wanted_capture_ports == -1 ] && str_capture="" # -1 means default, no command channels=n | |||
[ $wanted_playback_ports == -1 ] && str_playback="" ## | |||
# ---------------------------------------------- | |||
@@ -88,40 +116,166 @@ IsPulseAudioRunning() | |||
fi | |||
} | |||
if (IsPulseAudioRunning); then | |||
StartBridged() | |||
{ | |||
if (`jack_lsp | grep "PulseAudio JACK Sink:" > /dev/null`); then | |||
{ | |||
echo "PulseAudio is already running and bridged to JACK" | |||
} | |||
#write pulseaudio config file in a tmp file | |||
pa_file=$(mktemp --suffix .pa) | |||
echo .fail > $pa_file | |||
### Automatically restore the volume of streams and devices | |||
echo load-module module-device-restore >> $pa_file | |||
echo load-module module-stream-restore >> $pa_file | |||
echo load-module module-card-restore >> $pa_file | |||
### Load Jack modules | |||
[ $wanted_capture_ports != 0 ] && echo load-module module-jack-source $str_capture >> $pa_file | |||
[ $wanted_playback_ports != 0 ] && echo load-module module-jack-sink $str_playback >> $pa_file | |||
### Load unix protocol | |||
echo load-module module-native-protocol-unix >> $pa_file | |||
### Automatically restore the default sink/source when changed by the user | |||
### during runtime | |||
### NOTE: This should be loaded as early as possible so that subsequent modules | |||
### that look up the default sink/source get the right value | |||
echo load-module module-default-device-restore >> $pa_file | |||
### Automatically move streams to the default sink if the sink they are | |||
### connected to dies, similar for sources | |||
echo load-module module-rescue-streams >> $pa_file | |||
### Make sure we always have a sink around, even if it is a null sink. | |||
echo load-module module-always-sink >> $pa_file | |||
### Make Jack default | |||
[ $wanted_capture_ports != 0 ] && echo set-default-source jack_in >> $pa_file | |||
[ $wanted_playback_ports != 0 ] && echo set-default-sink jack_out >> $pa_file | |||
if (`pulseaudio --daemonize --high-priority --realtime --exit-idle-time=-1 --file=$pa_file -n`); then | |||
echo "Initiated PulseAudio successfully!" | |||
else | |||
{ | |||
echo "PulseAudio is already running, bridge it..." | |||
echo "Failed to initialize PulseAudio!" | |||
fi | |||
} | |||
if [ "$PLAY_ONLY" == "yes" ]; then | |||
{ | |||
pactl load-module module-jack-sink > /dev/null | |||
pacmd set-default-source jack_in > /dev/null | |||
} | |||
else | |||
{ | |||
pactl load-module module-jack-sink > /dev/null | |||
pactl load-module module-jack-source > /dev/null | |||
pacmd set-default-sink jack_out > /dev/null | |||
killReStart() | |||
{ | |||
pulseaudio -k && StartBridged | |||
exit | |||
} | |||
JackNotRunning() | |||
{ | |||
echo "JACK seems not running, start JACK before bridge PulseAudio" | |||
exit 1 | |||
} | |||
if (IsPulseAudioRunning); then | |||
{ | |||
#count all Jack Audio Physical ports | |||
all_jack_lsp=$(jack_lsp -p -t) || JackNotRunning | |||
output_physical_lines=$(echo "$all_jack_lsp"|grep -n "output,physical,"|cut -d':' -f1) | |||
input_physical_lines=$( echo "$all_jack_lsp"|grep -n "input,physical," |cut -d':' -f1) | |||
audio_lines=$(echo "$all_jack_lsp" |grep -n " audio"|cut -d':' -f1) | |||
capture_physical_ports=0 | |||
playback_physical_ports=0 | |||
for out_phy_line in $output_physical_lines;do | |||
if echo "$audio_lines"|grep -q $(($out_phy_line + 1));then | |||
((capture_physical_ports++)) | |||
fi | |||
done | |||
for in_phy_line in $input_physical_lines;do | |||
if echo "$audio_lines"|grep -q $(($in_phy_line + 1));then | |||
((playback_physical_ports++)) | |||
fi | |||
done | |||
#count PulseAudio jack ports | |||
current_playback_ports=$(echo "$all_jack_lsp"|grep ^"PulseAudio JACK Sink:" |wc -l) | |||
current_capture_ports=$( echo "$all_jack_lsp"|grep ^"PulseAudio JACK Source:"|wc -l) | |||
#if number of pulseaudio ports equal to physical ports, consider pulseaudio module is running the default mode (no channels=n) | |||
[ $current_capture_ports == $capture_physical_ports ] && current_capture_ports=-1 | |||
[ $current_playback_ports == $playback_physical_ports ] && current_playback_ports=-1 | |||
[ $wanted_capture_ports == $capture_physical_ports ] && wanted_capture_ports=-1 | |||
[ $wanted_playback_ports == $playback_physical_ports ] && wanted_playback_ports=-1 | |||
if [ $wanted_capture_ports == $current_capture_ports ] && [ $wanted_playback_ports == $current_playback_ports ];then | |||
echo "PulseAudio is already started and bridged to Jack with $current_capture_ports inputs and $current_playback_ports outputs, nothing to do !" | |||
exit | |||
fi | |||
if [ $current_capture_ports != $wanted_capture_ports ];then | |||
if [ $current_capture_ports != 0 ];then | |||
echo "unload PulseAudio JACK Source" | |||
pactl unload-module module-jack-source > /dev/null || killReStart | |||
fi | |||
if [ $wanted_capture_ports != 0 ];then | |||
echo "load PulseAudio JACK Source $str_capture" | |||
pactl load-module module-jack-source $str_capture > /dev/null | |||
pacmd set-default-source jack_in > /dev/null | |||
} | |||
fi | |||
echo "Done" | |||
} | |||
fi | |||
if [ $current_playback_ports != $wanted_playback_ports ];then | |||
if [ $current_playback_ports != 0 ];then | |||
echo "unload PulseAudio JACK Sink" | |||
pactl unload-module module-jack-sink > /dev/null || killReStart | |||
fi | |||
if [ $wanted_playback_ports != 0 ];then | |||
echo "load PulseAudio JACK Sink $str_playback" | |||
pactl load-module module-jack-sink $str_playback > /dev/null | |||
pactl set-default-sink jack_out > /dev/null | |||
fi | |||
fi | |||
} | |||
else | |||
{ | |||
if (`pulseaudio --daemonize --high-priority --realtime --exit-idle-time=-1 --file=$FILE -n`); then | |||
echo "Initiated PulseAudio successfully!" | |||
else | |||
echo "Failed to initialize PulseAudio!" | |||
fi | |||
{ | |||
StartBridged | |||
# #write pulseaudio config file in a tmp file | |||
# pa_file=$(mktemp --suffix .pa) | |||
# echo .fail > $pa_file | |||
# | |||
# ### Automatically restore the volume of streams and devices | |||
# echo load-module module-device-restore >> $pa_file | |||
# echo load-module module-stream-restore >> $pa_file | |||
# echo load-module module-card-restore >> $pa_file | |||
# | |||
# ### Load Jack modules | |||
# [ $wanted_capture_ports != 0 ] && echo load-module module-jack-source $str_capture >> $pa_file | |||
# [ $wanted_playback_ports != 0 ] && echo load-module module-jack-sink $str_playback >> $pa_file | |||
# | |||
# ### Load unix protocol | |||
# echo load-module module-native-protocol-unix >> $pa_file | |||
# | |||
# ### Automatically restore the default sink/source when changed by the user | |||
# ### during runtime | |||
# ### NOTE: This should be loaded as early as possible so that subsequent modules | |||
# ### that look up the default sink/source get the right value | |||
# echo load-module module-default-device-restore >> $pa_file | |||
# | |||
# ### Automatically move streams to the default sink if the sink they are | |||
# ### connected to dies, similar for sources | |||
# echo load-module module-rescue-streams >> $pa_file | |||
# | |||
# ### Make sure we always have a sink around, even if it is a null sink. | |||
# echo load-module module-always-sink >> $pa_file | |||
# | |||
# ### Make Jack default | |||
# [ $wanted_capture_ports != 0 ] && echo set-default-source jack_in >> $pa_file | |||
# [ $wanted_playback_ports != 0 ] && echo set-default-sink jack_out >> $pa_file | |||
# | |||
# if (`pulseaudio --daemonize --high-priority --realtime --exit-idle-time=-1 --file=$pa_file -n`); then | |||
# echo "Initiated PulseAudio successfully!" | |||
# else | |||
# echo "Failed to initialize PulseAudio!" | |||
# fi | |||
} | |||
fi |
@@ -916,6 +916,13 @@ | |||
</property> | |||
</widget> | |||
</item> | |||
<item> | |||
<widget class="QPushButton" name="b_pulse_channels"> | |||
<property name="text"> | |||
<string>Channels</string> | |||
</property> | |||
</widget> | |||
</item> | |||
<item> | |||
<spacer name="horizontalSpacer_13"> | |||
<property name="orientation"> | |||
@@ -956,13 +963,6 @@ | |||
</property> | |||
</widget> | |||
</item> | |||
<item> | |||
<widget class="QToolButton" name="tb_pulse_options"> | |||
<property name="text"> | |||
<string>...</string> | |||
</property> | |||
</widget> | |||
</item> | |||
</layout> | |||
</item> | |||
<item> | |||
@@ -6,8 +6,8 @@ | |||
<rect> | |||
<x>0</x> | |||
<y>0</y> | |||
<width>317</width> | |||
<height>72</height> | |||
<width>218</width> | |||
<height>124</height> | |||
</rect> | |||
</property> | |||
<property name="windowTitle"> | |||
@@ -15,11 +15,60 @@ | |||
</property> | |||
<layout class="QVBoxLayout" name="verticalLayout"> | |||
<item> | |||
<widget class="QCheckBox" name="cb_playback_only"> | |||
<property name="text"> | |||
<string>Playback Mode only</string> | |||
</property> | |||
</widget> | |||
<layout class="QGridLayout" name="gridLayout"> | |||
<item row="0" column="0"> | |||
<widget class="QLabel" name="labelPulseInputs"> | |||
<property name="text"> | |||
<string>Input Channels :</string> | |||
</property> | |||
<property name="alignment"> | |||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> | |||
</property> | |||
</widget> | |||
</item> | |||
<item row="1" column="0"> | |||
<widget class="QLabel" name="labelPulseOutputs"> | |||
<property name="text"> | |||
<string>Output Channels :</string> | |||
</property> | |||
<property name="alignment"> | |||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> | |||
</property> | |||
</widget> | |||
</item> | |||
<item row="0" column="1"> | |||
<widget class="QSpinBox" name="spinBoxPulseInputs"> | |||
<property name="specialValueText"> | |||
<string>Default</string> | |||
</property> | |||
<property name="minimum"> | |||
<number>-1</number> | |||
</property> | |||
<property name="maximum"> | |||
<number>10</number> | |||
</property> | |||
<property name="value"> | |||
<number>-1</number> | |||
</property> | |||
</widget> | |||
</item> | |||
<item row="1" column="1"> | |||
<widget class="QSpinBox" name="spinBoxPulseOutputs"> | |||
<property name="specialValueText"> | |||
<string>Default</string> | |||
</property> | |||
<property name="minimum"> | |||
<number>-1</number> | |||
</property> | |||
<property name="maximum"> | |||
<number>10</number> | |||
</property> | |||
<property name="value"> | |||
<number>-1</number> | |||
</property> | |||
</widget> | |||
</item> | |||
</layout> | |||
</item> | |||
<item> | |||
<widget class="QDialogButtonBox" name="buttonBox"> | |||
@@ -119,10 +119,16 @@ XDG_APPLICATIONS_PATH = [ | |||
] | |||
# --------------------------------------------------------------------- | |||
class PulseAudioJackBridgeValues(object): | |||
clientIdCapture = -1 | |||
clientIdPlayback = -1 | |||
portCaptureNumber = 0 | |||
portPlaybackNumber = 0 | |||
global jackClientIdALSA, jackClientIdPulse | |||
global jackClientIdALSA | |||
jackClientIdALSA = -1 | |||
jackClientIdPulse = -1 | |||
pA_bridge_values = PulseAudioJackBridgeValues() | |||
# jackdbus indexes | |||
iGraphVersion = 0 | |||
@@ -337,7 +343,8 @@ def isPulseAudioStarted(): | |||
def isPulseAudioBridged(): | |||
global jackClientIdPulse | |||
return bool(jackClientIdPulse != -1) | |||
return bool(pA_bridge_values.clientIdCapture != -1 | |||
or pA_bridge_values.clientIdPlayback != -1) | |||
def isDesktopFileInstalled(desktop): | |||
for X_PATH in XDG_APPLICATIONS_PATH: | |||
@@ -584,10 +591,10 @@ class ForceRestartThread(QThread): | |||
# PulseAudio | |||
if GlobalSettings.value("Pulse2JACK/AutoStart", True, type=bool) and not isPulseAudioBridged(): | |||
if GlobalSettings.value("Pulse2JACK/PlaybackModeOnly", False, type=bool): | |||
os.system("cadence-pulse2jack -p") | |||
else: | |||
os.system("cadence-pulse2jack") | |||
inputs = GlobalSettings.value("Pulse2JACK/CaptureChannels", -1, type=int) | |||
outputs = GlobalSettings.value("Pulse2JACK/PlaybackChannels", -1, type=int) | |||
os.system("cadence-pulse2jack -c %s -p %s" % (str(inputs), str(outputs))) | |||
self.progressChanged.emit(100) | |||
@@ -721,18 +728,24 @@ class ToolBarAlsaAudioDialog(QDialog, ui_cadence_tb_alsa.Ui_Dialog): | |||
self.close() | |||
# Additional PulseAudio options | |||
class ToolBarPADialog(QDialog, ui_cadence_tb_pa.Ui_Dialog): | |||
class PAChannelsDialog(QDialog, ui_cadence_tb_pa.Ui_Dialog): | |||
def __init__(self, parent): | |||
QDialog.__init__(self, parent) | |||
self.setupUi(self) | |||
self.parent = parent | |||
self.cb_playback_only.setChecked(GlobalSettings.value("Pulse2JACK/PlaybackModeOnly", False, type=bool)) | |||
self.spinBoxPulseInputs.setValue(GlobalSettings.value("Pulse2JACK/CaptureChannels", 2, type=int)) | |||
self.spinBoxPulseOutputs.setValue(GlobalSettings.value("Pulse2JACK/PlaybackChannels", 2, type=int)) | |||
self.accepted.connect(self.slot_setOptions) | |||
self.accepted.connect(self.slot_updateChannels) | |||
@pyqtSlot() | |||
def slot_setOptions(self): | |||
GlobalSettings.setValue("Pulse2JACK/PlaybackModeOnly", self.cb_playback_only.isChecked()) | |||
def slot_updateChannels(self): | |||
GlobalSettings.setValue("Pulse2JACK/CaptureChannels", self.spinBoxPulseInputs.value()) | |||
GlobalSettings.setValue("Pulse2JACK/PlaybackChannels", self.spinBoxPulseOutputs.value()) | |||
if isPulseAudioBridged(): | |||
self.parent.slot_PulseAudioBridgeStart() | |||
def done(self, r): | |||
QDialog.done(self, r) | |||
@@ -744,6 +757,8 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): | |||
DBusJackServerStoppedCallback = pyqtSignal() | |||
DBusJackClientAppearedCallback = pyqtSignal(int, str) | |||
DBusJackClientDisappearedCallback = pyqtSignal(int) | |||
DBusJackPortAppearedCallback = pyqtSignal(int) | |||
DBusJackPortDisappearedCallback = pyqtSignal(int) | |||
DBusA2JBridgeStartedCallback = pyqtSignal() | |||
DBusA2JBridgeStoppedCallback = pyqtSignal() | |||
@@ -1069,6 +1084,7 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): | |||
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")) | |||
self.systray.addMenuAction("pulse", "pulse_channels", self.tr("Channels")) | |||
self.systray.setActionIcon("jack_start", "media-playback-start") | |||
self.systray.setActionIcon("jack_stop", "media-playback-stop") | |||
@@ -1079,6 +1095,7 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): | |||
self.systray.setActionIcon("a2j_stop", "media-playback-stop") | |||
self.systray.setActionIcon("pulse_start", "media-playback-start") | |||
self.systray.setActionIcon("pulse_stop", "media-playback-stop") | |||
self.systray.setActionIcon("pulse_channels", "audio-card") | |||
self.systray.connect("jack_start", self.slot_JackServerStart) | |||
self.systray.connect("jack_stop", self.slot_JackServerStop) | |||
@@ -1089,6 +1106,7 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): | |||
self.systray.connect("a2j_stop", self.slot_A2JBridgeStop) | |||
self.systray.connect("pulse_start", self.slot_PulseAudioBridgeStart) | |||
self.systray.connect("pulse_stop", self.slot_PulseAudioBridgeStop) | |||
self.systray.connect("pulse_channels", self.slot_PulseAudioBridgeChannels) | |||
self.systray.addMenu("tools", self.tr("Tools")) | |||
self.systray.addMenuAction("tools", "app_catarina", "Catarina") | |||
@@ -1133,7 +1151,7 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): | |||
self.b_a2j_stop.clicked.connect(self.slot_A2JBridgeStop) | |||
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) | |||
self.b_pulse_channels.clicked.connect(self.slot_PulseAudioBridgeChannels) | |||
self.pic_catia.clicked.connect(self.func_start_catia) | |||
self.pic_claudia.clicked.connect(self.func_start_claudia) | |||
@@ -1185,6 +1203,8 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): | |||
# org.jackaudio.JackPatchbay | |||
self.DBusJackClientAppearedCallback.connect(self.slot_DBusJackClientAppearedCallback) | |||
self.DBusJackClientDisappearedCallback.connect(self.slot_DBusJackClientDisappearedCallback) | |||
self.DBusJackPortAppearedCallback.connect(self.slot_DBusJackPortAppearedCallback) | |||
self.DBusJackPortDisappearedCallback.connect(self.slot_DBusJackPortDisappearedCallback) | |||
# org.gna.home.a2jmidid.control | |||
self.DBusA2JBridgeStartedCallback.connect(self.slot_DBusA2JBridgeStartedCallback) | |||
@@ -1233,9 +1253,12 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): | |||
if group_name == "alsa2jack": | |||
global jackClientIdALSA | |||
jackClientIdALSA = group_id | |||
elif group_name == "PulseAudio JACK Source": | |||
pA_bridge_values.clientIdCapture = group_id | |||
pA_bridge_values.portCaptureNumber = len(ports) | |||
elif group_name == "PulseAudio JACK Sink": | |||
global jackClientIdPulse | |||
jackClientIdPulse = group_id | |||
pA_bridge_values.clientIdPlayback = group_id | |||
pA_bridge_values.portPlaybackNumber = len(ports) | |||
self.jackStarted() | |||
@@ -1301,6 +1324,10 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): | |||
self.DBusJackClientAppearedCallback.emit(args[iJackClientId], args[iJackClientName]) | |||
elif kwds['member'] == "ClientDisappeared": | |||
self.DBusJackClientDisappearedCallback.emit(args[iJackClientId]) | |||
elif kwds['member'] == "PortAppeared": | |||
self.DBusJackPortAppearedCallback.emit(args[iJackClientId]) | |||
elif kwds['member'] == "PortDisappeared": | |||
self.DBusJackPortDisappearedCallback.emit(args[iJackClientId]) | |||
elif kwds['interface'] == "org.gna.home.a2jmidid.control": | |||
if DEBUG: print("org.gna.home.a2jmidid.control", kwds['member']) | |||
@@ -1382,9 +1409,11 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): | |||
self.b_a2j_start.setEnabled(False) | |||
self.systray.setActionEnabled("a2j_start", False) | |||
global jackClientIdALSA, jackClientIdPulse | |||
global jackClientIdALSA | |||
jackClientIdALSA = -1 | |||
jackClientIdPulse = -1 | |||
pA_bridge_values.clientIdCapture = -1 | |||
pA_bridge_values.clientIdPlayback = -1 | |||
if haveDBus: | |||
self.checkAlsaAudio() | |||
@@ -1487,7 +1516,10 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): | |||
self.b_pulse_stop.setEnabled(True) | |||
self.systray.setActionEnabled("pulse_start", False) | |||
self.systray.setActionEnabled("pulse_stop", True) | |||
self.label_bridge_pulse.setText(self.tr("PulseAudio is started and bridged to JACK")) | |||
self.label_bridge_pulse.setText( | |||
self.tr("PulseAudio is started and bridged to JACK with %s inputs/%s outputs") | |||
% (pA_bridge_values.portCaptureNumber, | |||
pA_bridge_values.portPlaybackNumber)) | |||
else: | |||
jackRunning = bool(gDBus.jack and gDBus.jack.IsStarted()) | |||
self.b_pulse_start.setEnabled(jackRunning) | |||
@@ -1621,19 +1653,44 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): | |||
global jackClientIdALSA | |||
jackClientIdALSA = group_id | |||
self.checkAlsaAudio() | |||
elif group_name == "PulseAudio JACK Source": | |||
pA_bridge_values.clientIdCapture = group_id | |||
self.checkPulseAudio() | |||
elif group_name == "PulseAudio JACK Sink": | |||
global jackClientIdPulse | |||
jackClientIdPulse = group_id | |||
pA_bridge_values.clientIdPlayback = group_id | |||
self.checkPulseAudio() | |||
@pyqtSlot(int) | |||
def slot_DBusJackClientDisappearedCallback(self, group_id): | |||
global jackClientIdALSA, jackClientIdPulse | |||
global jackClientIdALSA | |||
if group_id == jackClientIdALSA: | |||
jackClientIdALSA = -1 | |||
self.checkAlsaAudio() | |||
elif group_id == jackClientIdPulse: | |||
jackClientIdPulse = -1 | |||
elif group_id == pA_bridge_values.clientIdCapture: | |||
pA_bridge_values.clientIdCapture = -1 | |||
pA_bridge_values.portCaptureNumber = 0 | |||
self.checkPulseAudio() | |||
elif group_id == pA_bridge_values.clientIdPlayback: | |||
pA_bridge_values.clientIdPlayback = -1 | |||
pA_bridge_values.portPlaybackNumber = 0 | |||
self.checkPulseAudio() | |||
@pyqtSlot(int) | |||
def slot_DBusJackPortAppearedCallback(self, group_id): | |||
if group_id == pA_bridge_values.clientIdCapture: | |||
pA_bridge_values.portCaptureNumber+=1 | |||
self.checkPulseAudio() | |||
elif group_id == pA_bridge_values.clientIdPlayback: | |||
pA_bridge_values.portPlaybackNumber+=1 | |||
self.checkPulseAudio() | |||
@pyqtSlot(int) | |||
def slot_DBusJackPortDisappearedCallback(self, group_id): | |||
if group_id == pA_bridge_values.clientIdCapture: | |||
pA_bridge_values.portCaptureNumber+=1 | |||
self.checkPulseAudio() | |||
elif group_id == pA_bridge_values.clientIdPlayback: | |||
pA_bridge_values.portPlaybackNumber+=1 | |||
self.checkPulseAudio() | |||
@pyqtSlot() | |||
@@ -1789,18 +1846,18 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): | |||
@pyqtSlot() | |||
def slot_PulseAudioBridgeStart(self): | |||
if GlobalSettings.value("Pulse2JACK/PlaybackModeOnly", False, type=bool): | |||
os.system("cadence-pulse2jack -p") | |||
else: | |||
os.system("cadence-pulse2jack") | |||
inputs = GlobalSettings.value("Pulse2JACK/CaptureChannels", 2, type=int) | |||
outputs = GlobalSettings.value("Pulse2JACK/PlaybackChannels", 2, type=int) | |||
os.system("cadence-pulse2jack -c %s -p %s" % (str(inputs), str(outputs))) | |||
@pyqtSlot() | |||
def slot_PulseAudioBridgeStop(self): | |||
os.system("pulseaudio -k") | |||
@pyqtSlot() | |||
def slot_PulseAudioBridgeOptions(self): | |||
ToolBarPADialog(self).exec_() | |||
def slot_PulseAudioBridgeChannels(self): | |||
PAChannelsDialog(self).exec_() | |||
@pyqtSlot() | |||
def slot_handleCrash_jack(self): | |||
@@ -137,10 +137,10 @@ def startSession(systemStarted, secondSystemStartAttempt): | |||
# PulseAudio | |||
if GlobalSettings.value("Pulse2JACK/AutoStart", True, type=bool): | |||
if GlobalSettings.value("Pulse2JACK/PlaybackModeOnly", False, type=bool): | |||
os.system("cadence-pulse2jack -p") | |||
else: | |||
os.system("cadence-pulse2jack") | |||
inputs = GlobalSettings.value("Pulse2JACK/CaptureChannels", -1, type=int) | |||
outputs = GlobalSettings.value("Pulse2JACK/PlaybackChannels", -1, type=int) | |||
os.system("cadence-pulse2jack -c %s -p %s" % (str(inputs), str(outputs))) | |||
print("JACK Started Successfully") | |||
return True | |||