I have an applet that uses sun.audio.AudioPlayer. It works fine on browsers
that do NOT use Java 2. I pulled the AudioPlayer classes out of rt.jar in my
jre folder and decompiled them. (for both JRE 1.2.2 & JRE 1.3.0) They are
very different from the files found in JDK1.1.x. If the sun.audio classes
are deprecated, why is Sun playing with them? These changes break all my
audio code.
Has anyone else had any problems with this code?
I wouldn't mind so much if I just knew WHY? I have been all over the Sun
site, through the JDK documentation, forums, newsgroups... Nothing. Why do
they make make changes like this and offer no explanation.
The following Applet works fine in IE or Netscape versions using JDK
versions previous to Java 2:
public class SampleCode
extends java.applet.Applet {
private sun.audio.AudioPlayer audioPlayer;
public void
init() {
setSize(320,240);
audioPlayer = sun.audio.AudioPlayer.player;
}
}
Netscape 6.0 using JDK 1.3.0 results in the following Exception:
java.security.AccessControlException: access denied
(java.lang.RuntimePermission accessClassInPackage.sun.audio)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPackageAccess(Unknown Source)
at sun.applet.AppletSecurity.checkPackageAccess(Unknown Source)
at java.lang.ClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.lang.ClassLoader.checkPackageAccess(Unknown Source)
at java.lang.Class.newInstance0(Native Method)
at java.lang.Class.newInstance(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Thanks in advence for any help,
~jeff
>Classes in packages that start with "sun." are not officially
>part of the JDK.
The problem is : until 1.1, there has been absolutely no way to
perform sound synthesis in java without using those "unofficial"
sun.audio classes.
So, the real question is : what code actually replaces the usual
calls to the sun.audio.* classes in order to perform sound
synthesis with the new java plugins ?
Michel
>There was a method added in JDK 1.2: Applet.newAudioClip(URL). Even
>though its in the Applet class, it's static so you don't need to have an
>applet to use it.
Sure, but this is clip reading, not sound synthesis (I mean constructing
waves from scratch and play them).
Michel
: The problem is : until 1.1, there has been absolutely no way to
: perform sound synthesis in java without using those "unofficial"
: sun.audio classes.
: So, the real question is : what code actually replaces the usual
: calls to the sun.audio.* classes in order to perform sound
: synthesis with the new java plugins ?
Presumably the new sun.audio.AudioPlayer does much the same job as
the old one - but with a different (and as yet undocumented?) API.
Maybe someone will create a wrapper class at some stage that
checks the VM version, and farms out the audio code appropriately.
--
__________
|im |yler t...@iname.com Home page: http://alife.co.uk/tim/
I haven't looked at javax.sound, but it's certainly worth checking if that
quasi-standard API does what you want, which would be far better than using
internal Sun classes.
Chris Smith
: Maybe someone will create a wrapper class at some stage that
: checks the VM version, and farms out the audio code appropriately.
Argh! Just when I thought I had learned my way around the sun.audio
package.
That shouldn't be too hard, and is definitely something I need to do soon.
If you are interested, let me know and I'll post something on the web, but
it should be simple enough to write your own.
I've been wanting to develop an API for sound synthesis that determines
whether the user has JSyn, java 2 or nothing and then loads the highest
quality audio package.
Also, why don't you decompile the new sun.audio package and see whats in
it. That was the only documentation I ever really had for the old one.
Kristjan
p.s.
{ If anybody has the need for a sun.audio programmer please let me know }