2023-03-06 14:42:04 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
// Copyright The Music Player Daemon Project
|
2009-07-06 07:37:37 +02:00
|
|
|
|
2022-08-18 17:00:45 +02:00
|
|
|
#include "Type.hxx"
|
2009-07-06 07:37:37 +02:00
|
|
|
|
2020-03-12 23:20:59 +01:00
|
|
|
#include <cassert>
|
2018-08-19 07:49:54 +02:00
|
|
|
#include <stdexcept>
|
|
|
|
|
2009-07-06 07:37:37 +02:00
|
|
|
#include <string.h>
|
|
|
|
|
2014-12-02 18:17:55 +01:00
|
|
|
MixerType
|
2018-08-19 07:49:54 +02:00
|
|
|
mixer_type_parse(const char *input)
|
2009-07-06 07:37:37 +02:00
|
|
|
{
|
2020-02-01 13:49:19 +01:00
|
|
|
assert(input != nullptr);
|
2009-07-06 07:37:37 +02:00
|
|
|
|
|
|
|
if (strcmp(input, "none") == 0 || strcmp(input, "disabled") == 0)
|
2014-12-02 18:17:47 +01:00
|
|
|
return MixerType::NONE;
|
2009-07-06 07:37:37 +02:00
|
|
|
else if (strcmp(input, "hardware") == 0)
|
2014-12-02 18:17:47 +01:00
|
|
|
return MixerType::HARDWARE;
|
2009-07-06 07:37:37 +02:00
|
|
|
else if (strcmp(input, "software") == 0)
|
2014-12-02 18:17:47 +01:00
|
|
|
return MixerType::SOFTWARE;
|
2014-12-02 18:16:33 +01:00
|
|
|
else if (strcmp(input, "null") == 0)
|
|
|
|
return MixerType::NULL_;
|
2009-07-06 07:37:37 +02:00
|
|
|
else
|
2018-08-19 07:49:54 +02:00
|
|
|
throw std::runtime_error("Unrecognized mixer type");
|
2009-07-06 07:37:37 +02:00
|
|
|
}
|