External libraries

We have already mentioned that one of the software engineering maximas that CLAM observes is reuse. When developing a framework everything is designed with future reuse in mind. In a similar sense a framework must reuse all possible pre-existing solutions. In CLAM we always try not to fall onto the ``redesigning the wheel'' paradigm. Because of this a number of external libraries that provide specific functionality are used. In this section we will briefly describe their main features.

FFTW [Frigo and Johnson, 1998,www-FFTW, ] is a C subroutine library for computing the Discrete Fourier Transform (DFT) in one or more dimensions, of both real and complex data, and of arbitrary input size. We believe that FFTW, which is free software, should become the FFT library of choice for most applications. Our benchmarks, performed on on a variety of platforms, show that FFTW's performance is typically superior to that of other publicly available FFT software. Moreover, FFTW's performance is portable: the program will perform well on most architectures without modification. Another FFT library that has been integrated into CLAM is the new FFT-Ooura, which is almost as efficient as the FFTW but has a BSD-style kind of license.

Two different graphical user interface toolkits have been in some way integrated into the CLAM framework: FLTK and QT. The Fast and Light ToolKit (FLTK) [www-FLTK, ] (pronounced "fulltick") is a LGPL'd C++ graphical user interface toolkit for X (UNIX), MacOS, and Microsoft Windows, that offers lightweight solutions for building GUI's and supports 3D graphics with OpenGL. It is currently maintained by a small group of developers across the world with a central repository on SourceForge. Qt [Blanchette and Summerfield, 2004,www-QT, ] is a C++ framework for application development. It lets application developers target all major operating systems with a single application source code. Qt provides a platform-independent API to all central platform functionality: GUI, database access, networking, file handling, etc. The Qt library encapsulates the different APIs of different operating systems, providing the application programmer with a single, common API for all operating systems. The native C APIs are encapsulated in a set of well-designed, fully object-oriented C++ classes. It is clear that Qt offers superior features to those found in FLTK. But it has a downside: the license can only be considered Free for the GNU/Linux platform.

Currently most of CLAM's XML support is given through the use of Xerces-C++. Xerces-C++ [Xercesc, ] is a validating XML parser written in a portable subset of C++. Xerces-C++ makes it easy to give your application the ability to read and write XML data. A shared library is provided for parsing, generating, manipulating, and validating XML documents. Xerces-C++ is faithful to the XML 1.0 recommendation and associated standards ( DOM 1.0, DOM 2.0. SAX 1.0, SAX 2.0, Namespaces, and W3C's XML Schema recommendation version 1.0.) The parser provides high performance, modularity, and scalability. Source code, samples and API documentation are provided with the parser. For portability, care has been taken to make minimal use of templates, no RTTI, no C++ namespaces and minimal use of #ifdefs. It must be said though that some of those decisions have produced a code that is less efficient than desirable. For this reason other solutions for the CLAM XML support are already under study.

In order to offer transparent audio input/audio on any platform different solutions have been used in CLAM. As already explained in section 3.2.2 CLAM adds an abstraction layer on a number of libraries in order to make them homogeneously accessible. These libraries are PortAudio, RTAudio, Alsa, and DirectX Sound. The first two are indeed cross-platform audio libraries that in CLAM are used both for Microsoft Windows and Apple OSX while the other two are platform-specific.

Port Audio [Bencina and Burk, 2001,Bencina, 2003,www-PortAudio, ] is a Free cross-platform library for managing audio input and output on virtually any platform. It offers thorough support for all the platforms offering low latency and high efficiency. RtAudio[Scavone, 2002,www-RtAudio, ] is a similar library. Although it may not offer as many features as PortAudio, it is much easier to use and deploy as it is just made up of a single C++ class and it is more object-oriented. On GNU/Linux CLAM directly addresses the ALSA library interface in order to ensure low-latency and the highest efficiency. This can also be done (up to the operating system's particular limitations) on the Microsoft Windows platform using the DirectX Sound interface to CLAM.

In a similar way PortMIDI [www-PortMIDI, ] is used for MIDI input/output on the Microsoft Windows and Apple OSX operating systems while the ALSA interface is directly used on GNU/Linux.

Three libraries are used for sound file input/output: Libsndfile, LibMad and OggVorbis. Libsndfile is a GPL library that gives support to virtually any sound file format. In CLAM it is used especially for encoding/decoding PCM audio formats. Both LibMad and OggVorbis offer support for compressed formats not available in Libsndfile. OggVorbis supports the Free Ogg format while LibMad supports the MP3 format, which is subject to some patent issues but so extended that it seemed a good idea to integrate into CLAM.

Id3lib[www-id3lib, ] is a Free Software, cross-platform software development library for reading, writing, and manipulating ID3v1 and ID3v2 tags. ID3 is a standard specification to add metadata information (such as author or title) to any sound file.

Finally the Win Pthreads library is used to ensure the use of this standard in the Microsoft Windows operating system when handling multi-threading issues.

2004-10-18