mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-09-01 17:23:48 +00:00
ts-audiotestsrc: fix non-desirable harmonics
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2392>
This commit is contained in:
parent
00cd58a21c
commit
34462445e8
1 changed files with 2 additions and 2 deletions
|
@ -403,7 +403,7 @@ impl TaskImpl for AudioTestSrcTask {
|
|||
let value = if self.mute {
|
||||
0
|
||||
} else {
|
||||
(self.accumulator.sin() * self.volume * (i16::MAX as f64)) as i16
|
||||
(f64::sin(self.accumulator) * (i16::MAX as f64) * self.volume).round() as i16
|
||||
};
|
||||
for sample in chunk {
|
||||
*sample = value;
|
||||
|
@ -411,7 +411,7 @@ impl TaskImpl for AudioTestSrcTask {
|
|||
|
||||
self.accumulator += self.step;
|
||||
if self.accumulator >= 2.0 * std::f64::consts::PI {
|
||||
self.accumulator = -2.0 * std::f64::consts::PI;
|
||||
self.accumulator -= 2.0 * std::f64::consts::PI;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue