MOC and Hifiberry Digi+ Pro

Hi
Just installed Digi+ Pro on my raspberry and set it up. Its working fine in mplayer and cmus but not in MOC. When I try to start moc it only says FATAL_ERROR: No valid sound driver!. The log file:

jan. 11 10:27:06.198742: alsa.c:365 alsa_init_mixer_channel(): ERROR: Can't find mixer PCM
jan. 11 10:27:06.198806: server.c:667 add_event_all(): No events have been added because there are no clients
jan. 11 10:27:06.198827: alsa.c:365 alsa_init_mixer_channel(): ERROR: Can't find mixer Master
jan. 11 10:27:06.198842: server.c:667 add_event_all(): No events have been added because there are no clients
jan. 11 10:27:06.198937: oss.c:207 oss_init(): ERROR: Can't open mixer device /dev/mixer: Ingen slik fil eller fil$
jan. 11 10:27:06.198954: server.c:667 add_event_all(): No events have been added because there are no clients
jan. 11 10:27:06.198987: oss.c:71 open_dev(): ERROR: Can't open /dev/dsp: Ingen slik fil eller filkatalog
jan. 11 10:27:06.199039: server.c:667 add_event_all(): No events have been added because there are no clients
jan. 11 10:27:06.199056: oss.c:87 set_capabilities(): ERROR: Can't open the device.
jan. 11 10:27:06.199071: server.c:667 add_event_all(): No events have been added because there are no clients
jan. 11 10:27:06.199112: audio.c:926 find_working_driver(): FATAL ERROR: No valid sound driver!

pi@raspberrypi:~ $ amixer
Simple mixer control 'Tx Source',0
Capabilities: enum
Items: 'S/PDIF RX' 'AIF'
Item0: 'AIF'

Anybody knows what I'm doing wrong?

You could try to set AlsaMixer1 and AlsaMixer2 to "Tx Source" in MOC config file.

I tried this
ALSADevice = default
ALSAMixer1 = "Tx Source"
#ALSAMixer2 = "Tx Source"

Here is the output from the log file

an 11 13:49:11.918868: main.c:1189 main(): This is Music On Console (version 2.6-alpha3)
Jan 11 13:49:11.919272: main.c:1193 main(): Configured: '--build=arm-linux-gnueabihf' '--prefix=/usr' '--includedir=${prefix}/include' '--$
Jan 11 13:49:11.919341: main.c:1203 main(): Running on: Linux 4.14.79-v7+ armv7l
jan. 11 13:49:11.920645: main.c:1155 log_command_line(): mocp -D --config=/home/pi/.moc/config
jan. 11 13:49:11.921014: main.c:1169 log_popt_command_line(): mocp --debug --config='/home/pi/.moc/config'
jan. 11 13:49:11.988632: decoder.c:703 load_plugins(): Loaded 11 decoders: aac flac modplug mp3 musepack opus sidplay2 sndfile speex vorbi$
jan. 11 13:49:11.990170: server.c:329 server_init(): Starting MOC Server
jan. 11 13:49:11.990582: log.c:233 log_init_stream(): Writing log to: mocp_server_log
jan. 11 13:49:11.990797: server.c:300 log_process_stack_size(): Process's stack size: 8388608
jan. 11 13:49:11.991135: server.c:317 log_pthread_stack_size(): PThread's stack size: 8388608
jan. 11 13:49:11.991219: alsa.c:477 alsa_init(): Initialising ALSA device: default
jan. 11 13:49:11.994604: alsa.c:370 alsa_init_mixer_channel(): ERROR: Mixer device has no playback volume (Tx Source).
jan. 11 13:49:11.994660: server.c:667 add_event_all(): No events have been added because there are no clients
jan. 11 13:49:11.994681: alsa.c:365 alsa_init_mixer_channel(): ERROR: Can't find mixer Master
jan. 11 13:49:11.994697: server.c:667 add_event_all(): No events have been added because there are no clients
jan. 11 13:49:11.994766: audio.c:926 find_working_driver(): FATAL ERROR: No valid sound driver!

So unfortunatly it didn't work.

Right, it seems this mixer channel has no volume control and MOC can't use it. Regretfully, MOC for some unknown reason needs a working mixer channel. I believe it should be fixed and it was even discussed some time ago with MOC developer.

For now, as a workaround, you could play with .asoundrc file to create a virtual device with mixer capabilities. Maybe something like that would help: https://wiki.archlinux.org/index.php/Advanced_Linux_Sound_Architecture#Dmix https://www.alsa-project.org/main/index.php/Asoundrc#Software_mixing

Thanks
Tried to put

pcm.dsp {
type plug
slave.pcm "dmix"
}

in my asound.conf file but its the same. To bad its such a pain to get it to work as I really like MOC.

I can try to prepare a patch for MOC, if you are willing to compile it yourself.

Here's the patch: tomaszg.pl/moc/tg-no-mixer.patch.gz

You can apply it by zcat tg-no-mixer.patch.gz | patch -p0

It is not perfect but it should do the trick.

Thanks for your help :)
I just downloaded it and put it in .moc folder. Ran the command and got this

can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|Index: alsa.c
|===================================================================
|--- alsa.c (revision 2992)
|+++ alsa.c (working copy)
--------------------------
File to patch:

You need to compile MOC from source code. Grab the current version from SVN as described on the page https://moc.daper.net/download. In that directory run patch command and then follow the rest of compilation instructions. You would need devel versions of many libraries for that to succeed. Sorry but I don't know your platform, so I can't help you with detailed instructions.

Thanks for taking the time to help :)
Right after I posted I figured I had to compile from source code. Many years since I did that last time so have to read a bit I think. It's a raspberry pi 3 b+ with raspbian stretch lite.

BTW, do I have to remove moc before I compile?

In general no. You can install the compiled version in a separate directory. By default it should go to /usr/local/bin, whereas original one is probably at /usr/bin.

Tried it just now.
Downloaded moc-2.5.2.tar.bz2, unpacked it with tar -xvf moc-2.5.2.tar.bz2, copied tg-no-mixer.patch.gz to the new moc-2.5.2 folder, ran zcat tg-no-mixer.patch.gz | patch -p0 in that directory and got this message:
patching file alsa.c
Hunk #1 FAILED at 492.
Hunk #2 FAILED at 778.
Hunk #3 FAILED at 803.
Hunk #4 FAILED at 888.
4 out of 4 hunks FAILED -- saving rejects to file alsa.c.rej
what did I do wrong?

You used old source version. The patch is supposed to work against current SVN head, i.e. follow the instructions in "Current Development Sources" in download guide (svn co svn://svn.daper.net/moc/trunk and so on).

Thanks for your help :)
Downloaded the alpha release, installed youre patch, installed a bunch of stuff and finaly got it working :)
Had to do it a couple of times since I forgot to install some stuff, but now I can play music again :D