mirror of
https://codeberg.org/unspeaker/tek.git
synced 2026-02-01 16:46:41 +01:00
fix sample preview crashes
This commit is contained in:
parent
bdd3e31403
commit
e1eaa51d26
3 changed files with 13 additions and 8 deletions
|
|
@ -255,11 +255,17 @@ impl Sample {
|
|||
while sample.channels.len() < spec.channels.count() {
|
||||
sample.channels.push(vec![]);
|
||||
}
|
||||
let mut samples = SampleBuffer::new(decoded.frames() as u64, spec);
|
||||
samples.copy_interleaved_ref(decoded);
|
||||
for frame in samples.samples().chunks(spec.channels.count()) {
|
||||
for (chan, frame) in frame.iter().enumerate() {
|
||||
sample.channels[chan].push(*frame)
|
||||
// Load sample
|
||||
let mut samples = SampleBuffer::new(
|
||||
decoded.frames() as u64,
|
||||
spec
|
||||
);
|
||||
if samples.capacity() > 0 {
|
||||
samples.copy_interleaved_ref(decoded);
|
||||
for frame in samples.samples().chunks(spec.channels.count()) {
|
||||
for (chan, frame) in frame.iter().enumerate() {
|
||||
sample.channels[chan].push(*frame)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue