RFR: 8356049: Need a simple way to play back a sound clip [v6]
    Sergey Bylokhov 
    serb at openjdk.org
       
    Wed May 14 04:14:54 UTC 2025
    
    
  
On Tue, 13 May 2025 21:28:24 GMT, Phil Race <prr at openjdk.org> wrote:
>> A simple API to replace java.applet.AudioClip
>> 
>> CSR is now created : https://bugs.openjdk.org/browse/JDK-8356200
>
> Phil Race has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8356049
src/java.desktop/share/classes/com/sun/media/sound/JavaSoundAudioClip.java line 131:
> 129:             }
> 130:         } catch (UnsupportedAudioFileException e) {
> 131:             // not an audio file
This code path seems will not be (rarely) executed?
The midi file will be handled above by the AudioSystem.getAudioInputStream() via SoftMidiAudioFileReader provider? But if converted midi->sampled data cannot be played via audio device then it might be useful to try MidiDevice, but I do not think it can be done by catching UnsupportedAudioFileException.
src/java.desktop/share/classes/javax/sound/SoundClip.java line 93:
> 91:      * Each time this method is called, the clip is restarted from the beginning.
> 92:      */
> 93:     public synchronized void play() {
We might want to clarify that play() and loop() are non-blocking in terms of execution but may keep the application alive if audio threads are still running.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24991#discussion_r2087964236
PR Review Comment: https://git.openjdk.org/jdk/pull/24991#discussion_r2087992995
    
    
More information about the client-libs-dev
mailing list