properly zero the buffers
This commit is contained in:
parent
4d46093ae7
commit
eac9f00cb0
1 changed files with 12 additions and 7 deletions
11
server.py
11
server.py
|
@ -80,9 +80,6 @@ def init_buffers() -> None:
|
|||
transfer_buffer1 = Jack.RingBuffer(jack.samplerate * 10)
|
||||
transfer_buffer2 = Jack.RingBuffer(jack.samplerate * 10)
|
||||
|
||||
transfer_buffer1.write(struct.pack('f', 0))
|
||||
transfer_buffer2.write(struct.pack('f', 0))
|
||||
|
||||
|
||||
init_buffers()
|
||||
|
||||
|
@ -90,9 +87,17 @@ init_buffers()
|
|||
@jack.set_process_callback # type: ignore
|
||||
def process(frames: int) -> None:
|
||||
buf1 = out1.get_buffer()
|
||||
if transfer_buffer1.read_space == 0:
|
||||
for i in range(len(buf1)):
|
||||
buf1[i] = b'\x00'
|
||||
else:
|
||||
piece1 = transfer_buffer1.read(len(buf1))
|
||||
buf1[: len(piece1)] = piece1
|
||||
buf2 = out2.get_buffer()
|
||||
if transfer_buffer2.read_space == 0:
|
||||
for i in range(len(buf2)):
|
||||
buf2[i] = b'\x00'
|
||||
else:
|
||||
piece2 = transfer_buffer2.read(len(buf2))
|
||||
buf2[: len(piece2)] = piece2
|
||||
|
||||
|
|
Loading…
Reference in a new issue