diff options
author | Chris Robinson <[email protected]> | 2010-06-05 19:33:06 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2010-06-05 19:33:06 -0700 |
commit | 80fbe8a788b7007deb2e42178c857e504207aa50 (patch) | |
tree | 97204574e484a7c649aaea06a15e32aa77e86fc2 | |
parent | 0fdec056facefe2dc8a58889651fd5c859d303b7 (diff) |
Allow prepending backend names with - to remove them from the available devices
-rw-r--r-- | Alc/ALc.c | 29 | ||||
-rw-r--r-- | alsoftrc.sample | 3 |
2 files changed, 23 insertions, 9 deletions
@@ -436,13 +436,16 @@ static void alc_init(void) int n; size_t len; const char *next = devs; - int endlist; + int endlist, delitem; i = 0; do { devs = next; next = strchr(devs, ','); + delitem = (devs[0] == '-'); + if(devs[0] == '-') devs++; + if(!devs[0] || devs[0] == ',') { endlist = 0; @@ -456,15 +459,25 @@ static void alc_init(void) if(len == strlen(BackendList[n].name) && strncmp(BackendList[n].name, devs, len) == 0) { - BackendInfo Bkp = BackendList[n]; - while(n > i) + if(delitem) { - BackendList[n] = BackendList[n-1]; - --n; + do { + BackendList[n] = BackendList[n+1]; + ++n; + } while(BackendList[n].Init); + } + else + { + BackendInfo Bkp = BackendList[n]; + while(n > i) + { + BackendList[n] = BackendList[n-1]; + --n; + } + BackendList[n] = Bkp; + + i++; } - BackendList[n] = Bkp; - - i++; break; } } diff --git a/alsoftrc.sample b/alsoftrc.sample index f9714dd3..e5f0203d 100644 --- a/alsoftrc.sample +++ b/alsoftrc.sample @@ -116,7 +116,8 @@ # duplicated names are ignored. Unlisted backends won't be considered for use # unless the list is ended with a comma (eg. 'oss,' will list OSS first # followed by all other available backends, while 'oss' will list OSS only). -# An empty list means the default. +# Backends prepended with - won't be available for use (eg. '-oss,' will allow +# all available backends except OSS). An empty list means the default. #drivers = pulse,alsa,oss,solaris,dsound,winmm,port,null,wave ## excludefx: |