Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (121)
games submitted by our members
Games in WIP (577)
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"  (Read 2014 times)
0 Members and 1 Guest are viewing this topic.
Offline MisterBob

Senior Newbie




Developing: 2D Space Shooter & RPG


« Posted 2003-09-27 16:23:39 »

If I attempt to play 2 of the same sound around the same time (For example, if mario jumps through a large group of coins in a game), it causes some serious lag.

If you need an example of this, check out my platformer in the games section...

Is there any way to fix this? Or is it beyound the capabilities of JavaSound?

Offline Preston

Senior Duke


Medals: 4



« Reply #1 - Posted 2003-09-29 07:30:05 »

I've got a similar effect, however just until one sound is played for the very first time. When it plays the first time there's a lag. Whenever the same sample is being played again no lag is noticeable.
So far I can live with this "very first time" lag. :-)
Offline mdicosimo

Innocent Bystander




Java games rock!


« Reply #2 - Posted 2003-11-10 11:03:20 »

Hi everybody,
I'm beginning my experience with Java and I'm stuck with the same problem in repetition of sounds.

Have found any solution since?

I tried the following but I had no success:

1) I created two versions of the same clip  bang.wav (bang1.wav and bang2.wav) and loaded them in clipBang1 and clipBang2 via two different lines

2) Every time a bullet is fired, I stop() the last played clip, set its frame position to 0 and start() the other clip.

Max
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline z.e.r.o

Junior Duke




Java games rock!


« Reply #3 - Posted 2004-05-01 06:09:25 »

Well, if you're using Clip you're already using different lines for every Clip (and it's a very bad implementation for sounds in a game).

A better method is to cache sounds in a byte array and use it to play them, instead of using streaming directly from disk.

Precaching sound is better becaure the other way you will always have lag, since your HD will have to fetch the file and play it. Usually sound FX (even if WAV) are really small (a bunch of KB), so you can have even hundreds of them in memory without reaching even a MB of RAM spent...

Matteo Anelli
.brain - http://www.dot-brain.com
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #4 - Posted 2004-05-01 06:24:26 »

Well, there are two Clips. The usual one and the crappy ones from Applet. The usual ones are ok and play instantly (they are stored in ram as pcm), but you can get a slight delay at the first time you play one of them. As far as I can tell, it's because there isn't a mixer around and java needs to create a default mixer first.

弾幕 ☆ @mahonnaiseblog
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.

theagentd (19 views)
2014-10-25 15:46:29

Longarmx (52 views)
2014-10-17 03:59:02

Norakomi (45 views)
2014-10-16 15:22:06

Norakomi (34 views)
2014-10-16 15:20:20

lcass (39 views)
2014-10-15 16:18:58

TehJavaDev (68 views)
2014-10-14 00:39:48

TehJavaDev (68 views)
2014-10-14 00:35:47

TehJavaDev (60 views)
2014-10-14 00:32:37

BurntPizza (74 views)
2014-10-11 23:24:42

BurntPizza (45 views)
2014-10-11 23:10:45
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
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!