yaxu/Dirt — pull request #14 by munshkr (2014-07-09 03:00:22+00:00)
Title: Add -c/--channels option to enable multichannel mode

Hallo,
I added an additional command-line option to define the number of output channels. So the `CHANNELS` macro was removed, as this option replaces it.

Some statically defined arrays and structures are now defined dynamically, based on the number of channels specified, for example:

* `output_ports`: Initialized by `jack_init()`, freed by `jack_shutdown()`.
* `delays`: Initialied by `audio_init()`, freed by `audio_close()`, which is called by `atexit()` on program exit.
* `sound.vcf`, `sound.formant_history`: Initialized by `new_sound()`, freed also by `new_sound()` just before replacing old sound in `sounds` array, and by `audio_close()`.

I checked with Valgrind for memory leaks or invalid reads. Also fixed an old leak related to sndfile and sample data allocation (there was an old TODO comment :)