Jamba C++ API 7.5.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 <sstream>
25
26namespace pongasoft {
27namespace VST {
28namespace Debug {
29
34{
35public:
36 explicit ParamLine(ParamDisplay iParamDisplay) : fParamDisplay{std::move(iParamDisplay)} {}
37
38 ParamLine &precision(int32 iPrecision) { fParamDisplay.precision(iPrecision); return *this; }
39 ParamLine &keys(std::vector<ParamDisplay::Key> const &iKeys) { fParamDisplay.keys(iKeys); return *this; };
40 ParamLine &key(ParamDisplay::Key iKey) { fParamDisplay.key(iKey); return *this; }
41 ParamLine &ids(std::vector<ParamID> const &iParamIDs) { fParamDisplay.ids(iParamIDs); return *this; };
42 ParamLine &id(ParamID iParamID) { fParamDisplay.id(iParamID); return *this; };
43 ParamLine &firstSeparator(std::string iString) { fFirstSeparator = std::move(iString); return *this; }
44 ParamLine &nextSeparator(std::string iString) { fNextSeparator = std::move(iString); return *this; }
45 ParamLine &paramSeparator(std::string iString) { fParamSeparator = std::move(iString); return *this; }
46 ParamLine &skipEmptyEntry(bool iFlag = true) { fSkipEmptyEntry = iFlag; return *this; }
47
48 // returns a line representation of the params
49 std::string toString() const;
50
51 // returns a line representation of normalized state
52 std::string toString(NormalizedState const &iNormalizedState) const;
53
54public:
58 static ParamLine from(Parameters const &iParams);
59
63 static ParamLine from(RT::RTState const *iState, bool iSaveStateOnly = false);
64
68 static ParamLine from(GUI::GUIState const *iState, bool iSaveStateOnly = false);
69
70protected:
71 // toString
72 std::string toString(ParamDisplay::ParamMap const &iParamMap) const;
73
74private:
76
77 std::string fFirstSeparator{"="};
78 std::string fNextSeparator{"/"};
79 std::string fParamSeparator{", "};
80 bool fSkipEmptyEntry{true};
81};
82
83}
84}
85}
This helper class is used to display the parameters (vst/jmb) WARNING: this class is allocating memor...
Definition ParamDisplay.h:35
std::map< ParamID, ValueMap > ParamMap
Definition ParamDisplay.h:60
Key
Definition ParamDisplay.h:38
This helper class is used to display the parameters (vst/jmb) in a line WARNING: this class is alloca...
Definition ParamLine.h:34
ParamLine(ParamDisplay iParamDisplay)
Definition ParamLine.h:36
std::string fParamSeparator
Definition ParamLine.h:79
bool fSkipEmptyEntry
Definition ParamLine.h:80
std::string fNextSeparator
Definition ParamLine.h:78
std::string toString() const
Definition ParamLine.cpp:70
ParamLine & id(ParamID iParamID)
Definition ParamLine.h:42
ParamLine & nextSeparator(std::string iString)
Definition ParamLine.h:44
ParamLine & key(ParamDisplay::Key iKey)
Definition ParamLine.h:40
ParamLine & ids(std::vector< ParamID > const &iParamIDs)
Definition ParamLine.h:41
std::string fFirstSeparator
Definition ParamLine.h:77
ParamDisplay fParamDisplay
Definition ParamLine.h:75
ParamLine & firstSeparator(std::string iString)
Definition ParamLine.h:43
ParamLine & paramSeparator(std::string iString)
Definition ParamLine.h:45
ParamLine & keys(std::vector< ParamDisplay::Key > const &iKeys)
Definition ParamLine.h:39
ParamLine & precision(int32 iPrecision)
Definition ParamLine.h:38
ParamLine & skipEmptyEntry(bool iFlag=true)
Definition ParamLine.h:46
static ParamLine from(Parameters const &iParams)
Shortcut to create a table for all registered parameter (definition not current value).
Definition ParamLine.cpp:88
Definition GUIState.h:43
Used to communicate the state between the UI and the RT and read/write to stream.
Definition NormalizedState.h:39
This is the class which maintains all the registered parameters.
Definition Parameters.h:39
Manages the state used by the processor: you add all the parameters that the state manages using the ...
Definition RTState.h:46
Definition ParamDisplay.cpp:29
Definition Clock.h:24
Definition Clock.h:23