diff options
-rw-r--r-- | Alc/ALc.c | 41 | ||||
-rw-r--r-- | openalrc.sample | 1 |
2 files changed, 41 insertions, 1 deletions
@@ -191,11 +191,52 @@ static void InitAL(void) if(!done) { int i; + const char *devs; InitializeCriticalSection(&g_mutex); ALTHUNK_INIT(); ReadALConfig(); + devs = GetConfigValue(NULL, "drivers", ""); + if(devs[0]) + { + int n; + size_t len; + const char *next = devs; + + i = 0; + + do { + devs = next; + next = strchr(devs, ','); + + if(!devs[0] || devs[0] == ',') + continue; + + len = (next ? ((size_t)(next-devs)) : strlen(devs)); + for(n = i;BackendList[n].Init;n++) + { + if(len == strlen(BackendList[n].name) && + strncmp(BackendList[n].name, devs, len) == 0) + { + const char *name = BackendList[i].name; + void (*Init)(BackendFuncs*) = BackendList[i].Init; + + BackendList[i].name = BackendList[n].name; + BackendList[i].Init = BackendList[n].Init; + + BackendList[n].name = name; + BackendList[n].Init = Init; + + i++; + } + } + } while(next++); + + BackendList[i].name = NULL; + BackendList[i].Init = NULL; + } + for(i = 0;BackendList[i].Init;i++) BackendList[i].Init(&BackendList[i].Funcs); done = 1; diff --git a/openalrc.sample b/openalrc.sample index 74bcba22..efd0ba86 100644 --- a/openalrc.sample +++ b/openalrc.sample @@ -23,7 +23,6 @@ refresh = 0 # Sets the number of frames-per-update. Default is calculated as # 8192*frequency/22050. Note that the actual granularity may or # may not be less than this. -# TODO: Implement this option drivers = # Sets the backend driver list order, comma-seperated. Unknown # backends and duplicated names are ignored, and unlisted backends # won't be considered for use. An empty list means the default. |