mirror of
https://github.com/mii443/maudio-router.git
synced 2025-08-22 16:05:35 +00:00
33 lines
657 B
Rust
33 lines
657 B
Rust
use crate::args::Run;
|
|
|
|
fn reshape_audio_data<T>(input: &[T], channels: usize) -> Vec<Vec<T>>
|
|
where
|
|
T: Clone,
|
|
{
|
|
let mut output = vec![vec![]; channels];
|
|
for frame in input.chunks(channels) {
|
|
for (i, sample) in frame.iter().enumerate() {
|
|
output[i].push(sample.clone());
|
|
}
|
|
}
|
|
output
|
|
}
|
|
|
|
fn to_flat_audio_data<T>(input: &[Vec<T>]) -> Vec<T>
|
|
where
|
|
T: Clone,
|
|
{
|
|
let channels = input.len();
|
|
let frames = input[0].len();
|
|
let mut output = vec![];
|
|
for i in 0..frames {
|
|
for j in 0..channels {
|
|
output.push(input[j][i].clone());
|
|
}
|
|
}
|
|
output
|
|
}
|
|
|
|
pub fn run(args: Run) {
|
|
|
|
} |