mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
remove unnecesary conversion
This commit is contained in:
@@ -182,14 +182,8 @@ public class AudioClip implements IAudioClip {
|
|||||||
if (!fSound.exists()) {
|
if (!fSound.exists()) {
|
||||||
throw new IllegalArgumentException("Sound file " + fSound.toString() + " does not exist, cannot make a clip of it");
|
throw new IllegalArgumentException("Sound file " + fSound.toString() + " does not exist, cannot make a clip of it");
|
||||||
}
|
}
|
||||||
InputStream inputStream = null;
|
|
||||||
try {
|
try {
|
||||||
inputStream = Files.asByteSource(fSound).openStream();
|
ByteArrayInputStream bis = new ByteArrayInputStream(Converter.convertFrom(Files.asByteSource(fSound).openStream()).toByteArray());
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
ByteArrayInputStream bis = new ByteArrayInputStream(Converter.convertFrom(inputStream).toByteArray());
|
|
||||||
AudioInputStream stream = AudioSystem.getAudioInputStream(bis);
|
AudioInputStream stream = AudioSystem.getAudioInputStream(bis);
|
||||||
AudioFormat format = stream.getFormat();
|
AudioFormat format = stream.getFormat();
|
||||||
DataLine.Info info = new DataLine.Info(Clip.class, stream.getFormat(), ((int) stream.getFrameLength() * format.getFrameSize()));
|
DataLine.Info info = new DataLine.Info(Clip.class, stream.getFormat(), ((int) stream.getFrameLength() * format.getFrameSize()));
|
||||||
|
|||||||
Reference in New Issue
Block a user