Skip to content

Commit

Permalink
fix(anni-playback): pad 0 to output stream (#45)
Browse files Browse the repository at this point in the history
fixes noise when there is not enough audio data
  • Loading branch information
snylonue authored Apr 20, 2024
1 parent 20ab0f9 commit 9207e60
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions anni-playback/src/cpal_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ impl CpalOutputStream {
data[0..written]
.iter_mut()
.for_each(|s| *s *= BASE_VOLUME * *controls.volume());

data[written..].fill(0.);
} else {
data.fill(0.);
}
}
},
Expand Down

0 comments on commit 9207e60

Please sign in to comment.