mirror of
https://github.com/jketterl/openwebrx.git
synced 2026-01-08 17:50:11 +01:00
improve the chain insert() api
This commit is contained in:
parent
9d2b626e6f
commit
e109149b92
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Reference in a new issue