Application infrastructure

When implementing a new application, the developer has two options in order to design the architecture. First, the different examples included in the CLAM repository must be visited, it is very probable that one of the included examples is closely related or can be used as a base for developing the new application at hand. But if a fast development of a completely new application is sought, the framework also includes some application skeletons that can be particularized to the new application.

CLAM includes several Application classes that provide a basic framework for typical application situations, such as audio, or audio + graphical user interface. When necessary, threads or setup, and several virtual functions are provided, which can be implemented by deriving from the relevant application subclass (AudioApplication or GUIAudioApplication).

The BaseAudioApplication class is the base class of all AudioApplication classes. It sets up a high priority audio thread, and specifies several virtual functions: an AudioMain() that will be executed inside the audio thread, this is where the derived classes implement the actual audio processing; a UserMain() that will be executed by the main thread, this is where the derived classes implement the actual (graphical) user interface; an AppCleanup() that will be executed when the applications ends, this is where the derived classes implement any extra resource cleanup; and a bool Canceled() that can be used in the AudioMain to check if the audio thread has been canceled.

This class should never be used directly. AudioApplication should be used instead when looking for a simple non-graphical application.

The GUIAudioApplication class is derived from BaseAudioApplication, and additionally provides a standard user-interface, with start/stop functionality. This user interface must use the FLTK library. The virtual function UserMain() by default just calls the execution of the FLTK library, but a derived class could add a more complex user interface,. The operation Run(int argc,char** argv) has to be called to execute the application.