From 80fbe8a788b7007deb2e42178c857e504207aa50 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 5 Jun 2010 19:33:06 -0700 Subject: Allow prepending backend names with - to remove them from the available devices --- Alc/ALc.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'Alc') diff --git a/Alc/ALc.c b/Alc/ALc.c index 2a03765b..8156b272 100644 --- a/Alc/ALc.c +++ b/Alc/ALc.c @@ -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; } } -- cgit v1.2.3