Separate external and internal bus namespaces

Instead of looking up buses by id in synth connections (and manipulating
the reference count every time), store bus pointers directly.

Separate the index namespaces for internal and external buses and add an
additional flags parameter to the bus mapping API methods.