Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (536)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Sound lag on Linux  (Read 1602 times)
0 Members and 1 Guest are viewing this topic.
Offline wmjoers

Senior Newbie




Nobody can be uncheered with a balloon.


« Posted 2004-06-24 07:06:14 »

When playing sound (both sampled and midi) there is a noticable delay between method call and sound beeing played. It's very anoying and make it almost impossible to write multiplatform game using core java.

I'm using J2SE 1.5 beta 2 on a Fedora Core 2... can any of you verify this on some other Linux release?

I know I read something about improving sound on linux in the 1.5 release but I'm not sure what it was.
Offline princec

JGO Kernel


Medals: 343
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #1 - Posted 2004-06-24 09:39:35 »

Quote
make it almost impossible to write multiplatform game using core java

Don't cut yourself up about it - core Java is more or less almost but not quite exactly the wrong technology to try writing a proper game with. Use the right tool for the job! Use LWJGL, or if you feel like making life complicated for yourself, use JOGL/JOAL/JInput, and forget the core libraries for games.

Cas Smiley

Offline wmjoers

Senior Newbie




Nobody can be uncheered with a balloon.


« Reply #2 - Posted 2004-06-24 10:57:37 »

What about sound through OpenAL (using LWJGL) then?

Is that working properly on Linux as well as Windows?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline oNyx

JGO Coder


Medals: 1


pixels! :x


« Reply #3 - Posted 2004-06-24 14:30:09 »

If you have timing problems and bad sound with midi, you've most likely "forgotten" to install a soundbank (sdk comes with and jre without).

http://java.sun.com/products/java-media/sound/soundbanks.html

And sampled sound... well, there are several ways for playback. Applet's AudioClip stuff for example performs generally very poor, because the audio data get stored in ram the first time a sample is played (and your game is usually already running then).

What works quite ok-ish is using Clips (not Applet's of course). The audio data is then already stored in ram and there is no delay (well ok maybe 50msec) if they are played. At the very first time a sample is played there is a small delay, if you hadn't created a mixer first (the default mixer is then created and everything is fine).

[search for "SoundManager" to get some example code]

That works quite well, but it's only suitable for rather short samples (eg 150 300-1500msec sfx samples). For background music you usually need something else (streaming).

With OpenAL it's similar - decode, put it into ram and playback whenever you want to. It's very fast and you can only use good methods there (all that silly stuff was omitted Wink).

Edit...

> Is that working properly on Linux as well as Windows?

Yep, and on Mac, too Smiley

弾幕 ☆ @mahonnaiseblog
Offline princec

JGO Kernel


Medals: 343
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #4 - Posted 2004-06-24 15:08:27 »

Hear OpenAL in action here:
http://www.puppygames.net/downloads/alienflux-full.jnlp

Requires Java 1.4+, hardware OpenGL drivers and preferably a GPU, 400MHz CPU and 32MB free RAM

Cas Smiley

Offline hoz

Senior Newbie




Java games rock!


« Reply #5 - Posted 2004-07-09 11:34:58 »

We had the same experience when we implemented a sound enginge for our Java Quake2 port (http://www.bytonic.de/html/jake2.html). With the java sound api sound is lagging behind the action. :-(

So we switched to joal. We had some problems with dll incompatibilities on windows. But now Jake2 sounds great.

Holger

Jake2 -  Java Quake2 engine
http://www.bytonic.de
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Riven (15 views)
2014-07-29 18:09:19

Riven (10 views)
2014-07-29 18:08:52

Dwinin (10 views)
2014-07-29 10:59:34

E.R. Fleming (28 views)
2014-07-29 03:07:13

E.R. Fleming (10 views)
2014-07-29 03:06:25

pw (40 views)
2014-07-24 01:59:36

Riven (39 views)
2014-07-23 21:16:32

Riven (27 views)
2014-07-23 21:07:15

Riven (29 views)
2014-07-23 20:56:16

ctomni231 (59 views)
2014-07-18 06:55:21
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!