Chapter 23. Compiling Scores

Until now, the score support has permitted you to write score files and play them directly from the IDE—the score is interpreted on the fly and fed directly to the JavaSound sound driver. However, there is an obvious drawback to this for people looking to use their scores outside the IDE: there must be an “export format” for the music. A simple solution is to let the user create audio files in a standard audio format from the score. Such audio files can be played with standard player tools, added to web pages, and so on.

To support this from the NetBeans module, we could just make a special action, Save as Audio. But in general the user may be doing a number of such transformations as part of her project, and it would be cumbersome for them all to have separate actions with no integrated UI. So NetBeans supports an abstract notion of compilation. In the simplest cases, this could mean compiling Java sources to bytecode. But it can also apply to any situation where one set of files is generated mechanically from some source files, under the control of the IDE. The standard UI provides the Compile action that invokes the proper type of compilation on the selected object.

Compile All compiles a whole folder or folders of objects at once. Build (and Build All) forces rebuilds, and Clean (and Clean All) removes generated compilation products. So using the standard API not only simplifies the UI but permits these recursive actions to work with audio file generation, ...

Get NetBeans: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.