RFR: 8356049: Need a simple way to play back a sound clip [v6]

Sergey Bylokhov serb at openjdk.org
Wed May 14 04:42:52 UTC 2025


On Wed, 14 May 2025 04:35:22 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

>> 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.
>
> And still do we want to have all of them synchronized? so the app may affect these methods by synchronized(soundClip)?

>     * Each time this method is called, the clip is restarted from the beginning.
Note that calls within 30 ms are ignored: https://github.com/openjdk/jdk/blob/2c4e8d211a030c85488e656a9a851d10dd0f9c11/src/java.desktop/share/classes/com/sun/media/sound/JavaSoundAudioClip.java#L158

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/24991#discussion_r2088016451


More information about the client-libs-dev mailing list