Multichannel Editing

Problems

 * 1) Some parts of Audacity (namely - Track.cpp and friends) were written with mono in mind. As a result, they always assume that each track is a mono track and nothing else. Apparently, stereo support was added later, so now this code checks for a track being a part of stereo pair and handles the second track in addition to the first track. This code has to be replaced (rather than extended) to work with arbitrary number of tracks or channels (see below).
 * 2) Other parts of Audacity (namely - MixerBoard.cpp and all sound effects) were written with stereo in mind. They handle mono as a special case of stereo with one of the channels being NULL. This logic is even worse than the one mentioned above and also must be replaced.
 * 3) Audacity does not have channel mapping at all. In a stereo track the upper track is always the left channel, and the bottom track - the right channel. Panning works because of that assumption. For true multi-channel tracks a channel mapping matrix should be introduced. Rows of the matrix are the output channels, columns - the channels of the track, and floating point values at the intersections of rows and columns will define the amount of sound a particular track channel should contribute to a particular output channel. Simplest matrix will look as identity matrix. Mixing is somewhat more complex than that and includes phase and frequency modifications, but it will probably have to be hard-coded as an alternative to the mapping matrix. This is roughly what FFDShow audio filter does on Windows.
 * 4) A track is identified as a part of stereo pair by the return value of its GetLink method. If it is non-NULL, the track is a part of stereo pair. If track's GetLinked method returns true, the track is first in the pair, else it is second. Thus, multi-channel grouping at its present state has no part in the track hierarchy and it is not possible to refer to a group of tracks as a multi-channel track. There are two ways of resolving this issue:
 * 5) Add an addition hierarchy level - multichannel track group (with mono tracks as groups of 1 element) and rewrite the code mentioned above to work with these groups. The difficulty is that there may be operations on a track that must not be extended to all its channels, that will require careful handling. It might also interfere with existing track grouping (related to label tracks).
 * 6) Extend the 'link' concept to apply to multiple tracks, such as using an integer instead of a boolean (probably even two integers). The change is somewhat easier to integrate with some parts of Audacity (it will still work on a per-track basis and will still check for a track being part of a multi-channel group, but the method of checking and the handling of multi-channel groups will be different than the ones used for stereo tracks), but it retains all the awkwardness of current linking concept (including the possibility of the link being inconsistent and the need to carefully maintain that consistency).