Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Question about sun.audio.AudioPlayer

60 views
Skip to first unread message

Jeff Davey

unread,
May 7, 2001, 9:23:30 PM5/7/01
to
I have a question about the sun.audio classes.

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


Kevin Riff

unread,
May 8, 2001, 12:10:50 AM5/8/01
to
Classes in packages that start with "sun." are not officially part of the JDK.
There is no documentation for them except what you can learn from decompiling
the classes. Since they aren't supposed to be public knowledge, Sun can modify
them however they need. They have no obligation to tell you since you're not
supposed to know in the first place.

Michel

unread,
May 8, 2001, 4:32:33 PM5/8/01
to
Kevin Riff wrote :

>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

Kevin Riff

unread,
May 9, 2001, 12:08:42 AM5/9/01
to
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.

Michel

unread,
May 9, 2001, 2:41:12 AM5/9/01
to
Kevin Riff wrote :

>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

Tim Tyler

unread,
May 17, 2001, 7:50:52 AM5/17/01
to
Michel <c...@skynet.be> wrote:

: 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/

Chris Smith

unread,
May 17, 2001, 10:07:53 AM5/17/01
to
"Tim Tyler" <t...@iname.com> wrote ...

> : 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.

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


Kristjan Varnik

unread,
May 17, 2001, 3:38:00 PM5/17/01
to
Tim Tyler <t...@iname.com> wrote:
: 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.

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 }

0 new messages