Better heuristics for guessing the primary type of an input or output
authorJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>
Thu, 7 Jul 2016 17:17:16 +0000 (19:17 +0200)
committerJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>
Sat, 9 Jul 2016 19:08:16 +0000 (21:08 +0200)
commit9389ee1e964cc8c7b01cea02a6f9621b680eb447
treecb9cb2e1d752fc43d15367ef6d7f0042cd847ed4
parent35b4cb91d21f8e45e49d2e629f6df818cb9742c6
Better heuristics for guessing the primary type of an input or output

In order to choose which port name to display (if any) in the button,
MixerStrip::update_io_button() first chose a primary type for the input
or output. It was AUDIO in all cases, except if the route was a
MidiTrack where the primary type was MIDI.

In the latter case, it enabled the following code of update_io_button()
to show the MIDI sources feeding the MidiTrack rather than showing an
unhelpful dash.

But this simple heuristic has several shortcommings:
 - Going further, tracks and busses will probably loose strong types so
   the approach is not future-proof;
 - It doesn't take midi busses into account, yet there is no reason for
   them to be handled differently than midi tracks;
 - It falls short when the midi track contains a synthesiser and is
   meant to output audio.

Improve the heuristics by choosing the data type as follows:
 A) If there are connected audio ports, consider audio as primary type.
 B) Else, if there are connected midi ports, consider midi as primary type.
 C) If there are audio ports, consider audio as primary type.
 D) Else, if there are midi ports, consider midi as primary type.

These new heuristics give the same results for audio tracks and busses
(whose audio inputs have not been removed), and the same result for the
input of midi tracks (again, provided the inputs have not been tampered
with). It improves the situation for inputs of midi busses, and output
of midi tracks and busses, especially when synthesisers are in use.
gtk2_ardour/mixer_strip.cc