OSS Can't read from mixer on Debian Sid

I am running Debian Unstable with OSS and cannot figure out how to get moc to use the mixer.

In moc I receive the error: (46766!) Can't read from mixer.

Also, I left moc running without a song playing and came back to find all my ram exausted and page file maxed out by the mocp process.

I have tried the following mixers against OSSMixerDevice in ~/.moc/config which I found.

/dev/mixer0 (/dev/mixer0 -> /dev/oss/oss_hdaudio0/mix0)

Currently the config is:

> grep OSS ~/.moc/config
# Sound driver - OSS, ALSA, JACK, SNDIO (on OpenBSD) or null (only for
SoundDriver = OSS:ALSA:JACK
# OSS output device.
OSSDevice = /dev/dsp
# OSS Mixer device.
OSSMixerDevice = /dev/oss/oss_hdaudio0/mix0
# OSS Mixer channel: pcm or master.
OSSMixerChannel = pcm
# Second OSS Mixer channel: pcm or master.
OSSMixerChannel2 = master

> apt-cache policy moc
Installed: 1:2.5.0~alpha4+svn20111012-1
Candidate: 1:2.5.0~alpha4+svn20111012-1

ossinfo and ossmix as follows:

Version info: OSS 4.2 (b 2005/201110151348) (0x00040100) GPL
Platform: Linux/x86_64 3.2.0-1-amd64 #1 SMP Tue Jan 24 05:01:45 UTC 2012 (damage.happytreasure.local)

Number of audio devices: 6
Number of audio engines: 10
Number of MIDI devices: 0
Number of mixer devices: 1

Device objects
0: osscore0 OSS core services
1: oss_hdaudio0 Intel HD Audio interrupts=378534 (378586)
HD Audio controller Intel HD Audio
Vendor ID 0x8086293e
Subvendor ID 0x17aa20f2
Codec 0: CX20561 (0x14f15051/0x17aa20fd)
2: oss_usb0 USB audio core services

MIDI devices (/dev/midi*)

Mixer devices
0: High Definition Audio CX20561 (Mixer 0 of device object 1)

Audio devices
HD Audio play pcm1 /dev/oss/oss_hdaudio0/pcm0 (device index 0)
HD Audio play pcm2 /dev/oss/oss_hdaudio0/pcm1 (device index 1)
HD Audio play pcm3 /dev/oss/oss_hdaudio0/pcm2 (device index 2)
HD Audio rec rec1 /dev/oss/oss_hdaudio0/pcmin0 (device index 3)
HD Audio rec fp-mic /dev/oss/oss_hdaudio0/pcmin1 (device index 4)
HD Audio rec pcm3 /dev/oss/oss_hdaudio0/pcmin2 (device index 5)

/dev/dsp -> /dev/oss/oss_hdaudio0/pcm0
/dev/dsp_in -> /dev/oss/oss_hdaudio0/pcm0
/dev/dsp_out -> /dev/oss/oss_hdaudio0/pcm0
/dev/dsp_mmap -> /dev/oss/oss_hdaudio0/pcm0
/dev/dsp_multich -> /dev/oss/oss_hdaudio0/pcm0

> ossmix
Selected mixer 0/High Definition Audio CX20561
Known controls are:
jack.fp-green.mode (currently pcm1)
jack.fp-pink [:] (currently 39.9:39.9 dB)
jack.int-speaker.mode (currently pcm1)
jack.int-mic [:] (currently 9.9:9.9 dB)
jack.black.mode (currently pcm3)
record.rec1 [:] (currently 64.9:64.9 dB)
record.fp-mic [:] (currently 64.9:64.9 dB)
misc.pcm1 [:] (currently 65.9:65.9 dB)
misc.pcm2 [:] (currently 68.9:68.9 dB)
misc <-28.-8dB|-19.-2dB|-9.-6dB|0.0dB> (currently -28.-8dB)
vmix0-enable ON|OFF (currently ON)
vmix0-rate (currently 48000) (Read-only)
vmix0-channels (currently Stereo)
vmix0-src (currently Fast)
vmix0-outvol (currently 25.0 dB)
vmix0-invol (currently 19.1 dB)
vmix0.pcm6 [:] (currently 22.5:22.5 dB) ("mocp")
vmix0.pcm7 [:] (currently 25.0:25.0 dB)
vmix0.pcm8 [:] (currently 25.0:25.0 dB)
vmix0.pcm9 [:] (currently 25.0:25.0 dB)


Thanks ZedDB,

I found your other post and the link to the patch you made and have successfully used it.

Thanks very much for creating the patch - it works fine.


I've had this problem but I have created a patch for it so that it works with OSS4.

Here it is: http://pastebin.com/2NBPeKWA

IIRC the problem is that when music is not playing mocp frees the OSS4 pcm slot that it's using but tries to read back the volume. However because it isn't using any slot it can't do so and fails. It tries this over and over again.
So I've created a little hack to have it stop making these checks when you are not playing anything.

I'm not sure if "/usr/lib/oss/include/sys/soundcard.h" is the correct path on all dists so you might want to change that.

An other thing worth mentioning is that if you change volume in moc it will change the volume of that pcm slot in vmix.
You can view it with ossxmix.

I might add something that resets the volume. But I haven't figured out a way yet to do that cleanly.