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;
43extern bool mouseWheelZoom;
47extern float pixelRatio;
49extern std::string uiTheme;
51extern float cableOpacity;
53extern float cableTension;
54extern float rackBrightness;
55extern float haloBrightness;
57extern bool allowCursorLock;
64extern KnobMode knobMode;
65extern bool knobScroll;
66extern float knobLinearSensitivity;
67extern float knobScrollSensitivity;
68extern float sampleRate;
69extern int threadCount;
70extern bool tooltips;
71extern bool cpuMeter;
72extern bool lockModules;
73extern bool squeezeModules;
74extern bool preferDarkPanels;
76extern float frameRateLimit;
78extern float autosaveInterval;
79extern bool skipLoadOnLaunch;
80extern std::list<std::string> recentPatchPaths;
81extern std::vector<NVGcolor> cableColors;
82extern std::vector<std::string> cableLabels;
83extern bool cableAutoRotate;
84extern bool autoCheckUpdates;
85extern bool verifyHttpsCerts;
86extern bool showTipsOnLaunch;
87extern int tipIndex;
97extern float browserZoom;
98extern json_t* pluginSettingsJ;
99
101 bool enabled = true;
102 bool favorite = false;
103 int added = 0;
104 double lastAdded = NAN;
105};
107extern std::map<std::string, std::map<std::string, ModuleInfo>> moduleInfos;
110ModuleInfo* getModuleInfo(const std::string& pluginSlug, const std::string& moduleSlug);
111
118 bool subscribed = false;
119 std::set<std::string> moduleSlugs;
120};
121extern std::map<std::string, PluginWhitelist> moduleWhitelist;
122
123bool isModuleWhitelisted(const std::string& pluginSlug, const std::string& moduleSlug);
125
128PRIVATE json_t* toJson();
129PRIVATE void fromJson(json_t* rootJ);
130PRIVATE void save(std::string path = "");
131PRIVATE void load(std::string path = "");
132
133
134} // namespace settings
135} // namespace rack
#define PRIVATE
Attribute for private functions not intended to be called by plugins.
Definition common.hpp:32
BrowserSort browserSort
PRIVATE void save(std::string path="")
PRIVATE void fromJson(json_t *rootJ)
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:88
@ BROWSER_SORT_UPDATED
Definition settings.hpp:89
@ BROWSER_SORT_LAST_USED
Definition settings.hpp:90
@ BROWSER_SORT_NAME
Definition settings.hpp:93
@ BROWSER_SORT_MOST_USED
Definition settings.hpp:91
@ BROWSER_SORT_BRAND
Definition settings.hpp:92
@ BROWSER_SORT_RANDOM
Definition settings.hpp:94
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
PRIVATE json_t * toJson()
float haloBrightness
KnobMode
Definition settings.hpp:58
@ KNOB_MODE_LINEAR
Definition settings.hpp:59
@ KNOB_MODE_ROTARY_ABSOLUTE
Definition settings.hpp:61
@ KNOB_MODE_ROTARY_RELATIVE
Definition settings.hpp:62
@ KNOB_MODE_SCALED_LINEAR
Definition settings.hpp:60
std::vector< NVGcolor > cableColors
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:100
bool enabled
Definition settings.hpp:101
bool favorite
Definition settings.hpp:102
double lastAdded
Definition settings.hpp:104
int added
Definition settings.hpp:103
The VCV JSON API returns the data structure {pluginSlug: [moduleSlugs] or true} where "true" represen...
Definition settings.hpp:117
bool subscribed
Definition settings.hpp:118
std::set< std::string > moduleSlugs
Definition settings.hpp:119