domino-team / domino-firmware

This is the firmware and source code for Domino
12 stars 10 forks source link

Volume changing not working for mpd #2

Open pelov opened 8 years ago

pelov commented 8 years ago

I installed mpd (opkg install mpd-mini) but the client cannot change the volume. I get the following error:

Failed to read mixer for 'default detected output': READ_DEVMASK failed: Function not implemented

When I look at the glzt_i2s.c I see that the ioctl SOUND_MIXER_READ_DEVMASK is indeed not implemented.

I use the following audio output configuration in /etc/mpd.conf:

audio_output { type "oss"

mixer_type "hardware" mixer_device "/dev/mixer" mixer_control "Vol" }

Is it possible to fix that?

Another issue is that if you read the volume it returns only the value for the left channel, the value for the right channel is 0, so mpd gets confused. May be you should return the same value for both channels or even better, implement stereo volume changing!

alzhao commented 8 years ago

Maybe the code doesn't implement SOUND_MIXER_READ_DEVMASK, but it does implement volume control. use mpg123 --control, then you can change volume by using + and -. Please try and see.

alzhao commented 8 years ago

Volume from left and right should always be the same. So only one is returned.

pelov commented 8 years ago

Yes, may be I can change the volume with mpg123 but this is not what I want to achieve. I would like to be able to run an mpd daemon (which btw is included in the domino distribution) and control the daemon with any client.

I think implementing the SOUND_MIXER_READ_DEVMASK is not very difficult. May be all it takes is to return

val = SOUND_MASK_VOLUME | SOUND_MASK_IGAIN;

I tried to implement it myself but the driver didn't work. I recompiled and flashed the whole firmware. Volume changing now works through mpd but if I start playing music the system crashes and restarts. It's difficult for me to debug the problem - I don't have enough experience with linux driver programming. BTW, are you sure you have the latest source of the driver on github?

pelov commented 8 years ago

If the left and right volumes are the same then I think both should be returned. Otherwise mpd gets confused and complains.

BTW doesn't wm8978 support stereo volume? If yes then why don't you implement it?

Also, shouldn't be there a separate volume controls in the driver for the dac level (R11,R12 -> SOUND_MIXER_PCM) and speaker output on the header (ROUT2, LOUT2 -> SOUND_MIXER_SPEAKER)?