improve the chain insert() api

This commit is contained in:
Jakob Ketterl 2023-08-28 23:39:50 +02:00
parent 9d2b626e6f
commit e109149b92
3 changed files with 3 additions and 3 deletions

View file

@ -94,7 +94,7 @@ class Chain(Module):
if self.writer is not None:
newWorker.setWriter(self.writer)
def insert(self, newWorker, index=0):
def insert(self, index, newWorker):
nextWorker = None
previousWorker = None
if index < len(self.workers):

View file

@ -42,7 +42,7 @@ class ClientAudioChain(Chain):
if index >= 0:
self.replace(index, converter)
else:
self.insert(converter)
self.insert(0, converter)
def setFormat(self, format: Format) -> None:
if format == self.format:

View file

@ -118,7 +118,7 @@ class Selector(Chain):
def _enableBandpass(self):
index = self.indexOf(lambda x: isinstance(x, Bandpass))
if index < 0:
self.insert(self.bandpass, 2)
self.insert(2, self.bandpass)
def _disableBandpass(self):
index = self.indexOf(lambda x: isinstance(x, Bandpass))