Go back to statically initialized arrays

This commit is contained in:
Raphaël Londeix 2016-01-06 09:27:22 +01:00
parent 45cd6a7af2
commit ce60176e99
3 changed files with 147 additions and 286 deletions

View file

@ -19,7 +19,7 @@
#endif #endif
#if defined(SOUNDIO_STATIC_LIBRARY) #if defined(SOUNDIO_STATIC_LIBRARY)
# define SOUNDIO_EXPORT # define SOUNDIO_EXPORT SOUNDIO_EXTERN_C
#else #else
# if defined(_WIN32) # if defined(_WIN32)
# if defined(SOUNDIO_BUILDING_LIBRARY) # if defined(SOUNDIO_BUILDING_LIBRARY)
@ -183,8 +183,6 @@ enum SoundIoChannelId {
SoundIoChannelIdAux13, SoundIoChannelIdAux13,
SoundIoChannelIdAux14, SoundIoChannelIdAux14,
SoundIoChannelIdAux15, SoundIoChannelIdAux15,
SoundIoChannelIdMax
}; };
/// Built-in channel layouts for convenience. /// Built-in channel layouts for convenience.
@ -215,8 +213,6 @@ enum SoundIoChannelLayoutId {
SoundIoChannelLayoutId7Point1Wide, SoundIoChannelLayoutId7Point1Wide,
SoundIoChannelLayoutId7Point1WideBack, SoundIoChannelLayoutId7Point1WideBack,
SoundIoChannelLayoutIdOctagonal, SoundIoChannelLayoutIdOctagonal,
SoundIoChannelLayoutIdMax
}; };
enum SoundIoBackend { enum SoundIoBackend {

View file

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

@ -34,28 +34,39 @@ static const enum SoundIoBackend available_backends[] = {
}; };
typedef int (*backend_init_t)(struct SoundIoPrivate *); typedef int (*backend_init_t)(struct SoundIoPrivate *);
static backend_init_t *make_backend_init_fns() static backend_init_t backend_init_fns[] = {
{
static backend_init_t fns[6] = { 0 };
#ifdef SOUNDIO_HAVE_JACK #ifdef SOUNDIO_HAVE_JACK
fns[SoundIoBackendJack] = soundio_jack_init; &soundio_jack_init,
#else
NULL,
#endif #endif
#ifdef SOUNDIO_HAVE_PULSEAUDIO #ifdef SOUNDIO_HAVE_PULSEAUDIO
fns[SoundIoBackendPulseAudio] = soundio_pulseaudio_init; &soundio_pulseaudio_init,
#else
NULL,
#endif #endif
#ifdef SOUNDIO_HAVE_ALSA #ifdef SOUNDIO_HAVE_ALSA
fns[SoundIoBackendAlsa] = soundio_alsa_init; &soundio_alsa_init,
#else
NULL,
#endif #endif
#ifdef SOUNDIO_HAVE_COREAUDIO #ifdef SOUNDIO_HAVE_COREAUDIO
fns[SoundIoBackendCoreAudio] = soundio_coreaudio_init; &soundio_coreaudio_init,
#else
NULL,
#endif #endif
#ifdef SOUNDIO_HAVE_WASAPI #ifdef SOUNDIO_HAVE_WASAPI
fns[SoundIoBackendWasapi] = soundio_wasapi_init; soundio_wasapi_init,
#else
NULL,
#endif #endif
fns[SoundIoBackendDummy] = soundio_dummy_init;
return &fns[0]; &soundio_dummy_init,
} };
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)