On Tue, 13 May 2025 19:40:09 GMT, Sergey Bylokhov <s...@openjdk.org> wrote:
>> src/java.desktop/share/classes/javax/sound/SoundClip.java line 61: >> >>> 59: * @throws IOException if there is an error reading from {@code >>> file} >>> 60: */ >>> 61: public static SoundClip createSoundClip(File file) throws >>> IOException { >> >> Can we gain any benefits by using Path instead? > > Or maybe we can add this API to AudioSystem/clip? > Old code > > File file = new File(file); > AudioInputStream audioIn = AudioSystem.getAudioInputStream(...file...); > Clip clip = AudioSystem.getClip(); > clip.open(audioIn); > clip.start(); > > new code: > > File file = new File(file); > AudioClip clip = AudioSystem.getAudioClip(...file...); > clip.play()/canPlay/loop/stop; or maybe inject all these simple methods into `javax.sound.sampled.Clip` or its subclass/superclass. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/24991#discussion_r2087516819