IO used to manually keep a list of user bundles it was connected to, but
it didn't work correctly: sometimes it didn't notice that a bundle
wasn't connected anymore, and the list wasn't correctly persisted across
save/reloads among other things.
Moreover, it wasn't needed at all, since the user bundles are correctly
listed by _session.bundles() and IO already notices they are connected !
Remove all occurrences of |_bundles_connected| and |check_bundles_connected|.
When |allow_partial| is true, only when the number of channels of a
given DataType is the same for both bundles are the corresponding
channels connected together.
When |allow_partial| is false (the default), the number of channels must
match for each DataType (the ChanCounts must be equal) for the
connection to be attempted.
This also fixes the logic in case two bundles have the same number of
channels, or even the same ChanCounts, but not with the DataTypes in the
same order (so connecting the ith channel of the bundle to the ith
channel of the other bundle makes no sense).
|Bundle::nchannels()| creates a ChanCount on demand, by iterating over
the |_channel| member variable. The sum of all |nchannels().n(t)| over
all non-NIL DataTypes |t| is thus equal to |_channel.size()|.
Consequently, calling |nchannels().n_total()| is a convoluted (and slow)
way of getting |_channel.size()|. Add a method |Bundle::n_total()| that
directly returns the latter.
Ensure the master bus is the first proposed bundle if it is present.
Also propose internal route inputs before physical outs or other
software via JACK.
Last, but not least, add to the menu not only exactly matching bundles,
but also bundles that have the same number of channels than the route
output when considering only the DataType we think the user wants to
use. This covers both the case of a MIDI+STEREO instrument track
connecting to master, and the case of a STEREO track connecting to a
MIDI+STEREO vocoder track.
Avoid proposing the monitor section in the list if the current route is
not the master bus. Also allow the caller to pass a DataType as argument
to allow partial bundle match on that datatype only.
The heuristic currently used to display port connections in a
compact user-friendly way only considers Audio and MIDI data types.
Replace it by a better heuristic that does essentially the same thing
with all DataTypes, assuming they are ordered by likeliness of usage.
Currently the result is the same since there are only two DataTypes.
When starting ardour using the jack backend, playback only devices
currently do not get displayed. Mixing and Mastering only workspaces
with e.g. a single USB Dac should be a common use case. Take this use
case into account by adding them to the device list. Tested on Linux
with jack-alsa.
Labeling it "Ok" would imply that by clicking it, descriptions would be saved
without further interaction. If we did so, we would also need to add a
cancel-button or handle simple closing of the dialog window appropriately.