1- #include " PluginEditorHub.h"
1+ #include " PluginEditorHub.h"
22#include " CoreCallbacks.h"
33#include " RCManager.h"
44#include " ../../audioCore/AC_API.h"
@@ -20,6 +20,16 @@ PluginEditorHub::PluginEditorHub() {
2020 PluginEditorHub::getInstance ()->effectIndexChanged (type, track, oldIndex, newIndex);
2121 }
2222 );
23+ CoreCallbackAPI<int >::add (CoreCallbacks::CallbackType::TrackInstrChanged,
24+ [](int index) {
25+ PluginEditorHub::getInstance ()->instrChanged (index);
26+ }
27+ );
28+ CoreCallbackAPI<int , int , int >::add (CoreCallbacks::CallbackType::TrackEffectChanged,
29+ [](int type, int track, int index) {
30+ PluginEditorHub::getInstance ()->effectChanged (type, track, index);
31+ }
32+ );
2333}
2434
2535PluginEditorHub::~PluginEditorHub () {
@@ -38,7 +48,7 @@ void PluginEditorHub::openInstr(int index) {
3848 container->setBufferedPainting (this ->bufferedPainting );
3949 container->setWindowIcon (this ->iconTemp );
4050
41- container->update (0 , index, 0 );
51+ container->update (( int )quickAPI::TrackType::Track , index, 0 );
4252
4353 /* * Show */
4454 this ->openEditor (container.get ());
@@ -236,6 +246,22 @@ void PluginEditorHub::effectIndexChanged(int type, int track, int oldIndex, int
236246 }
237247}
238248
249+ void PluginEditorHub::instrChanged (int track) {
250+ auto it = this ->instrEditors .find (this ->getInstrRef (track));
251+ if (it != this ->instrEditors .end ()) {
252+ /* * Update */
253+ it->second ->update ((int )quickAPI::TrackType::Track, track, 0 );
254+ }
255+ }
256+
257+ void PluginEditorHub::effectChanged (int type, int track, int index) {
258+ auto it = this ->effectEditors .find (this ->getEffectRef (type, track, index));
259+ if (it != this ->effectEditors .end ()) {
260+ /* * Update */
261+ it->second ->update (type, track, index);
262+ }
263+ }
264+
239265PluginEditorHub::RefType PluginEditorHub::getInstrRef (int index) const {
240266 return static_cast <RefType>(quickAPI::getInstrRef (index));
241267}
0 commit comments