Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (408)
games submitted by our members
Games in WIP (293)
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 1436 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
« League of Dukes »

JGO Kernel


Medals: 196
Projects: 3


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!
Try the Free Demo of Revenge of the Titans
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
« League of Dukes »

JGO Kernel


Medals: 196
Projects: 3


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.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars and Titan!

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

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (133 views)
2013-05-17 21:29:12

alaslipknot (142 views)
2013-05-16 21:24:48

gouessej (171 views)
2013-05-16 00:53:38

gouessej (165 views)
2013-05-16 00:17:58

theagentd (175 views)
2013-05-15 15:01:13

theagentd (160 views)
2013-05-15 15:00:54

StreetDoggy (204 views)
2013-05-14 15:56:26

kutucuk (228 views)
2013-05-12 17:10:36

kutucuk (228 views)
2013-05-12 15:36:09

UnluckyDevil (231 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.117 seconds with 21 queries.