7c22ae1f02
- remove diagnostic canaries from audio hot path (crackle fix) and stuck C5 note raw-MIDI test (Vst2Instrument::init noteOff) - split native bridge into daw_vst_bridge (VSTi) + fx_vst_bridge (VST FX) - VST3: processData prepare before setActive, zero input buses, accept both .vstpreset and bridge-state blob in RenderJob presets - native_render/vst_engine: bridge-exe discovery + render_fx_chain + /fx-gui - delete old install/ engine binaries (install via sidecar+resources now) - add BUILD_LAYOUT.md, build_selfcheck, tools/ diagnostics
55 lines
1.9 KiB
Python
55 lines
1.9 KiB
Python
# Read SHM state: heartbeat/writeIndex advance + master buffer energy.
|
|
import ctypes, sys, time
|
|
|
|
sys.stdout.reconfigure(encoding='utf-8', errors='replace')
|
|
APP_PID = sys.argv[1]
|
|
SHM_NAME = f'SonicForge_DAW_IPC_{APP_PID}'
|
|
|
|
# offsets from header: clientReadIndex@0, bridgeWriteIndex@4, masterLeft@8 (256*4),
|
|
# masterRight@1032, blockTimestamp@2056, midiQueue@2064, midiQueueCount@2832,
|
|
# controlQueue@2836, controlQueueCount@11156, attachInFlight@11160, heartbeat@11164
|
|
OFF_CLIENT_READ = 0
|
|
OFF_BRIDGE_WRITE = 4
|
|
OFF_MASTER_L = 8
|
|
OFF_MASTER_R = 1032
|
|
OFF_HEARTBEAT = 11164
|
|
|
|
k32 = ctypes.WinDLL('kernel32', use_last_error=True)
|
|
k32.OpenFileMappingA.restype = ctypes.c_void_p
|
|
k32.OpenFileMappingA.argtypes = [ctypes.c_uint32, ctypes.c_int, ctypes.c_char_p]
|
|
k32.MapViewOfFile.restype = ctypes.c_void_p
|
|
k32.MapViewOfFile.argtypes = [ctypes.c_void_p, ctypes.c_uint32, ctypes.c_uint32, ctypes.c_uint32, ctypes.c_size_t]
|
|
k32.UnmapViewOfFile.argtypes = [ctypes.c_void_p]
|
|
k32.CloseHandle.argtypes = [ctypes.c_void_p]
|
|
|
|
h = k32.OpenFileMappingA(0x0002, 0, SHM_NAME.encode())
|
|
if not h:
|
|
print('FATAL: open SHM failed', ctypes.get_last_error())
|
|
sys.exit(1)
|
|
ptr = k32.MapViewOfFile(h, 0x0002, 0, 0, 0)
|
|
if not ptr:
|
|
print('FATAL: map failed', ctypes.get_last_error())
|
|
sys.exit(1)
|
|
|
|
def r32(off): return ctypes.c_uint32.from_address(ptr + off).value
|
|
def energy(off):
|
|
arr = (ctypes.c_float * 256).from_address(ptr + off)
|
|
return sum(abs(v) for v in arr)
|
|
|
|
samples = []
|
|
for i in range(20):
|
|
hb = r32(OFF_HEARTBEAT)
|
|
wi = r32(OFF_BRIDGE_WRITE)
|
|
eL = energy(OFF_MASTER_L)
|
|
eR = energy(OFF_MASTER_R)
|
|
samples.append((hb, wi, eL, eR))
|
|
time.sleep(0.15)
|
|
print('sample hb wi eL eR')
|
|
for s in samples: print(s)
|
|
print('hb advanced:', len(set(s[0] for s in samples)) > 1)
|
|
print('wi advanced:', len(set(s[1] for s in samples)) > 1)
|
|
print('max eL:', max(s[2] for s in samples), 'max eR:', max(s[3] for s in samples))
|
|
|
|
k32.UnmapViewOfFile(ptr)
|
|
k32.CloseHandle(h)
|