Do not use C99 array initialization syntax.

This commit is contained in:
Raphaël Londeix 2015-12-07 03:23:34 +01:00
parent aa3749a062
commit d1eb1d8042
2 changed files with 283 additions and 419 deletions

View file

@ -9,23 +9,25 @@
#include <stdio.h> #include <stdio.h>
static struct SoundIoChannelLayout builtin_channel_layouts[] = { static struct SoundIoChannelLayout *make_builtin_channel_layouts()
[SoundIoChannelLayoutIdMono] = { {
static struct SoundIoChannelLayout layouts[SoundIoChannelLayoutIdMax];
layouts[SoundIoChannelLayoutIdMono] = {
"Mono", "Mono",
1, 1,
{ {
SoundIoChannelIdFrontCenter, SoundIoChannelIdFrontCenter,
}, },
}, };
[SoundIoChannelLayoutIdStereo] = { layouts[SoundIoChannelLayoutIdStereo] = {
"Stereo", "Stereo",
2, 2,
{ {
SoundIoChannelIdFrontLeft, SoundIoChannelIdFrontLeft,
SoundIoChannelIdFrontRight, SoundIoChannelIdFrontRight,
}, },
}, };
[SoundIoChannelLayoutId2Point1] = { layouts[SoundIoChannelLayoutId2Point1] = {
"2.1", "2.1",
3, 3,
{ {
@ -33,8 +35,8 @@ static struct SoundIoChannelLayout builtin_channel_layouts[] = {
SoundIoChannelIdFrontRight, SoundIoChannelIdFrontRight,
SoundIoChannelIdLfe, SoundIoChannelIdLfe,
}, },
}, };
[SoundIoChannelLayoutId3Point0] = { layouts[SoundIoChannelLayoutId3Point0] = {
"3.0", "3.0",
3, 3,
{ {
@ -42,8 +44,8 @@ static struct SoundIoChannelLayout builtin_channel_layouts[] = {
SoundIoChannelIdFrontRight, SoundIoChannelIdFrontRight,
SoundIoChannelIdFrontCenter, SoundIoChannelIdFrontCenter,
} }
}, };
[SoundIoChannelLayoutId3Point0Back] = { layouts[SoundIoChannelLayoutId3Point0Back] = {
"3.0 (back)", "3.0 (back)",
3, 3,
{ {
@ -51,8 +53,8 @@ static struct SoundIoChannelLayout builtin_channel_layouts[] = {
SoundIoChannelIdFrontRight, SoundIoChannelIdFrontRight,
SoundIoChannelIdBackCenter, SoundIoChannelIdBackCenter,
} }
}, };
[SoundIoChannelLayoutId3Point1] = { layouts[SoundIoChannelLayoutId3Point1] = {
"3.1", "3.1",
4, 4,
{ {
@ -61,8 +63,8 @@ static struct SoundIoChannelLayout builtin_channel_layouts[] = {
SoundIoChannelIdFrontCenter, SoundIoChannelIdFrontCenter,
SoundIoChannelIdLfe, SoundIoChannelIdLfe,
} }
}, };
[SoundIoChannelLayoutId4Point0] = { layouts[SoundIoChannelLayoutId4Point0] = {
"4.0", "4.0",
4, 4,
{ {
@ -71,8 +73,8 @@ static struct SoundIoChannelLayout builtin_channel_layouts[] = {
SoundIoChannelIdFrontCenter, SoundIoChannelIdFrontCenter,
SoundIoChannelIdBackCenter, SoundIoChannelIdBackCenter,
} }
}, };
[SoundIoChannelLayoutIdQuad] = { layouts[SoundIoChannelLayoutIdQuad] = {
"Quad", "Quad",
4, 4,
{ {
@ -81,8 +83,8 @@ static struct SoundIoChannelLayout builtin_channel_layouts[] = {
SoundIoChannelIdBackLeft, SoundIoChannelIdBackLeft,
SoundIoChannelIdBackRight, SoundIoChannelIdBackRight,
}, },
}, };
[SoundIoChannelLayoutIdQuadSide] = { layouts[SoundIoChannelLayoutIdQuadSide] = {
"Quad (side)", "Quad (side)",
4, 4,
{ {
@ -91,8 +93,8 @@ static struct SoundIoChannelLayout builtin_channel_layouts[] = {
SoundIoChannelIdSideLeft, SoundIoChannelIdSideLeft,
SoundIoChannelIdSideRight, SoundIoChannelIdSideRight,
} }
}, };
[SoundIoChannelLayoutId4Point1] = { layouts[SoundIoChannelLayoutId4Point1] = {
"4.1", "4.1",
5, 5,
{ {
@ -102,8 +104,8 @@ static struct SoundIoChannelLayout builtin_channel_layouts[] = {
SoundIoChannelIdBackCenter, SoundIoChannelIdBackCenter,
SoundIoChannelIdLfe, SoundIoChannelIdLfe,
} }
}, };
[SoundIoChannelLayoutId5Point0Back] = { layouts[SoundIoChannelLayoutId5Point0Back] = {
"5.0 (back)", "5.0 (back)",
5, 5,
{ {
@ -113,8 +115,8 @@ static struct SoundIoChannelLayout builtin_channel_layouts[] = {
SoundIoChannelIdBackLeft, SoundIoChannelIdBackLeft,
SoundIoChannelIdBackRight, SoundIoChannelIdBackRight,
} }
}, };
[SoundIoChannelLayoutId5Point0Side] = { layouts[SoundIoChannelLayoutId5Point0Side] = {
"5.0 (side)", "5.0 (side)",
5, 5,
{ {
@ -124,8 +126,8 @@ static struct SoundIoChannelLayout builtin_channel_layouts[] = {
SoundIoChannelIdSideLeft, SoundIoChannelIdSideLeft,
SoundIoChannelIdSideRight, SoundIoChannelIdSideRight,
} }
}, };
[SoundIoChannelLayoutId5Point1] = { layouts[SoundIoChannelLayoutId5Point1] = {
"5.1", "5.1",
6, 6,
{ {
@ -136,8 +138,8 @@ static struct SoundIoChannelLayout builtin_channel_layouts[] = {
SoundIoChannelIdSideRight, SoundIoChannelIdSideRight,
SoundIoChannelIdLfe, SoundIoChannelIdLfe,
} }
}, };
[SoundIoChannelLayoutId5Point1Back] = { layouts[SoundIoChannelLayoutId5Point1Back] = {
"5.1 (back)", "5.1 (back)",
6, 6,
{ {
@ -148,8 +150,8 @@ static struct SoundIoChannelLayout builtin_channel_layouts[] = {
SoundIoChannelIdBackRight, SoundIoChannelIdBackRight,
SoundIoChannelIdLfe, SoundIoChannelIdLfe,
} }
}, };
[SoundIoChannelLayoutId6Point0Side] = { layouts[SoundIoChannelLayoutId6Point0Side] = {
"6.0 (side)", "6.0 (side)",
6, 6,
{ {
@ -160,8 +162,8 @@ static struct SoundIoChannelLayout builtin_channel_layouts[] = {
SoundIoChannelIdSideRight, SoundIoChannelIdSideRight,
SoundIoChannelIdBackCenter, SoundIoChannelIdBackCenter,
} }
}, };
[SoundIoChannelLayoutId6Point0Front] = { layouts[SoundIoChannelLayoutId6Point0Front] = {
"6.0 (front)", "6.0 (front)",
6, 6,
{ {
@ -172,8 +174,8 @@ static struct SoundIoChannelLayout builtin_channel_layouts[] = {
SoundIoChannelIdFrontLeftCenter, SoundIoChannelIdFrontLeftCenter,
SoundIoChannelIdFrontRightCenter, SoundIoChannelIdFrontRightCenter,
} }
}, };
[SoundIoChannelLayoutIdHexagonal] = { layouts[SoundIoChannelLayoutIdHexagonal] = {
"Hexagonal", "Hexagonal",
6, 6,
{ {
@ -184,8 +186,8 @@ static struct SoundIoChannelLayout builtin_channel_layouts[] = {
SoundIoChannelIdBackRight, SoundIoChannelIdBackRight,
SoundIoChannelIdBackCenter, SoundIoChannelIdBackCenter,
} }
}, };
[SoundIoChannelLayoutId6Point1] = { layouts[SoundIoChannelLayoutId6Point1] = {
"6.1", "6.1",
7, 7,
{ {
@ -197,8 +199,8 @@ static struct SoundIoChannelLayout builtin_channel_layouts[] = {
SoundIoChannelIdBackCenter, SoundIoChannelIdBackCenter,
SoundIoChannelIdLfe, SoundIoChannelIdLfe,
} }
}, };
[SoundIoChannelLayoutId6Point1Back] = { layouts[SoundIoChannelLayoutId6Point1Back] = {
"6.1 (back)", "6.1 (back)",
7, 7,
{ {
@ -210,8 +212,8 @@ static struct SoundIoChannelLayout builtin_channel_layouts[] = {
SoundIoChannelIdBackCenter, SoundIoChannelIdBackCenter,
SoundIoChannelIdLfe, SoundIoChannelIdLfe,
} }
}, };
[SoundIoChannelLayoutId6Point1Front] = { layouts[SoundIoChannelLayoutId6Point1Front] = {
"6.1 (front)", "6.1 (front)",
7, 7,
{ {
@ -223,8 +225,8 @@ static struct SoundIoChannelLayout builtin_channel_layouts[] = {
SoundIoChannelIdFrontRightCenter, SoundIoChannelIdFrontRightCenter,
SoundIoChannelIdLfe, SoundIoChannelIdLfe,
} }
}, };
[SoundIoChannelLayoutId7Point0] = { layouts[SoundIoChannelLayoutId7Point0] = {
"7.0", "7.0",
7, 7,
{ {
@ -236,8 +238,8 @@ static struct SoundIoChannelLayout builtin_channel_layouts[] = {
SoundIoChannelIdBackLeft, SoundIoChannelIdBackLeft,
SoundIoChannelIdBackRight, SoundIoChannelIdBackRight,
} }
}, };
[SoundIoChannelLayoutId7Point0Front] = { layouts[SoundIoChannelLayoutId7Point0Front] = {
"7.0 (front)", "7.0 (front)",
7, 7,
{ {
@ -249,8 +251,8 @@ static struct SoundIoChannelLayout builtin_channel_layouts[] = {
SoundIoChannelIdFrontLeftCenter, SoundIoChannelIdFrontLeftCenter,
SoundIoChannelIdFrontRightCenter, SoundIoChannelIdFrontRightCenter,
} }
}, };
[SoundIoChannelLayoutId7Point1] = { layouts[SoundIoChannelLayoutId7Point1] = {
"7.1", "7.1",
8, 8,
{ {
@ -263,8 +265,8 @@ static struct SoundIoChannelLayout builtin_channel_layouts[] = {
SoundIoChannelIdBackRight, SoundIoChannelIdBackRight,
SoundIoChannelIdLfe, SoundIoChannelIdLfe,
} }
}, };
[SoundIoChannelLayoutId7Point1Wide] = { layouts[SoundIoChannelLayoutId7Point1Wide] = {
"7.1 (wide)", "7.1 (wide)",
8, 8,
{ {
@ -277,8 +279,8 @@ static struct SoundIoChannelLayout builtin_channel_layouts[] = {
SoundIoChannelIdFrontRightCenter, SoundIoChannelIdFrontRightCenter,
SoundIoChannelIdLfe, SoundIoChannelIdLfe,
} }
}, };
[SoundIoChannelLayoutId7Point1WideBack] = { layouts[SoundIoChannelLayoutId7Point1WideBack] = {
"7.1 (wide) (back)", "7.1 (wide) (back)",
8, 8,
{ {
@ -291,8 +293,8 @@ static struct SoundIoChannelLayout builtin_channel_layouts[] = {
SoundIoChannelIdFrontRightCenter, SoundIoChannelIdFrontRightCenter,
SoundIoChannelIdLfe, SoundIoChannelIdLfe,
} }
}, };
[SoundIoChannelLayoutIdOctagonal] = { layouts[SoundIoChannelLayoutIdOctagonal] = {
"Octagonal", "Octagonal",
8, 8,
{ {
@ -305,357 +307,226 @@ static struct SoundIoChannelLayout builtin_channel_layouts[] = {
SoundIoChannelIdBackRight, SoundIoChannelIdBackRight,
SoundIoChannelIdBackCenter, SoundIoChannelIdBackCenter,
} }
}, };
return &layouts[0];
}; };
static struct SoundIoChannelLayout *builtin_channel_layouts = make_builtin_channel_layouts();
#define CHANNEL_NAME_ALIAS_COUNT 3 #define CHANNEL_NAME_ALIAS_COUNT 3
static const char *channel_names[][CHANNEL_NAME_ALIAS_COUNT] = { typedef const char *channel_names_t[CHANNEL_NAME_ALIAS_COUNT];
[SoundIoChannelIdInvalid] = { static channel_names_t *make_channel_names()
"(Invalid Channel)", {
NULL, static channel_names_t names[SoundIoChannelIdMax];
NULL, names[SoundIoChannelIdInvalid][0] = "(Invalid Channel)";
}, names[SoundIoChannelIdInvalid][1] = NULL;
[SoundIoChannelIdFrontLeft] = { names[SoundIoChannelIdInvalid][2] = NULL;
"Front Left", names[SoundIoChannelIdFrontLeft][0] = "Front Left";
"FL", names[SoundIoChannelIdFrontLeft][1] = "FL";
"front-left", names[SoundIoChannelIdFrontLeft][2] = "front-left";
}, names[SoundIoChannelIdFrontRight][0] = "Front Right";
[SoundIoChannelIdFrontRight] = { names[SoundIoChannelIdFrontRight][1] = "FR";
"Front Right", names[SoundIoChannelIdFrontRight][2] = "front-right";
"FR", names[SoundIoChannelIdFrontCenter][0] = "Front Center";
"front-right", names[SoundIoChannelIdFrontCenter][1] = "FC";
}, names[SoundIoChannelIdFrontCenter][2] = "front-center";
[SoundIoChannelIdFrontCenter] = { names[SoundIoChannelIdLfe][0] = "LFE";
"Front Center", names[SoundIoChannelIdLfe][1] = "LFE";
"FC", names[SoundIoChannelIdLfe][2] = "lfe";
"front-center", names[SoundIoChannelIdBackLeft][0] = "Back Left";
}, names[SoundIoChannelIdBackLeft][1] = "BL";
[SoundIoChannelIdLfe] = { names[SoundIoChannelIdBackLeft][2] = "rear-left";
"LFE", names[SoundIoChannelIdBackRight][0] = "Back Right";
"LFE", names[SoundIoChannelIdBackRight][1] = "BR";
"lfe", names[SoundIoChannelIdBackRight][2] = "rear-right";
}, names[SoundIoChannelIdFrontLeftCenter][0] = "Front Left Center";
[SoundIoChannelIdBackLeft] = { names[SoundIoChannelIdFrontLeftCenter][1] = "FLC";
"Back Left", names[SoundIoChannelIdFrontLeftCenter][2] = "front-left-of-center";
"BL", names[SoundIoChannelIdFrontRightCenter][0] = "Front Right Center";
"rear-left", names[SoundIoChannelIdFrontRightCenter][1] = "FRC";
}, names[SoundIoChannelIdFrontRightCenter][2] = "front-right-of-center";
[SoundIoChannelIdBackRight] = { names[SoundIoChannelIdBackCenter][0] = "Back Center";
"Back Right", names[SoundIoChannelIdBackCenter][1] = "BC";
"BR", names[SoundIoChannelIdBackCenter][2] = "rear-center";
"rear-right", names[SoundIoChannelIdSideLeft][0] = "Side Left";
}, names[SoundIoChannelIdSideLeft][1] = "SL";
[SoundIoChannelIdFrontLeftCenter] = { names[SoundIoChannelIdSideLeft][2] = "side-left";
"Front Left Center", names[SoundIoChannelIdSideRight][0] = "Side Right";
"FLC", names[SoundIoChannelIdSideRight][1] = "SR";
"front-left-of-center", names[SoundIoChannelIdSideRight][2] = "side-right";
}, names[SoundIoChannelIdTopCenter][0] = "Top Center";
[SoundIoChannelIdFrontRightCenter] = { names[SoundIoChannelIdTopCenter][1] = "TC";
"Front Right Center", names[SoundIoChannelIdTopCenter][2] = "top-center";
"FRC", names[SoundIoChannelIdTopFrontLeft][0] = "Top Front Left";
"front-right-of-center", names[SoundIoChannelIdTopFrontLeft][1] = "TFL";
}, names[SoundIoChannelIdTopFrontLeft][2] = "top-front-left";
[SoundIoChannelIdBackCenter] = { names[SoundIoChannelIdTopFrontCenter][0] = "Top Front Center";
"Back Center", names[SoundIoChannelIdTopFrontCenter][1] = "TFC";
"BC", names[SoundIoChannelIdTopFrontCenter][2] = "top-front-center";
"rear-center", names[SoundIoChannelIdTopFrontRight][0] = "Top Front Right";
}, names[SoundIoChannelIdTopFrontRight][1] = "TFR";
[SoundIoChannelIdSideLeft] = { names[SoundIoChannelIdTopFrontRight][2] = "top-front-right";
"Side Left", names[SoundIoChannelIdTopBackLeft][0] = "Top Back Left";
"SL", names[SoundIoChannelIdTopBackLeft][1] = "TBL";
"side-left", names[SoundIoChannelIdTopBackLeft][2] = "top-rear-left";
}, names[SoundIoChannelIdTopBackCenter][0] = "Top Back Center";
[SoundIoChannelIdSideRight] = { names[SoundIoChannelIdTopBackCenter][1] = "TBC";
"Side Right", names[SoundIoChannelIdTopBackCenter][2] = "top-rear-center";
"SR", names[SoundIoChannelIdTopBackRight][0] = "Top Back Right";
"side-right", names[SoundIoChannelIdTopBackRight][1] = "TBR";
}, names[SoundIoChannelIdTopBackRight][2] = "top-rear-right";
[SoundIoChannelIdTopCenter] = { names[SoundIoChannelIdBackLeftCenter][0] = "Back Left Center";
"Top Center", names[SoundIoChannelIdBackLeftCenter][1] = NULL;
"TC", names[SoundIoChannelIdBackLeftCenter][2] = NULL;
"top-center", names[SoundIoChannelIdBackRightCenter][0] = "Back Right Center";
}, names[SoundIoChannelIdBackRightCenter][1] = NULL;
[SoundIoChannelIdTopFrontLeft] = { names[SoundIoChannelIdBackRightCenter][2] = NULL;
"Top Front Left", names[SoundIoChannelIdFrontLeftWide][0] = "Front Left Wide";
"TFL", names[SoundIoChannelIdFrontLeftWide][1] = NULL;
"top-front-left", names[SoundIoChannelIdFrontLeftWide][2] = NULL;
}, names[SoundIoChannelIdFrontRightWide][0] = "Front Right Wide";
[SoundIoChannelIdTopFrontCenter] = { names[SoundIoChannelIdFrontRightWide][1] = NULL;
"Top Front Center", names[SoundIoChannelIdFrontRightWide][2] = NULL;
"TFC", names[SoundIoChannelIdFrontLeftHigh][0] = "Front Left High";
"top-front-center", names[SoundIoChannelIdFrontLeftHigh][1] = NULL;
}, names[SoundIoChannelIdFrontLeftHigh][2] = NULL;
[SoundIoChannelIdTopFrontRight] = { names[SoundIoChannelIdFrontCenterHigh][0] = "Front Center High";
"Top Front Right", names[SoundIoChannelIdFrontCenterHigh][1] = NULL;
"TFR", names[SoundIoChannelIdFrontCenterHigh][2] = NULL;
"top-front-right", names[SoundIoChannelIdFrontRightHigh][0] = "Front Right High";
}, names[SoundIoChannelIdFrontRightHigh][1] = NULL;
[SoundIoChannelIdTopBackLeft] = { names[SoundIoChannelIdFrontRightHigh][2] = NULL;
"Top Back Left", names[SoundIoChannelIdTopFrontLeftCenter][0] = "Top Front Left Center";
"TBL", names[SoundIoChannelIdTopFrontLeftCenter][1] = NULL;
"top-rear-left", names[SoundIoChannelIdTopFrontLeftCenter][2] = NULL;
}, names[SoundIoChannelIdTopFrontRightCenter][0] = "Top Front Right Center";
[SoundIoChannelIdTopBackCenter] = { names[SoundIoChannelIdTopFrontRightCenter][1] = NULL;
"Top Back Center", names[SoundIoChannelIdTopFrontRightCenter][2] = NULL;
"TBC", names[SoundIoChannelIdTopSideLeft][0] = "Top Side Left";
"top-rear-center", names[SoundIoChannelIdTopSideLeft][1] = NULL;
}, names[SoundIoChannelIdTopSideLeft][2] = NULL;
[SoundIoChannelIdTopBackRight] = { names[SoundIoChannelIdTopSideRight][0] = "Top Side Right";
"Top Back Right", names[SoundIoChannelIdTopSideRight][1] = NULL;
"TBR", names[SoundIoChannelIdTopSideRight][2] = NULL;
"top-rear-right", names[SoundIoChannelIdLeftLfe][0] = "Left LFE";
}, names[SoundIoChannelIdLeftLfe][1] = NULL;
[SoundIoChannelIdBackLeftCenter] = { names[SoundIoChannelIdLeftLfe][2] = NULL;
"Back Left Center", names[SoundIoChannelIdRightLfe][0] = "Right LFE";
NULL, names[SoundIoChannelIdRightLfe][1] = NULL;
NULL, names[SoundIoChannelIdRightLfe][2] = NULL;
}, names[SoundIoChannelIdLfe2][0] = "LFE 2";
[SoundIoChannelIdBackRightCenter] = { names[SoundIoChannelIdLfe2][1] = NULL;
"Back Right Center", names[SoundIoChannelIdLfe2][2] = NULL;
NULL, names[SoundIoChannelIdBottomCenter][0] = "Bottom Center";
NULL, names[SoundIoChannelIdBottomCenter][1] = NULL;
}, names[SoundIoChannelIdBottomCenter][2] = NULL;
[SoundIoChannelIdFrontLeftWide] = { names[SoundIoChannelIdBottomLeftCenter][0] = "Bottom Left Center";
"Front Left Wide", names[SoundIoChannelIdBottomLeftCenter][1] = NULL;
NULL, names[SoundIoChannelIdBottomLeftCenter][2] = NULL;
NULL, names[SoundIoChannelIdBottomRightCenter][0] = "Bottom Right Center";
}, names[SoundIoChannelIdBottomRightCenter][1] = NULL;
[SoundIoChannelIdFrontRightWide] = { names[SoundIoChannelIdBottomRightCenter][2] = NULL;
"Front Right Wide", names[SoundIoChannelIdMsMid][0] = "Mid/Side Mid";
NULL, names[SoundIoChannelIdMsMid][1] = NULL;
NULL, names[SoundIoChannelIdMsMid][2] = NULL;
}, names[SoundIoChannelIdMsSide][0] = "Mid/Side Side";
[SoundIoChannelIdFrontLeftHigh] = { names[SoundIoChannelIdMsSide][1] = NULL;
"Front Left High", names[SoundIoChannelIdMsSide][2] = NULL;
NULL, names[SoundIoChannelIdAmbisonicW][0] = "Ambisonic W";
NULL, names[SoundIoChannelIdAmbisonicW][1] = NULL;
}, names[SoundIoChannelIdAmbisonicW][2] = NULL;
[SoundIoChannelIdFrontCenterHigh] = { names[SoundIoChannelIdAmbisonicX][0] = "Ambisonic X";
"Front Center High", names[SoundIoChannelIdAmbisonicX][1] = NULL;
NULL, names[SoundIoChannelIdAmbisonicX][2] = NULL;
NULL, names[SoundIoChannelIdAmbisonicY][0] = "Ambisonic Y";
}, names[SoundIoChannelIdAmbisonicY][1] = NULL;
[SoundIoChannelIdFrontRightHigh] = { names[SoundIoChannelIdAmbisonicY][2] = NULL;
"Front Right High", names[SoundIoChannelIdAmbisonicZ][0] = "Ambisonic Z";
NULL, names[SoundIoChannelIdAmbisonicZ][1] = NULL;
NULL, names[SoundIoChannelIdAmbisonicZ][2] = NULL;
}, names[SoundIoChannelIdXyX][0] = "X-Y X";
[SoundIoChannelIdTopFrontLeftCenter] = { names[SoundIoChannelIdXyX][1] = NULL;
"Top Front Left Center", names[SoundIoChannelIdXyX][2] = NULL;
NULL, names[SoundIoChannelIdXyY][0] = "X-Y Y";
NULL, names[SoundIoChannelIdXyY][1] = NULL;
}, names[SoundIoChannelIdXyY][2] = NULL;
[SoundIoChannelIdTopFrontRightCenter] = { names[SoundIoChannelIdHeadphonesLeft][0] = "Headphones Left";
"Top Front Right Center", names[SoundIoChannelIdHeadphonesLeft][1] = NULL;
NULL, names[SoundIoChannelIdHeadphonesLeft][2] = NULL;
NULL, names[SoundIoChannelIdHeadphonesRight][0] = "Headphones Right";
}, names[SoundIoChannelIdHeadphonesRight][1] = NULL;
[SoundIoChannelIdTopSideLeft] = { names[SoundIoChannelIdHeadphonesRight][2] = NULL;
"Top Side Left", names[SoundIoChannelIdClickTrack][0] = "Click Track";
NULL, names[SoundIoChannelIdClickTrack][1] = NULL;
NULL, names[SoundIoChannelIdClickTrack][2] = NULL;
}, names[SoundIoChannelIdForeignLanguage][0] = "Foreign Language";
[SoundIoChannelIdTopSideRight] = { names[SoundIoChannelIdForeignLanguage][1] = NULL;
"Top Side Right", names[SoundIoChannelIdForeignLanguage][2] = NULL;
NULL, names[SoundIoChannelIdHearingImpaired][0] = "Hearing Impaired";
NULL, names[SoundIoChannelIdHearingImpaired][1] = NULL;
}, names[SoundIoChannelIdHearingImpaired][2] = NULL;
[SoundIoChannelIdLeftLfe] = { names[SoundIoChannelIdNarration][0] = "Narration";
"Left LFE", names[SoundIoChannelIdNarration][1] = NULL;
NULL, names[SoundIoChannelIdNarration][2] = NULL;
NULL, names[SoundIoChannelIdHaptic][0] = "Haptic";
}, names[SoundIoChannelIdHaptic][1] = NULL;
[SoundIoChannelIdRightLfe] = { names[SoundIoChannelIdHaptic][2] = NULL;
"Right LFE", names[SoundIoChannelIdDialogCentricMix][0] = "Dialog Centric Mix";
NULL, names[SoundIoChannelIdDialogCentricMix][1] = NULL;
NULL, names[SoundIoChannelIdDialogCentricMix][2] = NULL;
}, names[SoundIoChannelIdAux][0] = "Aux";
[SoundIoChannelIdLfe2] = { names[SoundIoChannelIdAux][1] = NULL;
"LFE 2", names[SoundIoChannelIdAux][2] = NULL;
NULL, names[SoundIoChannelIdAux0][0] = "Aux 0";
NULL, names[SoundIoChannelIdAux0][1] = NULL;
}, names[SoundIoChannelIdAux0][2] = NULL;
[SoundIoChannelIdBottomCenter] = { names[SoundIoChannelIdAux1][0] = "Aux 1";
"Bottom Center", names[SoundIoChannelIdAux1][1] = NULL;
NULL, names[SoundIoChannelIdAux1][2] = NULL;
NULL, names[SoundIoChannelIdAux2][0] = "Aux 2";
}, names[SoundIoChannelIdAux2][1] = NULL;
[SoundIoChannelIdBottomLeftCenter] = { names[SoundIoChannelIdAux2][2] = NULL;
"Bottom Left Center", names[SoundIoChannelIdAux3][0] = "Aux 3";
NULL, names[SoundIoChannelIdAux3][1] = NULL;
NULL, names[SoundIoChannelIdAux3][2] = NULL;
}, names[SoundIoChannelIdAux4][0] = "Aux 4";
[SoundIoChannelIdBottomRightCenter] = { names[SoundIoChannelIdAux4][1] = NULL;
"Bottom Right Center", names[SoundIoChannelIdAux4][2] = NULL;
NULL, names[SoundIoChannelIdAux5][0] = "Aux 5";
NULL, names[SoundIoChannelIdAux5][1] = NULL;
}, names[SoundIoChannelIdAux5][2] = NULL;
[SoundIoChannelIdMsMid] = { names[SoundIoChannelIdAux6][0] = "Aux 6";
"Mid/Side Mid", names[SoundIoChannelIdAux6][1] = NULL;
NULL, names[SoundIoChannelIdAux6][2] = NULL;
NULL, names[SoundIoChannelIdAux7][0] = "Aux 7";
}, names[SoundIoChannelIdAux7][1] = NULL;
[SoundIoChannelIdMsSide] = { names[SoundIoChannelIdAux7][2] = NULL;
"Mid/Side Side", names[SoundIoChannelIdAux8][0] = "Aux 8";
NULL, names[SoundIoChannelIdAux8][1] = NULL;
NULL, names[SoundIoChannelIdAux8][2] = NULL;
}, names[SoundIoChannelIdAux9][0] = "Aux 9";
[SoundIoChannelIdAmbisonicW] = { names[SoundIoChannelIdAux9][1] = NULL;
"Ambisonic W", names[SoundIoChannelIdAux9][2] = NULL;
NULL, names[SoundIoChannelIdAux10][0] = "Aux 10";
NULL, names[SoundIoChannelIdAux10][1] = NULL;
}, names[SoundIoChannelIdAux10][2] = NULL;
[SoundIoChannelIdAmbisonicX] = { names[SoundIoChannelIdAux11][0] = "Aux 11";
"Ambisonic X", names[SoundIoChannelIdAux11][1] = NULL;
NULL, names[SoundIoChannelIdAux11][2] = NULL;
NULL, names[SoundIoChannelIdAux12][0] = "Aux 12";
}, names[SoundIoChannelIdAux12][1] = NULL;
[SoundIoChannelIdAmbisonicY] = { names[SoundIoChannelIdAux12][2] = NULL;
"Ambisonic Y", names[SoundIoChannelIdAux13][0] = "Aux 13";
NULL, names[SoundIoChannelIdAux13][1] = NULL;
NULL, names[SoundIoChannelIdAux13][2] = NULL;
}, names[SoundIoChannelIdAux14][0] = "Aux 14";
[SoundIoChannelIdAmbisonicZ] = { names[SoundIoChannelIdAux14][1] = NULL;
"Ambisonic Z", names[SoundIoChannelIdAux14][2] = NULL;
NULL, names[SoundIoChannelIdAux15][0] = "Aux 15";
NULL, names[SoundIoChannelIdAux15][1] = NULL;
}, names[SoundIoChannelIdAux15][2] = NULL;
[SoundIoChannelIdXyX] = { return &names[0];
"X-Y X",
NULL,
NULL,
},
[SoundIoChannelIdXyY] = {
"X-Y Y",
NULL,
NULL,
},
[SoundIoChannelIdHeadphonesLeft] = {
"Headphones Left",
NULL,
NULL,
},
[SoundIoChannelIdHeadphonesRight] = {
"Headphones Right",
NULL,
NULL,
},
[SoundIoChannelIdClickTrack] = {
"Click Track",
NULL,
NULL,
},
[SoundIoChannelIdForeignLanguage] = {
"Foreign Language",
NULL,
NULL,
},
[SoundIoChannelIdHearingImpaired] = {
"Hearing Impaired",
NULL,
NULL,
},
[SoundIoChannelIdNarration] = {
"Narration",
NULL,
NULL,
},
[SoundIoChannelIdHaptic] = {
"Haptic",
NULL,
NULL,
},
[SoundIoChannelIdDialogCentricMix] = {
"Dialog Centric Mix",
NULL,
NULL,
},
[SoundIoChannelIdAux] = {
"Aux",
NULL,
NULL,
},
[SoundIoChannelIdAux0] = {
"Aux 0",
NULL,
NULL,
},
[SoundIoChannelIdAux1] = {
"Aux 1",
NULL,
NULL,
},
[SoundIoChannelIdAux2] = {
"Aux 2",
NULL,
NULL,
},
[SoundIoChannelIdAux3] = {
"Aux 3",
NULL,
NULL,
},
[SoundIoChannelIdAux4] = {
"Aux 4",
NULL,
NULL,
},
[SoundIoChannelIdAux5] = {
"Aux 5",
NULL,
NULL,
},
[SoundIoChannelIdAux6] = {
"Aux 6",
NULL,
NULL,
},
[SoundIoChannelIdAux7] = {
"Aux 7",
NULL,
NULL,
},
[SoundIoChannelIdAux8] = {
"Aux 8",
NULL,
NULL,
},
[SoundIoChannelIdAux9] = {
"Aux 9",
NULL,
NULL,
},
[SoundIoChannelIdAux10] = {
"Aux 10",
NULL,
NULL,
},
[SoundIoChannelIdAux11] = {
"Aux 11",
NULL,
NULL,
},
[SoundIoChannelIdAux12] = {
"Aux 12",
NULL,
NULL,
},
[SoundIoChannelIdAux13] = {
"Aux 13",
NULL,
NULL,
},
[SoundIoChannelIdAux14] = {
"Aux 14",
NULL,
NULL,
},
[SoundIoChannelIdAux15] = {
"Aux 15",
NULL,
NULL,
},
}; };
static channel_names_t *channel_names = make_channel_names();
const char *soundio_get_channel_name(enum SoundIoChannelId id) { const char *soundio_get_channel_name(enum SoundIoChannelId id) {
if (id >= ARRAY_LENGTH(channel_names)) if (id >= ARRAY_LENGTH(channel_names))

View file

@ -33,36 +33,29 @@ static const enum SoundIoBackend available_backends[] = {
SoundIoBackendDummy, SoundIoBackendDummy,
}; };
static int (*backend_init_fns[])(struct SoundIoPrivate *) = { typedef int (*backend_init_t)(struct SoundIoPrivate *);
[SoundIoBackendNone] = NULL, static backend_init_t *make_backend_init_fns()
{
static backend_init_t fns[6] = { 0 };
#ifdef SOUNDIO_HAVE_JACK #ifdef SOUNDIO_HAVE_JACK
[SoundIoBackendJack] = soundio_jack_init, fns[SoundIoBackendJack] = soundio_jack_init;
#else
[SoundIoBackendJack] = NULL,
#endif #endif
#ifdef SOUNDIO_HAVE_PULSEAUDIO #ifdef SOUNDIO_HAVE_PULSEAUDIO
[SoundIoBackendPulseAudio] = soundio_pulseaudio_init, fns[SoundIoBackendPulseAudio] = soundio_pulseaudio_init;
#else
[SoundIoBackendPulseAudio] = NULL,
#endif #endif
#ifdef SOUNDIO_HAVE_ALSA #ifdef SOUNDIO_HAVE_ALSA
[SoundIoBackendAlsa] = soundio_alsa_init, fns[SoundIoBackendAlsa] = soundio_alsa_init;
#else
[SoundIoBackendAlsa] = NULL,
#endif #endif
#ifdef SOUNDIO_HAVE_COREAUDIO #ifdef SOUNDIO_HAVE_COREAUDIO
[SoundIoBackendCoreAudio] = soundio_coreaudio_init, fns[SoundIoBackendCoreAudio] = soundio_coreaudio_init;
#else
[SoundIoBackendCoreAudio] = NULL,
#endif #endif
#ifdef SOUNDIO_HAVE_WASAPI #ifdef SOUNDIO_HAVE_WASAPI
[SoundIoBackendWasapi] = soundio_wasapi_init, fns[SoundIoBackendWasapi] = soundio_wasapi_init;
#else
[SoundIoBackendWasapi] = NULL,
#endif #endif
[SoundIoBackendDummy] = soundio_dummy_init, fns[SoundIoBackendDummy] = soundio_dummy_init;
}; return &fns[0];
}
static backend_init_t *backend_init_fns = make_backend_init_fns();
SOUNDIO_MAKE_LIST_DEF(struct SoundIoDevice*, SoundIoListDevicePtr, SOUNDIO_LIST_NOT_STATIC) SOUNDIO_MAKE_LIST_DEF(struct SoundIoDevice*, SoundIoListDevicePtr, SOUNDIO_LIST_NOT_STATIC)
SOUNDIO_MAKE_LIST_DEF(struct SoundIoSampleRateRange, SoundIoListSampleRateRange, SOUNDIO_LIST_NOT_STATIC) SOUNDIO_MAKE_LIST_DEF(struct SoundIoSampleRateRange, SoundIoListSampleRateRange, SOUNDIO_LIST_NOT_STATIC)