<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<br>
> AudioSynthesizer has a method open(line, config) which is the
only way <br>
> of configuring its parameters and thus it seems <br>
> (<a href="https://bugs.openjdk.org/browse/JDK-6941027" rel="noreferrer" target="_blank" class="moz-txt-link-freetext">https://bugs.openjdk.org/browse/JDK-6941027</a>)
that it was intended to <br>
> be made public. <br>
<br>
I can't spot what text in that bug is about this ....<br>
<br>
> It is not the case in JDK 21. There were other useful <br>
> classes, like FFT, that are also no longer accessible.<br>
<br>
"accessible" is not "public".<br>
Anyone who found a need for a public API in JDK 7, or 8 should have
submitted an RFE then,<br>
not hack around it and then wait until the module system made it
harder to hack around to ask for it.<br>
<br>
The thread that could not be located is this one
<a class="moz-txt-link-freetext" href="https://mail.openjdk.org/pipermail/sound-dev/2016-November/000493.html">https://mail.openjdk.org/pipermail/sound-dev/2016-November/000493.html</a><br>
<br>
The RFE that exists for this is
<a class="moz-txt-link-freetext" href="https://bugs.openjdk.org/browse/JDK-8170518">https://bugs.openjdk.org/browse/JDK-8170518</a><br>
<br>
If there is still REAL interest in this we can take another look but
it would be JDK 24 at this point.<br>
<br>
-phil.<br>
<br>
<br>
<div class="moz-cite-prefix">On 7/11/24 10:22 AM, SWinxy wrote:<br>
</div>
<blockquote type="cite" cite="mid:CAPRuVTV1OXG9O7UdNOGkdSHcc7RF_p0haRyj0WLNZBLOrv3Gew@mail.gmail.com">
<div dir="ltr">I tried to dig into the archives for the two rotted
links.
<div><br>
</div>
<div>The first is a link to <a href="https://mail.openjdk.org/pipermail/audio-engine-dev/2007-October/000024.html" target="_blank" moz-do-not-send="true">an email</a> from
Florian Bomers on Oct 12, 2007. He thought the class should be
public:</div>
<div><br>
</div>
<div>>> As a 1st step I suggest to create such interface
in com.sun.media.sound <br>
>> package, and them move it to javax.sound.midi.<br>
<br>
> I don't see an advantage for going in 2 steps, I'd prefer
to put<br>
> it in javax.sound.midi directly.<br>
</div>
<div><br>
</div>
<div>I couldn't find the second link, though. It gives no hint
as to where or when it was emailed. It's likely in a jdk9
mailing list, but those are extensive and the mail server
doesn't have a search function.</div>
<div><br>
</div>
<div>If you <i>really</i> need it, and you are okay with
hacking your way into places where you shouldn't be,
add --add-opens java.desktop/com.sun.media.sound=ALL-UNNAMED
as a VM argument. Then, the following forbidden knowledge may
work:</div>
<div><br>
</div>
<div>Class<?> synth =
Class.forName("com.sun.media.sound.AudioSynthesizer");<br>
Class<?> audio =
Class.forName("com.sun.media.sound.SoftSynthesizer");<br>
<br>
Method open = synth.getMethod("open", SourceDataLine.class,
Map.class);<br>
Constructor<?> declaredConstructor =
audio.getDeclaredConstructor();<br>
declaredConstructor.setAccessible(true);<br>
Object o = declaredConstructor.newInstance();<br>
<br>
open.setAccessible(true);<br>
open.invoke(o, null, null);<br>
</div>
<div><br>
</div>
<div>It's horrible but it seems to work in my tests. I wouldn't
advise this; reflection to access protected classes is a Bad
Idea.</div>
<div><br>
</div>
<div>SWinxy</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Fri, Jul 5, 2024 at 2:50 PM
Aleksei Ivanov <<a href="mailto:alexey.ivanov@oracle.com" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">alexey.ivanov@oracle.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi
Ithinu,<br>
<br>
This message belongs in client-libs-dev mailing list.<br>
<br>
I see Dalibor's message, “It didn't get done in time for JDK
9.” Yet the <br>
link in his message is broken now.<br>
<br>
Let's see if anyone has more details.<br>
<br>
On 2024-07-04 23:53, Ithinu wrote:<br>
> Hi,<br>
><br>
> AudioSynthesizer has a method open(line, config) which is
the only way <br>
> of configuring its parameters and thus it seems <br>
> (<a href="https://bugs.openjdk.org/browse/JDK-6941027" rel="noreferrer" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">https://bugs.openjdk.org/browse/JDK-6941027</a>)
that it was intended to <br>
> be made public. It is not the case in JDK 21. There were
other useful <br>
> classes, like FFT, that are also no longer accessible.<br>
><br>
> According to <br>
> <a href="https://forums.oracle.com/ords/apexds/post/com-sun-media-sound-in-java-9-0673" rel="noreferrer" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">https://forums.oracle.com/ords/apexds/post/com-sun-media-sound-in-java-9-0673</a>
<br>
> "it didn't get done in time for JDK 9".<br>
><br>
> Is it plausible that someone will eventually look into
that? Thanks.<br>
-- <br>
Regards,<br>
Alexey<br>
</blockquote>
</div>
</blockquote>
<br>
</body>
</html>