Ok, I think I got everything figured out. I am having a problem with this one method used to play my audio files:
public void loadAu(String filepath)
{
try
{
InputStream in = getClass().getResourceAsStream(filepath);
AudioInputStream stream = AudioSystem.getAudioInputStream(in);
AudioFormat format = stream.getFormat();
if (format.getEncoding() != AudioFormat.Encoding.PCM_SIGNED)
{
format = new AudioFormat(
AudioFormat.Encoding.PCM_SIGNED,
format.getSampleRate(),
format.getSampleSizeInBits()*2,
format.getChannels(),
format.getFrameSize()*2,
format.getFrameRate(),
true);
stream = AudioSystem.getAudioInputStream(format, stream);
}
DataLine.Info info = new DataLine.Info(
Clip.class, stream.getFormat(), ((int)stream.getFrameLength()*format.getFrameSize()));
clip = (Clip) AudioSystem.getLine(info);
clip.open(stream);
clip.addLineListener(this);
stream.close();
}
catch (MalformedURLException e){e.printStackTrace();}
catch (IOException e){e.printStackTrace();}
catch (LineUnavailableException e){e.printStackTrace();}
catch (UnsupportedAudioFileException e){e.printStackTrace();}
}
It throws an IOException when It is in a jar and when I call it with the parameter “Audio/file.au” Audio being the subdirectory and Audio.au being the audio file. It works when I use it in Bluej or in Eclipse. This is the exact error:
java.io.IOException: mark/reset not supported
at java.util.zip.InflaterInputStream.reset(Unknown Source)
at java.io.FilterInputStream.reset(Unknown Source)
at java.io.FilterInputStream.reset(Unknown Source)
at com.sun.media.sound.WaveFileReader.getFMT(Unknown Source)
at com.sun.media.sound.WaveFileReader.getAudioInputStream(Unknown Source)
at javax.sound.sampled.AudioSystem.getAudioInputStream(Unknown Source)