RFR: 8356049: Need a simple way to play back a sound clip [v6]
Sergey Bylokhov
serb at openjdk.org
Fri May 16 21:00:59 UTC 2025
On Fri, 16 May 2025 18:25:15 GMT, Phil Race <prr at openjdk.org> wrote:
>> 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.
>
> Perhaps but that's the behaviour today and I don't see the need to change it in order to provide a different API to reach here.
My point was not about adding a different API, but about changing this logic, which I believe no longer works well after the Gervill integration. For MIDI files, we should first attempt to play them as audio files(we do it now). But if no audio output devices are available then should fallback to this code path and use a MidiDevice directly.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24991#discussion_r2093670550
More information about the client-libs-dev
mailing list