Skip to content

Commit

Permalink
Bind the 'fnt' library to surge for string formatting (#4975)
Browse files Browse the repository at this point in the history
  • Loading branch information
baconpaul authored Sep 2, 2021
1 parent 615468e commit e34fa82
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@
[submodule "libs/LuaJitLib/LuaJIT"]
path = libs/LuaJitLib/LuaJIT
url = https://github.com/LuaJIT/LuaJIT.git
[submodule "libs/fmt"]
path = libs/fmt
url = https://github.com/fmtlib/fmt.git
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ add_subdirectory(libs/airwindows)
add_subdirectory(libs/catch2)
add_subdirectory(libs/eurorack)
add_subdirectory(libs/filesystem)
add_subdirectory(libs/fmt)
add_subdirectory(libs/tinyxml)
add_subdirectory(libs/oddsound-mts)
if(MINGW)
Expand Down Expand Up @@ -203,6 +204,7 @@ target_link_libraries(surge-shared PUBLIC
samplerate
surge-shared-binary
tuning-library
fmt
)

# We want to run this once alas, since JUCE needs it even though it is a byproduct of a phase to build the
Expand Down
1 change: 1 addition & 0 deletions libs/fmt
Submodule fmt added at d58d19
3 changes: 2 additions & 1 deletion src/gui/SurgeGUIEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "SurgeSynthEditor.h"

#include "SurgeGUIEditorTags.h"
#include "fmt/core.h"

#include "overlays/AboutScreen.h"
#include "overlays/CoveringMessageOverlay.h"
Expand Down Expand Up @@ -2380,7 +2381,7 @@ juce::PopupMenu SurgeGUIEditor::makeTuningMenu(const juce::Point<int> &where, bo
[this](const std::string &s) {
float freq = ::atof(s.c_str());
auto kb = Tunings::tuneA69To(freq);
kb.name = "Note 69 Retuned 440 to " + std::to_string(freq);
kb.name = fmt::format("Note 69 Retuned 440 to {:.2f}", freq);
if (!this->synth->storage.remapToKeyboard(kb))
{
synth->storage.reportError("This .kbm file is not valid!",
Expand Down

0 comments on commit e34fa82

Please sign in to comment.