2015-07-01 08:24:57 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2015 Andrew Kelley
|
|
|
|
*
|
|
|
|
* This file is part of libsoundio, which is MIT licensed.
|
|
|
|
* See http://opensource.org/licenses/MIT
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "soundio.hpp"
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
static struct SoundIoChannelLayout builtin_channel_layouts[] = {
|
2015-07-28 21:53:54 +00:00
|
|
|
[SoundIoChannelLayoutIdMono] = {
|
2015-07-01 08:24:57 +00:00
|
|
|
"Mono",
|
|
|
|
1,
|
|
|
|
{
|
|
|
|
SoundIoChannelIdFrontCenter,
|
|
|
|
},
|
|
|
|
},
|
2015-07-28 21:53:54 +00:00
|
|
|
[SoundIoChannelLayoutIdStereo] = {
|
2015-07-01 08:24:57 +00:00
|
|
|
"Stereo",
|
|
|
|
2,
|
|
|
|
{
|
|
|
|
SoundIoChannelIdFrontLeft,
|
|
|
|
SoundIoChannelIdFrontRight,
|
|
|
|
},
|
|
|
|
},
|
2015-07-28 21:53:54 +00:00
|
|
|
[SoundIoChannelLayoutId2Point1] = {
|
2015-07-01 08:24:57 +00:00
|
|
|
"2.1",
|
|
|
|
3,
|
|
|
|
{
|
|
|
|
SoundIoChannelIdFrontLeft,
|
|
|
|
SoundIoChannelIdFrontRight,
|
2015-07-10 06:35:58 +00:00
|
|
|
SoundIoChannelIdLfe,
|
2015-07-01 08:24:57 +00:00
|
|
|
},
|
|
|
|
},
|
2015-07-28 21:53:54 +00:00
|
|
|
[SoundIoChannelLayoutId3Point0] = {
|
2015-07-01 08:24:57 +00:00
|
|
|
"3.0",
|
|
|
|
3,
|
|
|
|
{
|
|
|
|
SoundIoChannelIdFrontLeft,
|
|
|
|
SoundIoChannelIdFrontRight,
|
|
|
|
SoundIoChannelIdFrontCenter,
|
|
|
|
}
|
|
|
|
},
|
2015-07-28 21:53:54 +00:00
|
|
|
[SoundIoChannelLayoutId3Point0Back] = {
|
2015-07-01 08:24:57 +00:00
|
|
|
"3.0 (back)",
|
|
|
|
3,
|
|
|
|
{
|
|
|
|
SoundIoChannelIdFrontLeft,
|
|
|
|
SoundIoChannelIdFrontRight,
|
|
|
|
SoundIoChannelIdBackCenter,
|
|
|
|
}
|
|
|
|
},
|
2015-07-28 21:53:54 +00:00
|
|
|
[SoundIoChannelLayoutId3Point1] = {
|
2015-07-01 08:24:57 +00:00
|
|
|
"3.1",
|
|
|
|
4,
|
|
|
|
{
|
|
|
|
SoundIoChannelIdFrontLeft,
|
|
|
|
SoundIoChannelIdFrontRight,
|
|
|
|
SoundIoChannelIdFrontCenter,
|
2015-07-10 06:35:58 +00:00
|
|
|
SoundIoChannelIdLfe,
|
2015-07-01 08:24:57 +00:00
|
|
|
}
|
|
|
|
},
|
2015-07-28 21:53:54 +00:00
|
|
|
[SoundIoChannelLayoutId4Point0] = {
|
2015-07-01 08:24:57 +00:00
|
|
|
"4.0",
|
|
|
|
4,
|
|
|
|
{
|
|
|
|
SoundIoChannelIdFrontLeft,
|
|
|
|
SoundIoChannelIdFrontRight,
|
|
|
|
SoundIoChannelIdFrontCenter,
|
|
|
|
SoundIoChannelIdBackCenter,
|
|
|
|
}
|
|
|
|
},
|
2015-07-28 21:53:54 +00:00
|
|
|
[SoundIoChannelLayoutIdQuad] = {
|
2015-07-01 08:24:57 +00:00
|
|
|
"Quad",
|
|
|
|
4,
|
|
|
|
{
|
|
|
|
SoundIoChannelIdFrontLeft,
|
|
|
|
SoundIoChannelIdFrontRight,
|
|
|
|
SoundIoChannelIdBackLeft,
|
|
|
|
SoundIoChannelIdBackRight,
|
|
|
|
},
|
|
|
|
},
|
2015-07-28 21:53:54 +00:00
|
|
|
[SoundIoChannelLayoutIdQuadSide] = {
|
2015-07-01 08:24:57 +00:00
|
|
|
"Quad (side)",
|
|
|
|
4,
|
|
|
|
{
|
|
|
|
SoundIoChannelIdFrontLeft,
|
|
|
|
SoundIoChannelIdFrontRight,
|
|
|
|
SoundIoChannelIdSideLeft,
|
|
|
|
SoundIoChannelIdSideRight,
|
|
|
|
}
|
|
|
|
},
|
2015-07-28 21:53:54 +00:00
|
|
|
[SoundIoChannelLayoutId4Point1] = {
|
2015-07-27 18:27:41 +00:00
|
|
|
"4.1",
|
|
|
|
5,
|
|
|
|
{
|
|
|
|
SoundIoChannelIdFrontLeft,
|
|
|
|
SoundIoChannelIdFrontRight,
|
|
|
|
SoundIoChannelIdFrontCenter,
|
|
|
|
SoundIoChannelIdBackCenter,
|
|
|
|
SoundIoChannelIdLfe,
|
|
|
|
}
|
|
|
|
},
|
2015-07-28 22:23:08 +00:00
|
|
|
[SoundIoChannelLayoutId5Point0Back] = {
|
|
|
|
"5.0 (back)",
|
2015-07-01 08:24:57 +00:00
|
|
|
5,
|
|
|
|
{
|
|
|
|
SoundIoChannelIdFrontLeft,
|
|
|
|
SoundIoChannelIdFrontRight,
|
|
|
|
SoundIoChannelIdFrontCenter,
|
2015-07-28 22:23:08 +00:00
|
|
|
SoundIoChannelIdBackLeft,
|
|
|
|
SoundIoChannelIdBackRight,
|
2015-07-01 08:24:57 +00:00
|
|
|
}
|
|
|
|
},
|
2015-07-28 22:23:08 +00:00
|
|
|
[SoundIoChannelLayoutId5Point0Side] = {
|
|
|
|
"5.0 (side)",
|
2015-07-01 08:24:57 +00:00
|
|
|
5,
|
|
|
|
{
|
|
|
|
SoundIoChannelIdFrontLeft,
|
|
|
|
SoundIoChannelIdFrontRight,
|
|
|
|
SoundIoChannelIdFrontCenter,
|
2015-07-28 22:23:08 +00:00
|
|
|
SoundIoChannelIdSideLeft,
|
|
|
|
SoundIoChannelIdSideRight,
|
2015-07-01 08:24:57 +00:00
|
|
|
}
|
|
|
|
},
|
2015-07-28 21:53:54 +00:00
|
|
|
[SoundIoChannelLayoutId5Point1] = {
|
2015-07-01 08:24:57 +00:00
|
|
|
"5.1",
|
|
|
|
6,
|
|
|
|
{
|
|
|
|
SoundIoChannelIdFrontLeft,
|
|
|
|
SoundIoChannelIdFrontRight,
|
|
|
|
SoundIoChannelIdFrontCenter,
|
|
|
|
SoundIoChannelIdSideLeft,
|
|
|
|
SoundIoChannelIdSideRight,
|
2015-07-10 06:35:58 +00:00
|
|
|
SoundIoChannelIdLfe,
|
2015-07-01 08:24:57 +00:00
|
|
|
}
|
|
|
|
},
|
2015-07-28 21:53:54 +00:00
|
|
|
[SoundIoChannelLayoutId5Point1Back] = {
|
2015-07-01 08:24:57 +00:00
|
|
|
"5.1 (back)",
|
|
|
|
6,
|
|
|
|
{
|
|
|
|
SoundIoChannelIdFrontLeft,
|
|
|
|
SoundIoChannelIdFrontRight,
|
|
|
|
SoundIoChannelIdFrontCenter,
|
|
|
|
SoundIoChannelIdBackLeft,
|
|
|
|
SoundIoChannelIdBackRight,
|
2015-07-10 06:35:58 +00:00
|
|
|
SoundIoChannelIdLfe,
|
2015-07-01 08:24:57 +00:00
|
|
|
}
|
|
|
|
},
|
2015-07-28 22:23:08 +00:00
|
|
|
[SoundIoChannelLayoutId6Point0Side] = {
|
|
|
|
"6.0 (side)",
|
2015-07-01 08:24:57 +00:00
|
|
|
6,
|
|
|
|
{
|
|
|
|
SoundIoChannelIdFrontLeft,
|
|
|
|
SoundIoChannelIdFrontRight,
|
|
|
|
SoundIoChannelIdFrontCenter,
|
|
|
|
SoundIoChannelIdSideLeft,
|
|
|
|
SoundIoChannelIdSideRight,
|
|
|
|
SoundIoChannelIdBackCenter,
|
|
|
|
}
|
|
|
|
},
|
2015-07-28 21:53:54 +00:00
|
|
|
[SoundIoChannelLayoutId6Point0Front] = {
|
2015-07-01 08:24:57 +00:00
|
|
|
"6.0 (front)",
|
|
|
|
6,
|
|
|
|
{
|
|
|
|
SoundIoChannelIdFrontLeft,
|
|
|
|
SoundIoChannelIdFrontRight,
|
|
|
|
SoundIoChannelIdSideLeft,
|
|
|
|
SoundIoChannelIdSideRight,
|
2015-07-10 06:35:58 +00:00
|
|
|
SoundIoChannelIdFrontLeftCenter,
|
|
|
|
SoundIoChannelIdFrontRightCenter,
|
2015-07-01 08:24:57 +00:00
|
|
|
}
|
|
|
|
},
|
2015-07-28 21:53:54 +00:00
|
|
|
[SoundIoChannelLayoutIdHexagonal] = {
|
2015-07-01 08:24:57 +00:00
|
|
|
"Hexagonal",
|
|
|
|
6,
|
|
|
|
{
|
|
|
|
SoundIoChannelIdFrontLeft,
|
|
|
|
SoundIoChannelIdFrontRight,
|
|
|
|
SoundIoChannelIdFrontCenter,
|
|
|
|
SoundIoChannelIdBackLeft,
|
|
|
|
SoundIoChannelIdBackRight,
|
|
|
|
SoundIoChannelIdBackCenter,
|
|
|
|
}
|
|
|
|
},
|
2015-07-28 21:53:54 +00:00
|
|
|
[SoundIoChannelLayoutId6Point1] = {
|
2015-07-01 08:24:57 +00:00
|
|
|
"6.1",
|
|
|
|
7,
|
|
|
|
{
|
|
|
|
SoundIoChannelIdFrontLeft,
|
|
|
|
SoundIoChannelIdFrontRight,
|
|
|
|
SoundIoChannelIdFrontCenter,
|
|
|
|
SoundIoChannelIdSideLeft,
|
|
|
|
SoundIoChannelIdSideRight,
|
|
|
|
SoundIoChannelIdBackCenter,
|
2015-07-10 06:35:58 +00:00
|
|
|
SoundIoChannelIdLfe,
|
2015-07-01 08:24:57 +00:00
|
|
|
}
|
|
|
|
},
|
2015-07-28 21:53:54 +00:00
|
|
|
[SoundIoChannelLayoutId6Point1Back] = {
|
2015-07-01 08:24:57 +00:00
|
|
|
"6.1 (back)",
|
|
|
|
7,
|
|
|
|
{
|
|
|
|
SoundIoChannelIdFrontLeft,
|
|
|
|
SoundIoChannelIdFrontRight,
|
|
|
|
SoundIoChannelIdFrontCenter,
|
|
|
|
SoundIoChannelIdBackLeft,
|
|
|
|
SoundIoChannelIdBackRight,
|
|
|
|
SoundIoChannelIdBackCenter,
|
2015-07-10 06:35:58 +00:00
|
|
|
SoundIoChannelIdLfe,
|
2015-07-01 08:24:57 +00:00
|
|
|
}
|
|
|
|
},
|
2015-07-28 21:53:54 +00:00
|
|
|
[SoundIoChannelLayoutId6Point1Front] = {
|
2015-07-01 08:24:57 +00:00
|
|
|
"6.1 (front)",
|
|
|
|
7,
|
|
|
|
{
|
|
|
|
SoundIoChannelIdFrontLeft,
|
|
|
|
SoundIoChannelIdFrontRight,
|
|
|
|
SoundIoChannelIdSideLeft,
|
|
|
|
SoundIoChannelIdSideRight,
|
2015-07-10 06:35:58 +00:00
|
|
|
SoundIoChannelIdFrontLeftCenter,
|
|
|
|
SoundIoChannelIdFrontRightCenter,
|
|
|
|
SoundIoChannelIdLfe,
|
2015-07-01 08:24:57 +00:00
|
|
|
}
|
|
|
|
},
|
2015-07-28 21:53:54 +00:00
|
|
|
[SoundIoChannelLayoutId7Point0] = {
|
2015-07-01 08:24:57 +00:00
|
|
|
"7.0",
|
|
|
|
7,
|
|
|
|
{
|
|
|
|
SoundIoChannelIdFrontLeft,
|
|
|
|
SoundIoChannelIdFrontRight,
|
|
|
|
SoundIoChannelIdFrontCenter,
|
|
|
|
SoundIoChannelIdSideLeft,
|
|
|
|
SoundIoChannelIdSideRight,
|
|
|
|
SoundIoChannelIdBackLeft,
|
|
|
|
SoundIoChannelIdBackRight,
|
|
|
|
}
|
|
|
|
},
|
2015-07-28 21:53:54 +00:00
|
|
|
[SoundIoChannelLayoutId7Point0Front] = {
|
2015-07-01 08:24:57 +00:00
|
|
|
"7.0 (front)",
|
|
|
|
7,
|
|
|
|
{
|
|
|
|
SoundIoChannelIdFrontLeft,
|
|
|
|
SoundIoChannelIdFrontRight,
|
|
|
|
SoundIoChannelIdFrontCenter,
|
|
|
|
SoundIoChannelIdSideLeft,
|
|
|
|
SoundIoChannelIdSideRight,
|
2015-07-10 06:35:58 +00:00
|
|
|
SoundIoChannelIdFrontLeftCenter,
|
|
|
|
SoundIoChannelIdFrontRightCenter,
|
2015-07-01 08:24:57 +00:00
|
|
|
}
|
|
|
|
},
|
2015-07-28 21:53:54 +00:00
|
|
|
[SoundIoChannelLayoutId7Point1] = {
|
2015-07-01 08:24:57 +00:00
|
|
|
"7.1",
|
|
|
|
8,
|
|
|
|
{
|
|
|
|
SoundIoChannelIdFrontLeft,
|
|
|
|
SoundIoChannelIdFrontRight,
|
|
|
|
SoundIoChannelIdFrontCenter,
|
|
|
|
SoundIoChannelIdSideLeft,
|
|
|
|
SoundIoChannelIdSideRight,
|
|
|
|
SoundIoChannelIdBackLeft,
|
|
|
|
SoundIoChannelIdBackRight,
|
2015-07-10 06:35:58 +00:00
|
|
|
SoundIoChannelIdLfe,
|
2015-07-01 08:24:57 +00:00
|
|
|
}
|
|
|
|
},
|
2015-07-28 21:53:54 +00:00
|
|
|
[SoundIoChannelLayoutId7Point1Wide] = {
|
2015-07-01 08:24:57 +00:00
|
|
|
"7.1 (wide)",
|
|
|
|
8,
|
|
|
|
{
|
|
|
|
SoundIoChannelIdFrontLeft,
|
|
|
|
SoundIoChannelIdFrontRight,
|
|
|
|
SoundIoChannelIdFrontCenter,
|
|
|
|
SoundIoChannelIdSideLeft,
|
|
|
|
SoundIoChannelIdSideRight,
|
2015-07-10 06:35:58 +00:00
|
|
|
SoundIoChannelIdFrontLeftCenter,
|
|
|
|
SoundIoChannelIdFrontRightCenter,
|
|
|
|
SoundIoChannelIdLfe,
|
2015-07-01 08:24:57 +00:00
|
|
|
}
|
|
|
|
},
|
2015-07-28 21:53:54 +00:00
|
|
|
[SoundIoChannelLayoutId7Point1WideBack] = {
|
2015-07-01 08:24:57 +00:00
|
|
|
"7.1 (wide) (back)",
|
|
|
|
8,
|
|
|
|
{
|
|
|
|
SoundIoChannelIdFrontLeft,
|
|
|
|
SoundIoChannelIdFrontRight,
|
|
|
|
SoundIoChannelIdFrontCenter,
|
|
|
|
SoundIoChannelIdBackLeft,
|
|
|
|
SoundIoChannelIdBackRight,
|
2015-07-10 06:35:58 +00:00
|
|
|
SoundIoChannelIdFrontLeftCenter,
|
|
|
|
SoundIoChannelIdFrontRightCenter,
|
|
|
|
SoundIoChannelIdLfe,
|
2015-07-01 08:24:57 +00:00
|
|
|
}
|
|
|
|
},
|
2015-07-28 21:53:54 +00:00
|
|
|
[SoundIoChannelLayoutIdOctagonal] = {
|
2015-07-01 08:24:57 +00:00
|
|
|
"Octagonal",
|
|
|
|
8,
|
|
|
|
{
|
|
|
|
SoundIoChannelIdFrontLeft,
|
|
|
|
SoundIoChannelIdFrontRight,
|
|
|
|
SoundIoChannelIdFrontCenter,
|
|
|
|
SoundIoChannelIdSideLeft,
|
|
|
|
SoundIoChannelIdSideRight,
|
|
|
|
SoundIoChannelIdBackLeft,
|
|
|
|
SoundIoChannelIdBackRight,
|
|
|
|
SoundIoChannelIdBackCenter,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2015-07-28 21:53:54 +00:00
|
|
|
static const int channel_name_alias_count = 3;
|
|
|
|
static const char *channel_names[][channel_name_alias_count] = {
|
|
|
|
[SoundIoChannelIdInvalid] = {
|
|
|
|
"(Invalid Channel)",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdFrontLeft] = {
|
|
|
|
"Front Left",
|
|
|
|
"FL",
|
|
|
|
"front-left",
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdFrontRight] = {
|
|
|
|
"Front Right",
|
|
|
|
"FR",
|
|
|
|
"front-right",
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdFrontCenter] = {
|
|
|
|
"Front Center",
|
|
|
|
"FC",
|
|
|
|
"front-center",
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdLfe] = {
|
|
|
|
"LFE",
|
|
|
|
"LFE",
|
|
|
|
"lfe",
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdBackLeft] = {
|
|
|
|
"Back Left",
|
|
|
|
"BL",
|
|
|
|
"rear-left",
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdBackRight] = {
|
|
|
|
"Back Right",
|
|
|
|
"BR",
|
|
|
|
"rear-right",
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdFrontLeftCenter] = {
|
|
|
|
"Front Left Center",
|
|
|
|
"FLC",
|
|
|
|
"front-left-of-center",
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdFrontRightCenter] = {
|
|
|
|
"Front Right Center",
|
|
|
|
"FRC",
|
|
|
|
"front-right-of-center",
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdBackCenter] = {
|
|
|
|
"Back Center",
|
|
|
|
"BC",
|
|
|
|
"rear-center",
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdSideLeft] = {
|
|
|
|
"Side Left",
|
|
|
|
"SL",
|
|
|
|
"side-left",
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdSideRight] = {
|
|
|
|
"Side Right",
|
|
|
|
"SR",
|
|
|
|
"side-right",
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdTopCenter] = {
|
|
|
|
"Top Center",
|
|
|
|
"TC",
|
|
|
|
"top-center",
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdTopFrontLeft] = {
|
|
|
|
"Top Front Left",
|
|
|
|
"TFL",
|
|
|
|
"top-front-left",
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdTopFrontCenter] = {
|
|
|
|
"Top Front Center",
|
|
|
|
"TFC",
|
|
|
|
"top-front-center",
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdTopFrontRight] = {
|
|
|
|
"Top Front Right",
|
|
|
|
"TFR",
|
|
|
|
"top-front-right",
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdTopBackLeft] = {
|
|
|
|
"Top Back Left",
|
|
|
|
"TBL",
|
|
|
|
"top-rear-left",
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdTopBackCenter] = {
|
|
|
|
"Top Back Center",
|
|
|
|
"TBC",
|
|
|
|
"top-rear-center",
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdTopBackRight] = {
|
|
|
|
"Top Back Right",
|
|
|
|
"TBR",
|
|
|
|
"top-rear-right",
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdBackLeftCenter] = {
|
|
|
|
"Back Left Center",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdBackRightCenter] = {
|
|
|
|
"Back Right Center",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdFrontLeftWide] = {
|
|
|
|
"Front Left Wide",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdFrontRightWide] = {
|
|
|
|
"Front Right Wide",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdFrontLeftHigh] = {
|
|
|
|
"Front Left High",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdFrontCenterHigh] = {
|
|
|
|
"Front Center High",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdFrontRightHigh] = {
|
|
|
|
"Front Right High",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdTopFrontLeftCenter] = {
|
|
|
|
"Top Front Left Center",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdTopFrontRightCenter] = {
|
|
|
|
"Top Front Right Center",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdTopSideLeft] = {
|
|
|
|
"Top Side Left",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdTopSideRight] = {
|
|
|
|
"Top Side Right",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdLeftLfe] = {
|
|
|
|
"Left LFE",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdRightLfe] = {
|
|
|
|
"Right LFE",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
2015-08-02 05:40:55 +00:00
|
|
|
[SoundIoChannelIdLfe2] = {
|
|
|
|
"LFE 2",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
2015-07-28 21:53:54 +00:00
|
|
|
[SoundIoChannelIdBottomCenter] = {
|
|
|
|
"Bottom Center",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdBottomLeftCenter] = {
|
|
|
|
"Bottom Left Center",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdBottomRightCenter] = {
|
|
|
|
"Bottom Right Center",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
2015-08-02 05:40:55 +00:00
|
|
|
[SoundIoChannelIdMsMid] = {
|
|
|
|
"Mid/Side Mid",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdMsSide] = {
|
|
|
|
"Mid/Side Side",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdAmbisonicW] = {
|
|
|
|
"Ambisonic W",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdAmbisonicX] = {
|
|
|
|
"Ambisonic X",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdAmbisonicY] = {
|
|
|
|
"Ambisonic Y",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdAmbisonicZ] = {
|
|
|
|
"Ambisonic Z",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdXyX] = {
|
|
|
|
"X-Y X",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdXyY] = {
|
|
|
|
"X-Y Y",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdHeadphonesLeft] = {
|
|
|
|
"Headphones Left",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdHeadphonesRight] = {
|
|
|
|
"Headphones Right",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdClickTrack] = {
|
|
|
|
"Click Track",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdForeignLanguage] = {
|
|
|
|
"Foreign Language",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdHearingImpaired] = {
|
|
|
|
"Hearing Impaired",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdNarration] = {
|
|
|
|
"Narration",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdHaptic] = {
|
|
|
|
"Haptic",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdDialogCentricMix] = {
|
|
|
|
"Dialog Centric Mix",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdAux] = {
|
|
|
|
"Aux",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdAux0] = {
|
|
|
|
"Aux 0",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdAux1] = {
|
|
|
|
"Aux 1",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdAux2] = {
|
|
|
|
"Aux 2",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdAux3] = {
|
|
|
|
"Aux 3",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdAux4] = {
|
|
|
|
"Aux 4",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdAux5] = {
|
|
|
|
"Aux 5",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdAux6] = {
|
|
|
|
"Aux 6",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdAux7] = {
|
|
|
|
"Aux 7",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdAux8] = {
|
|
|
|
"Aux 8",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdAux9] = {
|
|
|
|
"Aux 9",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdAux10] = {
|
|
|
|
"Aux 10",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdAux11] = {
|
|
|
|
"Aux 11",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdAux12] = {
|
|
|
|
"Aux 12",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdAux13] = {
|
|
|
|
"Aux 13",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdAux14] = {
|
|
|
|
"Aux 14",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
|
|
|
[SoundIoChannelIdAux15] = {
|
|
|
|
"Aux 15",
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
},
|
2015-07-28 21:53:54 +00:00
|
|
|
};
|
2015-07-01 08:24:57 +00:00
|
|
|
|
2015-07-28 21:53:54 +00:00
|
|
|
const char *soundio_get_channel_name(enum SoundIoChannelId id) {
|
|
|
|
if (id < 0 || id > array_length(channel_names))
|
|
|
|
return "(Invalid Channel)";
|
|
|
|
else
|
|
|
|
return channel_names[id][0];
|
2015-07-01 08:24:57 +00:00
|
|
|
}
|
|
|
|
|
2015-07-10 06:35:58 +00:00
|
|
|
bool soundio_channel_layout_equal(
|
|
|
|
const struct SoundIoChannelLayout *a,
|
|
|
|
const struct SoundIoChannelLayout *b)
|
|
|
|
{
|
|
|
|
if (a->channel_count != b->channel_count)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
for (int i = 0; i < a->channel_count; i += 1) {
|
|
|
|
if (a->channels[i] != b->channels[i])
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-07-01 08:24:57 +00:00
|
|
|
int soundio_channel_layout_builtin_count(void) {
|
|
|
|
return array_length(builtin_channel_layouts);
|
|
|
|
}
|
|
|
|
|
|
|
|
const struct SoundIoChannelLayout *soundio_channel_layout_get_builtin(int index) {
|
|
|
|
assert(index >= 0);
|
|
|
|
assert(index <= array_length(builtin_channel_layouts));
|
|
|
|
return &builtin_channel_layouts[index];
|
|
|
|
}
|
|
|
|
|
|
|
|
int soundio_channel_layout_find_channel(
|
|
|
|
const struct SoundIoChannelLayout *layout, enum SoundIoChannelId channel)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < layout->channel_count; i += 1) {
|
|
|
|
if (layout->channels[i] == channel)
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2015-07-10 06:35:58 +00:00
|
|
|
bool soundio_channel_layout_detect_builtin(struct SoundIoChannelLayout *layout) {
|
|
|
|
for (int i = 0; i < array_length(builtin_channel_layouts); i += 1) {
|
|
|
|
const struct SoundIoChannelLayout *builtin_layout = &builtin_channel_layouts[i];
|
|
|
|
if (soundio_channel_layout_equal(builtin_layout, layout)) {
|
|
|
|
layout->name = builtin_layout->name;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2015-07-13 16:17:20 +00:00
|
|
|
layout->name = nullptr;
|
2015-07-10 06:35:58 +00:00
|
|
|
return false;
|
|
|
|
}
|
2015-07-27 18:27:41 +00:00
|
|
|
|
|
|
|
const struct SoundIoChannelLayout *soundio_channel_layout_get_default(int channel_count) {
|
|
|
|
switch (channel_count) {
|
|
|
|
case 1: return soundio_channel_layout_get_builtin(SoundIoChannelLayoutIdMono);
|
|
|
|
case 2: return soundio_channel_layout_get_builtin(SoundIoChannelLayoutIdStereo);
|
2015-07-28 22:23:08 +00:00
|
|
|
case 3: return soundio_channel_layout_get_builtin(SoundIoChannelLayoutId3Point0);
|
|
|
|
case 4: return soundio_channel_layout_get_builtin(SoundIoChannelLayoutId4Point0);
|
|
|
|
case 5: return soundio_channel_layout_get_builtin(SoundIoChannelLayoutId5Point0Back);
|
|
|
|
case 6: return soundio_channel_layout_get_builtin(SoundIoChannelLayoutId5Point1Back);
|
2015-07-27 18:27:41 +00:00
|
|
|
case 7: return soundio_channel_layout_get_builtin(SoundIoChannelLayoutId6Point1);
|
|
|
|
case 8: return soundio_channel_layout_get_builtin(SoundIoChannelLayoutId7Point1);
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|
2015-07-28 18:28:07 +00:00
|
|
|
|
|
|
|
enum SoundIoChannelId soundio_parse_channel_id(const char *str, int str_len) {
|
2015-07-28 21:53:54 +00:00
|
|
|
for (int id = 0; id < array_length(channel_names); id += 1) {
|
|
|
|
for (int i = 0; i < channel_name_alias_count; i += 1) {
|
|
|
|
const char *alias = channel_names[id][i];
|
|
|
|
if (!alias)
|
|
|
|
break;
|
|
|
|
int alias_len = strlen(alias);
|
|
|
|
if (soundio_streql(alias, alias_len, str, str_len))
|
|
|
|
return (SoundIoChannelId)id;
|
|
|
|
}
|
|
|
|
}
|
2015-07-28 18:28:07 +00:00
|
|
|
return SoundIoChannelIdInvalid;
|
|
|
|
}
|