VCV Rack API v2
Loading...
Searching...
No Matches
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;
27
28// Persistent state, serialized to settings.json.
29
31extern bool safeMode;
33extern std::string token;
35extern bool windowMaximized;
39extern math::Vec windowPos;
41extern bool invertZoom;
45extern float pixelRatio;
47extern std::string uiTheme;
49extern float cableOpacity;
51extern float cableTension;
52extern float rackBrightness;
53extern float haloBrightness;
55extern bool allowCursorLock;
62extern KnobMode knobMode;
63extern bool knobScroll;
64extern float knobLinearSensitivity;
65extern float knobScrollSensitivity;
66extern float sampleRate;
67extern int threadCount;
68extern bool tooltips;
69extern bool cpuMeter;
70extern bool lockModules;
71extern bool squeezeModules;
72extern bool preferDarkPanels;
74extern float frameRateLimit;
76extern float autosaveInterval;
77extern bool skipLoadOnLaunch;
78extern std::list<std::string> recentPatchPaths;
79extern std::vector<NVGcolor> cableColors;
80extern bool cableAutoRotate;
81extern bool autoCheckUpdates;
82extern bool verifyHttpsCerts;
83extern bool showTipsOnLaunch;
84extern int tipIndex;
94extern float browserZoom;
95extern json_t* pluginSettingsJ;
96
97struct ModuleInfo {
98 bool enabled = true;
99 bool favorite = false;
100 int added = 0;
101 double lastAdded = NAN;
102};
104extern std::map<std::string, std::map<std::string, ModuleInfo>> moduleInfos;
107ModuleInfo* getModuleInfo(const std::string& pluginSlug, const std::string& moduleSlug);
108
115 bool subscribed = false;
116 std::set<std::string> moduleSlugs;
117};
118extern std::map<std::string, PluginWhitelist> moduleWhitelist;
119
120bool isModuleWhitelisted(const std::string& pluginSlug, const std::string& moduleSlug);
122
125PRIVATE json_t* toJson();
126PRIVATE void fromJson(json_t* rootJ);
127PRIVATE void save(std::string path = "");
128PRIVATE void load(std::string path = "");
129
130
131} // namespace settings
132} // namespace rack
#define PRIVATE
Attribute for private functions not intended to be called by plugins.
Definition common.hpp:30
BrowserSort browserSort
PRIVATE void save(std::string path="")
PRIVATE void fromJson(json_t *rootJ)
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:85
@ BROWSER_SORT_UPDATED
Definition settings.hpp:86
@ BROWSER_SORT_LAST_USED
Definition settings.hpp:87
@ BROWSER_SORT_NAME
Definition settings.hpp:90
@ BROWSER_SORT_MOST_USED
Definition settings.hpp:88
@ BROWSER_SORT_BRAND
Definition settings.hpp:89
@ BROWSER_SORT_RANDOM
Definition settings.hpp:91
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()
PRIVATE json_t * toJson()
float haloBrightness
KnobMode
Definition settings.hpp:56
@ KNOB_MODE_LINEAR
Definition settings.hpp:57
@ KNOB_MODE_ROTARY_ABSOLUTE
Definition settings.hpp:59
@ KNOB_MODE_ROTARY_RELATIVE
Definition settings.hpp:60
@ KNOB_MODE_SCALED_LINEAR
Definition settings.hpp:58
void cableColorsReset()
std::vector< NVGcolor > cableColors
float autosaveInterval
Interval between autosaves in seconds.
PRIVATE void destroy()
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:97
bool enabled
Definition settings.hpp:98
bool favorite
Definition settings.hpp:99
double lastAdded
Definition settings.hpp:101
int added
Definition settings.hpp:100
The VCV JSON API returns the data structure {pluginSlug: [moduleSlugs] or true} where "true" represen...
Definition settings.hpp:114
bool subscribed
Definition settings.hpp:115
std::set< std::string > moduleSlugs
Definition settings.hpp:116