Skip to content

Commit

Permalink
fill buffer with zeros
Browse files Browse the repository at this point in the history
  • Loading branch information
deanlee committed Jul 27, 2024
1 parent 4caecf2 commit 1a7bf60
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion selfdrive/ui/soundd.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ def get_sound_data(self, frames): # get "frames" worth of data from the current
def callback(self, data_out: np.ndarray, frames: int, time, status) -> None:
if status:
cloudlog.warning(f"soundd stream over/underflow: {status}")
data_out[:frames, 0] = self.get_sound_data(frames)
if self.current_alert == AudibleAlert.none:
data_out.fill(0)
else:
data_out[:frames, 0] = self.get_sound_data(frames)

def update_alert(self, new_alert):
current_alert_played_once = self.current_alert == AudibleAlert.none or self.current_sound_frame > len(self.loaded_sounds[self.current_alert])
Expand Down

0 comments on commit 1a7bf60

Please sign in to comment.