Fixes re: zognia's testing #2

Merged
skeh merged 11 commits from feat/zogpog into main 2025-01-24 08:28:14 +00:00
Showing only changes of commit 4bbd2b1bb0 - Show all commits

View file

@ -33,7 +33,7 @@ class AudioAlert(PluginBase):
else: else:
self.clips[key][1] = maya.now() self.clips[key][1] = maya.now()
stream_dq = self.streams.get(path, None) stream_dq = self.streams.get(key, None)
if stream_dq is None: if stream_dq is None:
stream_dq = deque(maxlen=poly) stream_dq = deque(maxlen=poly)
self.streams[key] = stream_dq self.streams[key] = stream_dq
@ -41,13 +41,14 @@ class AudioAlert(PluginBase):
if stream_dq.maxlen != poly: if stream_dq.maxlen != poly:
self.logger.warn('Cannot change poly while streams are active!') self.logger.warn('Cannot change poly while streams are active!')
if len(stream_dq) != poly: if len(stream_dq) == stream_dq.maxlen:
stream_dq.rotate(1)
stream = stream_dq[0]
else:
stream = Stream(clip, self.output_index, stream = Stream(clip, self.output_index,
buffer_length=self.buffer_length) buffer_length=self.buffer_length)
stream_dq.append(stream) stream_dq.append(stream)
else:
stream_dq.rotate(1)
stream = stream_dq[0]
if immediate: if immediate:
asyncio.create_task(stream.aplay()) asyncio.create_task(stream.aplay())