sad

simple audio daemon
git clone git://git.2f30.org/sad.git
Log | Files | Refs | LICENSE

commit 57bc72dd3e8d5310cd56057b40a2c8adb54b5300
parent aa530b3385c427a14e9fefd0244dee526f92819d
Author: sin <sin@2f30.org>
Date:   Wed Dec 31 15:12:36 +0000

Simplify a bit the output enable/disable semantics

Diffstat:
output.c | 20+++-----------------
1 file changed, 3 insertions(+), 17 deletions(-)
diff --git a/output.c b/output.c @@ -111,14 +111,9 @@ closeoutput(Outputdesc *desc) if (!desc->active) return 0; - if (desc->output->close() < 0) { - desc->active = 1; - return -1; - } - printf("Closed %s output\n", desc->name); desc->active = 0; - return 0; + return desc->output->close(); } int @@ -223,8 +218,6 @@ enableoutput(const char *name) desc = &outputdescs[i]; if (strcmp(desc->name, name)) continue; - if (desc->active) - return -1; if (openoutput(desc) < 0) { desc->enabled = 0; return -1; @@ -246,15 +239,8 @@ disableoutput(const char *name) desc = &outputdescs[i]; if (strcmp(desc->name, name)) continue; - if (!desc->active) - return -1; - if (closeoutput(desc) < 0) { - desc->enabled = 1; - return -1; - } else { - desc->enabled = 0; - return 0; - } + desc->enabled = 0; + return closeoutput(desc); } return -1; }