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;
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 spotlightBrightness;
60extern float spotlightRadius;
61extern float haloBrightness;
63extern bool allowCursorLock;
70extern KnobMode knobMode;
71extern bool knobScroll;
72extern float knobLinearSensitivity;
73extern float knobScrollSensitivity;
74extern float sampleRate;
75extern int threadCount;
76extern bool tooltips;
77extern bool cpuMeter;
78extern bool lockModules;
79extern bool squeezeModules;
80extern bool preferDarkPanels;
82extern float frameRateLimit;
84extern float autosaveInterval;
85extern bool skipLoadOnLaunch;
86extern std::string lastPatchDirectory;
87extern std::string lastSelectionDirectory;
88extern std::list<std::string> recentPatchPaths;
89extern std::vector<NVGcolor> cableColors;
90extern std::vector<std::string> cableLabels;
91extern bool cableAutoRotate;
92extern bool autoCheckUpdates;
93extern bool verifyHttpsCerts;
94extern bool showTipsOnLaunch;
95extern int tipIndex;
105extern float browserZoom;
106extern json_t* pluginSettingsJ;
107
109 bool enabled = true;
110 bool favorite = false;
111 int added = 0;
112 double lastAdded = NAN;
113};
114
115extern std::map<std::string, std::map<std::string, ModuleInfo>> moduleInfos;
118ModuleInfo* getModuleInfo(const std::string& pluginSlug, const std::string& moduleSlug);
119
126 bool subscribed = false;
127 std::set<std::string> moduleSlugs;
128};
129extern std::map<std::string, PluginWhitelist> moduleWhitelist;
130
131bool isModuleWhitelisted(const std::string& pluginSlug, const std::string& moduleSlug);
133
136PRIVATE json_t* toJson();
137PRIVATE void fromJson(json_t* rootJ);
138PRIVATE void save(std::string path = "");
139PRIVATE void load(std::string path = "");
140
141
142} // namespace settings
143} // 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:96
@ BROWSER_SORT_UPDATED
Definition settings.hpp:97
@ BROWSER_SORT_LAST_USED
Definition settings.hpp:98
@ BROWSER_SORT_NAME
Definition settings.hpp:101
@ BROWSER_SORT_MOST_USED
Definition settings.hpp:99
@ BROWSER_SORT_BRAND
Definition settings.hpp:100
@ BROWSER_SORT_RANDOM
Definition settings.hpp:102
float pixelRatio
Ratio between UI pixel and physical screen pixel.
float spotlightRadius
std::list< std::string > recentPatchPaths
std::map< std::string, PluginWhitelist > moduleWhitelist
float frameRateLimit
Maximum screen redraw frequency in Hz, or 0 for unlimited.
float spotlightBrightness
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:64
@ KNOB_MODE_LINEAR
Definition settings.hpp:65
@ KNOB_MODE_ROTARY_ABSOLUTE
Definition settings.hpp:67
@ KNOB_MODE_ROTARY_RELATIVE
Definition settings.hpp:68
@ KNOB_MODE_SCALED_LINEAR
Definition settings.hpp:66
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:108
bool enabled
Definition settings.hpp:109
bool favorite
Definition settings.hpp:110
double lastAdded
Definition settings.hpp:112
int added
Definition settings.hpp:111
The VCV JSON API returns the data structure {pluginSlug: [moduleSlugs] or true} where "true" represen...
Definition settings.hpp:125
bool subscribed
Definition settings.hpp:126
std::set< std::string > moduleSlugs
Definition settings.hpp:127