diff --git a/csdr/chain/__init__.py b/csdr/chain/__init__.py index 02bb5951..bebe121d 100644 --- a/csdr/chain/__init__.py +++ b/csdr/chain/__init__.py @@ -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): diff --git a/csdr/chain/clientaudio.py b/csdr/chain/clientaudio.py index febfd15c..9fd748b8 100644 --- a/csdr/chain/clientaudio.py +++ b/csdr/chain/clientaudio.py @@ -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: diff --git a/csdr/chain/selector.py b/csdr/chain/selector.py index 2f272bbc..8009f6b9 100644 --- a/csdr/chain/selector.py +++ b/csdr/chain/selector.py @@ -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))