File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Game Development and the fly likes Sound Issues with Different Platforms Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Game Development
Reply Bookmark "Sound Issues with Different Platforms" Watch "Sound Issues with Different Platforms" New topic
Author

Sound Issues with Different Platforms

Olivier Legat
Ranch Hand

Joined: Nov 17, 2007
Posts: 166

Hello everyone.

I'm developing a game and want to add some nice little music to it. I'm using the javax.sound.sampled package to do this. I have simple WAV player class like so:

Which I can use in a simple thread such as this one:


When using the MenuSong class on a Windows platform it works fine, run() starts the music and cancel() stops it. However, on Unix platforms such as CentOS or Mac OS the program "blocks" on s.stop(); - by "block" I mean the execution of the code seems paused at that point and everything there after simply isn't executed.

The API for the method stop() mentions that:
This doesn't guarantee that there will never be discontinuities beyond the current buffer, of course; if the stopped condition continues for too long, input or output samples might be dropped

But I don't understand what that means.

Help on this issue would be greatly appreciated as it appears that WavPlayer might totally have to be redesigned.

Thank-you.


Olly
 
 
subject: Sound Issues with Different Platforms
 
Threads others viewed
Quit audio before application exits.
Play a .wav file
JAR + Including Files
AudioInputStream contstructor problem
Progress Bar while using Streaming
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture