Lag with OSS

Place to talk about all that new hardware and decaying software you have.

Moderator: General Mods

Post Reply
paulguy
Zealot
Posts: 1076
Joined: Sat Jul 02, 2005 2:01 am
Contact:

Lag with OSS

Post by paulguy »

I recently tried switching to 4front's OSS from ALSA, mostly because the program I was making used the OSS library and I thought it best to use the real thing. It sounds great and all, seems to even have a bit less noise than ALSA, and the volume adjustments seem to work better (no overdrive) but the big problem is there seems to be a good half a second delay in the audio. I tried looking on the internet for solutions but I couldn't find any, but this message board has a lot of big fans of OSS so this would probably be my best bet.

System configuration:
Gentoo Linux 2008.0 using kernel 2.6.25-gentoo-r6
Intel Core 2 Duo E6750 @2.66Ghz
Asus P5K-e AP motherboard
4 gig DDR-800 RAM
Creative Sound Blaster Live w\o livedrive

I tested with bsnes, wine and gmeplay. bsnes seems to have the least delay of them all but still very noticeable.
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

Make sure all your apps are set to use the OSS API.
Also make sure the wrapper APIs (SDL, libao, OpenAL) all use OSS directly. Otherwise there will be more of a lag.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
paulguy
Zealot
Posts: 1076
Joined: Sat Jul 02, 2005 2:01 am
Contact:

Post by paulguy »

Yes, I've set them all to use OSS and I'm not using any audio servers like arts or esd.
ZH/Franky

Post by ZH/Franky »

Hmm, that's strange, I use OSS4 and sound on my system is generally perfect.

System configuration:
OS ~ Ubuntu 8.04.1, Linux 2.6.24-19-generic #1 SMP, i686
CPU ~ Pentium 4 Prescott 640 @ 3.2GHz
Mobo ~ Dell 0WG261
Memory ~ 1024MiB (512MiB x 2, Infineon, DDR2 @ 266MHz)
Sound ~ Intel 82801G (ICH7) HDA
Last edited by ZH/Franky on Wed Sep 17, 2008 7:21 pm, edited 1 time in total.
tukuyomi
Rookie
Posts: 39
Joined: Mon Aug 02, 2004 5:14 am
Contact:

Post by tukuyomi »

Does this have to do with the Creative Sound Blaster? (can't remember where I read that from...)
I also have a Creative Sound Blaster Live! card and the sound in general have some delay with OSS.
On another PC with a Cirrus Logic CS, there is no problem
On both systems: Debian Lenny; Ubuntu 8.04, AMD Athlon 2600+; AMD Athlon Thunderbird, Creative Labs SB Live! EMU10k1; Cirrus Logic CS 4614/22/24/30
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

I have an SB Live! myself. It worked fine for me with OSS except when the app uses a large buffer. OSS 4 also makes better usage of smaller buffers than OSS 3 did. Which may explain why bsnes sounds the best for you, I made it use a smaller buffer.

Tell me how ZSNES with OSS sounds, that might help narrow it down.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
paulguy
Zealot
Posts: 1076
Joined: Sat Jul 02, 2005 2:01 am
Contact:

Post by paulguy »

I don't quite know how to get zsnes to use OSS directly. I checked the configure help and it didn't mention it... Usinf SDL(with OSS) the delay is pretty bad.
tukuyomi
Rookie
Posts: 39
Joined: Mon Aug 02, 2004 5:14 am
Contact:

Post by tukuyomi »

OK, I managed to disable vmix on OSS and the latency I experienced is now back to something normal.
Quick howto disable vmix:

Code: Select all

nano /usr/lib/oss/conf/osscore.conf
Uncomment OR add this line

Code: Select all

vmix_disabled=1
and issue as root

Code: Select all

# soundoff && soundon
I tested with ZSNES 1.51b (both i586 binary and src) and bsnes, mplayer, ...

Code: Select all

./zsnes -ad oss
Audio Opened.
Driver: OSS audio driver output 
Channels: 2
Rate: 32000
Hope this will help you a bit..
paulguy
Zealot
Posts: 1076
Joined: Sat Jul 02, 2005 2:01 am
Contact:

Post by paulguy »

Oh sweet, it worked. Thanks a lot for all the help, everyone. I imagine this should be noted in some audio thread somewhere, since I'm probably not the first or last to encounter this problem.

EDIT: Is there any way to utilize my sound card's hardware mixing so I don't have problems with things mot working if something has the sound card open?
kick
Trooper
Posts: 550
Joined: Wed Mar 01, 2006 8:47 pm

Post by kick »

Here's another (better) way to do this:

- Go to /usr/lib/oss/etc and open 'installed_drivers' in a text editor.
(it's a good idea to make a backup copy of it first,before editing)

- Remove all lines with listed devices (USB audio,VMix,etc.),except for that of your main soundcard/audio interface and save (overwrite) the file

- Stop and restart OSS (needs root permission)

- Open a terminal and start 'ossxmix'. You can see that now your Creative soundcard is using the hardware mixer
[i]Have a nice kick in da nutz[/i] @~@* c//
tukuyomi
Rookie
Posts: 39
Joined: Mon Aug 02, 2004 5:14 am
Contact:

Post by tukuyomi »

Nach wrote:I have an SB Live! myself. It worked fine for me with OSS except when the app uses a large buffer. OSS 4 also makes better usage of smaller buffers than OSS 3 did. Which may explain why bsnes sounds the best for you, I made it use a smaller buffer.

Tell me how ZSNES with OSS sounds, that might help narrow it down.
Sorry Nach, but the latency is still there with zsnes 1.51b (if vmix is enabled in OSS).
Some more informations Debian Lenny up-to-date, Custom 2.6.26 kernel, Sound Blaster Live with MIDI Interface, (not really useful but still)ATi Radeon 9200 Pro (AGP Port)

Code: Select all

$ cat '/boot/config-2.6.26-custom' | grep _OSS
CONFIG_SND_OSSEMUL=y
CONFIG_SND_MIXER_OSS=m
CONFIG_SND_PCM_OSS=m
CONFIG_SND_PCM_OSS_PLUGINS=y
CONFIG_SND_SEQUENCER_OSS=y

#  lspci -vvvs 01:07
01:07.0 Multimedia audio controller: Creative Labs SB Live! EMU10k1 (rev 07)
	Subsystem: Creative Labs Device 8064
	Control: I/O+ Mem- BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 32 (500ns min, 5000ns max)
	Interrupt: pin A routed to IRQ 5
	Region 0: I/O ports at c000 [size=32]
	Capabilities: [dc] Power Management version 1
		Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
		Status: D0 PME-Enable- DSel=0 DScale=0 PME-
	Kernel driver in use: sblive

01:07.1 Input device controller: Creative Labs SB Live! Game Port (rev 07)
	Subsystem: Creative Labs Device 0020
	Control: I/O+ Mem- BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 32
	Region 0: I/O ports at c400 [size=8]
	Capabilities: [dc] Power Management version 1
		Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
		Status: D0 PME-Enable- DSel=0 DScale=0 PME-
	Kernel driver in use: Emu10k1_gameport
	Kernel modules: emu10k1-gp

#  lspci -vvvs 02:00
02:00.0 VGA compatible controller: ATI Technologies Inc RV280 [Radeon 9200 PRO] (rev 01)
	Subsystem: PC Partner Limited Device 7c13
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 32 (2000ns min), Cache Line Size: 32 bytes
	Interrupt: pin A routed to IRQ 5
	Region 0: Memory at d0000000 (32-bit, prefetchable) [size=128M]
	Region 1: I/O ports at d000 [size=256]
	Region 2: Memory at e1000000 (32-bit, non-prefetchable) [size=64K]
	[virtual] Expansion ROM at e0000000 [disabled] [size=128K]
	Capabilities: [58] AGP version 3.0
		Status: RQ=256 Iso- ArqSz=0 Cal=0 SBA+ ITACoh- GART64- HTrans- 64bit- FW+ AGP3+ Rate=x4,x8
		Command: RQ=32 ArqSz=2 Cal=0 SBA+ AGP+ GART64- 64bit- FW- Rate=x8
	Capabilities: [50] Power Management version 2
		Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
		Status: D0 PME-Enable- DSel=0 DScale=0 PME-
	Kernel modules: radeonfb

02:00.1 Display controller: ATI Technologies Inc RV280 [Radeon 9200 PRO] (Secondary) (rev 01)
	Subsystem: PC Partner Limited Device 7c12
	Control: I/O- Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Region 0: Memory at d8000000 (32-bit, prefetchable) [disabled] [size=128M]
	Region 1: Memory at e1010000 (32-bit, non-prefetchable) [disabled] [size=64K]
	Capabilities: [50] Power Management version 2
		Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
		Status: D0 PME-Enable- DSel=0 DScale=0 PME-
ALSA no longer installed
OSS v4.0-1016 installed from the deb provided here: www.opensound.com/
And I can't think of any other infos right now.
Ask me if I can be of any help :)

EDIT: wanted to add an important information: The latency I have seems to be system-wide, not zsnes specific.
paulguy
Zealot
Posts: 1076
Joined: Sat Jul 02, 2005 2:01 am
Contact:

Post by paulguy »

OK, got hardware mixing to work.

I did what tukuyomi said to do to turn off vmix, then I opened sblive.conf in the same directory and changed

Code: Select all

#sblive_devices = 0
to

Code: Select all

sblive_devices = 5
. You can probably mess with that value to figure out the actual maximum but I just picked the lowest allowed value which seemed safe.
tukuyomi
Rookie
Posts: 39
Joined: Mon Aug 02, 2004 5:14 am
Contact:

Post by tukuyomi »

I did what paulguy said, but when I attempt to run a second application, I get the '/dev/dsp is busy' message :/
About the system-wide audio latency, I can't seem to find anything on their forums :/
paulguy
Zealot
Posts: 1076
Joined: Sat Jul 02, 2005 2:01 am
Contact:

Post by paulguy »

I had trouble with it when I had my intel hd audio enabled. I had to disable it in my BIOS before it'd work right, even after disabling the driver in OSS, I'd end up with a bunch of broken symlinks in /dev.
tukuyomi
Rookie
Posts: 39
Joined: Mon Aug 02, 2004 5:14 am
Contact:

Post by tukuyomi »

That comment in this code block is interesting...

Code: Select all

	  if (devc->card_type == SB_LIVE)
	    {


Do not enable vmix by default on Live! It would cause enormous latencies because emu10k1 doesn't have working full/half buffer DMA interrupts.

	      adev->vmix_flags = VMIX_MULTIFRAG | VMIX_SKIP;
	      adev->max_intrate = 50;
	      adev->min_block = 4096;
	    }
	  else
	    {
	      adev->max_fragments = 2;
	    }
http://manuals.opensound.com/sources/sblive.c.html
Can anyone tell me more about it?
I have an SB Live! myself.
Nach, Which driver do you use with your SBLive? sblive or emu10k1x (http://manuals.opensound.com/sources/emu10k1x.c.html)
emu10k1x.....Creative Labs 10K1X (DELL SBLIVE 5.1 OEM)
sbive..........Sound Blaster: Live/MP3/Platinum, Audigy, Audigy2, Audigy2ZS, Audigy2-Value
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

tukuyomi wrote:Nach, Which driver do you use with your SBLive?
It's emu10k something, my SBLive! is currently in a computer which is under going reconstruction, so I can't check exactly which one, but I do recall always seeing emu10k something being loaded.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
paulguy
Zealot
Posts: 1076
Joined: Sat Jul 02, 2005 2:01 am
Contact:

Post by paulguy »

Emu10k1x was for a cheapo piece of shit Dell ripoff which is similar but modified to be cheaper. sblive is most likely what you want.
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

paulguy wrote:Emu10k1x was for a cheapo piece of shit Dell ripoff which is similar but modified to be cheaper. sblive is most likely what you want.
Well, I don't have anything from dell, and it has 5 jacks on the back and a gameport.
Was marked as the original SB Live! Value (didn't come with games or the front audio panel), and it wasn't that later piece of junk card.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
Post Reply