Loading [MathJax]/extensions/tex2jax.js
VCV Rack API v2
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
settings.hpp
Go to the documentation of this file.
1#pragma once
2#include <vector>
3#include <set>
4#include <map>
5#include <list>
6#include <tuple>
7
8#include <jansson.h>
9
10#include <common.hpp>
11#include <math.hpp>
12#include <color.hpp>
13
14
15namespace rack {
17namespace settings {
18
19
20// Runtime state, not serialized.
21
23extern std::string settingsPath;
24extern bool devMode;
25extern bool headless;
26extern bool isPlugin;
28extern bool restart;
29
30// Persistent state, serialized to settings.json.
31
33extern std::string language;
35extern bool safeMode;
37extern std::string token;
39extern bool windowMaximized;
43extern math::Vec windowPos;
45extern bool invertZoom;
47extern bool mouseWheelZoom;
51extern float pixelRatio;
53extern std::string uiTheme;
55extern float cableOpacity;
57extern float cableTension;
58extern float rackBrightness;
59extern float haloBrightness;
61extern bool allowCursorLock;
68extern KnobMode knobMode;
69extern bool knobScroll;
70extern float knobLinearSensitivity;
71extern float knobScrollSensitivity;
72extern float sampleRate;
73extern int threadCount;
74extern bool tooltips;
75extern bool cpuMeter;
76extern bool lockModules;
77extern bool squeezeModules;
78extern bool preferDarkPanels;
80extern float frameRateLimit;
82extern float autosaveInterval;
83extern bool skipLoadOnLaunch;
84extern std::string lastPatchDirectory;
85extern std::string lastSelectionDirectory;
86extern std::list<std::string> recentPatchPaths;
87extern std::vector<NVGcolor> cableColors;
88extern std::vector<std::string> cableLabels;
89extern bool cableAutoRotate;
90extern bool autoCheckUpdates;
91extern bool verifyHttpsCerts;
92extern bool showTipsOnLaunch;
93extern int tipIndex;
103extern float browserZoom;
104extern json_t* pluginSettingsJ;
105
107 bool enabled = true;
108 bool favorite = false;
109 int added = 0;
110 double lastAdded = NAN;
111};
112
113extern std::map<std::string, std::map<std::string, ModuleInfo>> moduleInfos;
116ModuleInfo* getModuleInfo(const std::string& pluginSlug, const std::string& moduleSlug);
117
124 bool subscribed = false;
125 std::set<std::string> moduleSlugs;
126};
127extern std::map<std::string, PluginWhitelist> moduleWhitelist;
128
129bool isModuleWhitelisted(const std::string& pluginSlug, const std::string& moduleSlug);
131
134PRIVATE json_t* toJson();
135PRIVATE void fromJson(json_t* rootJ);
136PRIVATE void save(std::string path = "");
137PRIVATE void load(std::string path = "");
138
139
140} // namespace settings
141} // namespace rack
#define PRIVATE
Attribute for private functions not intended to be called by plugins.
Definition common.hpp:32
Process-scope globals, most of which are persisted across launches.
Definition settings.hpp:17
BrowserSort browserSort
PRIVATE void save(std::string path="")
PRIVATE void fromJson(json_t *rootJ)
std::string lastPatchDirectory
std::string language
ISO 639-1 language code for string translations.
bool mouseWheelZoom
Mouse wheel zooms instead of pans.
KnobMode knobMode
math::Vec windowPos
Position in window in pixels.
float knobLinearSensitivity
ModuleInfo * getModuleInfo(const std::string &pluginSlug, const std::string &moduleSlug)
Returns a ModuleInfo if exists for the given slugs.
PRIVATE void load(std::string path="")
PRIVATE void init()
float knobScrollSensitivity
bool isModuleWhitelisted(const std::string &pluginSlug, const std::string &moduleSlug)
math::Vec windowSize
Size of window in pixels.
float cableTension
Straightness of cables in the range [0, 1].
json_t * pluginSettingsJ
std::string settingsPath
Path to settings.json.
BrowserSort
Definition settings.hpp:94
@ BROWSER_SORT_UPDATED
Definition settings.hpp:95
@ BROWSER_SORT_LAST_USED
Definition settings.hpp:96
@ BROWSER_SORT_NAME
Definition settings.hpp:99
@ BROWSER_SORT_MOST_USED
Definition settings.hpp:97
@ BROWSER_SORT_BRAND
Definition settings.hpp:98
@ BROWSER_SORT_RANDOM
Definition settings.hpp:100
float pixelRatio
Ratio between UI pixel and physical screen pixel.
std::list< std::string > recentPatchPaths
std::map< std::string, PluginWhitelist > moduleWhitelist
float frameRateLimit
Maximum screen redraw frequency in Hz, or 0 for unlimited.
float rackBrightness
std::string uiTheme
Name of UI theme, specified in ui::refreshTheme()
std::vector< std::string > cableLabels
std::string lastSelectionDirectory
PRIVATE json_t * toJson()
float haloBrightness
KnobMode
Definition settings.hpp:62
@ KNOB_MODE_LINEAR
Definition settings.hpp:63
@ KNOB_MODE_ROTARY_ABSOLUTE
Definition settings.hpp:65
@ KNOB_MODE_ROTARY_RELATIVE
Definition settings.hpp:66
@ KNOB_MODE_SCALED_LINEAR
Definition settings.hpp:64
std::vector< NVGcolor > cableColors
bool restart
Requests to restart the application on exit.
float autosaveInterval
Interval between autosaves in seconds.
PRIVATE void destroy()
void resetCables()
bool safeMode
Launches Rack without loading plugins or the autosave patch.
std::map< std::string, std::map< std::string, ModuleInfo > > moduleInfos
pluginSlug -> (moduleSlug -> ModuleInfo)
float cableOpacity
Opacity of cables in the range [0, 1].
bool windowMaximized
Whether the window is maximized.
std::string token
vcvrack.com user token
bool allowCursorLock
Allows rack to hide and lock the cursor position when dragging knobs etc.
bool invertZoom
Reverse the zoom scroll direction.
Root namespace for the Rack API.
Definition AudioDisplay.hpp:9
2-dimensional vector of floats, representing a point on the plane for graphics.
Definition math.hpp:189
Definition settings.hpp:106
bool enabled
Definition settings.hpp:107
bool favorite
Definition settings.hpp:108
double lastAdded
Definition settings.hpp:110
int added
Definition settings.hpp:109
The VCV JSON API returns the data structure {pluginSlug: [moduleSlugs] or true} where "true" represen...
Definition settings.hpp:123
bool subscribed
Definition settings.hpp:124
std::set< std::string > moduleSlugs
Definition settings.hpp:125