[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-2d-dev
Subject:    RE: the easiest ways to play an audio clip are the discouraged ones
From:       <mark.yagnatinsky () barclays ! com>
Date:       2023-12-31 19:43:09
Message-ID: MN2PR12MB36168351D36CF6AE14916061F963A () MN2PR12MB3616 ! namprd12 ! prod ! outlook ! com
[Download RAW message or body]

[Attachment #2 (text/plain)]

Resending; last one got blocked due to message size so trimming previous conversation

From: Yagnatinsky, Mark : Markets Pre Trade
Sent: Tuesday, December 26, 2023 12:18 AM
To: 'SWinxy' <swinxythecat@gmail.com>
Cc: client-libs-dev@openjdk.org
Subject: RE: the easiest ways to play an audio clip are the discouraged ones

Thanks for responding.  And thanks for the history page!!
The sad thing is that the issue is not just a documentation issue.
It really does takes around five dozen of lines of code to do accomplish the \
following task: "play a sound file on my disk without leaking any resources"
(Or at least, I haven't found a way to do it in much less than five dozen lines.)

AudioAction is also "intern-ish": it seems designed to be called from look & feel \
code.

As for the tutorials: I realize they are barely maintained and I wish they still \
were. But I see they still get occasional updates.  Maybe this one could be improved.
I suspect the sound tutorial has had no big updates since 1998, though the history \
page you linked claims 2006 for Java 6… (but where's getClip() then?)

But lack of good docs is merely the second-biggest problem.
The biggest is that the API provides no easy way to accomplish what should be a \
trivial task. Ideally the following lines of code should Just Work:
javax.sound.Player.playAsync(url); // fire and forget; leaks nothing
javax.sound.Player.playAndWait(url); // returns once playback is done, leaks nothing.
I shouldn't have to know about ULAW vs ALAW vs PCM.
I shouldn't even have to know about sampled vs midi.
(For nontrivial things, obviously those are very different; but not for something \
this simple.) I shouldn't have to implement line listeners and create a countdown \
latch. It really shouldn't be this hard!
The current difficulty level is high enough that people will ask themselves:
"do I really need add sound support?  Maybe I can live without it?"
It should be easy enough that you can do it on a whim!

This message is for information purposes only. It is not a recommendation, advice, \
offer or solicitation to buy or sell a product or service, nor an official \
confirmation of any transaction. It is directed at persons who are professionals and \
is intended for the recipient(s) only. It is not directed at retail customers. This \
message is subject to the terms at: \
https://www.cib.barclays/disclosures/web-and-email-disclaimer.html. 

For important disclosures, please see: \
https://www.cib.barclays/disclosures/sales-and-trading-disclaimer.html regarding \
marketing commentary from Barclays Sales and/or Trading desks, who are active market \
participants; https://www.cib.barclays/disclosures/barclays-global-markets-disclosures.html \
regarding our standard terms for Barclays Corporate and Investment Bank where we \
trade with you in principal-to-principal wholesale markets transactions; and in \
respect to Barclays Research, including disclosures relating to specific issuers, \
see: http://publicresearch.barclays.com. \
__________________________________________________________________________________  \
If you are incorporated or operating in Australia, read these important disclosures: \
https://www.cib.barclays/disclosures/important-disclosures-asia-pacific.html. \
__________________________________________________________________________________ \
For more details about how we use personal information, see our privacy notice: \
https://www.cib.barclays/disclosures/personal-information-use.html.  \
__________________________________________________________________________________


[Attachment #3 (text/html)]

<html xmlns:v="urn:schemas-microsoft-com:vml" \
xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" \
xmlns="http://www.w3.org/TR/REC-html40"> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;}
span.EmailStyle21
	{mso-style-type:personal-reply;
	font-family:"Calibri",sans-serif;
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-size:10.0pt;}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Resending; last one got blocked due to message size so trimming \
previous conversation<o:p></o:p></p> <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Yagnatinsky, Mark : Markets Pre Trade <br>
<b>Sent:</b> Tuesday, December 26, 2023 12:18 AM<br>
<b>To:</b> 'SWinxy' &lt;swinxythecat@gmail.com&gt;<br>
<b>Cc:</b> client-libs-dev@openjdk.org<br>
<b>Subject:</b> RE: the easiest ways to play an audio clip are the discouraged \
ones<o:p></o:p></p> </div>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">Thanks for responding.&nbsp; And thanks for the history \
page!!<o:p></o:p></p> <p class="MsoNormal">The sad thing is that the issue is not \
just a documentation issue.<o:p></o:p></p> <p class="MsoNormal">It really does takes \
around five dozen of lines of code to do accomplish the following \
task:<o:p></o:p></p> <p class="MsoNormal">"play a sound file on my disk without \
leaking any resources"<o:p></o:p></p> <p class="MsoNormal">(Or at least, I haven't \
found a way to do it in much less than five dozen lines.)<o:p></o:p></p> <p \
class="MsoNormal"><o:p>&nbsp;</o:p></p> <p class="MsoNormal">AudioAction is also \
"intern-ish": it seems designed to be called from look &amp; feel \
code.<o:p></o:p></p> <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">As for the tutorials: I realize they are barely maintained and I \
wish they still were.<o:p></o:p></p> <p class="MsoNormal">But I see they still get \
occasional updates.&nbsp; Maybe this one could be improved.<o:p></o:p></p> <p \
class="MsoNormal">I suspect the sound tutorial has had no big updates since 1998, \
though the history page you linked claims 2006 for Java 6… (but where's getClip() \
then?)<o:p></o:p></p> <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">But lack of good docs is merely the second-biggest \
problem.<o:p></o:p></p> <p class="MsoNormal">The biggest is that the API provides no \
easy way to accomplish what should be a trivial task.<o:p></o:p></p> <p \
class="MsoNormal">Ideally the following lines of code should Just \
Work:<o:p></o:p></p> <p class="MsoNormal">javax.sound.Player.playAsync(url); // fire \
and forget; leaks nothing<o:p></o:p></p> <p \
class="MsoNormal">javax.sound.Player.playAndWait(url); // returns once playback is \
done, leaks nothing.<o:p></o:p></p> <p class="MsoNormal">I shouldn't have to know \
about ULAW vs ALAW vs PCM.<o:p></o:p></p> <p class="MsoNormal">I shouldn't even have \
to know about sampled vs midi.<o:p></o:p></p> <p class="MsoNormal">(For nontrivial \
things, obviously those are very different; but not for something this \
simple.)<o:p></o:p></p> <p class="MsoNormal">I shouldn't have to implement line \
listeners and create a countdown latch.<o:p></o:p></p> <p class="MsoNormal">It really \
shouldn't be this hard!<o:p></o:p></p> <p class="MsoNormal">The current difficulty \
level is high enough that people will ask themselves:<o:p></o:p></p> <p \
class="MsoNormal">"do I really need add sound support?&nbsp; Maybe I can live without \
it?"<o:p></o:p></p> <p class="MsoNormal">It should be easy enough that you can do it \
on a whim!<o:p></o:p></p> </div>

<P><SPAN lang=EN-US style="mso-ansi-language: EN-US">This message is for 
information purposes only. It is not a recommendation, advice, offer or 
solicitation to buy or sell a product or service, nor an official confirmation 
of any transaction. It is directed at persons who are professionals and is 
intended for the recipient(s) only. It is not directed at retail customers. This 
message is subject to the terms at: <A 
href="https://www.cib.barclays/disclosures/web-and-email-disclaimer.html">https://www.cib.barclays/disclosures/web-and-email-disclaimer.html</A>. \
 </SPAN></P>
<P><SPAN lang=EN-US style="mso-ansi-language: EN-US">For important disclosures, 
please see: <A 
href="https://www.cib.barclays/disclosures/sales-and-trading-disclaimer.html">https://www.cib.barclays/disclosures/sales-and-trading-disclaimer.html</A> \
 regarding marketing commentary from Barclays Sales and/or Trading desks, who are 
active market participants; <A 
href="https://www.cib.barclays/disclosures/barclays-global-markets-disclosures.html">https://www.cib.barclays/disclosures/barclays-global-markets-disclosures.html</A> \
 regarding our standard terms for Barclays Corporate and Investment Bank where we 
trade with you in principal-to-principal wholesale markets transactions; and in 
respect to Barclays Research, including disclosures relating to specific 
issuers, see: <A 
href="http://publicresearch.barclays.com">http://publicresearch.barclays.com</A>.<BR>_ \
_________________________________________________________________________________  \
                <BR>If you are incorporated or operating in Australia, read these \
                important 
disclosures: <A 
href="https://www.cib.barclays/disclosures/important-disclosures-asia-pacific.html">ht \
tps://www.cib.barclays/disclosures/important-disclosures-asia-pacific.html</A>.<BR>___ \
_______________________________________________________________________________<BR>For \
 more details about how we use personal information, see our privacy notice: <A 
href="https://www.cib.barclays/disclosures/personal-information-use.html">https://www.cib.barclays/disclosures/personal-information-use.html</A>. \
 <BR>__________________________________________________________________________________<BR></O:P></SPAN></P>
 </body>
</html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic