Jump to content
  • Advertisement
Sign in to follow this  
brainlesspinkey

[java] sound api lag in linux but not windows

This topic is 5080 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, i am having another problem with lagging in linux Before, it was animation lagging because the toolkit's sync wasn't called. Now, its sound lagging because something isn't called. Any ideas what that something is? Heres the outline: Event happens. (insert lag here) Sound plays. but in windows, there is no lag. I think i need to flush a buffer somehow. any help is appreciated. -pink PS: I am using the clip class

Share this post


Link to post
Share on other sites
Advertisement
Are you using Java 1.4? Some claim that JavaSound is broke, and
"late" sound on Linux is a known issue. Some say it has been
resolved in 1.5, some disagree. I can't really give an answer,
since I haven't meddled too much with it myself.

You are using Clip... Does the sound lag at once, or does it stutter
momentarily after stopping and/or restarting? Clips that are stopped and/or restarted actually cause blocks, which naturally give off bad results,
(especially in a game).

There are several other solutions for using sounds out there (most of it native though). If you need to ust javasound, you can always check out this link:

http://www.jsresources.org

It has some decent info on using java sound.

Share this post


Link to post
Share on other sites
Quote:
Original post by Addictman
Are you using Java 1.4? Some claim that JavaSound is broke, and
"late" sound on Linux is a known issue. Some say it has been
resolved in 1.5, some disagree. I can't really give an answer,
since I haven't meddled too much with it myself.

You are using Clip... Does the sound lag at once, or does it stutter
momentarily after stopping and/or restarting? Clips that are stopped and/or restarted actually cause blocks, which naturally give off bad results,
(especially in a game).

There are several other solutions for using sounds out there (most of it native though). If you need to ust javasound, you can always check out this link:

http://www.jsresources.org

It has some decent info on using java sound.

actually, I've found it the other way around, going from 1.4 to 1.5 made my sound laggy and weird.

Share this post


Link to post
Share on other sites
Ok, heres what i have found out so far:
I upgraded to jdk1.5 and the lag went away, but then the clips only would play once.
So, I added, before all the play statements, a clip.setPosition(0); statement, but then there was a highpitched click at the end of each clip.
So, I added a clip.flush(); before the setPosition, and it works flawlessly.
Hopefully I won't run into any more problems.

-pink

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!