mirror of
https://github.com/RustAudio/rodio
synced 2024-12-13 21:52:38 +00:00
Restrict the format to 2 channels
This commit is contained in:
parent
d920872bb1
commit
53143b5f02
1 changed files with 2 additions and 17 deletions
|
@ -75,29 +75,14 @@ impl Engine {
|
||||||
let f1 = f1.unwrap();
|
let f1 = f1.unwrap();
|
||||||
|
|
||||||
// we privilege f32 formats to avoid a conversion
|
// we privilege f32 formats to avoid a conversion
|
||||||
if f1.data_type == cpal::SampleFormat::F32 && f2.data_type != cpal::SampleFormat::F32 {
|
|
||||||
return Some(f1);
|
|
||||||
}
|
|
||||||
if f2.data_type == cpal::SampleFormat::F32 && f1.data_type != cpal::SampleFormat::F32 {
|
if f2.data_type == cpal::SampleFormat::F32 && f1.data_type != cpal::SampleFormat::F32 {
|
||||||
return Some(f2);
|
return Some(f2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if f1.channels.len() < f2.channels.len() {
|
// priviledge outputs with 2 channels for now
|
||||||
|
if f2.channels.len() == 2 && f1.channels.len() != 2 {
|
||||||
return Some(f2);
|
return Some(f2);
|
||||||
}
|
}
|
||||||
if f2.channels.len() < f1.channels.len() {
|
|
||||||
return Some(f1);
|
|
||||||
}
|
|
||||||
if f2.channels.len() > 7 { // TODO: not proper
|
|
||||||
return Some(f1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if f1.samples_rate.0 < 44100 && f2.samples_rate.0 >= 44100 {
|
|
||||||
return Some(f2);
|
|
||||||
}
|
|
||||||
if f2.samples_rate.0 < 44100 && f1.samples_rate.0 >= 44100 {
|
|
||||||
return Some(f1);
|
|
||||||
}
|
|
||||||
|
|
||||||
Some(f1)
|
Some(f1)
|
||||||
}).expect("The endpoint doesn't support any format!?");
|
}).expect("The endpoint doesn't support any format!?");
|
||||||
|
|
Loading…
Reference in a new issue