Absolutely no reason, I checked my most recent version of this method and turns out I had already changed it:
public void load(File file, String name) {
if (getClips().get(name) != null) {
return;
}
try {
AudioInputStream decodedInputStream = SoundUtilities.decodeInputStream(AudioSystem.getAudioInputStream(file));
Clip clip = AudioSystem.getClip();
clip.open(decodedInputStream);
getClips().put(name, clip);
}
catch(Exception e) {
e.printStackTrace();
}
}
The decodeInputStream method:
public static AudioInputStream decodeInputStream(AudioInputStream input) {
AudioFormat rawFormat = input.getFormat();
AudioFormat decoderFormat = new AudioFormat(
AudioFormat.Encoding.PCM_SIGNED,
rawFormat.getSampleRate(),
16,
rawFormat.getChannels(),
rawFormat.getChannels() * 2,
rawFormat.getSampleRate(),
false);
return AudioSystem.getAudioInputStream(decoderFormat, input);
}
//TODO stop() -> pause()
//TODO proper stop() method
Thanks!
//TODO loop() -> loopClip()
Thanks!
I'm afraid I don't understand the whole reasoning behind it either (looking into it though!) but I'm pretty sure it's a DataLine/IO Buffering thing.
I like enums! Anywhere you would use them in here?
Welcome to OSB
And thanks for the tips, I love getting constructive feedback like this.