LMMS
Loading...
Searching...
No Matches
Lv2Options.h
Go to the documentation of this file.
1/*
2 * Lv2Options.h - Lv2Options class
3 *
4 * Copyright (c) 2020-2020 Johannes Lorenz <jlsf2013$users.sourceforge.net, $=@>
5 *
6 * This file is part of LMMS - https://lmms.io
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program (see COPYING); if not, write to the
20 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301 USA.
22 *
23 */
24
25#ifndef LMMS_LV2_OPTIONS_H
26#define LMMS_LV2_OPTIONS_H
27
28#include "lmmsconfig.h"
29
30#ifdef LMMS_HAVE_LV2
31
32#include <cstdint>
33#include <lv2/options/options.h>
34#include <lv2/urid/urid.h>
35#include <map>
36#include <memory>
37#include <set>
38#include <vector>
39
40#include "Engine.h"
41#include "Lv2Manager.h"
42#include "Lv2UridCache.h"
43
44namespace lmms
45{
46
62{
63public:
65 static bool isOptionSupported(LV2_URID key);
67 static void supportOption(LV2_URID key);
68
70 template<typename Opt, typename Arg>
73 std::uint32_t subject = 0)
74 {
76 initOption(cache[key], sizeof(Opt), cache[Lv2UridCache::IdForType<Opt>::value],
77 std::make_shared<Opt>(std::forward<Arg>(value)), context, subject);
78 }
79
83 {
84 return m_options.data();
85 }
86
87 void clear();
88
89private:
94 std::shared_ptr<void> value,
96 uint32_t subject = 0);
98 static std::set<LV2_URID> s_supportedOptions;
100 std::map<LV2_URID, LV2_Options_Option> m_optionByUrid;
102 std::vector<LV2_Options_Option> m_options;
104 std::map<LV2_URID, std::shared_ptr<void>> m_optionValues;
105};
106
107
108} // namespace lmms
109
110#endif // LMMS_HAVE_LV2
111
112#endif // LMMS_LV2_OPTIONS_H
CAdPlugDatabase::CRecord::RecordType type
Definition adplugdb.cpp:93
static class Lv2Manager * getLv2Manager()
Definition Engine.h:85
const Lv2UridCache & uridCache() const
Definition Lv2Manager.h:125
Definition Lv2Options.h:62
void clear()
Definition Lv2Options.cpp:99
std::vector< LV2_Options_Option > m_options
option storage
Definition Lv2Options.h:102
static std::set< LV2_URID > s_supportedOptions
options that are supported by every processor
Definition Lv2Options.h:98
static void supportOption(LV2_URID key)
Mark option as supported.
Definition Lv2Options.cpp:49
const LV2_Options_Option * feature() const
Return the feature.
Definition Lv2Options.h:82
std::map< LV2_URID, std::shared_ptr< void > > m_optionValues
option value storage
Definition Lv2Options.h:104
void createOptionVectors()
Fill m_options and m_optionPointers with all options.
Definition Lv2Options.cpp:58
static bool isOptionSupported(LV2_URID key)
Return if an option is supported by LMMS.
Definition Lv2Options.cpp:41
void initOption(Lv2UridCache::Id key, Arg &&value, LV2_Options_Context context=LV2_OPTIONS_INSTANCE, std::uint32_t subject=0)
Initialize an option.
Definition Lv2Options.h:71
std::map< LV2_URID, LV2_Options_Option > m_optionByUrid
options + data, ordered by URID
Definition Lv2Options.h:100
Cached URIDs for fast access (for use in real-time code).
Definition Lv2UridCache.h:41
Id
< ID for m_uridCache array
Definition Lv2UridCache.h:44
static PuglViewHint int value
Definition pugl.h:1708
LV2_Options_Context
Definition options.h:50
@ LV2_OPTIONS_INSTANCE
Definition options.h:55
uint32_t LV2_URID
Definition urid.h:58
unsigned int uint32_t
Definition mid.cpp:100
Definition AudioAlsa.cpp:35
Definition options.h:94
Definition Lv2UridCache.h:59
ZCONST char * key
Definition crypt.c:587
ulg size
Definition extract.c:2350