# FreeBSD 9 RELEASE_ can't start ossxmix



## foxconn (Feb 2, 2012)

```
#ossinfo
....
Number of audio devices:        8
Number of audio engines:        8
Number of MIDI devices:         0
Number of mixer devices:        2


Device objects
 0: pcm0 HDA Sigmatel STAC9274D PCM #0 Analog
    at cad 2 nid 1 on hdac0 
 1: pcm1 HDA Sigmatel STAC9274D PCM #1 Digital
    at cad 2 nid 1 on hdac0 

MIDI devices (/dev/midi*)

Mixer devices
 0: pcm0:mixer (Mixer 0 of device object 0)
 1: pcm1:mixer (Mixer 0 of device object 1)

Audio devices
pcm0:play:dsp0.p0                 /dev/dsp0.p0  (device index 0)
pcm0:virtual:dsp0.vp0             /dev/dsp0.vp0  (device index 1)
pcm0:virtual:dsp0.vp1             /dev/dsp0.vp1  (device index 2)
pcm0:record:dsp0.r0               /dev/dsp0.r0  (device index 3)
pcm0:virtual:dsp0.vr0             /dev/dsp0.vr0  (device index 4)
pcm1:play:dsp1.p0                 /dev/dsp1.p0  (device index 5)
pcm1:virtual:dsp1.vp0             /dev/dsp1.vp0  (device index 6)
pcm1:virtual:dsp1.vp1             /dev/dsp1.vp1  (device index 7)

Nodes
```

But when I try to start ossxmix (gtk2.0 already installed from port):

```
#ossxmix
SNDCTL_MIX_NRMIX: Invalid argument
Error: OSS version 4.0 or later is required
```

I tried to google "SNDCTL_MIX_NRMIX: invalid argument" and this sounds like ossxmix can't find the default mixer.

If I start ossmix instead:

```
#ossmix
No such file or directory
```

At this moment in KDE my OSS work fine in mplayer/VLC but only in 2 channel mode only, so I want to fix this with ossxmix/ossmix, please help

I'm using the Intel HD audio with the snd_hda driver complied into the kernel. This used to work flawlessly in FreeBSD 8 and 7 with OSS.


----------



## mav@ (Feb 2, 2012)

As I understand, you are trying to use mixer from OSSv4 from ports with sound(4) subsystem from the base system. It won't work that way now, as sound(4) doesn't support full set of APIs of OSSv4. These APIs were bad designed in many places, so their implementation is questionable.

You don't need ossxmix to enable multichannel playback. If you want analog 5.1 output, most likely you should just configure vchans for your speaker configuration with dev.pcm.0.play.vchanformat="s16le:5.1" sysctl and set mplayer to play 6 channels using "-channels 6" option.


----------



## foxconn (Feb 2, 2012)

Thanks Mav@ for your reply. In fact I have already added 
	
	



```
dev.pcm.1.play.vchanformat=s16le:5.1
```
 to my /etc/sysctl.conf.


```
$ sysctl -a | grep -i pcm
pcm0: <HDA Sigmatel STAC9274D PCM #0 Analog> at cad 2 nid 1 on hdac0
pcm1: <HDA Sigmatel STAC9274D PCM #1 Digital> at cad 2 nid 1 on hdac0
pcm0: <HDA Sigmatel STAC9274D PCM #0 Analog> at cad 2 nid 1 on hdac0
pcm1: <HDA Sigmatel STAC9274D PCM #1 Digital> at cad 2 nid 1 on hdac0
pcm0: <HDA Sigmatel STAC9274D PCM #0 Analog> at cad 2 nid 1 on hdac0
pcm1: <HDA Sigmatel STAC9274D PCM #1 Digital> at cad 2 nid 1 on hdac0
pcm0: <HDA Sigmatel STAC9274D PCM #0 Analog> at cad 2 nid 1 on hdac0
pcm1: <HDA Sigmatel STAC9274D PCM #1 Digital> at cad 2 nid 1 on hdac0
dev.pcm.0.%desc: HDA Sigmatel STAC9274D PCM #0 Analog
dev.pcm.0.%driver: pcm
dev.pcm.0.%parent: hdac0
dev.pcm.0.play.vchans: 2
dev.pcm.0.play.vchanmode: fixed
dev.pcm.0.play.vchanrate: 48000
dev.pcm.0.play.vchanformat: s16le:2.0
dev.pcm.0.rec.vchans: 1
dev.pcm.0.rec.vchanmode: fixed
dev.pcm.0.rec.vchanrate: 48000
dev.pcm.0.rec.vchanformat: s16le:2.0
dev.pcm.0.buffersize: 16384
dev.pcm.0.bitperfect: 0
dev.pcm.1.%desc: HDA Sigmatel STAC9274D PCM #1 Digital
dev.pcm.1.%driver: pcm
dev.pcm.1.%parent: hdac0
dev.pcm.1.play.vchans: 2
dev.pcm.1.play.vchanmode: passthrough
dev.pcm.1.play.vchanrate: 48000
dev.pcm.1.play.vchanformat: s16le:5.1                     #<---------------- Channel 5.1 set----------------
dev.pcm.1.buffersize: 16384
dev.pcm.1.bitperfect: 0
```

But when *I* tried to explicitly tell mplayer to play in 5.1 channel for a test .ac3 file as what you suggested, I could only hear all the test sound (FR, FL,Centre, RR, RL) got emulated from the 2 front speakers only. My old amplifier in fact showed on its own display panel the signals it got from the SPDIF is just stereo (I just checked the other partition with FreeBSD 8 the signals the com sent out is clearly 5:1 instead) :q


```
$ mplayer -channels 6 www_lynnemusic_com_surround_test.ac3 
MPlayer SVN-r33137-snapshot-4.2.1 (C) 2000-2011 MPlayer Team

Playing www_lynnemusic_com_surround_test.ac3.
libavformat file format detected.
[ac3 @ 0x81005f010] max_analyze_duration reached
[ac3 @ 0x81005f010] Estimating duration from bitrate, this may be inaccurate
[lavf] stream 0: audio (ac3), -aid 0
Load subtitles in ./
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 6 ch, s16le, 448.0 kbit/9.72% (ratio: 56000->576000)
Selected audio codec: [ffac3] afm: ffmpeg (FFmpeg AC-3)
==========================================================================
AO: [oss] 48000Hz 6ch s16le (2 bytes per sample)
Video: no video
Starting playback...
A:   9.1 (09.0) of 9.3 (09.2)  0.5% 


Exiting... (End of file)
```


----------



## mav@ (Feb 3, 2012)

You haven't mentioned S/PDIF. It changes everything. You can't play discrete 5.1 via S/PDIF by definition. But you can do AC3/DTS passthrough via it. Remove -channels from mplayer and add instead -ac hwdts,hwac3,


----------



## foxconn (Feb 4, 2012)

mav@ said:
			
		

> You haven't mentioned S/PDIF. It changes everything. You can't play discrete 5.1 via S/PDIF by definition. But you can do AC3/DTS passthrough via it. Remove -channels from mplayer and add instead -ac hwdts,hwac3,



Thanks again, those arguments really worked:stud
But where should I put those options into the sound preference panels in smplayer?
if I picked OSS as the sound output driver there and checked "AC3/DTS pass-through S/PDIF", no signals came out from the S/PDIF:q


```
$ mplayer -ac hwdts,hwac3 www_lynnemusic_com_surround_test.ac3  
MPlayer SVN-r33137-snapshot-4.2.1 (C) 2000-2011 MPlayer Team

Playing www_lynnemusic_com_surround_test.ac3.
libavformat file format detected.
[ac3 @ 0x81005f010] max_analyze_duration reached
[ac3 @ 0x81005f010] Estimating duration from bitrate, this may be inaccurate
[lavf] stream 0: audio (ac3), -aid 0
Load subtitles in ./
==========================================================================
Forced audio codec: hwdts
Forced audio codec: hwac3
Opening audio decoder: [hwac3] AC3/DTS pass-through S/PDIF
hwac3: switched to AC3, 448000 bps, 48000 Hz

AUDIO: 48000 Hz, 2 ch, ac3be, 448.0 kbit/29.17% (ratio: 56000->192000)
Selected audio codec: [hwac3] afm: hwac3 (AC3 through S/PDIF)
==========================================================================
AO: [oss] 48000Hz 2ch ac3le (2 bytes per sample)
Video: no video
Starting playback...
A:   9.0 (08.9) of 9.3 (09.2)  0.1% 


Exiting... (End of file)
```


----------



## foxconn (Feb 4, 2012)

After some more googling I figured it out how to enable the AC3/DTS passthrough in smplayer and mplayer.

For mplayer: add the following to my mplayer configuration file (~/.mplayer/config)

```
afm=hwac3
```

With that alone, smplayer still crashed when I tried to play .ac3 file there even if *I* checked "AC3/DTS pass-through S/PDIF"
After some more googling, *I* disabled all the audio filters in the sound preference panels and now the .ac3 played flawlessly
(i.e. uncheck everything in the sound perference panel except for the AC3/DTS passthrough).


----------

