Set Up Master track for Each Edit

I want to set up a Master track with each edit. So, the Master track is created and each other track redirects its output to it.

What is the most succinct code to accomplish this?

EDIT: I think I have this figured out, but I would still like to know the “official” way to do it, especially how to set it as “the” Master track.

That’s not a feature we have right now.
The master track is a bit of a pseudo track in that it really just holds master plugins and these get applied to the “default audio output” device. So any tracks that output to the default device will get the master plugins applied.

They’re not really routed to or through the master track.

Improving this so it is a proper routing destination is something I’d like to do one day though.

It seems that most of the pieces for a Master track are there. For example, I can create a track, name it “Master” and use

track->getOutput().setOutputToTrack(masterTrack);

to redirect all other tracks to it.

Or is there more to it that I am not seeing?

You can do it like that. Just note that your masterTrack there has to be an AudioTrack. The te::MasterTrack can’t be a destination as it doesn’t have a true audio path.