aboutsummaryrefslogtreecommitdiffstats
path: root/lib/param_name.cpp
blob: b90fc1c327629bdec1b5537db8b57219067a42e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* Copyright 2012 Dietrich Epp <depp@zdome.net> */
#include "defs.h"
#include "fresample.h"
#include <array>
#include <string_view>
using namespace std::string_view_literals;

constexpr std::array<std::string_view, LFR_PARAM_COUNT> LFR_PARAM_NAME {
    "quality"sv,
    "inrate"sv,
    "outrate"sv,
    "ftransition"sv,
    "maxfreq"sv,
    "loose"sv,
    "minfpass"sv,
    "fpass"sv,
    "fstop"sv,
    "atten"sv
};

std::string_view lfr_param_name(lfr_param_t pname)
{
    int n = pname;
    if (n < 0 || n >= LFR_PARAM_COUNT)
        return {};
    return LFR_PARAM_NAME[n];
}

int lfr_param_lookup(const std::string_view& pname)
{
	int i = 0;
	for(const auto& name : LFR_PARAM_NAME)
	{
		if(name == pname)
		{
			return i;
		}
		++i;
	}
	return -1;
}