FreeBSD-7.2 - Only One pcm on OSS 4.2 ?

OSS specific BSD discussion (FreeBSD/NetBSD/OpenBSD)

Moderators: hannu, dev, cesium, kodachi

FreeBSD-7.2 - Only One pcm on OSS 4.2 ?

Postby vslash » Sat Nov 28, 2009 10:22 am

trying to recording while listening (as i used to), i discovered OSS 4.2 don't create pcm1 anymore. So, we have only one pcm registered in /dev/oss...
Is it a way to get more than one pcm device (other than buying a commercial version of OSS) ?
(using vmixctl don't work too, oss driver report no support at all)
Should we use previous versions (i get 3 or 4 of them working like a charm with vmix and pcm1 enabled) ?

Thanks for your help and assistance,

regards,

v/

PS :
[using free-non-commercial oss installed from FreeBSD-current(2009/11) port]
ossinfo :
Code: Select all
Version info: OSS 4.2 (b 2002/200911221427) (0x00040100) BSD
Platform: FreeBSD/i386 7.2-RELEASE FreeBSD 7.2-RELEASE #0: Wed Nov 25 21:22:46 CET 2009     
// .. //

Number of audio devices:        2
Number of audio engines:        7
Number of MIDI devices:         0
Number of mixer devices:        1


Device objects
0: oss_atiaudio0 ATI IXP200 interrupts=237595 (237596)

MIDI devices (/dev/midi*)

Mixer devices
0: AC97 Mixer (AD1888) (Mixer 0 of device object 0)

Audio devices
ATI IXP200                        /dev/oss/oss_atiaudio0/pcm0  (device index 0)
ATI IXP200 (SPDIF out)            /dev/oss/oss_atiaudio0/spdout  (device index 1)

Nodes
  /dev/dsp -> /dev/oss/oss_atiaudio0/pcm0
  /dev/dsp_in -> /dev/oss/oss_atiaudio0/pcm0
  /dev/dsp_out -> /dev/oss/oss_atiaudio0/pcm0
  /dev/dsp_ac3 -> /dev/oss/oss_atiaudio0/pcm0
  /dev/dsp_mmap -> /dev/oss/oss_atiaudio0/pcm0
  /dev/dsp_multich -> /dev/oss/oss_atiaudio0/pcm0
vslash
 
Posts: 9
Joined: Mon Apr 04, 2005 4:42 pm

Re: FreeBSD-7.2 - Only One pcm on OSS 4.2 ?

Postby cesium » Sat Nov 28, 2009 10:37 am

Can you also paste here the output of "ossinfo -v3" and of "ossmix"? From what I can tell, vmix is already attached (because the number of engines is higher than the number of devices)... Also, test this using "ossrecord" program along with "ossplay".
cesium
 
Posts: 903
Joined: Sun Aug 12, 2007 12:51 am

Re: FreeBSD-7.2 - Only One pcm on OSS 4.2 ?

Postby vslash » Sat Nov 28, 2009 11:16 am

Many thanks for you very quick reply !

I always use ossrecord in order to record anything.
my 'soundshot' script did :

//...//
ossrecord -d/dev/dsp1 -b 16 -c 2 -s44100 -v $foutwav >/dev/null
//..//

But for now, like i said, /dev/dsp1 (pcm1) don't exists anymore.
I cannot use dsp0 (pcm0), because it is used by the process outputing sounds (xmms).

Can you also paste here the output of "ossinfo -v3" and of "ossmix" ?


Yes, i do that and post here when ready (this afternoon)

Thanks to you,

--
v/
vslash
 
Posts: 9
Joined: Mon Apr 04, 2005 4:42 pm

Re: FreeBSD-7.2 - Only One pcm on OSS 4.2 ?

Postby vslash » Sat Nov 28, 2009 2:14 pm

Ok

1. OSS 4.0 (b071011/200904080824) used under FreeBSD-6.3 (my previous config) :
- build from port (0x00040003 == oss-v4.0-build1016-src-bsd.tar.bz2)
- pcm0, pcm1 and vmix : enabled
- ossinfo say :
Code: Select all
Version info: OSS 4.0 (b071011/200904080824) (0x00040003) CDDL
Platform: FreeBSD/i386 6.3-RELEASE FreeBSD 6.3-RELEASE #1: Tue Feb 26 18:35:52 CET 2008     
//...//

Number of audio devices:   11
Number of audio engines:   11
Number of MIDI devices:      0
Number of mixer devices:   1


Device objects
0: atiaudio0 ATI IXP200
1: vmix0 OSS transparent virtual support

MIDI devices (/dev/midi*)

Mixer devices (/dev/mixer*)
0: AC97 Mixer (AD1888) (Mixer 0 of device object 0)

Audio devices
/dev/oss/atiaudio0/pcm0   ATI IXP200  (device index 0)
/dev/oss/atiaudio0/pcm1   ATI IXP200  (device index 1)
/dev/oss/atiaudio0/spdout   ATI IXP200 (SPDIF out)  (device index 2)
/dev/oss/vmix0/pcm0   ATI IXP200 (VMIX0)  (device index 3)
/dev/oss/vmix0/pcm1   ATI IXP200 (VMIX0)  (device index 4)
/dev/oss/vmix0/pcm2   ATI IXP200 (VMIX0)  (device index 5)
/dev/oss/vmix0/pcm3   ATI IXP200 (VMIX0)  (device index 6)
/dev/oss/vmix0/pcm4   ATI IXP200 (VMIX0)  (device index 7)
/dev/oss/vmix0/pcm5   ATI IXP200 (VMIX0)  (device index 8)
/dev/oss/vmix0/pcm6   ATI IXP200 (VMIX0)  (device index 9)
/dev/oss/vmix0/pcm7   ATI IXP200 (VMIX0)  (device index 10)


2. OSS 4.0 (b071011/200904080824) built under FreeBSD-6.3, module loaded under FreeBSD-7.2 :
- all oss directories from 6.3 were used (etc, module, config ...), no mix-up btw versions.
- we are on the same motherboard
Result => bad trap, kernel panic, reboot
- Explain : don't try this, even with COMPAT6 option enabled on FBSD-7.2 kernel, i think module sources was specifically designed for 6.x and don't work under 7.x

3. OSS 4.0 (b071011/200904080824) built under FreeBSD-7.2 and loaded on FreeBSD-7.2 (sources from oss-v4.0-build1016-src-bsd.tar.bz2) :
- soundon => no trouble on loading kernel module
- work fine, but i don't try a 'brainstorming' on 7.2, all my audio programs were compiled with OSS-4.2/soundcard.h version, so it could be lead to some trouble, i must rebuild them.
- FYI : i didn't remember myself, but compiling build1016 lead to a bug ; i re-discovered it and fix it one more time ! (a very small one, see ossdetect.c:296 )
- ossinfo say :
Code: Select all
Version info: OSS 4.0 (b1016/200911281434) (0x00040003) BSD
Platform: FreeBSD/i386 7.2-RELEASE FreeBSD 7.2-RELEASE #0: Wed Nov 25 21:22:46 CET 2009     
// ...//

Number of audio devices:        7
Number of audio engines:        7
Number of mixer devices:        1


Device objects
0: atiaudio0 ATI IXP200


Mixer devices
0: AC97 Mixer (AD1888) (Mixer 0 of device object 0)

Audio devices
ATI IXP200                        /dev/oss/atiaudio0/pcm0  (device index 0)
ATI IXP200 (VMIX0)                /dev/oss/atiaudio0/pcm1  (device index 1)
ATI IXP200 (VMIX0)                /dev/oss/atiaudio0/pcm2  (device index 2)
ATI IXP200 (VMIX0)                /dev/oss/atiaudio0/pcm3  (device index 3)
ATI IXP200 (VMIX0)                /dev/oss/atiaudio0/pcm4  (device index 4)
ATI IXP200                        /dev/oss/atiaudio0/pcm5  (device index 5)
ATI IXP200 (SPDIF out)            /dev/oss/atiaudio0/spdout  (device index 6)


I get all 'my' pcm with OSS sound quality !

4. Conclusion : "only one pcm" come from a (bad) 4.2 feature. Previous version seems to work fine with all pcm and vmix enabled.

On my side, i think i'll still continue to use this version as it is nice for me.
Tell me if you want more information, more fixing, no trouble, i will help you (and us) with a great pleasure,

--
v/
vslash
 
Posts: 9
Joined: Mon Apr 04, 2005 4:42 pm

Re: FreeBSD-7.2 - Only One pcm on OSS 4.2 ?

Postby cesium » Sat Nov 28, 2009 6:04 pm

Ah, I see.

4.2 tries to set up all vmix devices under /dev/dsp, so that users won't have to set up programs to use different /dev/dspN if they want to make several output simultaneously. It's based on a FreeBSD 7-only feature (7.1+ to be more exact). I know this works for multiple playback, and I believe it should work for mixed recording/playback too. Does ossrecord under 4.2 give out an error if it's used without '-d/dev/dsp1'?

Secondly, I think setting "flat_device_model=1" in 4.2's /usr/lib/oss/osscore.conf (or /usr/local/lib/oss/osscore.conf - depends if you're using the port) and restarting OSS, will lead to the same result you're seeking (split device files). If that's not enough, you can rebuild OSS with the following modification: edit kernel/OS/FreeBSD/wrapper/bsddefs.h and prevent it from defining VDEV_SUPPORT. The rebuilt OSS will have the same behaviour as 4.0.

Thirdly, soundcard.h should be binary compatible across versions, so no need to worry there. 4.2 should work more nicely with FreeBSD - it has several fixes for programs compiled under local soundcard.h (e.g. SNDCTL_DSP_GETBLKSIZE is defined slightly differently under FreeBSD - 4.2 supports that) and for FreeBSD behaviour (e.g. fcntl() call to set up/remove nonblocking flag failed because FreeBSD sends some ioctls to driver in that case. This hurt libSDL based programs).
cesium
 
Posts: 903
Joined: Sun Aug 12, 2007 12:51 am

Re: FreeBSD-7.2 - Only One pcm on OSS 4.2 ?

Postby vslash » Sat Nov 28, 2009 7:20 pm

Does ossrecord under 4.2 give out an error if it's used without '-d/dev/dsp1'?

Yes, i was trying this before posting here. It don't work (device busy, policy/perm ok)

Secondly, I think setting "flat_device_model=1" in 4.2's /usr/lib/oss/osscore.conf

nice, i'll try this ...

you can rebuild OSS with the following modification: edit kernel/OS/FreeBSD/wrapper/bsddefs.h and prevent it from defining VDEV_SUPPORT

... and this too, and come back here for the results.

SNDCTL_DSP_GETBLKSIZE is defined slightly differently under FreeBSD

Yep, absolutly right ! @#!$:!#/ ... hu..., don't mind ... :o)
Thanks for your nices tips about soundcard.h, very usefull.

tkx for all,
c-u-soon,

v/
vslash
 
Posts: 9
Joined: Mon Apr 04, 2005 4:42 pm

Re: FreeBSD-7.2 - Only One pcm on OSS 4.2 ?

Postby vslash » Sun Nov 29, 2009 12:56 am

1. soudon with flat_device_model=1

>>> /dev/oss/.../pcm[0-15] : all have been created on dev, Ok

$ ossplay -d /dev/oss/../pcm0 file.wav &
$ cat /dev/sndstat
Code: Select all
Audio devices:
0: (Undefined or removed device)
1: ATI IXP200 (SPDIF out) (OUTPUT)
2: ATI IXP200 (vmix) (DUPLEX)
   Engine 9 opened OUT by ossplay/1308 @ 44100/48000 Hz Fragment: 2048/192000 (10.6 msec)
   Song name: vslash_parme_glock_record_090813-2025.wav
3: ATI IXP200 (vmix) (DUPLEX)
   Engine 8 opened OUT by ossplay/1308 @ 44100/48000 Hz Fragment: 2048/192000 (10.6 msec)
   Song name: vslash_parme_glock_record_090813-2025.wav
4: ATI IXP200 (vmix) (DUPLEX)
   Engine 7 opened OUT by ossplay/1308 @ 44100/48000 Hz Fragment: 2048/192000 (10.6 msec)
   Song name: vslash_parme_glock_record_090813-2025.wav
5: ATI IXP200 (vmix) (DUPLEX)
   Engine 6 opened OUT by ossplay/1308 @ 44100/48000 Hz Fragment: 2048/192000 (10.6 msec)
   Song name: vslash_parme_glock_record_090813-2025.wav
6: ATI IXP200 (vmix) (DUPLEX)
   Engine 5 opened OUT by ossplay/1308 @ 44100/48000 Hz Fragment: 2048/192000 (10.6 msec)
   Song name: vslash_parme_glock_record_090813-2025.wav
7: ATI IXP200 (vmix) (DUPLEX)
   Engine 4 opened OUT by ossplay/1308 @ 44100/48000 Hz Fragment: 2048/192000 (10.6 msec)
   Song name: vslash_parme_glock_record_090813-2025.wav
8: ATI IXP200 (vmix) (DUPLEX)
   Engine 3 opened OUT by ossplay/1308 @ 44100/48000 Hz Fragment: 2048/192000 (10.6 msec)
   Song name: vslash_parme_glock_record_090813-2025.wav
9: ATI IXP200 (vmix) (DUPLEX)
   Engine 2 opened OUT by ossplay/1308 @ 44100/48000 Hz Fragment: 2048/192000 (10.6 msec)
   Song name: vslash_parme_glock_record_090813-2025.wav


>>> all devices are used by the same process, you cannot record from pcm1 while writing to pcm0, device busy

$ lsof /dev/oss/.../pcm0
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
ossplay 1308 valery 3w VCHR 0,135 0t18859008 135 /dev/oss/oss_atiaudio0/pcm0

$ lsof /dev/oss/.../pcm1
_nothing_

>>> trouble seem to come from oss, not from filesystem

2. Keeping this, attaching vmix
# vmixctl attach /dev/oss/oss_atiaudio0/pcm0
Virtual mixer attached to device.

$ ossplay -d /dev/oss/../pcm0 file.wav &
$ cat /dev/sndstat
Code: Select all
//...
   same as above
...//
10: ATI IXP200 (vmix) (DUPLEX)
    Engine 1 opened OUT by ossplay/1339 @ 44100/48000 Hz Fragment: 2048/192000 (10.6 msec)
    Song name: vslash_parme_glock_record_090813-2025.wav
11: ATI IXP200 (vmix) (DUPLEX)
12: ATI IXP200 (vmix) (DUPLEX)
13: ATI IXP200 (vmix) (DUPLEX)
14: ATI IXP200 (vmix) (DUPLEX)
15: ATI IXP200 (vmix) (DUPLEX)
16: ATI IXP200 (vmix) (DUPLEX)
17: ATI IXP200 (vmix) (DUPLEX)

$ lsof /dev/oss/.../pcm0
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
ossplay 1308 valery 3w VCHR 0,135 0t18859008 135 /dev/oss/oss_atiaudio0/pcm0

$ lsof /dev/oss/.../pcm11 (first free pcm, other don't work)
_nothing_

$ ossrecord -d /dev/oss/oss_atiaudio0/pcm11 -c 2 -s44100 test-1.wav

>>> Ok, record start, next playing recorded sound is Ok and nice.

3. soundon with flat_dev=1 && ( vmix_disabled=1 || vmix_loopdevs=1 ) :
>>> DUPLEX don't work (recording & playing on the same device)

4. soundon with flat_dev=0 + 'vmixctl attach' on pcm0
DUPLEX don't work on any device
SIMPLEX-Out (pcm0) + SIMPLEX-In (pcm1) don't work together too.

5. 1st solution is to :
# set flat_dev=1
# starting OSS
# attaching vmix via vmixctl
$ (setting record source to "vol" of course)
$ recording from the 1st free vmix.


6. Building oss without VDEV_SUPPORT :
Doing this sched a small light on the mess :
#soudon with flat_device_model=0
$ xmms outputing sounds on pcm0 : Ok
$ cat /dev/sndstat
Code: Select all
Audio devices:
0: ATI IXP200 (DUPLEX)
   Engine 1 opened OUT by xmms/2367 @ 44100/48000 Hz Fragment: 4096/192000 (21.3 msec)
1: ATI IXP200 (SPDIF out) (OUTPUT)
2: ATI IXP200 (vmix) (DUPLEX)
3: ATI IXP200 (vmix) (DUPLEX)
4: ATI IXP200 (vmix) (DUPLEX)
5: ATI IXP200 (vmix) (DUPLEX)
6: ATI IXP200 (vmix) (DUPLEX)
7: ATI IXP200 (vmix) (DUPLEX)
8: ATI IXP200 (vmix) (DUPLEX)
9: ATI IXP200 (vmix) (DUPLEX)
10: (Undefined or removed device)
11: (Undefined or removed device)
12: (Undefined or removed device)
13: (Undefined or removed device)
14: (Undefined or removed device)
15: (Undefined or removed device)
16: (Undefined or removed device)
17: (Undefined or removed device)
18: ATI IXP200 (DUPLEX)
...


>>> only one engine attached
>>> from mixer point of view, it show that vmix use pcm1 to 8, but nothing about pcm9
>>> ossmix -D don't tell anything more about pcm9

$ ossrecord -d /dev/oss/oss_atiaudio0/pcm9 ...
>>> work fine

Don't understand all the mess, perhaps the trouble is coming from mixer,
or from the vmix mapping scheme, or from my audio board spec.

A whole framework picture of OSS features would be nice, anyway, we always find out a
solution, it was my goal here, and i got it,

Thanks,

v/
vslash
 
Posts: 9
Joined: Mon Apr 04, 2005 4:42 pm


Return to BSD

Who is online

Users browsing this forum: Bing [Bot], Majestic-12 [Bot] and 3 guests