Saiyato / volumio-snapcast-plugin

Volumio 2 SnapCast plugin, to easily manage SnapCast functionality
115 stars 25 forks source link

volume control for stream #62

Closed dddesign closed 5 years ago

dddesign commented 5 years ago

I can set the client for which to control volume (in my case there are no of my multiple clients in dropdown), but I'd like to controll the volume for entire stream of snapserver. Is this possible?

Saiyato commented 5 years ago

Hi, this is not possible, the volume is per client only. See the snapcast repo for more info: https://github.com/badaix/snapcast

dddesign commented 5 years ago

Before I used volumio I had a setup with mpd and snapcast. If I changed the volume of mpd (e. g. B mpc) this effected the entire stream, means all snapclients. So this probably not a snapcast issue, it's how mpd/volumio works/steams to snapserver. Thanks for your effort on this.

Saiyato commented 5 years ago

Yes, that should work, but then you are manipulating the stream put into SnapCast, this would affect all clients indeed. ;) Maybe SnapCast will evolve in the future allowing for this kind of control, which could be very helpful indeed.

dddesign commented 5 years ago

Can you make this (manipulating stream into snapcast) possible as an option? I would need exactly this.

Saiyato commented 5 years ago

This would impact the streaming service itself, not something I can change from within the plugin I'm afraid. It would require Volumio itself to manipulate how Volume control works. The only thing I did was map the volume slider and send it to the snapcast server for that particular client. The slider itself, for Volumio remains unchanged.

dddesign commented 5 years ago

I see Last question (sorry for this) : would it be possible to NOT map it to snapserver? So it stays as normal (=volumio volume). Hopefully this would control output volume which goes/is piped to snapserver.

Saiyato commented 5 years ago

By default it is/remains mapped to Volumio (i.e. ALSA), once set you need to unlink it by selecting 'disable volume update'; after which no updates are sent to the SnapCast environment.

dddesign commented 5 years ago

I wanted to try this but I recognized that I do not have any clients in the dropdown menu for selecting a snapclient to control volume for. I have multiple snapclients running on diffrenten devices. what could be the problem that they don't show up? even with no clients to select I tried to option "disable volume update" and saved it. but volumio volumen silder (even mute button) has no effect on any client. It seems I have here a problem.

monte-monte commented 4 years ago

If you use mixer_type "software" option in mpd.conf for snapfifo source like this:

audio_output {
    type            "fifo"
    enabled         "yes"
    name            "multiroom"
    path            "/tmp/snapfifo"
    format          "48000:16:2"
    mixer_type      "software"
}

you can control the volume of a stream that goes to Snapcast. The problem is that Volumio's web UI doesn't send current volume value to MPD, but it creates a file with it. It is located at /tmp/volume. For my setup I wrote a simple bash script that reads volume file and if there is a change then it sends new value to MPD via mpc volume command.

#!/bin/bash

file=/tmp/volume
if [[ -e $file ]]; then
        volume=$(<$file)
        lastvolume=$volume
        while true; do
                volume=$(<$file)
                if [[ -n "$volume" ]]; then
                        if [[ "$volume" != "$lastvolume" ]]; then
                                #echo "Volume: $volume"
                                mpc volume $volume >/dev/null
                                lastvolume=$volume
                        fi
                fi
                sleep 1
        done
else
        echo "ERROR reading volume file. '$file' does not exist" >&2
        exit 1
fi

@dddesign you can try it if you are still looking for a solution.