The old code assumed that the thread that created a request buffer for a given
signal-emitting thread would be the latter thread, and thus a thread-local
pointer to the request buffer could be used. This turns out not to be true: the
GUI thread tends to be responsible for constructing the request buffers for
pre-registered threads.
That mechanism has been replaced by using a RWLock protected map using
pthread_t as the key and the request buffer as the value. This allows any
thread to create and register the request buffers used between any other pair
of threads (because the lookup always uses a pthread_t).
The symptoms of this problem were a signal emitted in an audioengine thread
that was propagated to the target thread, but when the target thread scans its
request buffers for requests, it finds nothing (because it didn't know about
the request buffer). In a sense, the signal was successfully delivered to the
target thread, but no meaningful work (i.e the signal handler) is performed.
Because we use the non-callback API, we can call our thread init callback
ourselves from ::process_thread(). In addition, the init_callback in JACK is
used by every thread JACK creates, including the messagebuffer thread, and this
confuses things from an Ardour POV where the callback was intended just for
realtime threads.
This also fixes the channel-count use by the bus,
depending on the type (aux or direct out).
Mixbus detection is also moved from the GUI to the
backend.
This also limits the number of subgroup busses to one,
so that "Remove subgroup bus" works properly.
Eventually we should allow multiple subgroup busses
for aux-sends.
Previously, the PT import would place regions on tracks
numbered from 0, therefore landing on unrelated tracks
when pre-existing tracks were present in the session.
This change skips all existing ardour tracks and imports
the PT regions onto the correctly named, appended tracks.
If any tracks exist with the same names as the ones in the import,
the new tracks get an incremented number at the end of them and
the imported regions are placed on the new track, as expected.