Commit 5c7bb0dc authored by David Reid's avatar David Reid

Update the advanced config example with backend selection.

parent 5b24501a
...@@ -43,8 +43,22 @@ int main(int argc, char** argv) ...@@ -43,8 +43,22 @@ int main(int argc, char** argv)
// Typical installations of ALSA include a null device. The config below will exclude it from enumeration. // Typical installations of ALSA include a null device. The config below will exclude it from enumeration.
contextConfig.alsa.excludeNullDevice = MAL_TRUE; contextConfig.alsa.excludeNullDevice = MAL_TRUE;
// The prioritization of backends can be controlled by the application. You need only specify the backends
// you care about. If the context cannot be initialized for any of the specified backends mal_context_init()
// will fail.
mal_backend backends[] = {
mal_backend_wasapi, // Higest priority.
mal_backend_dsound,
mal_backend_winmm,
mal_backend_alsa,
mal_backend_oss,
mal_backend_opensl,
mal_backend_openal,
mal_backend_null // Lowest priority.
};
mal_context context; mal_context context;
if (mal_context_init(NULL, 0, &contextConfig, &context) != MAL_SUCCESS) { if (mal_context_init(backends, sizeof(backends)/sizeof(backends[0]), &contextConfig, &context) != MAL_SUCCESS) {
printf("Failed to initialize context."); printf("Failed to initialize context.");
return -2; return -2;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment