Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Solved: trying to control AVR volume from within Moode UI
#9
@swinokur, Its been a while since I've been around the volume handling code in moOde so I gave it a brief look and you may not need to modify any of the JS code.

There is a code block in /var/www/command/moode.php that sends the actual setvol command to MPD. This is where the modifications prolly need to be made. It's a plain source file and so can be edited directly.

Code:
    switch ($_GET['cmd']) {
        case 'updvolume':
            $session_volknob = $_SESSION['volknob'];

            // Update local MPD volume
            playerSession('write', 'volknob', $_POST['volknob']);
            sendMpdCmd($sock, 'setvol ' . $_POST['volknob']);
            $resp = readMpdResp($sock);

            // Update Receiver MPD volumes
            if ($_SESSION['multiroom_tx'] == 'On') {
                $voldiff = $session_volknob - $_POST['volknob'];

                if ($_POST['event'] == 'unmute') {
                    $tx_volcmd = '-mute'; // Toggle mute off
                }
                elseif ($voldiff == 0) {
                    $tx_volcmd = $_POST['volknob'];
                }
                else {
                    $tx_volcmd = $voldiff < 0 ? '-up ' . abs($voldiff) : '-dn ' . $voldiff;
                }

                updReceiverVol($tx_volcmd);
            }

            echo json_encode('OK');
            break;
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply


Messages In This Thread
RE: trying to control AVR volume from within Moode UI - by Tim Curtis - 01-26-2022, 11:33 AM

Forum Jump: