This is the README for
libmoss-2.1a.
The latest version of this README should be available at
http://www.alumni.caltech.edu/~dairiki/libmmoss/README.html.
As far as I can tell, the Linux version of Netscape Navigator/Communicator (the latest release as of this writing was Netscape Communicator 4.6) does not support the playing of sound by Java applets.
I have hacked up a replacement for Netscape's implementation of (the
Java class) sun.audio.AudioDevice (including some JRI native C
code) which enables the Netscape Java VM to play sound.
Here's a gzipped tar file with the source and binaries for my hacks:
To use these hacks you (most probably) need:
Precompiled binaries are included with this distribution, so no compilation should be necessary.
The kludge consists of three parts:
libmmoss.jar JAR file.
(Navigator 3.01 doesn't know about JAR files, if you are using
3.01, you will have to install the individual class files by hand.
See below.)
libmmoss.so.
If you're running Netscape Communicator 4.xx, the included
Makefile should be able to install the hacks for you.
(If it doesn't work, or if you'd like to install the hacks manually,
see the next section.
(If you are running Navigator 3.xx, see the old installation notes
below.)
Makefile. Pay particular
attention to the settings of MOZILLA_HOME which
specifies where you have installed Communicator. Also
check the settings of
pkgdir and bindir, which control
where the hacks will be installed.
netscape.sh.
netscape.sh. It may need
modification, particularly if you have other fancy plugins
(e.g. Acrobat Reader, RealAudio player, etc...) installed.
There are notes at the end of netscape.sh regarding
how I've dealt with these.
/usr/local/bin/netscape.
It will overwrite any wrapper script (or binary) you might
already have installed there so make sure this is okay!
PATH includes bindir,
the directory in which the wrapper was installed
(default: /usr/local/bin).
libmmoss.so and libmmoss.jar
need to be installed somewhere.
libmmoss.jar should be mentioned in CLASSPATH,
and libmmoss.so should be in a directory
which is mentioned by LD_LIBRARY_PATH.
libmmoss.jar is listed
in CLASSPATH before netscape's JAR's, in
particular java40.jar. This is because
libmmoss.jar contains classes which shadow the classes
in java40.jar.
netscape.sh.in.
(Or run `make', then look at netscape.sh.)
With Communicator 4.xx (and later), when my code loads, you will get a dialog box which requests permission to load a native library. You'll have to grant permission for the hacks to work. As of libmmoss version 2.0, you'll also be asked to grant permission to make network connections. You only really need to grant this if you want the EsounD support.
Since, I'm not about to pay money to obtain a certified signing
certificate, if you want to be able to verify the signature on
the libmmoss.jar file, you'll have to download (and trust)
this certificate.
You only need to do this if you want the ``Remember This Decision''
checkbox on the popup dialog to work.
(Note that my
old certificate and the
one before that even
have expired, so even if you've downloaded the certificate(s) for
previous versions of libmoss, you'll
still have to download the new one.)
(FWIW, the fingerprint of the certificate is
6D:7D:D6:AD:9C:E0:30:EE:CC:26:DD:24:AA:0A:9C:6A.)
Libmmoss can now output sound through esd, the
EsounD
sound daemon.
You do not need to do anything special to enable esd support,
libmmoss will, if possible, output to esd
and fall back to /dev/audio output, if not.
The ESPEAKER environment variable, if set, is used to find
the esd. Esd support can be disabled by setting
ESPEAKER to none.
Currently the esd support works okay but not great for me. Problems include:
I'd appreciate feedback on how well the esd support is working for you. Drop me a note with any comments or suggestions.
Javasoft has a dog-barking, train-whistling demo in their tutorial. (You have to find the applet, and then hit some buttons.)
They also have a more vocal demo here.
If you have trouble getting libmmoss to work, the first thing
you should do is take a look at Netscape's Java Console while
trying to play sounds. (In Communicator 4.x, you can get to the
Java Console via the menubar: select
Communicator->Tools->Java Console.)
The first time you try to play a sound, libmmoss will print an identifying message on the Java Console. If you do not see something like
Loading Libmmoss-2.0
Java sound for Linux Netscape
by G. T. Dairiki
(see http://www.alumni.caltech.edu/~dairiki/libmmoss/ )
then Netscape is not finding libmmoss.jar.
Check the setting of CLASSPATH in your netscape wrapper
script.
Once you get past the ``Loading Libmmoss'' message, libmmoss should spew various messages which may or may not help determine why you're not getting any sound.
If you get really stuck, feel free to e-mail me. If possible, include whatever Java Console output you get in your note.
Since Navigator does not know about JAR files, you must install the individual class files, of which there are now four:
The environment variables
LD_LIBRARY_PATH, and CLASSPATH
should probably be set something like:
export LD_LIBRARY_PATH=/usr/local/netscape/lib export CLASSPATH=/usr/local/netscape/java/classes
Note:If you want and/or need to include the Netscape class archive (e.g.
java_301) in your
For Navigator 3.01, you should not need to list the class archive in your CLASSPATH, as long as you have it installed in one of the ``standard places'': /usr/local/netscape/java/classes/java_301 |
Netscape Navigator 3.01 tends to crash frequently (particularly when using Java) unless one is using an older version of libc.so. Netscape apparently attempts to free() invalid memory pointers. (Either NULL pointers, or pointers to memory which has already been free()ed.) It seems the newer libc's are more intolerant of this behaviour.
These crashing problems seem to be fixed in Communicator 4.03. So this section does not apply if you are running Communicator.
I ran netscape on libc.so.5.0.9, and it seems to work pretty well. (I have it installed in /lib/old/libc.so.5.0.9, and made a symbolic link /usr/local/netscape/lib/libc.so.5 -> /lib/old/libc.so.5.0.9. Then I run netscape with LD_LIBRARY_PATH=/usr/local/netscape/lib.) The cleanest fix seems to be just to preloading an older, less finicky version or the malloc/free code. I have recently switched over to using this kludge - it seems to work too. More details on this scheme can be found here.
The gnumalloc.so I use can be found in gnumalloc.tar.gz. Which was apparently contributed by Doug Ridgeway. Thanks Doug!
Current version is libmmoss-2.1a.tar.gz
Changes from
libmmoss-2.1.tar.gz
Released 6 Jul, 1999.
Changes from
libmmoss-2.0.tar.gz
Released 14 Jun, 1999.
Changes from
libmmoss-1.4a.tar.gz
Released 8 Jun, 1999.
AudioDevice class, I took
the opportunity to do some pretty extensive restructuring/rewriting
of the code. It's highly likely that I've introduced some bugs which
didn't used to be there.
Let me know
when you find them.
Changes from
libmmoss-1.4.tar.gz
Released 25 May, 1999.
InputStream's from 400 bytes up to 512 bytes.
Sun's sun.audio.AudioDevice reads from it's
InputStream's in 400 byte blocks. Libmmoss reads
in 512 byte blocks. Some (broken) Java code does not like
producing audio in anything but 400 byte blocks
(here's
an example pointed out by Pete Wyckoff).
Changes from
libmmoss-1.3.tar.gz
Released 16 March, 1999.
Changes from
libmmoss-1.2.tar.gz
Released 6 October, 1998.
netscape.sh to ensure that LD_LIBRARY_PATH
and NPX_PLUGIN_PATH get exported.
Changes from
libmmoss-1.1.tar.gz
Released 14 October, 1997.
Changes from
libmmoss-0.4.tar.gz
Released 16 June, 1997.
Changes from
libmmoss-0.02.tar.gz
Released 28 May, 1997.
EBUSY and ENODEV
errors which occur while opening
/dev/audio do not permanently do us in. This should
alleviate the 'no audio dev' problem that I and others have been
experiencing. (It may not fix the problem completely, but at least
you shouldn't have to restart Netscape to recover from it anymore.)
If you have comments or suggestions, email me at dairiki@alumni.caltech.edu