aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cubeb_mixer.cpp
diff options
context:
space:
mode:
authorPaul Adenot <[email protected]>2017-04-25 15:02:32 +0200
committerGitHub <[email protected]>2017-04-25 15:02:32 +0200
commitaf965ff7bcafa9c4b1f79a2a297c72d763a77125 (patch)
tree726d490525eb117709529b3d1c1997380b4abdc0 /src/cubeb_mixer.cpp
parente5e8e812cd369018318ac282006cc3182b549a08 (diff)
downloadcubeb-af965ff7bcafa9c4b1f79a2a297c72d763a77125.tar.gz
cubeb-af965ff7bcafa9c4b1f79a2a297c72d763a77125.zip
Make cubeb work with high channel count devices (#288)
* Bail if the device has too many channels. If the device on the host where we're trying to open an audio stream has too many channels, just bail instead of trashing the memory in the loop just below. * Allow using audio output devices that have up to 256 channels. In particular, this allows using sound cards that have more than 8 channels (7.1), for musical purposes, and allows using the 64 output channels of SoundFlower, for testing and also advanced musical use-cases. If we are in a topology that has more than 8 channels, the other channels are considered unmapped, i.e. it's just a channel without a specific speaker assignation. This is useful for custom setups, such as wave field synthesis, or other creative applications. * Address chunmin and achronop comments.
Diffstat (limited to 'src/cubeb_mixer.cpp')
-rw-r--r--src/cubeb_mixer.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/cubeb_mixer.cpp b/src/cubeb_mixer.cpp
index 32f7e66..f9ac3e7 100644
--- a/src/cubeb_mixer.cpp
+++ b/src/cubeb_mixer.cpp
@@ -31,7 +31,8 @@ cubeb_channel_layout cubeb_channel_map_to_layout(cubeb_channel_map const * chann
{
uint32_t channel_mask = 0;
for (uint8_t i = 0 ; i < channel_map->channels ; ++i) {
- if (channel_map->map[i] == CHANNEL_INVALID) {
+ if (channel_map->map[i] == CHANNEL_INVALID ||
+ channel_map->map[i] == CHANNEL_UNMAPPED) {
return CUBEB_LAYOUT_UNDEFINED;
}
channel_mask |= 1 << channel_map->map[i];