08-27-2024, 05:14 PM
The variables and status look OK.
Here is the code block that handles "RoonBridge Active"
/var/www/daemon/worker.php
This conditional statement determines whether to set the active flag
Maybe RoonBridge is using a different ALSA card number than the one moode uses in $_SESSION['cardnum']. I have no idea how RB chooses the the ALSA card and device.
Here is the code block that handles "RoonBridge Active"
/var/www/daemon/worker.php
Code:
function chkRbActive() {
$result = sysCmd('pgrep -c mono-sgen');
if ($result[0] > 0) {
$rendererNotActive = ($_SESSION['btactive'] == '0' && $GLOBALS['aplactive'] == '0' && $GLOBALS['spotactive'] == '0'
&& $GLOBALS['slactive'] == '0' && $_SESSION['paactive'] && $_SESSION['rxactive'] == '0'
&& $GLOBALS['inpactive'] == '0');
$mpdNotPlaying = empty(sysCmd('mpc status | grep playing')[0]) ? true : false;
$alsaOutputActive = sysCmd('cat /proc/asound/card' . $_SESSION['cardnum'] . '/pcm0p/sub0/hw_params')[0] == 'closed' ? false : true;
//workerLog('rnp:' . ($rendererNotActive ? 'T' : 'F') . '|' . 'mnp:' . ($mpdNotPlaying ? 'T' : 'F') . '|' . 'aoa:' . ($alsaOutputActive ? 'T' : 'F'));
if ($rendererNotActive && $mpdNotPlaying && $alsaOutputActive) {
// Do this section only once
if ($GLOBALS['rbactive'] == '0') {
$GLOBALS['rbactive'] = '1';
phpSession('write', 'rbactive', '1');
$GLOBALS['scnsaver_timeout'] = $_SESSION['scnsaver_timeout'];
sendFECmd('rbactive1');
}
} else {
// Do this section only once
if ($GLOBALS['rbactive'] == '1') {
$GLOBALS['rbactive'] = '0';
phpSession('write', 'rbactive', '0');
sendFECmd('rbactive0');
sysCmd('/var/www/util/vol.sh -restore');
if ($_SESSION['rsmafterrb'] == 'Yes') {
sysCmd('mpc play');
}
}
}
}
}
This conditional statement determines whether to set the active flag
Code:
if ($rendererNotActive && $mpdNotPlaying && $alsaOutputActive)
Maybe RoonBridge is using a different ALSA card number than the one moode uses in $_SESSION['cardnum']. I have no idea how RB chooses the the ALSA card and device.