M17: realtime FX mượt — MMCSS Pro Audio + HIGH_PRIORITY_CLASS (JuceFxLoop), GUI tick cadence động 30/200ms (guiBusy), worklet CAP 32->48, track FX gửi input NGAY như master
This commit is contained in:
@@ -568,13 +568,14 @@ void JuceFxGuiHost::guiMain() {
|
||||
// Thread này trở thành JUCE message thread.
|
||||
std::cerr << "[JuceFxGuiHost] guiMain start" << std::endl;
|
||||
juce::initialiseJuce_GUI();
|
||||
std::cerr << "[JuceFxGuiHost] initialiseJuce_GUI ok" << std::endl;
|
||||
std::cerr << "[JuceFxGuiHost] initialiseJuce_GUI ok" << std::endl;
|
||||
// Cadence inline (30ms busy / 200ms idle) — KHÔNG dùng juce::Timer: trên GUI thread riêng,
|
||||
// timer callback không bao giờ fire dù runDispatchLoopUntil pump liên tục
|
||||
// (test cho thấy 0 tick). tick() ở đây chạy trên chính message thread nên
|
||||
// pump + tạo/xoá Component an toàn.
|
||||
{
|
||||
using clock = std::chrono::steady_clock;
|
||||
using clock = std::chrono::steady_clock;
|
||||
const auto fastMs = std::chrono::milliseconds(30);
|
||||
const auto slowMs = std::chrono::milliseconds(200);
|
||||
auto lastTick = clock::now();
|
||||
while (!quit_.load()) {
|
||||
@@ -596,7 +597,11 @@ void JuceFxGuiHost::guiMain() {
|
||||
impl_->guiCv.notify_all();
|
||||
}
|
||||
juce::MessageManager::getInstance()->runDispatchLoopUntil(10);
|
||||
const auto now = clock::now();
|
||||
const auto now = clock::now();
|
||||
// Cadence động: có việc editor (queue/open/retry) → 30ms giữ
|
||||
// anchor/reconcile phản hồi nhanh; idle (không editor) → 200ms —
|
||||
// giảm wakeup + churn GUI thread BELOW_NORMAL khi chỉ chạy audio.
|
||||
const auto curMs = engine_.guiBusy() ? fastMs : slowMs;
|
||||
if (now - lastTick >= curMs) {
|
||||
tick();
|
||||
lastTick = now;
|
||||
|
||||
Reference in New Issue
Block a user