RFR: 8356049: Need a simple way to play back a sound clip [v5]
Sergey Bylokhov
serb at openjdk.org
Tue May 13 19:49:52 UTC 2025
On Tue, 13 May 2025 19:09:21 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:
>> Phil Race has updated the pull request incrementally with one additional commit since the last revision:
>>
>> 8356049
>
> 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;
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24991#discussion_r2087508034
More information about the client-libs-dev
mailing list