mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 20:56:43 +01:00
jammable again - and autoconnects!
This commit is contained in:
parent
3ed9ebddd4
commit
768c2337e7
5 changed files with 98 additions and 59 deletions
|
|
@ -70,6 +70,7 @@ impl Sampler {
|
|||
// dropping voices that have reached their ends.
|
||||
let mut voices = vec![];
|
||||
std::mem::swap(&mut voices, &mut self.voices);
|
||||
let gain = 0.5;
|
||||
loop {
|
||||
if voices.len() < 1 {
|
||||
break
|
||||
|
|
@ -79,7 +80,7 @@ impl Sampler {
|
|||
for (i, channel) in chunk.iter().enumerate() {
|
||||
let buffer = &mut mixed[i % channel_count];
|
||||
for (i, sample) in channel.iter().enumerate() {
|
||||
buffer[i] += sample;
|
||||
buffer[i] += sample * gain;
|
||||
}
|
||||
}
|
||||
self.voices.push(voice);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue