I want to create a class that has access to an audio buffer and can modify the values inside it, and I want to use this on the master output of my Tracktion Engine app (It needs to support having multiple instances though). I have done some research and it seems like te::plugin is the answer to my question and I can edit the buffer in the void applyToBuffer function.
But the problem is that I somehow cannot instantiate the plugin and add it to the master track pluginList. I’ve tried the code below which somehow calls the destructor immediately afterwards:
auto id = edit->createNewItemID();
this->plugin = std::make_shared<PluginClass>(PluginCreationInfo(*edit, edit->state, true));
edit->getMasterPluginList().insertPlugin(this->plugin.get(), 0, &selectionManager);
My main question is that is this really the best way to do this kind of operations in Tracktion? I want to be able to insert this class on other Tracks as well. And if yes, what is the best practice to instantiate this plugin and inserting it into any Track of my choice?
Thanks a lot, this was helpful! Somehow I missed this when going through the examples. I wish there was some kind of a link between the examples and the online documentation. For example when looking at the te::Plugin documentation in this page it would be a huge help if it mentioned that the DistortionEffectDemo is actually using it.