Merge pull request #84 from tomaka/alsa-channels

Use correct ALSA channels
This commit is contained in:
tomaka 2015-12-15 17:49:42 +01:00
commit b049e80ca3
1 changed files with 4 additions and 1 deletions

View File

@ -139,7 +139,10 @@ impl Endpoint {
let max_channels = cmp::min(max_channels, 32); // TODO: limiting to 32 channels or too much stuff is returned
let supported_channels = (min_channels .. max_channels + 1).filter_map(|num| {
if alsa::snd_pcm_hw_params_test_channels(playback_handle, hw_params.0, num) == 0 {
Some(iter::repeat(ChannelPosition::FrontLeft).take(num as usize).collect::<Vec<_>>()) // FIXME:
Some([ChannelPosition::FrontLeft, ChannelPosition::FrontRight,
ChannelPosition::BackLeft, ChannelPosition::BackRight,
ChannelPosition::FrontCenter, ChannelPosition::LowFrequency]
.iter().take(num as usize).cloned().collect::<Vec<_>>())
} else {
None
}