Rotary encoder volume not synchronized with GUI

Raspberry Pi related support

Rotary encoder volume not synchronized with GUI

Postby HITMAnsOFT » 19 Mar 2017, 13:49

Hi,

As this is my first post, I'd like to thank this project for making such an awesome piece of software!

I have installed RuneAudio_rpi2_rp3_0.4-beta_20170229_2GB.img.gz on RPi2 with IQAudIO DigiAMP+, and I've set up a rotary encoder volume control using this guide: post16839.html.

The problem is: if I set the volume using rotary, then change it from RuneUI or alsamixer, when I touch the encoder again, the volume comes back to the previous value as set by the encoder, the GUI changes are discarded.

Volume control in MPD preferences is set to hardware.
I've reviewed the IQ_rot.c file thinking that the volume value is cached somewhere, but no: on every touch it is read from ALSA. Does anyone know how to solve this?
HITMAnsOFT
 
Posts: 7
Joined: 19 Mar 2017, 13:34

Re: Rotary encoder volume not synchronized with GUI

Postby hondagx35 » 19 Mar 2017, 19:26

Hi HITMAnsOFT,

if I set the volume using rotary, then change it from RuneUI or alsamixer, when I touch the encoder again, the volume comes back to the previous value as set by the encoder

I do not think that it goes back to the level set by the encoder.
Rune uses mpd (mpc) to set the volume and the IQAudio tool uses alsa.
The values you get from
Code: Select all
mpc volume

and
Code: Select all
amixer get Digital

will be different.

Frank
User avatar
hondagx35
 
Posts: 3042
Joined: 11 Sep 2014, 22:06
Location: Germany

Re: Rotary encoder volume not synchronized with GUI

Postby HITMAnsOFT » 20 Mar 2017, 08:45

Thank you for your response!

I understand that the numbers shown in web UI and alsamixer are in different units, and the alsa code in IQ_rot.c gets an entirely different range (0 to 204 in my system), which maps linearly to 0-100 range of the WebUI knob by my observations. However, I can confirm looking at alsamixer that all these values affect the same mixer control.

It definitely goes back. I can hear it, and I can observe it on alsamixer. I turn the encoder until it's silent, then I set a normal volume using UI (70 for example). When I touch the encoder again, it turns silent and the alsamixer slider falls to 0-ish. Both the UI and alsamixer are mirroring the settings made with the encoder knob, but the encoder seems to have it's own memory. When I kill the IQ_rot process and start it again, it gets the correct volume.
HITMAnsOFT
 
Posts: 7
Joined: 19 Mar 2017, 13:34

Re: Rotary encoder volume not synchronized with GUI

Postby Stephane » 20 Mar 2017, 09:19

Hi,

Why don't you try to control the rotary know with a python (or bash) script? I found this example: http://www.bobrathbone.com/raspberrypi_rotary.htm, it shouldn't be too difficult to adapt and issue commands to control MPD.
Stephane
 
Posts: 64
Joined: 06 Feb 2017, 10:35

Re: Rotary encoder volume not synchronized with GUI

Postby HITMAnsOFT » 20 Mar 2017, 10:57

Hi Stephane,

Thanks for the hint, I'll have a look when I get home. I tried the IQ_rot first because of performance advantages of a native C daemon. I've even tweaked it a bit for finer steps and better response to fast rotation.

Using MPD for volume control seems like a good workaround. Is there any advantage/disadvantage for using MPD/MPC vs direct ALSA control? In fact, I was looking at disabling the MPD volume control altogether and letting only ALSA control the volume, so that it can work the same way with other sources, like DLNA/Airplay. If I remember correctly, the volume control is disabled when using Airplay, is that right? I'll double-check that again.
HITMAnsOFT
 
Posts: 7
Joined: 19 Mar 2017, 13:34

Re: Rotary encoder volume not synchronized with GUI

Postby HITMAnsOFT » 21 Mar 2017, 16:25

I double-checked that GUI volume control is inactive for Airplay for some reason. It is possible to adjust volume through MPC though, so the workaround should work.

Update: I've modified the IQ_rot utility to use libmpdclient instead of ALSA, yielding much shorter and cleaner code which works perfectly so far.
HITMAnsOFT
 
Posts: 7
Joined: 19 Mar 2017, 13:34

support RuneAudio Donate with PayPal


Return to Raspberry Pi

Who is online

Users browsing this forum: No registered users and 13 guests