Some of these are bug-fixes, including fixes for third-party software. Some of these are diagnostics or tests. Some of these are just little snippets of useful code from larger packages. Some of these are platform-specific, and may not apply to you.
- SoundMonitor: JavaSound Input Levels
SoundMonitor is a simple Swing application that measures the amplitude of every available JavaSound input line (TargetDataLine), and displays the level on sliding graphical meters. It discovers things for itself, and configures itself based on what it finds.Hover the mouse cursor over a slider to see the Mixer.Info description.
This application demonstrates that Mac OS X's JavaSound support for more than a single TargetDataLine is hopelessly broken. When there are multiple audio-input lines available, either built-in or add-on, the levels should change independently, but they don't. Also, the other input signals should be measured, but they aren't: only a built-in channel's signal is used. The degree to which the TargetDataLines are broken may depend on which Mac model you use. I get identical misbehavior on my Core Duo Mac Mini and my dual G4, but your mileage may vary.
Freely released into the public domain. PROVIDED ENTIRELY AS-IS. NO WARRANTIES EXPRESSED OR IMPLIED.
Includes Java source code. Requires JDK 1.4 or higher, but is otherwise platform-neutral.
- AboutSound: Describing JavaSound
The JavaSound API is a dynamic adaptable environment. It discovers things for itself, and configures itself and its mixers, devices, etc. based on what it finds. Configurations and capabilities of devices can vary wildly across platforms, or just by plugging and unplugging different audio devices on your computer. The situation is even more dynamic with hot-plugging of USB audio devices.The AboutSound program is a diagnostic command-line utility that enumerates every JavaSound conversion, mixer, device, format, etc. supported by the sampled-sound AudioSystem, and describes them in plain English text. (Well, as "plain English" as one can be when describing computer audio devices.) It does this using only the standard JavaSound API classes and methods, so it also serves as an example of how to get and use this information in your own apps.
Freely released into the public domain. PROVIDED ENTIRELY AS-IS. NO WARRANTIES EXPRESSED OR IMPLIED.
Includes Java source code. Requires JDK 1.2 or higher, but is otherwise platform-neutral. What it tells you about a machine's audio devices, however, is definitely NOT platform-neutral.
- Imager Trials: When there's nothing better to do
This is a simple flexible framework for running speed trials of various Graphics or Graphics2D operations on various BufferedImage types. It's designed to be customized to investigate the things that specifically interest you.I wrote this so developers can more easily discover details of imaging performance on platforms they are interested in. Please don't send me any results. I already know there's a huge variation among platforms and configurations, so sending me your specific results is almost meaningless.
Freely released into the public domain. Use or abuse as you choose.
Includes full Java source code. Requires JDK 1.3 or higher.
- Miasma
You can download Miasma source, class, and description and perform thrilling, informative benchmarks to give you valuable insights into complete Java performance profiles before spending thousands of dollars.Or maybe not.
- Fix for PICTWriter in JIMI
Sun's Java Image Management (JIMI) library has a couple of fatal bugs writing PICT files. Easily remedied, I'm providing Wyatt Tellis's fix for PICTWriter.Full platform-neutral source is provided.
- Extended80
A Java class I wrote that decodes the extended80 type into a double. The extended80 type is an IEEE 80-bit floating-point value, and is typically encountered in the sample-rate of an AIFF or AIFC file.Full platform-neutral source is provided.
- Appender and Text.split()
I wrote this mainly as a text-splitter that treats adjacent delimiters as representing an empty field. This differs from StringTokenizer, which is a royal pain to get working for something as simple as splitting lines of tab-separated text.Also includes an Appender class that's very useful when building arbitrary variable-length arrays. Commonly you'd use a Vector to do this, but Vector is both overpowered and underpowered. Overpowered because it's thread-safe, ultra-flexible, and can handle random insertion and deletion. Underpowered because it doesn't do any type-checking. Appender is simpler than Vector, faster in most cases, and will do type-checking on elements as they are added. Best of all, it provides a method that returns an array of exactly the right size and type after you're done appending items.
Full platform-neutral source is provided.
- Anti Time Bandit
In older versions of MRJ running on PowerBooks, the millisecond timer will sometimes jump backwards. This happens because a drift-correction is being applied in a most indelicate manner. Unfortunately, you can get really wacko results if you are assuming that System.currentTimeMillis() will always be monotonically increasing (a faulty assumption even on Unix boxes: think of time-syncing to an NTP server).One of the more amusing cases of wacko results is when you're computing elapsed times.
The solution on Mac OS is to use the Mac's built-in microsecond timer for computing elapsed times. You not only get accurate elapsed times, you get 1000 times better resolution than using a millisecond timer. Code is provided that hooks into the microsecond timer on classic Mac OS using MRJ's JDirect-2 capability. Should be usable on Mac OS X, too, once you convert it to use JDirect-3, which is left as an exercise for the interested reader.
Full source for Mac OS is provided.
- JBindery Resource Formats
Describes the JBindery resource formats, and provides a set of Rez templates (.r files) for creating them. These are useful when you want to build a JBindery-type application using a shell program like MPW.
To Greg's Home Page