aboutsummaryrefslogtreecommitdiffstats
path: root/lib/info_name.cpp
blob: d0897d2da1474e4de665854e86f605e112c81c45 (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
/* Copyright 2012 Dietrich Epp <depp@zdome.net> */
#include "defs.h"
#include "fresample.h"
#include <string.h>
#include <array>
#include <string_view>

using namespace std::string_view_literals;

constexpr std::array<std::string_view, LFR_INFO_COUNT> LFR_INFO_NAME = {
	"size"sv,
	"delay"sv,
	"memsize"sv,
	"fpass"sv,
	"fstop"sv,
	"atten"sv
};

std::string_view
lfr_info_name(int pname)
{
    if (pname < 0 || pname >= LFR_INFO_COUNT)
        return {};
    return LFR_INFO_NAME[pname];
}

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