FinalMix — Overview

The source code of FinalMix is divided into following source files:

Each of this file has its corresponding .h file with public declarations and implements a certain logical part of the software. This document is an overview about what is implemented where.


This file contains defines, declarations, classes and global functions used on many other places of the source code.

The first part contains defines like FM_NAME and FM_VERSION_STRING indicating the real name of the project. Other defines like FM_PROJECT_TAG and FM_PROJECT_EXT define the default tag (indentifing characters) of FinalMix project files and their default extensions.

Class Exception (with derivated classes such as ExceptionZero, ExceptionIO and others declared elsewhere) is the base class of the objects thrown during exceptions. This class carries a severity flag and possibly a textural description of the exception. Exceptions with severity EXC_WARN (warning) and EXC_RUNTIME (run-time error) are usualy treated as recoverable (they prevent the current operation to proceed, but allow eventually the operation to succeed later). Other exceptions are usually threated as fatal.

Global types definition contains especially those types, which have to have given bit length and encoding (signed, unsigned), or at least certain properties (as being the native integer type) on all platforms. Types such as sample_pcm16s_t, samples_t and bool_t are thus defined using wxWidget's types wxInt16, wxUint64 and wxUint8. Warning: The type system currently only supports little-endian platforms. Additional provisions are needed to let the code work correctly on big-endian CPUs.

Global functions are used to handle common tasks all over the project. There are following groups of functions:


The base application class Application declared in this source file (derived from wxApp) represent the current state of the software while running. It also handles initialization (on application run) and cleanup (on application exit), as well as the exception handling of all fatal exceptions.

There are following important members of Application class:

There is only one instance of the Application class while FinalMix is running at it is derefenced by the wxGetApp() global function.


The Project class contains all the information about current audio project the user is editing in FinalMix and several methods to manipulate with the project properties.

The basics of all audio projects are the wave (audio) tracks, each represented by a Loader object (which supplies the wave data), a Peak object (which supplies cached/faster access to the visual representation of the waveform), volume and mute properties (how loudly the track plays in various output channels) and mappings (mapping of physical sample positions in the underlying file to logical sample positions). Methods AddTrack(), RemoveTrack() are used to manipulate the list of tracks, methods such as SetVolumeTrack() and GetVolumeTrack() manipulate track properties. Methods New(), Store() and Load() manipulate the whole project (erasing, storing and restoring from a file).

TrackPeaks(), GetPeak(), ZoomIn() and ZoomOut() are used to draw the visual representation to the GUI, Play(), Pause() and Stop() control the playback.

There are also other functions which manipulate the list of supported loaders and audio devices.

The Project class does implement also all the logic of real-time audio processing and mixing. However the real computations are done by the functions from generic.cpp.


This source file contains merely static metods and constants for drawing various parts of the GUI (visual track representation, etc.).


The visual representation of the GUI components of the main application window. The main window itself is the Frame class and contains the main menu, status bar, toolbar and implements most of the event handlers.

The central area of the main window is divided into two sections: track control and track view. Track view (Area class) is an area with the visual representation of the tracks in the project.

Track control (TrackControl class) is a set of widgets which manipulate the various properties of the track (volume, mute).


The Peaks class is used as a cache for the visual representation of the waveform of a track. The visual representation consists of the maximal values of subblock of the wave data and the length of the subblock depends on the scale (zoom) ratio the user chooses.

When the visual representation of a track is drawn in Frame.cpp, the values of the peaks are either gathered from the cache or calculated in real-time from the wave file itself.


This file implements several commonly used dialog windows. These dialog windows are used to setup application-wide parameters, create output files with given features, etc.


Classes derived from the Loader class represent the logical abstraction of various input and output wave file formats. Each derived class implements methods to recognize a file format, create a new file with given format and parameters, read wave data from the file and store new data.


Classes derived from the Device class implement wave input and output, mostly using a sound card API. This is the only part of FinalMix, which is highly platform-specific. Thus each device uses not only platform-specific wave API, but also platform-specific threading, synchronization, etc.

Most of the devices are implemented as a two-thread producer-consumer task (while the original main application thread still remains for the GUI and user commands processing). The push thread fills a cyclic buffer with the mixed audio data while the play thread copies the data from the cyclic buffer to the audio device.