fix(fx): realtime VST ngắt quãng khi mở MASTERING PANEL + PWR master không ảnh hưởng âm; pacing WS input/output, gate fxRt theo masterConnected, worklet cap 32
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
// native_bridge/include/FxRealtimeIPC.h
|
||||
// SHM layout cho fx_vst_bridge --realtime-fx (VST FX xử lý realtime, cloud-FX
|
||||
// loop): engine (Python) tạo mapping, bridge mở và chạy vòng lặp audio.
|
||||
// Tất cả field u32/float (4-byte) — KHÔNG padding — mirror chính xác bằng
|
||||
// ctypes trong app/core/fx_realtime.py.
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
|
||||
#define FXRT_MAGIC 0x46585254u // "FXRT"
|
||||
#define FXRT_BLOCK 256
|
||||
#define FXRT_IN_SLOTS 4 // engine -> bridge
|
||||
#define FXRT_OUT_SLOTS 8 // bridge -> engine
|
||||
#define FXRT_STATE_STARTING 0
|
||||
#define FXRT_STATE_READY 1
|
||||
#define FXRT_STATE_ERROR 2
|
||||
|
||||
// Header 48 bytes (12 u32) — giữ thứ tự khớp fx_realtime.py.
|
||||
struct FxRealtimeHeader {
|
||||
volatile uint32_t magic;
|
||||
volatile uint32_t state;
|
||||
uint32_t sampleRate;
|
||||
uint32_t blockSize;
|
||||
volatile uint32_t running; // engine set 0 → bridge thoát
|
||||
volatile uint32_t heartbeat; // bridge tăng mỗi 100ms (watchdog)
|
||||
volatile uint32_t inWrite; // producer: engine
|
||||
volatile uint32_t inRead; // consumer: bridge
|
||||
uint32_t inSlots;
|
||||
volatile uint32_t outWrite; // producer: bridge
|
||||
volatile uint32_t outRead; // consumer: engine
|
||||
uint32_t outSlots;
|
||||
};
|
||||
|
||||
struct FxRealtimeIPC {
|
||||
FxRealtimeHeader h;
|
||||
float inL[FXRT_IN_SLOTS][FXRT_BLOCK];
|
||||
float inR[FXRT_IN_SLOTS][FXRT_BLOCK];
|
||||
float outL[FXRT_OUT_SLOTS][FXRT_BLOCK];
|
||||
float outR[FXRT_OUT_SLOTS][FXRT_BLOCK];
|
||||
};
|
||||
@@ -81,3 +81,8 @@ private:
|
||||
};
|
||||
|
||||
#endif // RENDER_FX_JOB_H
|
||||
// Realtime SHM FX loop (fx_vst_bridge --realtime-fx): engine (Python) tạo
|
||||
// mapping FxRealtimeIPC, bridge mở, đọc input ring, xử lý qua RealtimeFxChain,
|
||||
// ghi output ring. Thoát khi running==0 hoặc parent chết.
|
||||
int run_realtime_fx_loop(const std::string& jobPath, const std::string& shmName,
|
||||
uint32_t parentPid);
|
||||
|
||||
Reference in New Issue
Block a user