On 16-Aug-99 Niessen ing. E.P.M. wrote:
> I installed the latest jdk1.2v2 on a redhat 6 installation. With the
> class audioclip I try to play a wav file. But it only plays .au files.
> Is this not yet supported in this pre release?
It is, I play wav files correctly.
> Somebody an idea how to play wav files under java?
I might guess what's happened, because I had troubles at the beginning.
It seems that if I play a wav file and then paint some components in a window,
the sound playing is aborted. I don't know if this is a wanted feature (why,
then?), a bug in Java or a bug in the Linux version.
My workaround, which could not be very smart, is to make the application sleep
while the sound is playing.
Here is an example:
--- begin ---
try
{
Applet.newAudioClip(new URL("file:" +
System.getProperty("user.dir") +
"/avvio.wav")).play();
}
catch (MalformedURLException e)
{
System.err.println(e.getMessage());
}
try
{
java.lang.Thread.currentThread().sleep(10000);
}
catch (java.lang.InterruptedException e)
{
System.err.println(e.getMessage());
}
--- end ---
This could be unwise or even wrong, surely is not very elegant. If someone else
has a better idea, I'll take notice and change my code.
---
Andrea "Kontorotsui" Controzzi - MALE Student of Computer Science at
University of Pisa - Italy - E-mail: [EMAIL PROTECTED]
My home page: http://www.cli.di.unipi.it/~controzz/intro.html
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]