small refactor

This commit is contained in:
Weird Constructor 2021-05-29 21:00:45 +02:00
parent 5019231302
commit 46d59dfc02
2 changed files with 76 additions and 71 deletions

View file

@ -17,7 +17,7 @@ serde_json = "1.0"
ringbuf = "0.2.2" ringbuf = "0.2.2"
triple_buffer = "5.0.6" triple_buffer = "5.0.6"
#hexotk = { optional = true, git = "https://github.com/WeirdConstructor/HexoTK.git" } #hexotk = { optional = true, git = "https://github.com/WeirdConstructor/HexoTK.git" }
hexotk = { optional = true, path = "../hexotk" } #hexotk = { optional = true, path = "../hexotk" }
hound = "3.4.0" hound = "3.4.0"
[dev-dependencies] [dev-dependencies]

View file

@ -132,6 +132,7 @@ impl Sampl {
is_playing = true; is_playing = true;
} }
let s =
if is_playing { if is_playing {
let playback_speed = let playback_speed =
denorm::Sampl::freq(freq, frame) / 440.0; denorm::Sampl::freq(freq, frame) / 440.0;
@ -199,9 +200,13 @@ impl Sampl {
// played past end => stop playing. // played past end => stop playing.
is_playing = false; is_playing = false;
} }
s
} else { } else {
out.write(frame, 0.0); 0.0
} };
out.write(frame, s);
} }
self.is_playing = is_playing; self.is_playing = is_playing;