RFR: 8356049: Need a simple way to play back a sound clip [v6]
Phil Race
prr at openjdk.org
Sun May 25 00:24:57 UTC 2025
On Sat, 24 May 2025 23:26:57 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:
> > that commit wasn't all of it - one more commit just pushed to restrict it to SoundClip
>
> How is the new implementation supposed to implement applications that will simply play audio, such as `./bin/play audio.mid`, looping at the end?
Do mean, "oh now it doesn't block exit, but what if I want it to?"
It already didn't block exit for many cases, maybe almost all typical cases,
so this last change just makes it consistent.
And that would be the typical case for Applet.AudioClip today.
I don't think I want to flip the other way and make all the cases non-daemon.
So the answer would have to be, you don't let main exit, and so perhaps the docs "advice"
would be partially the other way around, like
"Play back is managed in a background thread, which may be a daemon thread.
Applications therefore need to ensure at least one application thread (such as the "main" thread) remains alive to prevent the VM from exiting. Conversely calling stop() is recommended to ensure the play back thread is terminated."
That advice as written is true of Applet.AudioClip today and might be prudent for an application to follow but I do think it would be best if it is as consistent as possible - in the daemon mode.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/24991#issuecomment-2907521415
More information about the client-libs-dev
mailing list