Skip to content

Commit

Permalink
Merge branch 'even-more-small-stuff-again'
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoerdvankreel committed Nov 12, 2024
2 parents 3dc6c7d + f299766 commit 39e8cd7
Show file tree
Hide file tree
Showing 45 changed files with 158 additions and 130 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ Extract the zipped folder and copy/replace it (the entire folder, not just the .
- Linux: ~/.vst3 or ~/.clap

# System requirements and supported environments
- Windows: 64-bit (X64) cpu with AVX support. Tested on Windows 11. Needs Windows 10+.
- Mac: 64-bit (X64) cpu for Intel-based Macs. 64-bit ARM cpu for Apple Silicon. Universal binaries are provided. Tested on MacOS 14, minimum required is 10.15.
- Linux: 64-bit (X64) cpu. Provided binaries do not require AVX support, but you might want to build with march=native for better performance. Tested on Ubuntu 22, minimum required is 18. Needs glibc 2.25+. Known to work on Fedora and Mint, too.
- Windows: 64-bit (X64) cpu with AVX support. Tested on Windows 11. Windows 7+ should work but you might need this:<br/>[https://learn.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist?view=msvc-170](https://learn.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist?view=msvc-170).
- Explicitly supported hosts: Reaper, Bitwig, FLStudio, Waveform 13+. Please use a recent version.
- Explicitly NOT supported hosts:<br/>Renoise (bug), Cakewalk (probably same as this: https://forum.renoise.com/t/possible-probable-bug-w-r-t-vst3-parameter-flushing/70684/9).
- All other hosts, you'll just have to try and see.
Expand Down
9 changes: 9 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
### November 12, 2024 - V1.9.9.

- Fix a couple compiler warnings.
- Update all dependencies to latest.
- Update all supported hosts (for testing) to latest.
- Add new host test file for FLStudio + CLAP, seems OK now.
- Breaking change: since JUCE 8 is minimum Windows 10, now so is Firefly!
- Replace homebrew fft with juce version, should speed up filter graph rendering a bit.

### November 7, 2024 - V1.9.8.

- Global LFO now reacts to phase adjustment when in snap-to-host-time mode.
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion lib/JUCE
Submodule JUCE updated 2786 files
2 changes: 1 addition & 1 deletion lib/readerwriterqueue
2 changes: 1 addition & 1 deletion lib/sse2neon
2 changes: 1 addition & 1 deletion lib/vst3/base
2 changes: 1 addition & 1 deletion lib/vst3/public.sdk
Submodule public.sdk updated 174 files
4 changes: 2 additions & 2 deletions macos/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>1.9.8</string>
<string>1.9.9</string>
<key>CFBundleVersion</key>
<string>1.9.8</string>
<string>1.9.9</string>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>NSHighResolutionCapable</key>
Expand Down
4 changes: 2 additions & 2 deletions param_reference.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<html>
<head>
<title>Firefly Synth 1.9.8</title>
<title>Firefly Synth 1.9.9</title>
<style>th, td { padding: 3px; }a, a:visited { color: #666666; }.description { background:#EEEEEE; }h1 { font-size: 19px; color: black; }h2 { font-size: 17px; color: black; }h3 { font-size: 15px; color: black; }body { font-family: Verdana; color: black; }html { position: relative; max-width: 1024px; margin: auto; }tr td { width: auto; white-space: nowrap; } tr th { width: auto; white-space: nowrap; }table, th, td { font-size: 13px; border: 1px solid gray; border-collapse: collapse; text-align: left; }tr td:last-child { width: 100%; white-space: wrap; } tr th:last-child { width: 100%; white-space: wrap; }</style>
</head>
<body>
<h1>Firefly Synth 1.9.8</h1>
<h1>Firefly Synth 1.9.9</h1>
<h2>Module Overview</h2>
<table>
<tr>
Expand Down
1 change: 0 additions & 1 deletion plugin_base/cmake/plugin_base.juce.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
add_definitions(-DJUCE_USE_CURL=0)
add_definitions(-DJUCE_DISPLAY_SPLASH_SCREEN=0)
add_definitions(-DJUCE_MODAL_LOOPS_PERMITTED=0)

if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ pb_plugin::guiSetParent(clap_window const* window) noexcept
{
PB_LOG_FUNC_ENTRY_EXIT();
_gui->addToDesktop(0, window->ptr);
_gui->getPeer()->setCurrentRenderingEngine(0);
#if (defined __linux__) || (defined __FreeBSD__)
for (int fd : LinuxEventLoopInternal::getRegisteredFds())
_host.posixFdSupportRegister(fd, CLAP_POSIX_FD_READ);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ pb_editor::attached(void* parent, FIDString type)
loop->registerEventHandler(this, fd);
#endif
_gui->addToDesktop(0, parent);
_gui->getPeer()->setCurrentRenderingEngine(0);
_gui->setVisible(true);
_gui->add_param_listener(_controller);
_gui->reloaded();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ load_ibstream(IBStream* stream)
return data;
}

extern char const* modulation_output_count_param_guid = "{0ED52D09-8FD0-4A4A-8D71-BEDED941ADAF}";
char const* modulation_output_count_param_guid = "{0ED52D09-8FD0-4A4A-8D71-BEDED941ADAF}";
char const* modulation_output_param_guids[modulation_output_param_count] = {
"{00F56C57-6B95-4117-8DA1-D011CC0CC042}",
"{2F254575-DBDC-4916-9E37-58B59A606DBD}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class graph_engine {
std::map<int, std::map<int, std::unique_ptr<module_engine>>> _activated = {};

public:
~graph_engine() { _engine.deactivate(); }
virtual ~graph_engine() { _engine.deactivate(); }
graph_engine(plugin_desc const* desc, graph_engine_params const& params);

void process_end();
Expand Down
6 changes: 3 additions & 3 deletions plugin_base/src/plugin_base/plugin_base/dsp/utility.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ fast_rand_seed(int seed)
inline float
fast_rand_next(std::uint32_t& state)
{
float const max_int = static_cast<float>(std::numeric_limits<std::int32_t>::max());
float constexpr max_int = static_cast<float>(std::numeric_limits<std::int32_t>::max());
state = static_cast<std::uint64_t>(state) * 48271 % 0x7fffffff;
return static_cast<float>(state) / max_int;
}
Expand Down Expand Up @@ -198,7 +198,7 @@ check_bipolar(double val)
if (-1 <= val && val <= 1) return val;
assert(-1 <= val && val <= 1);
return val;
#endif;
#endif
}

inline float
Expand All @@ -224,7 +224,7 @@ check_bipolar(float val)
if (-1 - 1e-5 <= val && val <= 1 + 1e-5) return val;
assert(-1 - 1e-5 <= val && val <= 1 + 1e-5);
return val;
#endif;
#endif
}

inline float mix_signal(float mix, float dry, float wet)
Expand Down
10 changes: 7 additions & 3 deletions plugin_base/src/plugin_base/plugin_base/gui/controls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ _bold(bold), _tabular(tabular), _font_height(height)
if(bold) label_font = label_font.boldened();
if(height != -1) label_font = label_font.withHeight(height);
float th = label_font.getHeight();
#pragma warning(suppress : 4996) // TODO once it gets better
float tw = label_font.getStringWidthFloat(reference_text);
float nw = std::ceil(tw) + getBorderSize().getLeftAndRight();
setSize(nw, std::ceil(th) + getBorderSize().getTopAndBottom());
Expand All @@ -311,6 +312,7 @@ autofit_combobox::max_text_width(PopupMenu const& menu)
while(iter.next())
{
auto text = iter.getItem().text;
#pragma warning(suppress : 4996) // TODO once it gets better
auto text_width = font.getStringWidthFloat(text);
if(iter.getItem().subMenu)
result = std::max(result, max_text_width(*iter.getItem().subMenu));
Expand All @@ -325,7 +327,7 @@ autofit_combobox::autofit()
{
if(!_autofit) return;

int const hpadding = 19;
int const hpadding = 20;
auto const& font = _lnf->getComboBoxFont(*this);
float text_height = font.getHeight();
float max_width = max_text_width(*getRootMenu());
Expand Down Expand Up @@ -437,7 +439,8 @@ static std::string
get_longest_module_name(plugin_gui* gui)
{
float w = 0;
juce::Font font;
FontOptions options;
Font font(options);
std::string result;
std::string full_name;
std::string display_name;
Expand All @@ -447,7 +450,8 @@ get_longest_module_name(plugin_gui* gui)
if(desc.modules[i].module->gui.visible)
{
get_module_output_label_names(desc.modules[i], full_name, display_name);
float name_w = font.getStringWidth(display_name);
#pragma warning(suppress : 4996) // TODO once it gets better
float name_w = font.getStringWidthFloat(display_name);
if (name_w > w)
{
w = name_w;
Expand Down
2 changes: 1 addition & 1 deletion plugin_base/src/plugin_base/plugin_base/gui/controls.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public juce::Component
param_desc const* const _param;

protected:
void enablementChanged() { repaint(); }
void enablementChanged() override { repaint(); }

public:
void paint(juce::Graphics& g) override;
Expand Down
2 changes: 1 addition & 1 deletion plugin_base/src/plugin_base/plugin_base/gui/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ justification_type(gui_label const& label)

static int
module_header_height(int font_height)
{ return font_height + 6; }
{ return font_height + 7; }

std::vector<list_item>
gui_visuals_items()
Expand Down
6 changes: 3 additions & 3 deletions plugin_base/src/plugin_base/plugin_base/gui/gui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ public juce::MouseListener
{
plugin_gui* const _gui;
public:
void mouseUp(juce::MouseEvent const& event);
gui_undo_listener(plugin_gui* gui): _gui(gui) {}
gui_undo_listener(plugin_gui* gui) : _gui(gui) {}
void mouseUp(juce::MouseEvent const& event) override;
};

// triggers clear/copy/swap/etc
Expand All @@ -97,7 +97,7 @@ public juce::MouseListener
juce::TabBarButton* _button;

public:
void mouseUp(juce::MouseEvent const& event);
void mouseUp(juce::MouseEvent const& event) override;
~gui_tab_menu_listener() { _button->removeMouseListener(this); }
gui_tab_menu_listener(plugin_gui* gui, plugin_state* state, lnf* lnf, juce::TabBarButton* button, int module, int slot):
_gui(gui), _lnf(lnf), _state(state), _button(button), _module(module), _slot(slot) { _button->addMouseListener(this, true); }
Expand Down
16 changes: 9 additions & 7 deletions plugin_base/src/plugin_base/plugin_base/gui/lnf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ get_combobox_mod_target_indicator_width(ComboBox const& box, Font const& font)
if (param_cb == nullptr) return 0;
auto drop_action = param_cb->get_drop_target_action();
if (drop_action == drop_target_action::none) return 0;
#pragma warning(suppress : 4996) // TODO once it gets better
return font.getStringWidth("[N/A]") + 2;
}

Expand Down Expand Up @@ -250,7 +251,7 @@ lnf::init_theme(std::filesystem::path const& theme_folder, var const& json)
}
}
}

assert(json.hasProperty("global_settings"));
var global_settings = json["global_settings"];
if (global_settings.hasProperty("lighten"))
Expand Down Expand Up @@ -333,9 +334,9 @@ Font
lnf::font() const
{
// Handle the case for missing resources.
Font result;
Font result(FontOptions(_global_settings.get_font_height()));
if(_typeface.get())
result = Font(_typeface);
result = Font(FontOptions(_typeface));
result.setHeight(_global_settings.get_font_height());
result.setStyleFlags(_desc->plugin->gui.font_flags);
return result;
Expand Down Expand Up @@ -406,6 +407,7 @@ lnf::getTabButtonBestWidth(TabBarButton& b, int)
float bar_width = b.getTabbedButtonBar().getWidth();
int tab_count = b.getTabbedButtonBar().getNumTabs();
if(!auto_size) return bar_width / tab_count;
#pragma warning(suppress : 4996) // TODO once it gets better
return font().getStringWidth(b.getButtonText()) + _global_settings.section_radius + 10;
}
auto full_name = _desc->plugin->modules[_module].info.tag.full_name;
Expand Down Expand Up @@ -446,7 +448,7 @@ lnf::drawTooltip(Graphics& g, String const& text, int w, int h)
g.fillRect(bounds.toFloat());
g.setColour(colors().bubble_outline);
g.drawRect(bounds.toFloat().reduced(0.5f, 0.5f), 1.0f);
auto layout = detail::LookAndFeelHelpers::layoutTooltipText(text, findColour(TooltipWindow::textColourId));
auto layout = detail::LookAndFeelHelpers::layoutTooltipText(TypefaceMetricsKind::portable, text, findColour(TooltipWindow::textColourId));
layout.draw(g, Rectangle<float>(w, h));
}

Expand Down Expand Up @@ -909,15 +911,15 @@ lnf::drawLinearSlider(Graphics& g, int x, int y, int w, int h, float p, float, f
assert(style == Slider::SliderStyle::LinearHorizontal);

// output meter
auto const& param_topo = *ps->param()->param;
if (ps && ps->param()->param->gui.edit_type == gui_edit_type::output_meter)
auto const* param_topo = ps? ps->param()->param: nullptr;
if (param_topo && param_topo->gui.edit_type == gui_edit_type::output_meter)
{
int block_pad = 2;
int block_count = 20;
float block_width_base = width / block_count;
float actual_block_width = (int)(block_width_base - block_pad);
float actual_cell_width = actual_block_width + block_pad;
float pos_adjust = pos * (param_topo.domain.max - param_topo.domain.min);
float pos_adjust = pos * (param_topo->domain.max - param_topo->domain.min);
int block_count_off = block_count * std::clamp(pos_adjust, 0.0f, 1.0f);

g.setColour(colors().param_meter1);
Expand Down
4 changes: 2 additions & 2 deletions plugin_base/src/plugin_base/plugin_base/gui/lnf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public juce::LookAndFeel_V4 {
gui_colors section_gui_colors(std::string const& section_full_name);

plugin_topo_gui_theme_settings const& global_settings() const { return _global_settings; }
int combo_height(bool tabular) const { return _global_settings.get_font_height() + (tabular ? 10 : 6); }
int toggle_height(bool tabular) const { return _global_settings.get_font_height() + (tabular ? 8 : 4); }
int combo_height(bool tabular) const { return _global_settings.get_font_height() + (tabular ? 11 : 7); }
int toggle_height(bool tabular) const { return _global_settings.get_font_height() + (tabular ? 9 : 5); }

int getDefaultScrollbarWidth() override { return 8; }
bool areScrollbarButtonsVisible() override { return true; }
Expand Down
1 change: 1 addition & 0 deletions plugin_base/src/plugin_base/plugin_base/gui/utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ make_drag_source_image(Font const& font, std::string const& text, Colour border_
float margin_w = 8.0f;
float margin_h = 4.0f;
float text_h = font.getHeight();
#pragma warning(suppress : 4996) // TODO once it gets better
float text_w = font.getStringWidthFloat(String(text));

Image image(Image::PixelFormat::ARGB, text_w + margin_w + extra_left, text_h + margin_h + extra_top, true);
Expand Down
62 changes: 23 additions & 39 deletions plugin_base/src/plugin_base/plugin_base/shared/utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,6 @@ using namespace juce;

namespace plugin_base {

// https://rosettacode.org/wiki/Fast_Fourier_transform#C.2B.2B
static void
fft(std::complex<float>* inout, std::complex<float>* scratch, int count)
{
if (count < 2) return;
assert(count == next_pow2(count));
std::complex<float>* even = scratch;
std::complex<float>* odd = scratch + count / 2;
for (std::size_t i = 0; i < count / 2; i++) even[i] = inout[i * 2];
for (std::size_t i = 0; i < count / 2; i++) odd[i] = inout[i * 2 + 1];
fft(odd, inout, count / 2);
fft(even, inout, count / 2);
for (std::size_t i = 0; i < count / 2; i++)
{
float im = -2.0f * pi32 * i / count;
std::complex<float> t = std::polar(1.0f, im) * odd[i];
inout[i] = even[i] + t;
inout[i + count / 2] = even[i] - t;
}
}

double
seconds_since_epoch()
{
Expand Down Expand Up @@ -60,27 +39,32 @@ file_load(std::filesystem::path const& path)
return data;
}

std::vector<float>
fft(std::vector<float> const& in)
cached_fft::
cached_fft(int in_samples):
_in_samples(in_samples),
_output(next_pow2(in_samples) * 2, 0.0f),
_juce_fft(std::log2(next_pow2(in_samples)))
{ assert(in_samples > 1); }

std::vector<float> const&
cached_fft::perform(std::vector<float> const& in)
{
std::size_t pow2 = next_pow2(in.size());
std::vector<std::complex<float>> inout(pow2, std::complex<float>());
std::vector<std::complex<float>> scratch(pow2, std::complex<float>());
for (std::size_t i = 0; i < in.size(); i++)
inout[i] = std::complex<float>(in[i], 0.0f);
fft(inout.data(), scratch.data(), pow2);
_output.clear();
int np2 = next_pow2(_in_samples);
assert(in.size() == _in_samples);
_output.resize(np2 * 2);
std::copy(in.begin(), in.end(), _output.begin());
_juce_fft.performRealOnlyForwardTransform(_output.data(), true);
_output.erase(_output.begin() + np2 / 2, _output.end());

// drop above nyquist
inout.erase(inout.begin() + pow2 / 2, inout.end());

// scale to 0..1
std::vector<float> result;
// scale to 0..1, real part is in even indices, drop imag parts
float max = std::numeric_limits<float>::min();
for (int i = 0; i < inout.size(); i++)
max = std::max(max, std::abs(inout[i].real()));
for (int i = 0; i < inout.size(); i++)
result.push_back(max == 0.0f? 0.0f: std::abs(inout[i].real()) / max);
return result;
for (int i = 0; i < _output.size(); i += 2)
max = std::max(max, std::abs(_output[i]));
for (int i = 0; i < _output.size() / 2; i++)
_output[i] = max == 0.0f ? 0.0f : std::abs(_output[i * 2]) / max;
_output.erase(_output.begin() + np2 / 4, _output.end());
return _output;
}

std::vector<float>
Expand Down
Loading

0 comments on commit 39e8cd7

Please sign in to comment.