G3: 1 clock - PDC latency that + playhead engine-derived
This commit is contained in:
+14
-2
@@ -128,6 +128,7 @@ class FxRealtimeSession:
|
||||
# Phase 2.8: C++ consume qua SHM control ring.
|
||||
self.pending_params = {} # {slot_idx: {key: value}}
|
||||
self.latencies = {} # {slot_idx: samples}
|
||||
self.processed = None # G3: processed samples tu bridge (lat slot 0xFFFFFFFE)
|
||||
# Diagnostics (FXRT crackle hunt): drop/publish counters.
|
||||
self.stats = {'publish': 0, 'drop_batch': 0, 'drop_blocks': 0,
|
||||
'stale_flush': 0, 'read_blocks': 0, 'read_empty': 0,
|
||||
@@ -396,6 +397,12 @@ class FxRealtimeSession:
|
||||
self._lat_drain()
|
||||
return dict(self.latencies)
|
||||
|
||||
def get_processed(self):
|
||||
"""G3: processed samples (bridge da xu li) - playhead engine-derived."""
|
||||
with self._lock:
|
||||
self._lat_drain()
|
||||
return self.processed
|
||||
|
||||
def _lat_drain(self):
|
||||
shm = getattr(self, "shm", None)
|
||||
if shm is None:
|
||||
@@ -405,12 +412,17 @@ class FxRealtimeSession:
|
||||
lats = (FxLatReport * FXRT_LAT_SLOTS).from_buffer(shm.buf, LAT_OFF)
|
||||
while h.lat_read < h.lat_write:
|
||||
ls = h.lat_read & (h.lat_slots - 1)
|
||||
self.latencies[int(lats[ls].slot)] = int(lats[ls].samples)
|
||||
_slot = int(lats[ls].slot)
|
||||
_samples = int(lats[ls].samples)
|
||||
if _slot == 0xFFFFFFFE:
|
||||
# G3: processed - khong vao latencies dict (sum chain sai).
|
||||
self.processed = _samples
|
||||
else:
|
||||
self.latencies[_slot] = _samples
|
||||
h.lat_read += 1
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
# Registry toàn tiến trình (desktop app 1 user).
|
||||
_SESSIONS = {}
|
||||
_SESSIONS_LOCK = threading.Lock()
|
||||
|
||||
Reference in New Issue
Block a user