WAV files in JAR and Applet.newAutdioClip method

D

dtsas

Hello,

I am trying to get wav files out of a JAR file and use them in my
application. I am using the applet method newAudioClip. Everything
seems to work fine, but when I play the audio clip, I don't get any
sound. All the loading seems to work fine since no exceptions are
thrown and the objects are not null. Has anyone experience with
putting WAV's into a JAR?

Here is the code.

URL clickSoundURL = new URL("jar:file://" + dir +
"/jarfilename.jar!/com/sounds/click.wav");
newSound = Applet.newAudioClip(clickSoundURL);
newSound.play();


Thanks,

Dean
 
A

Andrew Thompson

.....
| I am trying to get wav files out of a JAR file and use them in
my
| application. I am using the applet method newAudioClip.
Everything
| seems to work fine, but when I play the audio clip, I don't get
any
| sound.

I have not heard 'works fine' defined that
way before..

|...All the loading seems to work fine since no exceptions are
| thrown and the objects are not null.

How do you know that? Your code
snippet does not indicate it..

|..Has anyone experience with
| putting WAV's into a JAR?

Yep. Putting them in, and getting
them back out. Some wavs will not
play in java, have you heard these
wavs play _before_ you jar'd them?
Can you play them when they are _not_
in a jar?

| Here is the code.

No, that's technically known as a 'code snippet'.
http://www.physci.org/codes/sscce.jsp
 
D

dtsas

....
| I am trying to get wav files out of a JAR file and use them in
my
| application. I am using the applet method newAudioClip.
Everything
| seems to work fine, but when I play the audio clip, I don't get
any
| sound.

I have not heard 'works fine' defined that
way before..

|...All the loading seems to work fine since no exceptions are
| thrown and the objects are not null.

How do you know that? Your code
snippet does not indicate it..

No exceptions thrown. No null pointer exceptions when we call the
play method on the AudioClip. If it was null, I would get an
exception.
|..Has anyone experience with
| putting WAV's into a JAR?

Yep. Putting them in, and getting
them back out. Some wavs will not
play in java, have you heard these
wavs play _before_ you jar'd them?
Yup

Can you play them when they are _not_
in a jar?
Sound great.
| Here is the code.

No, that's technically known as a 'code snippet'.

From my code snippet, do you see anything that seems out of place?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top