mirror of
https://github.com/onyx-and-iris/voicemeeter-compact.git
synced 2024-11-15 17:40:52 +00:00
502110ae0f
couple of bug fixes for submix frame minor version bump
36 lines
830 B
Python
36 lines
830 B
Python
class Subject:
|
|
def __init__(self):
|
|
"""list of current observers"""
|
|
|
|
self._observables = []
|
|
|
|
def notify(self, modifier=None):
|
|
"""run callbacks on update"""
|
|
|
|
for observer in self._observables:
|
|
observer.on_update()
|
|
|
|
def add(self, observer):
|
|
"""adds an observer to observables"""
|
|
|
|
if observer not in self._observables:
|
|
self._observables.append(observer)
|
|
|
|
def remove(self, observer):
|
|
"""removes an observer from observables"""
|
|
|
|
try:
|
|
self._observables.remove(observer)
|
|
except ValueError:
|
|
pass
|
|
|
|
def get(self) -> list:
|
|
"""returns the current observables"""
|
|
|
|
return self._observables
|
|
|
|
def clear(self):
|
|
"""clears the observables list"""
|
|
|
|
self._observables.clear()
|