mpd/src/mixer/Type.cxx

27 lines
615 B
C++
Raw Normal View History

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