Checkpoint

This commit is contained in:
maze authored and maze committed 2026-10-29 17:28:51 +01:00
1 parent 7b6db17870
commit 0295eb1ad2
125 files changed
+59376

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
package audio
// Deinterleave multi channel samples to separate slices.
func Deinterleave(samples []int16, slices [][]int16) {
if len(samples) == 0 {
return
}
if len(slices) == 1 {
copy(slices[0], samples)
return
}
channels := len(slices)
for i, sample := range samples {
j, k := i%channels, i/channels
slices[j][k] = sample
}
}
// Interleave multi channel samples to a single slice.
func Interleave(slices [][]int16, samples []int16) {
if len(slices) == 0 {
return
}
if len(slices) == 1 {
copy(samples, slices[0])
return
}
channels := len(slices)
for i := range samples {
j, k := i%channels, i/channels
samples[i] = slices[j][k]
}
}