Jamba C++ API 8.0.0
Loading...
Searching...
No Matches
ParamLine.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 pongasoft
3 *
4 * Licensed under the Apache License, Version 2.0 or the MIT license,
5 * at your option. You may not use this file except in compliance with
6 * one of these licenses. You may obtain copies of the licenses at:
7 *
8 * https://www.apache.org/licenses/LICENSE-2.0
9 * https://opensource.org/licenses/MIT
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 *
17 * @author Yan Pujante
18 */
19
20#pragma once
21
22#include "ParamDisplay.h"
23
24#include <string>
25
26namespace pongasoft::VST::Debug {
27
32{
33public:
34 explicit ParamLine(ParamDisplay iParamDisplay) : fParamDisplay{std::move(iParamDisplay)} {}
35
36 ParamLine &precision(int32 iPrecision) { fParamDisplay.precision(iPrecision); return *this; }
37 ParamLine &keys(std::vector<ParamDisplay::Key> const &iKeys) { fParamDisplay.keys(iKeys); return *this; }
38 ParamLine &key(ParamDisplay::Key iKey) { fParamDisplay.key(iKey); return *this; }
39 ParamLine &ids(std::vector<ParamID> const &iParamIDs) { fParamDisplay.ids(iParamIDs); return *this; }
40 ParamLine &id(ParamID iParamID) { fParamDisplay.id(iParamID); return *this; }
41 ParamLine &firstSeparator(std::string iString) { fFirstSeparator = std::move(iString); return *this; }
42 ParamLine &nextSeparator(std::string iString) { fNextSeparator = std::move(iString); return *this; }
43 ParamLine &paramSeparator(std::string iString) { fParamSeparator = std::move(iString); return *this; }
44 ParamLine &skipEmptyEntry(bool iFlag = true) { fSkipEmptyEntry = iFlag; return *this; }
45
46 // returns a line representation of the params
47 std::string toString() const;
48
49 // returns a line representation of normalized state
50 std::string toString(NormalizedState const &iNormalizedState) const;
51
52public:
56 static ParamLine from(Parameters const &iParams);
57
61 static ParamLine from(RT::RTState const *iState, bool iSaveStateOnly = false);
62
66 static ParamLine from(GUI::GUIState const *iState, bool iSaveStateOnly = false);
67
68protected:
69 // toString
70 std::string toString(ParamDisplay::ParamMap const &iParamMap) const;
71
72private:
74
75 std::string fFirstSeparator{"="};
76 std::string fNextSeparator{"/"};
77 std::string fParamSeparator{", "};
78 bool fSkipEmptyEntry{true};
79};
80
81}
This helper class is used to display the parameters (vst/jmb) WARNING: this class is allocating memor...
Definition ParamDisplay.h:33
std::map< ParamID, ValueMap > ParamMap
Definition ParamDisplay.h:58
Key
Definition ParamDisplay.h:36
This helper class is used to display the parameters (vst/jmb) in a line WARNING: this class is alloca...
Definition ParamLine.h:32
ParamLine(ParamDisplay iParamDisplay)
Definition ParamLine.h:34
std::string fParamSeparator
Definition ParamLine.h:77
bool fSkipEmptyEntry
Definition ParamLine.h:78
std::string fNextSeparator
Definition ParamLine.h:76
std::string toString() const
Definition ParamLine.cpp:68
ParamLine & id(ParamID iParamID)
Definition ParamLine.h:40
ParamLine & nextSeparator(std::string iString)
Definition ParamLine.h:42
ParamLine & key(ParamDisplay::Key iKey)
Definition ParamLine.h:38
ParamLine & ids(std::vector< ParamID > const &iParamIDs)
Definition ParamLine.h:39
std::string fFirstSeparator
Definition ParamLine.h:75
ParamDisplay fParamDisplay
Definition ParamLine.h:73
ParamLine & firstSeparator(std::string iString)
Definition ParamLine.h:41
ParamLine & paramSeparator(std::string iString)
Definition ParamLine.h:43
ParamLine & keys(std::vector< ParamDisplay::Key > const &iKeys)
Definition ParamLine.h:37
ParamLine & precision(int32 iPrecision)
Definition ParamLine.h:36
ParamLine & skipEmptyEntry(bool iFlag=true)
Definition ParamLine.h:44
static ParamLine from(Parameters const &iParams)
Shortcut to create a table for all registered parameter (definition not current value).
Definition ParamLine.cpp:86
Definition GUIState.h:45
Used to communicate the state between the UI and the RT and read/write to stream.
Definition NormalizedState.h:39
This is the class that maintains all the registered parameters.
Definition Parameters.h:41
Manages the state used by the processor: you add all the parameters that the state manages using the ...
Definition RTState.h:45
Definition ParamDisplay.cpp:29