sonnum/core/nodes/sink.py
2025-08-10 23:55:07 +03:00

32 lines
No EOL
680 B
Python

from ..soundnode import *
class SinkNode(SoundNode):
def __init__(self, name, room):
super().__init__(name, room)
def calc_r_amps(self, t):
# This function returns volumes of each relevant freq
# at tick t
res = dict()
for source_node in self.wire_in:
for freq, vol in self.sample_r_amps_by_wire(source_node, t).items():
if not freq in res:
res[freq] = vol
else:
res[freq] += vol
for source_node in self.air_in:
for freq, vol in self.sample_r_amps_by_air(source_node, t).items():
if not freq in res:
res[freq] = vol
else:
res[freq] += vol
self.r_amps[t] = res
#if res:
# print(self.r_amps[t])