Skip to content

Commit 62d7d33

Browse files
Fixed plugin editor bypass state sync
1 parent 6c6ca22 commit 62d7d33

File tree

3 files changed

+32
-4
lines changed

3 files changed

+32
-4
lines changed

src/audioCore/uiCallback/UICallbackType.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#pragma once
1+
#pragma once
22

33
enum class UICallbackType : int {
44
ErrorAlert,

src/ui/misc/PluginEditorHub.cpp

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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

2535
PluginEditorHub::~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+
239265
PluginEditorHub::RefType PluginEditorHub::getInstrRef(int index) const {
240266
return static_cast<RefType>(quickAPI::getInstrRef(index));
241267
}

src/ui/misc/PluginEditorHub.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#pragma once
1+
#pragma once
22

33
#include <JuceHeader.h>
44
#include "../component/plugin/PluginEditor.h"
@@ -36,6 +36,8 @@ class PluginEditorHub final : private juce::DeletedAtShutdown {
3636
void trackAdded(int type, int track);
3737
void trackRemoved(int type, int track);
3838
void effectIndexChanged(int type, int track, int oldIndex, int newIndex);
39+
void instrChanged(int track);
40+
void effectChanged(int type, int track, int index);
3941

4042
RefType getInstrRef(int index) const;
4143
RefType getEffectRef(int type, int track, int index) const;

0 commit comments

Comments
 (0)