fix(tracker): do not close Broker but rather just close the detector

This commit is contained in:
5684185+vsariola@users.noreply.github.com
2024-11-02 20:45:10 +02:00
parent 943073d0cc
commit 94058c2603
6 changed files with 12 additions and 8 deletions

View File

@ -106,6 +106,9 @@ func (s *Detector) Run() {
s.loudnessDetector.reset()
s.peakDetector.reset()
}
if msg.Quit {
return
}
switch data := msg.Data.(type) {
case *sointu.AudioBuffer:
buf := *data
@ -144,6 +147,11 @@ func (s *Detector) Run() {
}
}
// Close may theoretically block if the broker is full, but it should not happen in practice
func (s *Detector) Close() {
s.broker.ToDetector <- MsgToDetector{Quit: true}
}
func makeLoudnessDetector(weighting WeightingType) loudnessDetector {
return loudnessDetector{
weighting: weightings[weighting],