This chapter does not appear in the book.
The aim of this chapter is to create a visualizer that can turn any executing Java program into a pleasing animated kaleidoscope. The approach I've chosen is summarized by the diagram at the top right.
The application being visualized is monitored by a tracer implemented using the Java Platform Debugger Architecture (JPDA), specifically its Java Debug Interface (JDI) API. The JDI can be configured to watch for execution events such as the loading/unloading of classes, object state changes, method entry/exit, code execution, and JVM state changes. The details of such a tracer were explained in the last chapter.
This chapter describes a tracer called WhorldTracer, which watches for method entries and returns, and converts the details into MIDI messages sent to the Whorld visualizer.
MIDI (Musical Instrument Digital Interface) is a protocol that enables electronic musical instruments (e.g. synthesizers, sound cards, drum machines) to communicate and synchronize.
Whorld converts MIDI messages into animation parameters, which generate a myriad of swirling 'psychedelic' patterns. The pictures on the right, taken from the Whorld website, show some of the many possibilities.
The diagram below on the right is a Whorld animation generated by my WhorldTrace application. Each method call in the traced application is converted into a Whorld 'ring', which gradually grows, multiplies, and spreads out from the center of the screen until it disappears off the edges of the visualization window.
I'll start by explaining Whorld's capabilities, then how WhorldTrace is connected to Whorld using the LoopBe1 internal MIDI driver.
MIDI is only used as a message passing mechanism, and Whorld immediately maps the messages into animation parameters. As a consequence, we only need to employ (and understand) a tiny part of the extensive MIDI features offered by the Java Sound API.