Get TrackProperties at plugin load

Hey all,

Been trying to get the track name that the plugin is loaded on. AudioProcessor::updateTrackProperties() has been working in Ableton, except Ableton only calls back when the track name changes.

Both Juce docs and the VST3 docs (Vst::IInfoListener) say that we’re waiting on the host to call back changes— According to that we can’t control when Ableton calls back, but I’ve seen plugins like izotope neutron get the track name on load, so it must be possible somehow!

Is there something I’m missing?

After doing some further research on this topic, I think the way that other plugins get the track name is through using the Presonus Plug-In Extensions; which appears to let you ask the DAW “what track is my plugin on” Instead of just waiting around for the DAW to tell you like in the default VST3 implementation.

Unfortunately, I don’t yet know enough about C++, JUCE, or the underlying VST code to implement it lol. The JUCE VST3ClientExtensions looked promising but I was having trouble finding examples on how to use it, and got the impression that I would have to spend some additional time actually understanding how the VST3 library worked.

Oh well, I’ll cross that feature off my todo list for now. I’m building an OSC sender and auto filling the OSC path with the track name would have greatly reduced user setup time.

I have created a plugin that gets track names and track colours. You can’t get them proactively, but you can define
void updateTrackProperties (const TrackProperties &properties) override;
and then wait for track names and colours to arrive. When they do, stash them away! I have done this and my plugin in Ableton gets all the track names on startup, so I think Ableton is calling the above method when it loads a project as well as when the user changes a track name or colour. The only DAW I’ve had trouble with track names is Studio One.

I should add that Ableton will call updateTrackProperties with partial information! Sometimes it will call it with a track name and an empty colour and other times it will call with an empty track name and a colour. So you have to code the function implementation so that it takes what it can and doesn’t overwrite the other attribute with the empty value. Here is what my code looks like:

void StrataTrackAudioProcessor::updateTrackProperties (const TrackProperties &properties)
{

t->trace_begin("updateTrackProperties");

// WARNING: Experimentation has shown that the TrackProperties record only
// contains the track properties that have actually just changed.
//
// Example 1: If the track name has just been changed by the user in
// Ableton, then the track name field will be present, but the colour will be 0.
//
// Example 2: If the colour has just been changed, it will be present, but the
// track name will be the empty string.
//
// It is not clear how to distinguish between an empty track name and no track name update.
// Hmmmm. I just tried to change the track name in Ableton to "" and it wouldn't let me,
// so it seems that we can assume that "" means no update.
//
// It is not clear how to distinguish between a colour and no-colour-provided.
// I'm going to do it by converting it to text and comparing with "0".
//
// On Ableton startup (with a project that includes this plugin), it seems that
// Ableton makes three calls to this function:
//    1. A call with no name and no colour.
//    2. A call with a name, but no colour.
//    3. A call with a colour, but no name.
//
// So it seems wise to take what information we can when we can and stash it away.

juce::String s = properties.name;
t->trace("Track Name =");
t->trace_String(s);

juce::Colour c = properties.colour;
juce::String c_s = c.toString();
t->trace("Track Colour =");
t->trace_String(c_s);

// If a new track name was provided, update the track name.
if (properties.name != "") {
    track_name = properties.name.trim();
    t->trace_set_unique_string(track_name.toUTF8());
}

// If a new track colour was provided, update the track colour.
if (c_s != "0") {
    track_colour = properties.colour;
}

t->trace_end("updateTrackProperties");

}