I am new in Juce and still learning c++, I understand that in order to get the track name that your plugin is loaded to in your DAW you need to use the updateTrackProperties function but I have been searching for examples on how to call this function to display the track name on my plugin’s GUI but haven’t found anything. Can someone please kindly show me how this can been done. Forgive me if this is basic but I’m still a beginner learning my way around Juce.
You are not supposed to call updateTrackProperties yourself. It’s a virtual method you can override and if the feature happens to be supported in the host and plugin format you are using, the method will be called by Juce with the updated track properties, but that is not guaranteed to happen at all.
Oh I see, so would you go about creating a label on your GUI that gets the track name. I thought that is what updateTrackProperties does. Thanks for your response @xenakios
It’s a bit involved to attempt to get that to work. You need to override the updateTrackProperties method in your AudioProcessor and store the track name into a member variable of your processor. And then you need to make your editor class query that track name variable periodically with a timer and update your GUI label. And even if you do all that, it might not work, because this isn’t a required functionality in the plugin formats/hosts. Why do you need the track name to be displayed in the plugin GUI, anyway?
In my case, I use the feature so that I know which plugin belongs to which track. Say, I have the same plugin assigned on multiple tracks. And I have the editors showing for them all. Having the track name (and track color) helps to differentiate between the plugins.
Very true, but I wrote my own DAW (TracktionEngine based) and it does support the feature. So, it does work in my case.
In the plugins I publicly distribute, the feature is there if the user’s DAW supports it. And if the DAW does not support it, the GUI location is simply blank background on the plugin, and it is not obvious that the information is “missing”.
Sorry if this is off topic… is there a collective wiki/repo/forum thread/juce module somewhere with information about which DAWs support which features of the various formats? For example, playhead information, response curves, etc.?
sidenote: be aware not all daw handle argb the same way
so might have to “rewire” for some R and B will be swaped for ex, orfor some other A will go to red ect…
so you’ll need converters specific to daws
In my PluginProcessor.h declare a TrackProperties variable and upDateTrackProperties();
// upDateTrackProperties may be called by the host if it feels like it
// this method calls a similar one in the editor class that updates the editor
void updateTrackProperties(const TrackProperties& properties) override;
TrackProperties trackProperties;
Then, in PluginProcessor.cpp;
void PluginProcessor::updateTrackProperties(const TrackProperties& properties)
{
trackProperties = properties;
// call the verison in the editor to update there
if (auto* editor = dynamic_cast<PluginProcessorEditor*> (getActiveEditor()))
editor->updateTrackProperties();
}
// called from the processor version of same name
void PluginProcessorEditor::updateTrackProperties()
{
hostTrackColour = processor.trackProperties.colour;
hostTrackName = processor.trackProperties.name;
repaint();
}
That should allow it to update the hostTrackColour and hostTrackName variables if the host supports this feature.