SampleRateConverter: Generalize doubling/halving tests over channels

This commit is contained in:
Nicolas Braud-Santoni 2020-10-01 16:54:41 +02:00
parent 42e2e53f66
commit 663bdd57b2
No known key found for this signature in database
GPG key ID: E6F98EE292D5ECCB

View file

@ -285,10 +285,10 @@ mod test {
assert_eq!(input, output);
}
fn half_sample_rate(to: u32, input: Vec<u16>) -> () {
fn half_sample_rate(to: u32, input: Vec<u16>, n: u16) -> () {
let to = if to == 0 { return; } else { SampleRate(to) };
let from = multiply_rate(to, 2);
let n = 2u16;
if n == 0 { return; }
// Truncate the input, so it contains an integer number of frames.
let input = {
@ -306,10 +306,10 @@ mod test {
output)
}
fn double_sample_rate(from: u32, input: Vec<u16>) -> () {
fn double_sample_rate(from: u32, input: Vec<u16>, n: u16) -> () {
let from = if from == 0 { return; } else { SampleRate(from) };
let to = multiply_rate(from, 2);
let n = 2u16;
if n == 0 { return; }
// Truncate the input, so it contains an integer number of frames.
let input = {