@@ -0,0 +1 @@ | |||||
<div>Icons made by <a href="https://www.flaticon.com/authors/egor-rumyantsev" title="Egor Rumyantsev">Egor Rumyantsev</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a> is licensed by <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC 3.0 BY</a></div> |
@@ -0,0 +1,78 @@ | |||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | |||||
<svg | |||||
xmlns:dc="http://purl.org/dc/elements/1.1/" | |||||
xmlns:cc="http://creativecommons.org/ns#" | |||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | |||||
xmlns:svg="http://www.w3.org/2000/svg" | |||||
xmlns="http://www.w3.org/2000/svg" | |||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" | |||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" | |||||
version="1.1" | |||||
x="0px" | |||||
y="0px" | |||||
viewBox="-7074.5 3413.5 16 16" | |||||
enable-background="new -7074.5 3413.5 24 24" | |||||
xml:space="preserve" | |||||
id="svg12" | |||||
sodipodi:docname="settings_icon_cc.svg" | |||||
width="16" | |||||
height="16" | |||||
inkscape:version="0.92.3 (2405546, 2018-03-11)"><metadata | |||||
id="metadata18"><rdf:RDF><cc:Work | |||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type | |||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs | |||||
id="defs16"> | |||||
</defs><sodipodi:namedview | |||||
pagecolor="#ffffff" | |||||
bordercolor="#666666" | |||||
borderopacity="1" | |||||
objecttolerance="10" | |||||
gridtolerance="10" | |||||
guidetolerance="10" | |||||
inkscape:pageopacity="0" | |||||
inkscape:pageshadow="2" | |||||
inkscape:window-width="1920" | |||||
inkscape:window-height="1137" | |||||
id="namedview14" | |||||
showgrid="false" | |||||
inkscape:zoom="22.250293" | |||||
inkscape:cx="1.4996926" | |||||
inkscape:cy="9.1190487" | |||||
inkscape:window-x="-8" | |||||
inkscape:window-y="-8" | |||||
inkscape:window-maximized="1" | |||||
inkscape:current-layer="svg12" /><g | |||||
style="font-style:normal;font-weight:normal;font-size:40px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none" | |||||
id="text1044" /><g | |||||
style="font-style:normal;font-weight:normal;font-size:40px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none" | |||||
id="text1056" /><g | |||||
transform="matrix(0.04483133,0,0,0.04483133,-7072.6113,3415.4306)" | |||||
id="Settings" | |||||
style="fill:#b4b4b4;fill-opacity:1"><g | |||||
id="g4" | |||||
style="fill:#b4b4b4;fill-opacity:1"><path | |||||
style="clip-rule:evenodd;fill:#b4b4b4;fill-opacity:1;fill-rule:evenodd" | |||||
d="M 267.92,119.461 C 259.7639,108.37353 237.60907,113.69022 232.38746,96.479699 224.2718,82.390868 233.00438,67.286235 241.3705,56.29375 237.43425,44.426372 225.91606,35.523227 215.98352,28.244359 203.37196,32.005085 190.10946,46.088799 174.769,37.92 157.82363,32.983341 158.89813,13.404545 152.74813,1.7591562 140.59107,-0.17972483 126.1677,-2.1756684 114.95288,3.357125 112.96944,17.007361 108.38383,33.860528 92.63896,37.926967 77.775408,44.414555 65.997604,30.615672 53.839531,27.462953 43.772588,34.725084 31.977464,43.546698 27.964375,55.510625 c 8.49164,11.040709 17.354156,26.326968 8.991024,40.499701 -5.867916,15.344484 -24.485634,13.358994 -35.2431959,20.053284 -1.60577119,12.17834 -4.4742822,27.30556 2.2519219,37.97214 12.880627,2.23194 28.500004,5.84589 33.341875,20.29625 8.393178,15.26924 -5.888965,28.31876 -9.629844,40.84962 7.224375,9.96863 15.9554,21.67539 27.825594,25.64263 11.099937,-8.35246 26.446117,-17.06929 40.584732,-8.98545 15.634258,5.69547 13.544408,24.27779 19.933428,35.16712 12.15272,1.92903 26.57763,3.94093 37.78909,-1.60092 1.97214,-13.65237 6.56399,-30.5044 22.31039,-34.56583 14.86512,-6.50972 26.63511,7.31696 38.79786,10.45844 10.07865,-7.24787 21.85234,-16.08992 25.88513,-28.04249 -8.48485,-11.03294 -17.36567,-26.29404 -9.02937,-40.47181 5.58844,-11.68796 18.70272,-16.89286 31.01071,-16.51756 9.97767,-7.68663 4.90088,-25.51607 5.13628,-36.80475 z m -133.325,60.03 c -26.4812,0.83488 -49.170092,-25.58413 -44.306628,-51.64133 3.22607,-26.2257 32.618568,-44.652523 57.621488,-35.988163 25.41298,7.086788 39.29929,38.784143 27.08161,62.222153 -7.20502,15.27134 -23.48006,25.59801 -40.39647,25.40734 z" | |||||
id="path2" | |||||
inkscape:connector-curvature="0" /></g></g></svg> |
@@ -0,0 +1,27 @@ | |||||
<?xml version="1.0" encoding="iso-8859-1"?> | |||||
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> | |||||
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" | |||||
viewBox="0 0 268.765 268.765" style="enable-background:new 0 0 268.765 268.765;" xml:space="preserve" | |||||
> | |||||
<g id="Settings"> | |||||
<g> | |||||
<path style="fill-rule:evenodd;clip-rule:evenodd;" d="M267.92,119.461c-0.425-3.778-4.83-6.617-8.639-6.617 | |||||
c-12.315,0-23.243-7.231-27.826-18.414c-4.682-11.454-1.663-24.812,7.515-33.231c2.889-2.641,3.24-7.062,0.817-10.133 | |||||
c-6.303-8.004-13.467-15.234-21.289-21.5c-3.063-2.458-7.557-2.116-10.213,0.825c-8.01,8.871-22.398,12.168-33.516,7.529 | |||||
c-11.57-4.867-18.866-16.591-18.152-29.176c0.235-3.953-2.654-7.39-6.595-7.849c-10.038-1.161-20.164-1.197-30.232-0.08 | |||||
c-3.896,0.43-6.785,3.786-6.654,7.689c0.438,12.461-6.946,23.98-18.401,28.672c-10.985,4.487-25.272,1.218-33.266-7.574 | |||||
c-2.642-2.896-7.063-3.252-10.141-0.853c-8.054,6.319-15.379,13.555-21.74,21.493c-2.481,3.086-2.116,7.559,0.802,10.214 | |||||
c9.353,8.47,12.373,21.944,7.514,33.53c-4.639,11.046-16.109,18.165-29.24,18.165c-4.261-0.137-7.296,2.723-7.762,6.597 | |||||
c-1.182,10.096-1.196,20.383-0.058,30.561c0.422,3.794,4.961,6.608,8.812,6.608c11.702-0.299,22.937,6.946,27.65,18.415 | |||||
c4.698,11.454,1.678,24.804-7.514,33.23c-2.875,2.641-3.24,7.055-0.817,10.126c6.244,7.953,13.409,15.19,21.259,21.508 | |||||
c3.079,2.481,7.559,2.131,10.228-0.81c8.04-8.893,22.427-12.184,33.501-7.536c11.599,4.852,18.895,16.575,18.181,29.167 | |||||
c-0.233,3.955,2.67,7.398,6.595,7.85c5.135,0.599,10.301,0.898,15.481,0.898c4.917,0,9.835-0.27,14.752-0.817 | |||||
c3.897-0.43,6.784-3.786,6.653-7.696c-0.451-12.454,6.946-23.973,18.386-28.657c11.059-4.517,25.286-1.211,33.281,7.572 | |||||
c2.657,2.89,7.047,3.239,10.142,0.848c8.039-6.304,15.349-13.534,21.74-21.494c2.48-3.079,2.13-7.559-0.803-10.213 | |||||
c-9.353-8.47-12.388-21.946-7.529-33.524c4.568-10.899,15.612-18.217,27.491-18.217l1.662,0.043 | |||||
c3.853,0.313,7.398-2.655,7.865-6.588C269.044,139.917,269.058,129.639,267.92,119.461z M134.595,179.491 | |||||
c-24.718,0-44.824-20.106-44.824-44.824c0-24.717,20.106-44.824,44.824-44.824c24.717,0,44.823,20.107,44.823,44.824 | |||||
C179.418,159.385,159.312,179.491,134.595,179.491z"/> | |||||
</g> | |||||
</g> | |||||
</svg> |
@@ -3,6 +3,7 @@ | |||||
#include "window.hpp" | #include "window.hpp" | ||||
#include "engine.hpp" | #include "engine.hpp" | ||||
#include "asset.hpp" | #include "asset.hpp" | ||||
#include "settings.hpp" | |||||
#include "global.hpp" | #include "global.hpp" | ||||
#include "global_ui.hpp" | #include "global_ui.hpp" | ||||
@@ -14,6 +15,9 @@ extern void vst2_oversample_channels_set (int _numIn, int _numOut); | |||||
extern void vst2_oversample_channels_get (int *_numIn, int *_numOut); | extern void vst2_oversample_channels_get (int *_numIn, int *_numOut); | ||||
extern void vst2_idle_detect_mode_set (int _mode); | extern void vst2_idle_detect_mode_set (int _mode); | ||||
extern void vst2_idle_detect_mode_get (int *_mode); | extern void vst2_idle_detect_mode_get (int *_mode); | ||||
extern void vst2_refresh_rate_set (float _hz); | |||||
extern float vst2_refresh_rate_get (void); | |||||
extern void vst2_window_size_set (int _width, int _height); | |||||
#endif // RACK_HOST | #endif // RACK_HOST | ||||
namespace rack { | namespace rack { | ||||
@@ -320,6 +324,125 @@ struct IdleModeButton : TooltipIconButton { | |||||
} | } | ||||
}; | }; | ||||
struct settings_win_size_entry_t { | |||||
int w; | |||||
int h; | |||||
}; | |||||
static settings_win_size_entry_t loc_settings_win_sizes[] = { | |||||
{ 1002, 600 }, | |||||
{ 1272, 820 }, | |||||
{ 1408, 850 }, | |||||
{ 1588, 1100 }, | |||||
{ 1902, 1100 }, | |||||
{ 2500, 1980 }, | |||||
{ 3000, 1980 }, | |||||
}; | |||||
#define NUM_SETTINGS_WIN_SIZE (sizeof(loc_settings_win_sizes) / sizeof(settings_win_size_entry_t)) | |||||
struct SettingsWinSizeItem : MenuItem { | |||||
const settings_win_size_entry_t *setting; | |||||
void onAction(EventAction &e) override { | |||||
#ifdef RACK_HOST | |||||
global_ui->window.windowWidth = setting->w; | |||||
global_ui->window.windowHeight = setting->h; | |||||
vst2_window_size_set(setting->w, setting->h); | |||||
#endif // RACK_HOST | |||||
} | |||||
}; | |||||
struct settings_refresh_rate_entry_t { | |||||
int rate; | |||||
const char *caption; | |||||
}; | |||||
static settings_refresh_rate_entry_t loc_settings_refresh_rates[] = { | |||||
{ 0, "<host fps>" }, | |||||
{ 15, "15 fps" }, | |||||
{ 30, "30 fps" }, | |||||
{ 60, "60 fps" }, | |||||
{ 75, "75 fps" }, | |||||
{ 100, "100 fps" }, | |||||
}; | |||||
#define NUM_SETTINGS_REFRESH_RATE (sizeof(loc_settings_refresh_rates) / sizeof(settings_refresh_rate_entry_t)) | |||||
struct SettingsRefreshRateItem : MenuItem { | |||||
const settings_refresh_rate_entry_t *setting; | |||||
void onAction(EventAction &e) override { | |||||
#ifdef RACK_HOST | |||||
vst2_refresh_rate_set(float(setting->rate)); | |||||
#endif // RACK_HOST | |||||
} | |||||
}; | |||||
struct SettingsVsyncItem : MenuItem { | |||||
void onAction(EventAction &e) override { | |||||
lglw_swap_interval_set(global_ui->window.lglw, lglw_swap_interval_get(global_ui->window.lglw) ^ 1); | |||||
} | |||||
}; | |||||
struct SettingsSaveItem : MenuItem { | |||||
void onAction(EventAction &e) override { | |||||
settingsSave(assetLocal("settings.json")); | |||||
} | |||||
}; | |||||
struct SettingsButton : TooltipIconButton { | |||||
SettingsButton() { | |||||
setSVG(SVG::load(assetGlobal("res/icons/settings_icon_cc.svg"))); | |||||
tooltipText = "Global Settings"; | |||||
} | |||||
void onAction(EventAction &e) override { | |||||
Menu *menu = global_ui->ui.gScene->createMenu(); | |||||
menu->box.pos = getAbsoluteOffset(Vec(0, box.size.y)); | |||||
menu->box.size.x = box.size.x; | |||||
menu->addChild(MenuLabel::create("Global Settings")); | |||||
#ifdef RACK_HOST | |||||
int cWinW = int(global_ui->window.windowWidth); | |||||
int cWinH = int(global_ui->window.windowHeight); | |||||
for(int i = 0; i < NUM_SETTINGS_WIN_SIZE; i++) | |||||
{ | |||||
const settings_win_size_entry_t *en = &loc_settings_win_sizes[i]; | |||||
SettingsWinSizeItem *winSizeItem = new SettingsWinSizeItem(); | |||||
char buf[256]; | |||||
sprintf(buf, "%dx%d", en->w, en->h); | |||||
winSizeItem->text = buf; | |||||
winSizeItem->setting = en; | |||||
winSizeItem->rightText = CHECKMARK( (cWinW == en->w) && (cWinH == en->h) ); | |||||
menu->addChild(winSizeItem); | |||||
} | |||||
int cRate = int(vst2_refresh_rate_get()); | |||||
for(int i = 0; i < NUM_SETTINGS_REFRESH_RATE; i++) | |||||
{ | |||||
const settings_refresh_rate_entry_t *en = &loc_settings_refresh_rates[i]; | |||||
SettingsRefreshRateItem *rateItem = new SettingsRefreshRateItem(); | |||||
rateItem->text = en->caption; | |||||
rateItem->setting = en; | |||||
rateItem->rightText = CHECKMARK( (cRate == en->rate) ); | |||||
menu->addChild(rateItem); | |||||
} | |||||
SettingsVsyncItem *vsyncItem = new SettingsVsyncItem(); | |||||
vsyncItem->text = "Vsync"; | |||||
vsyncItem->rightText = CHECKMARK( (0 != lglw_swap_interval_get(global_ui->window.lglw)) ); | |||||
menu->addChild(vsyncItem); | |||||
SettingsSaveItem *saveItem = new SettingsSaveItem(); | |||||
saveItem->text = "Save Settings (+Favourites)"; | |||||
menu->addChild(saveItem); | |||||
#endif // RACK_HOST | |||||
} | |||||
}; | |||||
struct ZoomSlider : Slider { | struct ZoomSlider : Slider { | ||||
void onAction(EventAction &e) override { | void onAction(EventAction &e) override { | ||||
Slider::onAction(e); | Slider::onAction(e); | ||||
@@ -347,6 +470,7 @@ Toolbar::Toolbar() { | |||||
layout->addChild(new PowerMeterButton()); | layout->addChild(new PowerMeterButton()); | ||||
layout->addChild(new RackLockButton()); | layout->addChild(new RackLockButton()); | ||||
layout->addChild(new IdleModeButton()); | layout->addChild(new IdleModeButton()); | ||||
layout->addChild(new SettingsButton()); | |||||
wireOpacitySlider = new Slider(); | wireOpacitySlider = new Slider(); | ||||
wireOpacitySlider->box.size.x = 150; | wireOpacitySlider->box.size.x = 150; | ||||
@@ -9,16 +9,22 @@ | |||||
#include "global_ui.hpp" | #include "global_ui.hpp" | ||||
#ifdef RACK_HOST | |||||
extern void vst2_window_size_set (int _width, int _height); | extern void vst2_window_size_set (int _width, int _height); | ||||
extern void vst2_refresh_rate_set (float _hz); | extern void vst2_refresh_rate_set (float _hz); | ||||
#ifdef RACK_HOST | |||||
extern float vst2_refresh_rate_get (void); | |||||
extern void vst2_oversample_realtime_set (float _factor, int _quality); | extern void vst2_oversample_realtime_set (float _factor, int _quality); | ||||
extern void vst2_oversample_realtime_get (float *_factor, int *_quality); | |||||
extern void vst2_oversample_offline_set (float _factor, int _quality); | extern void vst2_oversample_offline_set (float _factor, int _quality); | ||||
extern void vst2_oversample_offline_get (float *_factor, int *_quality); | |||||
extern void vst2_oversample_offline_check_set (int _bEnable); | extern void vst2_oversample_offline_check_set (int _bEnable); | ||||
extern int32_t vst2_oversample_offline_check_get (void); | |||||
extern void vst2_oversample_channels_set (int _numIn, int _numOut); | extern void vst2_oversample_channels_set (int _numIn, int _numOut); | ||||
extern void vst2_oversample_channels_get (int *_numIn, int *_numOut); | |||||
extern void vst2_idle_detect_mode_fx_set (int _mode); | extern void vst2_idle_detect_mode_fx_set (int _mode); | ||||
extern int vst2_idle_detect_mode_fx_get (void); | |||||
extern void vst2_idle_detect_mode_instr_set (int _mode); | extern void vst2_idle_detect_mode_instr_set (int _mode); | ||||
extern int vst2_idle_detect_mode_instr_get (void); | |||||
#endif // RACK_HOST | #endif // RACK_HOST | ||||
namespace rack { | namespace rack { | ||||
@@ -30,11 +36,16 @@ static json_t *settingsToJson() { | |||||
// root | // root | ||||
json_t *rootJ = json_object(); | json_t *rootJ = json_object(); | ||||
#ifdef RACK_HOST | |||||
// token | // token | ||||
json_t *tokenJ = json_string(global->plugin.gToken.c_str()); | json_t *tokenJ = json_string(global->plugin.gToken.c_str()); | ||||
json_object_set_new(rootJ, "token", tokenJ); | json_object_set_new(rootJ, "token", tokenJ); | ||||
if (!windowIsMaximized()) { | |||||
#if 0 | |||||
if (!windowIsMaximized()) | |||||
#endif | |||||
{ | |||||
// windowSize | // windowSize | ||||
Vec windowSize = windowGetWindowSize(); | Vec windowSize = windowGetWindowSize(); | ||||
json_t *windowSizeJ = json_pack("[f, f]", windowSize.x, windowSize.y); | json_t *windowSizeJ = json_pack("[f, f]", windowSize.x, windowSize.y); | ||||
@@ -61,6 +72,86 @@ static json_t *settingsToJson() { | |||||
json_t *zoomJ = json_real(zoom); | json_t *zoomJ = json_real(zoom); | ||||
json_object_set_new(rootJ, "zoom", zoomJ); | json_object_set_new(rootJ, "zoom", zoomJ); | ||||
// refresh rate (Hz) | |||||
float refreshRate = vst2_refresh_rate_get(); | |||||
json_t *refreshRateJ = json_integer(int(refreshRate)); | |||||
json_object_set_new(rootJ, "refreshRate", refreshRateJ); | |||||
// vsync | |||||
int vsync = lglw_swap_interval_get(global_ui->window.lglw); | |||||
json_t *vsyncJ = json_boolean(vsync); | |||||
json_object_set_new(rootJ, "vsync", vsyncJ); | |||||
// touchInput | |||||
int touchInput = lglw_touchinput_get(global_ui->window.lglw); | |||||
json_t *touchInputJ = json_boolean(touchInput); | |||||
json_object_set_new(rootJ, "touchInput", touchInputJ); | |||||
// touchKbd | |||||
int touchKbd = b_touchkeyboard_enable; | |||||
json_t *touchKbdJ = json_boolean(touchKbd); | |||||
json_object_set_new(rootJ, "touchKbd", touchKbdJ); | |||||
// (realtime) oversampleFactor, oversampleQuality | |||||
{ | |||||
float factor; | |||||
int quality; | |||||
vst2_oversample_realtime_get(&factor, &quality); | |||||
json_t *factorJ = json_real(factor); | |||||
json_object_set_new(rootJ, "oversampleFactor", factorJ); | |||||
json_t *qualityJ = json_integer(quality); | |||||
json_object_set_new(rootJ, "oversampleQuality", qualityJ); | |||||
} | |||||
// oversampleOfflineFactor, oversampleOfflineQuality | |||||
{ | |||||
float factor; | |||||
int quality; | |||||
vst2_oversample_offline_get(&factor, &quality); | |||||
json_t *factorJ = json_real(factor); | |||||
json_object_set_new(rootJ, "oversampleOfflineFactor", factorJ); | |||||
json_t *qualityJ = json_integer(quality); | |||||
json_object_set_new(rootJ, "oversampleOfflineQuality", qualityJ); | |||||
} | |||||
// oversample offline check (oversampleOffline) | |||||
json_t *offlineJ = json_boolean(vst2_oversample_offline_check_get()); | |||||
json_object_set_new(rootJ, "oversampleOffline", offlineJ); | |||||
// oversample input channel limit (oversampleNumIn) | |||||
// oversample output channel limit (oversampleNumOut) | |||||
{ | |||||
int numIn; | |||||
int numOut; | |||||
vst2_oversample_channels_get(&numIn, &numOut); | |||||
json_t *numInJ = json_real(numIn); | |||||
json_object_set_new(rootJ, "oversampleNumIn", numInJ); | |||||
json_t *numOutJ = json_real(numOut); | |||||
json_object_set_new(rootJ, "oversampleNumOut", numOutJ); | |||||
} | |||||
// idleDetectInstr | |||||
{ | |||||
int idleMode = vst2_idle_detect_mode_instr_get(); | |||||
json_t *idleJ = json_integer(idleMode); | |||||
json_object_set_new(rootJ, "idleDetectInstr", idleJ); | |||||
} | |||||
// idleDetectFx | |||||
{ | |||||
int idleMode = vst2_idle_detect_mode_fx_get(); | |||||
json_t *idleJ = json_integer(idleMode); | |||||
json_object_set_new(rootJ, "idleDetectFx", idleJ); | |||||
} | |||||
// allowCursorLock | // allowCursorLock | ||||
json_t *allowCursorLockJ = json_boolean(global_ui->window.gAllowCursorLock); | json_t *allowCursorLockJ = json_boolean(global_ui->window.gAllowCursorLock); | ||||
json_object_set_new(rootJ, "allowCursorLock", allowCursorLockJ); | json_object_set_new(rootJ, "allowCursorLock", allowCursorLockJ); | ||||
@@ -87,6 +178,8 @@ static json_t *settingsToJson() { | |||||
// checkVersion | // checkVersion | ||||
json_object_set_new(rootJ, "checkVersion", json_boolean(global_ui->app.gCheckVersion)); | json_object_set_new(rootJ, "checkVersion", json_boolean(global_ui->app.gCheckVersion)); | ||||
#endif // RACK_HOST | |||||
return rootJ; | return rootJ; | ||||
} | } | ||||
@@ -107,7 +200,9 @@ static void settingsFromJson(json_t *rootJ, bool bWindowSizeOnly) { | |||||
{ | { | ||||
global_ui->window.windowWidth = int(width); | global_ui->window.windowWidth = int(width); | ||||
global_ui->window.windowHeight = int(height); | global_ui->window.windowHeight = int(height); | ||||
#ifdef RACK_HOST | |||||
vst2_window_size_set((int)width, (int)height); | vst2_window_size_set((int)width, (int)height); | ||||
#endif // RACK_HOST | |||||
return; | return; | ||||
} | } | ||||
#else | #else | ||||
@@ -146,7 +241,9 @@ static void settingsFromJson(json_t *rootJ, bool bWindowSizeOnly) { | |||||
// (note) <15: use DAW timer (effEditIdle) | // (note) <15: use DAW timer (effEditIdle) | ||||
json_t *refreshJ = json_object_get(rootJ, "refreshRate"); | json_t *refreshJ = json_object_get(rootJ, "refreshRate"); | ||||
if (refreshJ) { | if (refreshJ) { | ||||
#ifdef RACK_HOST | |||||
vst2_refresh_rate_set(clamp((float) json_number_value(refreshJ), 0.0f, 200.0f)); | vst2_refresh_rate_set(clamp((float) json_number_value(refreshJ), 0.0f, 200.0f)); | ||||
#endif // RACK_HOST | |||||
} | } | ||||
// vsync | // vsync | ||||
@@ -156,7 +253,7 @@ static void settingsFromJson(json_t *rootJ, bool bWindowSizeOnly) { | |||||
if (vsyncJ) | if (vsyncJ) | ||||
{ | { | ||||
lglw_glcontext_push(global_ui->window.lglw); | lglw_glcontext_push(global_ui->window.lglw); | ||||
lglw_swap_interval(global_ui->window.lglw, json_is_true(vsyncJ)); | |||||
lglw_swap_interval_set(global_ui->window.lglw, json_is_true(vsyncJ)); | |||||
lglw_glcontext_pop(global_ui->window.lglw); | lglw_glcontext_pop(global_ui->window.lglw); | ||||
} | } | ||||
} | } | ||||
@@ -18,7 +18,7 @@ | |||||
/// created: 25Jun2018 | /// created: 25Jun2018 | ||||
/// changed: 26Jun2018, 27Jun2018, 29Jun2018, 01Jul2018, 02Jul2018, 06Jul2018, 13Jul2018 | /// changed: 26Jun2018, 27Jun2018, 29Jun2018, 01Jul2018, 02Jul2018, 06Jul2018, 13Jul2018 | ||||
/// 26Jul2018, 04Aug2018, 05Aug2018, 06Aug2018, 07Aug2018, 09Aug2018, 11Aug2018 | /// 26Jul2018, 04Aug2018, 05Aug2018, 06Aug2018, 07Aug2018, 09Aug2018, 11Aug2018 | ||||
/// 18Aug2018, 19Aug2018 | |||||
/// 18Aug2018, 19Aug2018, 05Sep2018 | |||||
/// | /// | ||||
/// | /// | ||||
@@ -458,6 +458,8 @@ public: | |||||
bool b_check_offline; // true=ask host if it's in offline rendering mode | bool b_check_offline; // true=ask host if it's in offline rendering mode | ||||
sUI idle_detect_mode; | sUI idle_detect_mode; | ||||
sUI idle_detect_mode_fx; | |||||
sUI idle_detect_mode_instr; | |||||
sF32 idle_input_level_threshold; | sF32 idle_input_level_threshold; | ||||
sF32 idle_output_level_threshold; | sF32 idle_output_level_threshold; | ||||
sF32 idle_output_sec_threshold; | sF32 idle_output_sec_threshold; | ||||
@@ -563,6 +565,8 @@ public: | |||||
editor_rect.right = EDITWIN_X + _width; | editor_rect.right = EDITWIN_X + _width; | ||||
editor_rect.bottom = EDITWIN_Y + _height; | editor_rect.bottom = EDITWIN_Y + _height; | ||||
(void)lglw_window_resize(rack_global_ui.window.lglw, _width, _height); | |||||
} | } | ||||
void setRefreshRate(float _hz) { | void setRefreshRate(float _hz) { | ||||
@@ -570,6 +574,23 @@ public: | |||||
redraw_ival_ms = 0u; | redraw_ival_ms = 0u; | ||||
else | else | ||||
redraw_ival_ms = sUI(1000.0f / _hz); | redraw_ival_ms = sUI(1000.0f / _hz); | ||||
if(b_editor_open) | |||||
{ | |||||
lglw_timer_stop(rack_global_ui.window.lglw); | |||||
if(0u != redraw_ival_ms) | |||||
{ | |||||
lglw_timer_start(rack_global_ui.window.lglw, redraw_ival_ms); | |||||
} | |||||
} | |||||
} | |||||
float getRefreshRate(void) { | |||||
if(redraw_ival_ms > 0u) | |||||
return (1000.0f / redraw_ival_ms); | |||||
else | |||||
return 0.0f; | |||||
} | } | ||||
void destroyResamplerStates(void) { | void destroyResamplerStates(void) { | ||||
@@ -891,6 +912,20 @@ public: | |||||
idle_output_framecount = 0u; | idle_output_framecount = 0u; | ||||
} | } | ||||
void setIdleDetectModeFx(uint32_t _mode) { | |||||
idle_detect_mode_fx = _mode; | |||||
#ifdef VST2_EFFECT | |||||
setIdleDetectMode(uint32_t(_mode)); | |||||
#endif // VST2_EFFECT | |||||
} | |||||
void setIdleDetectModeInstr(uint32_t _mode) { | |||||
idle_detect_mode_instr = _mode; | |||||
#ifndef VST2_EFFECT | |||||
setIdleDetectMode(uint32_t(_mode)); | |||||
#endif // VST2_EFFECT | |||||
} | |||||
sUI getProgramChunk(uint8_t**_addr) { | sUI getProgramChunk(uint8_t**_addr) { | ||||
setGlobals(); | setGlobals(); | ||||
vst2_set_shared_plugin_tls_globals(); | vst2_set_shared_plugin_tls_globals(); | ||||
@@ -1719,6 +1754,12 @@ VstIntPtr VSTPluginDispatcher(VSTPlugin *vstPlugin, | |||||
if(NULL != ptr) | if(NULL != ptr) | ||||
{ | { | ||||
// ... | // ... | ||||
printf("xxx vstrack_plugin: effEditGetRect: (%d; %d; %d; %d)\n", | |||||
wrapper->editor_rect.top, | |||||
wrapper->editor_rect.left, | |||||
wrapper->editor_rect.bottom, | |||||
wrapper->editor_rect.right | |||||
); | |||||
*(void**)ptr = (void*) &wrapper->editor_rect; | *(void**)ptr = (void*) &wrapper->editor_rect; | ||||
r = 1; | r = 1; | ||||
} | } | ||||
@@ -1936,6 +1977,8 @@ VSTPluginWrapper::VSTPluginWrapper(audioMasterCallback vstHostCallback, | |||||
b_check_offline = false; | b_check_offline = false; | ||||
idle_detect_mode = IDLE_DETECT_NONE; | idle_detect_mode = IDLE_DETECT_NONE; | ||||
idle_detect_mode_fx = IDLE_DETECT_AUDIO; | |||||
idle_detect_mode_instr = IDLE_DETECT_MIDI; | |||||
b_idle = false; | b_idle = false; | ||||
idle_input_level_threshold = 0.00018f;//0.00007f; | idle_input_level_threshold = 0.00018f;//0.00007f; | ||||
idle_output_level_threshold = 0.00018f;//0.00003f; | idle_output_level_threshold = 0.00018f;//0.00003f; | ||||
@@ -1997,6 +2040,10 @@ void vst2_refresh_rate_set(float _hz) { | |||||
rack::global->vst2.wrapper->setRefreshRate(_hz); | rack::global->vst2.wrapper->setRefreshRate(_hz); | ||||
} | } | ||||
float vst2_refresh_rate_get(void) { | |||||
return rack::global->vst2.wrapper->getRefreshRate(); | |||||
} | |||||
extern "C" void lglw_timer_cbk(lglw_t _lglw) { | extern "C" void lglw_timer_cbk(lglw_t _lglw) { | ||||
VSTPluginWrapper *wrapper = (VSTPluginWrapper*)lglw_userdata_get(_lglw); | VSTPluginWrapper *wrapper = (VSTPluginWrapper*)lglw_userdata_get(_lglw); | ||||
wrapper->queueRedraw(); | wrapper->queueRedraw(); | ||||
@@ -2029,6 +2076,10 @@ void vst2_oversample_offline_check_set(int _bEnable) { | |||||
rack::global->vst2.wrapper->b_check_offline = (0 != _bEnable); | rack::global->vst2.wrapper->b_check_offline = (0 != _bEnable); | ||||
} | } | ||||
int32_t vst2_oversample_offline_check_get(void) { | |||||
return int32_t(rack::global->vst2.wrapper->b_check_offline); | |||||
} | |||||
void vst2_oversample_channels_set(int _numIn, int _numOut) { | void vst2_oversample_channels_set(int _numIn, int _numOut) { | ||||
rack::global->vst2.wrapper->setOversampleChannels(_numIn, _numOut); | rack::global->vst2.wrapper->setOversampleChannels(_numIn, _numOut); | ||||
} | } | ||||
@@ -2039,15 +2090,19 @@ void vst2_oversample_channels_get(int *_numIn, int *_numOut) { | |||||
} | } | ||||
void vst2_idle_detect_mode_fx_set(int _mode) { | void vst2_idle_detect_mode_fx_set(int _mode) { | ||||
#ifdef VST2_EFFECT | |||||
rack::global->vst2.wrapper->setIdleDetectMode(uint32_t(_mode)); | |||||
#endif // VST2_EFFECT | |||||
rack::global->vst2.wrapper->setIdleDetectModeFx(uint32_t(_mode)); | |||||
} | |||||
int vst2_idle_detect_mode_fx_get(void) { | |||||
return rack::global->vst2.wrapper->idle_detect_mode_fx; | |||||
} | } | ||||
void vst2_idle_detect_mode_instr_set(int _mode) { | void vst2_idle_detect_mode_instr_set(int _mode) { | ||||
#ifndef VST2_EFFECT | |||||
rack::global->vst2.wrapper->setIdleDetectMode(uint32_t(_mode)); | |||||
#endif // VST2_EFFECT | |||||
rack::global->vst2.wrapper->setIdleDetectModeInstr(uint32_t(_mode)); | |||||
} | |||||
int vst2_idle_detect_mode_instr_get(void) { | |||||
return rack::global->vst2.wrapper->idle_detect_mode_instr; | |||||
} | } | ||||
void vst2_idle_detect_mode_set(int _mode) { | void vst2_idle_detect_mode_set(int _mode) { | ||||
@@ -45,7 +45,7 @@ std::string QuantityWidget::getText() { | |||||
} | } | ||||
void QuantityWidget::onMouseLeave(EventMouseLeave &e) { | void QuantityWidget::onMouseLeave(EventMouseLeave &e) { | ||||
revert_val = INVALID_REVERT_VAL; | |||||
// // revert_val = INVALID_REVERT_VAL; | |||||
} | } | ||||
} // namespace rack | } // namespace rack |
@@ -374,7 +374,7 @@ void windowInit() { | |||||
global_ui->window.lastWindowTitle = ""; | global_ui->window.lastWindowTitle = ""; | ||||
lglw_glcontext_push(global_ui->window.lglw); | lglw_glcontext_push(global_ui->window.lglw); | ||||
lglw_swap_interval(global_ui->window.lglw, 1); // can be overridden via settings.json:"vsync" property | |||||
lglw_swap_interval_set(global_ui->window.lglw, 1); // can be overridden via settings.json:"vsync" property | |||||
lglw_mouse_callback_set (global_ui->window.lglw, &lglw_mouse_cbk); | lglw_mouse_callback_set (global_ui->window.lglw, &lglw_mouse_cbk); | ||||
lglw_focus_callback_set (global_ui->window.lglw, &lglw_focus_cbk); | lglw_focus_callback_set (global_ui->window.lglw, &lglw_focus_cbk); | ||||
@@ -0,0 +1 @@ | |||||
<div>Icons made by <a href="https://www.flaticon.com/authors/egor-rumyantsev" title="Egor Rumyantsev">Egor Rumyantsev</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a> is licensed by <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC 3.0 BY</a></div> |
@@ -0,0 +1,78 @@ | |||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | |||||
<svg | |||||
xmlns:dc="http://purl.org/dc/elements/1.1/" | |||||
xmlns:cc="http://creativecommons.org/ns#" | |||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | |||||
xmlns:svg="http://www.w3.org/2000/svg" | |||||
xmlns="http://www.w3.org/2000/svg" | |||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" | |||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" | |||||
version="1.1" | |||||
x="0px" | |||||
y="0px" | |||||
viewBox="-7074.5 3413.5 16 16" | |||||
enable-background="new -7074.5 3413.5 24 24" | |||||
xml:space="preserve" | |||||
id="svg12" | |||||
sodipodi:docname="settings_icon_cc.svg" | |||||
width="16" | |||||
height="16" | |||||
inkscape:version="0.92.3 (2405546, 2018-03-11)"><metadata | |||||
id="metadata18"><rdf:RDF><cc:Work | |||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type | |||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs | |||||
id="defs16"> | |||||
</defs><sodipodi:namedview | |||||
pagecolor="#ffffff" | |||||
bordercolor="#666666" | |||||
borderopacity="1" | |||||
objecttolerance="10" | |||||
gridtolerance="10" | |||||
guidetolerance="10" | |||||
inkscape:pageopacity="0" | |||||
inkscape:pageshadow="2" | |||||
inkscape:window-width="1920" | |||||
inkscape:window-height="1137" | |||||
id="namedview14" | |||||
showgrid="false" | |||||
inkscape:zoom="22.250293" | |||||
inkscape:cx="1.4996926" | |||||
inkscape:cy="9.1190487" | |||||
inkscape:window-x="-8" | |||||
inkscape:window-y="-8" | |||||
inkscape:window-maximized="1" | |||||
inkscape:current-layer="svg12" /><g | |||||
style="font-style:normal;font-weight:normal;font-size:40px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none" | |||||
id="text1044" /><g | |||||
style="font-style:normal;font-weight:normal;font-size:40px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none" | |||||
id="text1056" /><g | |||||
transform="matrix(0.04483133,0,0,0.04483133,-7072.6113,3415.4306)" | |||||
id="Settings" | |||||
style="fill:#b4b4b4;fill-opacity:1"><g | |||||
id="g4" | |||||
style="fill:#b4b4b4;fill-opacity:1"><path | |||||
style="clip-rule:evenodd;fill:#b4b4b4;fill-opacity:1;fill-rule:evenodd" | |||||
d="M 267.92,119.461 C 259.7639,108.37353 237.60907,113.69022 232.38746,96.479699 224.2718,82.390868 233.00438,67.286235 241.3705,56.29375 237.43425,44.426372 225.91606,35.523227 215.98352,28.244359 203.37196,32.005085 190.10946,46.088799 174.769,37.92 157.82363,32.983341 158.89813,13.404545 152.74813,1.7591562 140.59107,-0.17972483 126.1677,-2.1756684 114.95288,3.357125 112.96944,17.007361 108.38383,33.860528 92.63896,37.926967 77.775408,44.414555 65.997604,30.615672 53.839531,27.462953 43.772588,34.725084 31.977464,43.546698 27.964375,55.510625 c 8.49164,11.040709 17.354156,26.326968 8.991024,40.499701 -5.867916,15.344484 -24.485634,13.358994 -35.2431959,20.053284 -1.60577119,12.17834 -4.4742822,27.30556 2.2519219,37.97214 12.880627,2.23194 28.500004,5.84589 33.341875,20.29625 8.393178,15.26924 -5.888965,28.31876 -9.629844,40.84962 7.224375,9.96863 15.9554,21.67539 27.825594,25.64263 11.099937,-8.35246 26.446117,-17.06929 40.584732,-8.98545 15.634258,5.69547 13.544408,24.27779 19.933428,35.16712 12.15272,1.92903 26.57763,3.94093 37.78909,-1.60092 1.97214,-13.65237 6.56399,-30.5044 22.31039,-34.56583 14.86512,-6.50972 26.63511,7.31696 38.79786,10.45844 10.07865,-7.24787 21.85234,-16.08992 25.88513,-28.04249 -8.48485,-11.03294 -17.36567,-26.29404 -9.02937,-40.47181 5.58844,-11.68796 18.70272,-16.89286 31.01071,-16.51756 9.97767,-7.68663 4.90088,-25.51607 5.13628,-36.80475 z m -133.325,60.03 c -26.4812,0.83488 -49.170092,-25.58413 -44.306628,-51.64133 3.22607,-26.2257 32.618568,-44.652523 57.621488,-35.988163 25.41298,7.086788 39.29929,38.784143 27.08161,62.222153 -7.20502,15.27134 -23.48006,25.59801 -40.39647,25.40734 z" | |||||
id="path2" | |||||
inkscape:connector-curvature="0" /></g></g></svg> |