Commit
·
2d4dad3
1
Parent(s):
5709926
jam/consume wasnt being called
Browse files- jam_worker.py +6 -3
jam_worker.py
CHANGED
|
@@ -332,8 +332,11 @@ class JamWorker(threading.Thread):
|
|
| 332 |
self._spool_written += y.shape[0]
|
| 333 |
|
| 334 |
def _should_generate_next_chunk(self) -> bool:
|
| 335 |
-
#
|
| 336 |
-
|
|
|
|
|
|
|
|
|
|
| 337 |
|
| 338 |
def _emit_ready(self):
|
| 339 |
"""Emit next chunk(s) if the spool has enough samples."""
|
|
@@ -395,7 +398,7 @@ class JamWorker(threading.Thread):
|
|
| 395 |
# generate next model chunk
|
| 396 |
# snapshot current style vector under lock for this step
|
| 397 |
with self._lock:
|
| 398 |
-
style_vec = self.
|
| 399 |
wav, self.state = self.mrt.generate_chunk(state=self.state, style=style_vec)
|
| 400 |
# append and spool
|
| 401 |
self._append_model_chunk_and_spool(wav)
|
|
|
|
| 332 |
self._spool_written += y.shape[0]
|
| 333 |
|
| 334 |
def _should_generate_next_chunk(self) -> bool:
|
| 335 |
+
# Allow running ahead relative to whichever is larger: last *consumed*
|
| 336 |
+
# (explicit ack from client) or last *delivered* (implicit ack).
|
| 337 |
+
implicit_consumed = self._next_to_deliver - 1 # last chunk handed to client
|
| 338 |
+
horizon_anchor = max(self._last_consumed_index, implicit_consumed)
|
| 339 |
+
return self.idx <= (horizon_anchor + self._max_buffer_ahead)
|
| 340 |
|
| 341 |
def _emit_ready(self):
|
| 342 |
"""Emit next chunk(s) if the spool has enough samples."""
|
|
|
|
| 398 |
# generate next model chunk
|
| 399 |
# snapshot current style vector under lock for this step
|
| 400 |
with self._lock:
|
| 401 |
+
style_vec = self.params.style_vec
|
| 402 |
wav, self.state = self.mrt.generate_chunk(state=self.state, style=style_vec)
|
| 403 |
# append and spool
|
| 404 |
self._append_model_chunk_and_spool(wav)
|