From bdd4998b1bb1fe0c617add1e4c23fb2ecce68907 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Thu, 7 Jul 2022 22:14:40 +0200 Subject: [PATCH] fixed blury icon and recorder level meter --- core/backends/glfw/backend.cpp | 18 +++++++++--------- misc_modules/recorder/src/main.cpp | 3 ++- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/core/backends/glfw/backend.cpp b/core/backends/glfw/backend.cpp index 542e94f7..13ba5be7 100644 --- a/core/backends/glfw/backend.cpp +++ b/core/backends/glfw/backend.cpp @@ -112,15 +112,6 @@ namespace backend { break; } - #endif - - // Add callback for max/min if GLFW supports it - #if (GLFW_VERSION_MAJOR == 3) && (GLFW_VERSION_MINOR >= 3) - if (maximized) { - glfwMaximizeWindow(window); - } - - glfwSetWindowMaximizeCallback(window, maximized_callback); #endif // Load app icon @@ -164,6 +155,15 @@ namespace backend { free(icons[i].pixels); } + // Add callback for max/min if GLFW supports it + #if (GLFW_VERSION_MAJOR == 3) && (GLFW_VERSION_MINOR >= 3) + if (maximized) { + glfwMaximizeWindow(window); + } + + glfwSetWindowMaximizeCallback(window, maximized_callback); + #endif + // Setup Dear ImGui context IMGUI_CHECKVERSION(); ImGui::CreateContext(); diff --git a/misc_modules/recorder/src/main.cpp b/misc_modules/recorder/src/main.cpp index c95387d4..50201c77 100644 --- a/misc_modules/recorder/src/main.cpp +++ b/misc_modules/recorder/src/main.cpp @@ -279,9 +279,10 @@ private: lvlL = std::clamp(lvlL - (frameTime * 50.0), -90.0f, 10.0f); lvlR = std::clamp(lvlR - (frameTime * 50.0), -90.0f, 10.0f); + // Note: Yes, using the natural log is on purpose, it just gives a more beautiful result. dsp::stereo_t rawLvl = meter.getLevel(); meter.resetLevel(); - dsp::stereo_t dbLvl = { 10.0f * log10f(rawLvl.l), 10.0f * log10f(rawLvl.r) }; + dsp::stereo_t dbLvl = { 10.0f * logf(rawLvl.l), 10.0f * logf(rawLvl.r) }; if (dbLvl.l > lvlL) { lvlL = dbLvl.l; } if (dbLvl.r > lvlR) { lvlR = dbLvl.r; } ImGui::VolumeMeter(lvlL, lvlL, -60, 10);