id
int64 0
755k
| file_name
stringlengths 3
109
| file_path
stringlengths 13
185
| content
stringlengths 31
9.38M
| size
int64 31
9.38M
| language
stringclasses 1
value | extension
stringclasses 11
values | total_lines
int64 1
340k
| avg_line_length
float64 2.18
149k
| max_line_length
int64 7
2.22M
| alphanum_fraction
float64 0
1
| repo_name
stringlengths 6
65
| repo_stars
int64 100
47.3k
| repo_forks
int64 0
12k
| repo_open_issues
int64 0
3.4k
| repo_license
stringclasses 9
values | repo_extraction_date
stringclasses 92
values | exact_duplicates_redpajama
bool 2
classes | near_duplicates_redpajama
bool 2
classes | exact_duplicates_githubcode
bool 2
classes | exact_duplicates_stackv2
bool 1
class | exact_duplicates_stackv1
bool 2
classes | near_duplicates_githubcode
bool 2
classes | near_duplicates_stackv1
bool 2
classes | near_duplicates_stackv2
bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
24,710
|
convolver_menu_combine.cpp
|
wwmm_easyeffects/src/convolver_menu_combine.cpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#include "convolver_menu_combine.hpp"
#include <gio/gio.h>
#include <glib-object.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <gtk/gtkdropdown.h>
#include <sndfile.h>
#include <algorithm>
#include <cstddef>
#include <execution>
#include <filesystem>
#include <memory>
#include <numeric>
#include <sndfile.hh>
#include <string>
#include <thread>
#include <vector>
#include "convolver_ui_common.hpp"
#include "resampler.hpp"
#include "tags_app.hpp"
#include "tags_resources.hpp"
#include "ui_helpers.hpp"
#include "util.hpp"
namespace ui::convolver_menu_combine {
using namespace std::string_literals;
auto constexpr irs_ext = ".irs";
std::filesystem::path irs_dir = g_get_user_config_dir() + "/easyeffects/irs"s;
struct Data {
public:
~Data() { util::debug("data struct destroyed"); }
std::vector<std::thread> mythreads;
};
struct _ConvolverMenuCombine {
GtkBox parent_instance;
GtkDropDown *dropdown_kernel_1, *dropdown_kernel_2;
GtkEntry* output_kernel_name;
GtkSpinner* spinner;
GtkStringList *string_list_1, *string_list_2;
GSettings* app_settings;
Data* data;
};
// NOLINTNEXTLINE
G_DEFINE_TYPE(ConvolverMenuCombine, convolver_menu_combine, GTK_TYPE_POPOVER)
void append_to_string_list(ConvolverMenuCombine* self, const std::string& irs_filename) {
ui::append_to_string_list(self->string_list_1, irs_filename);
ui::append_to_string_list(self->string_list_2, irs_filename);
}
void remove_from_string_list(ConvolverMenuCombine* self, const std::string& irs_filename) {
ui::remove_from_string_list(self->string_list_1, irs_filename);
ui::remove_from_string_list(self->string_list_2, irs_filename);
}
void direct_conv(const std::vector<float>& a, const std::vector<float>& b, std::vector<float>& c) {
std::vector<size_t> indices(c.size());
std::iota(indices.begin(), indices.end(), 0U);
auto each = [&](const int n) {
c[n] = 0.0F;
// Static cast to avoid gcc signedness warning.
const int a_size = static_cast<int>(a.size());
const int b_size = static_cast<int>(b.size());
for (int m = 0; m < b_size; m++) {
if (const auto z = n - m; z >= 0 && z < a_size - 1) {
c[n] += b[m] * a[z];
}
}
};
#if defined(ENABLE_LIBCPP_WORKAROUNDS) && (_LIBCPP_VERSION < 170000 || defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL))
std::for_each(indices.begin(), indices.end(), each);
#else
std::for_each(std::execution::par_unseq, indices.begin(), indices.end(), each);
#endif
}
void combine_kernels(ConvolverMenuCombine* self,
const std::string& kernel_1_name,
const std::string& kernel_2_name,
const std::string& output_file_name) {
if (output_file_name.empty()) {
// The method combine_kernels run in a secondary thread. But the widgets have to be used in the main thread.
g_object_ref(self);
util::idle_add([=] { gtk_spinner_stop(self->spinner); }, [=]() { g_object_unref(self); });
return;
}
auto [rate1, kernel_1_L, kernel_1_R] = ui::convolver::read_kernel(irs_dir, irs_ext, kernel_1_name);
auto [rate2, kernel_2_L, kernel_2_R] = ui::convolver::read_kernel(irs_dir, irs_ext, kernel_2_name);
if (rate1 == 0 || rate2 == 0) {
g_object_ref(self);
util::idle_add([=] { gtk_spinner_stop(self->spinner); }, [=]() { g_object_unref(self); });
return;
}
if (rate1 > rate2) {
util::debug("resampling the kernel " + kernel_2_name + " to " + util::to_string(rate1) + " Hz");
auto resampler = std::make_unique<Resampler>(rate2, rate1);
kernel_2_L = resampler->process(kernel_2_L, true);
resampler = std::make_unique<Resampler>(rate2, rate1);
kernel_2_R = resampler->process(kernel_2_R, true);
} else if (rate2 > rate1) {
util::debug("resampling the kernel " + kernel_1_name + " to " + util::to_string(rate2) + " Hz");
auto resampler = std::make_unique<Resampler>(rate1, rate2);
kernel_1_L = resampler->process(kernel_1_L, true);
resampler = std::make_unique<Resampler>(rate1, rate2);
kernel_1_R = resampler->process(kernel_1_R, true);
}
std::vector<float> kernel_L(kernel_1_L.size() + kernel_2_L.size() - 1U);
std::vector<float> kernel_R(kernel_1_R.size() + kernel_2_R.size() - 1U);
// As the convolution is commutative we change the order based on which will run faster.
if (kernel_1_L.size() > kernel_2_L.size()) {
direct_conv(kernel_1_L, kernel_2_L, kernel_L);
direct_conv(kernel_1_R, kernel_2_R, kernel_R);
} else {
direct_conv(kernel_2_L, kernel_1_L, kernel_L);
direct_conv(kernel_2_R, kernel_1_R, kernel_R);
}
std::vector<float> buffer(kernel_L.size() * 2U); // 2 channels interleaved
for (size_t n = 0U; n < kernel_L.size(); n++) {
buffer[2U * n] = kernel_L[n];
buffer[2U * n + 1U] = kernel_R[n];
}
const auto output_file_path = irs_dir / std::filesystem::path{output_file_name + irs_ext};
auto mode = SFM_WRITE;
auto format = SF_FORMAT_WAV | SF_FORMAT_PCM_32;
auto n_channels = 2;
auto rate = (rate1 > rate2) ? rate1 : rate2;
auto sndfile = SndfileHandle(output_file_path.string(), mode, format, n_channels, rate);
sndfile.writef(buffer.data(), static_cast<sf_count_t>(kernel_L.size()));
util::debug("combined kernel saved: " + output_file_path.string());
g_object_ref(self);
util::idle_add([=] { gtk_spinner_stop(self->spinner); }, [=]() { g_object_unref(self); });
}
void on_combine_kernels(ConvolverMenuCombine* self, GtkButton* btn) {
if (g_list_model_get_n_items(G_LIST_MODEL(self->string_list_1)) == 0U ||
g_list_model_get_n_items(G_LIST_MODEL(self->string_list_2)) == 0U) {
return;
}
auto* dropdown_1_selection = gtk_drop_down_get_selected_item(self->dropdown_kernel_1);
auto* dropdown_2_selection = gtk_drop_down_get_selected_item(self->dropdown_kernel_2);
if (dropdown_1_selection == nullptr || dropdown_2_selection == nullptr) {
return;
}
gtk_spinner_start(self->spinner);
const auto* const kernel_1_name = gtk_string_object_get_string(GTK_STRING_OBJECT(dropdown_1_selection));
const auto* const kernel_2_name = gtk_string_object_get_string(GTK_STRING_OBJECT(dropdown_2_selection));
std::string output_name = g_utf8_make_valid(gtk_editable_get_text(GTK_EDITABLE(self->output_kernel_name)), -1);
gtk_editable_set_text(GTK_EDITABLE(self->output_kernel_name), "");
util::str_trim(output_name);
if (output_name.empty() || output_name.find_first_of("\\/") != std::string::npos) {
util::debug(" combined IR filename is empty or has illegal characters.");
gtk_widget_add_css_class(GTK_WIDGET(self->output_kernel_name), "error");
gtk_widget_grab_focus(GTK_WIDGET(self->output_kernel_name));
gtk_spinner_stop(self->spinner);
} else {
// Truncate filename if longer than 100 characters
if (output_name.size() > 100U) {
output_name.resize(100U);
}
gtk_widget_remove_css_class(GTK_WIDGET(self->output_kernel_name), "error");
/*
The current code convolving the impulse responses is doing direct convolution. It can be very slow depending on
the size of each kernel. So we do not want to do it in the main thread.
*/
self->data->mythreads.emplace_back( // Using emplace_back here makes sense
[=]() { combine_kernels(self, kernel_1_name, kernel_2_name, output_name); });
}
}
void dispose(GObject* object) {
auto* self = EE_CONVOLVER_MENU_COMBINE(object);
for (auto& t : self->data->mythreads) {
t.join();
}
self->data->mythreads.clear();
g_object_unref(self->app_settings);
util::debug("disposed");
G_OBJECT_CLASS(convolver_menu_combine_parent_class)->dispose(object);
}
void finalize(GObject* object) {
auto* self = EE_CONVOLVER_MENU_COMBINE(object);
delete self->data;
util::debug("finalized");
G_OBJECT_CLASS(convolver_menu_combine_parent_class)->finalize(object);
}
void convolver_menu_combine_class_init(ConvolverMenuCombineClass* klass) {
auto* object_class = G_OBJECT_CLASS(klass);
auto* widget_class = GTK_WIDGET_CLASS(klass);
object_class->dispose = dispose;
object_class->finalize = finalize;
gtk_widget_class_set_template_from_resource(widget_class, tags::resources::convolver_menu_combine_ui);
gtk_widget_class_bind_template_child(widget_class, ConvolverMenuCombine, string_list_1);
gtk_widget_class_bind_template_child(widget_class, ConvolverMenuCombine, string_list_2);
gtk_widget_class_bind_template_child(widget_class, ConvolverMenuCombine, dropdown_kernel_1);
gtk_widget_class_bind_template_child(widget_class, ConvolverMenuCombine, dropdown_kernel_2);
gtk_widget_class_bind_template_child(widget_class, ConvolverMenuCombine, output_kernel_name);
gtk_widget_class_bind_template_child(widget_class, ConvolverMenuCombine, spinner);
gtk_widget_class_bind_template_callback(widget_class, on_combine_kernels);
}
void convolver_menu_combine_init(ConvolverMenuCombine* self) {
gtk_widget_init_template(GTK_WIDGET(self));
self->data = new Data();
for (const auto& name : util::get_files_name(irs_dir, irs_ext)) {
gtk_string_list_append(self->string_list_1, name.c_str());
gtk_string_list_append(self->string_list_2, name.c_str());
}
self->app_settings = g_settings_new(tags::app::id);
g_settings_bind(self->app_settings, "autohide-popovers", self, "autohide", G_SETTINGS_BIND_DEFAULT);
}
auto create() -> ConvolverMenuCombine* {
return static_cast<ConvolverMenuCombine*>(g_object_new(EE_TYPE_CONVOLVER_MENU_COMBINE, nullptr));
}
} // namespace ui::convolver_menu_combine
| 10,279
|
C++
|
.cpp
| 224
| 42.263393
| 117
| 0.700422
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,711
|
gate_preset.cpp
|
wwmm_easyeffects/src/gate_preset.cpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#include "gate_preset.hpp"
#include <gio/gio.h>
#include <glib.h>
#include <nlohmann/json_fwd.hpp>
#include "plugin_preset_base.hpp"
#include "preset_type.hpp"
#include "tags_plugin_name.hpp"
#include "tags_schema.hpp"
#include "util.hpp"
GatePreset::GatePreset(PresetType preset_type, const int& index)
: PluginPresetBase(tags::schema::gate::id,
tags::schema::gate::input_path,
tags::schema::gate::output_path,
preset_type,
index) {
instance_name.assign(tags::plugin_name::gate).append("#").append(util::to_string(index));
}
void GatePreset::save(nlohmann::json& json) {
json[section][instance_name]["bypass"] = g_settings_get_boolean(settings, "bypass") != 0;
json[section][instance_name]["input-gain"] = g_settings_get_double(settings, "input-gain");
json[section][instance_name]["output-gain"] = g_settings_get_double(settings, "output-gain");
json[section][instance_name]["dry"] = g_settings_get_double(settings, "dry");
json[section][instance_name]["wet"] = g_settings_get_double(settings, "wet");
json[section][instance_name]["attack"] = g_settings_get_double(settings, "attack");
json[section][instance_name]["release"] = g_settings_get_double(settings, "release");
json[section][instance_name]["curve-threshold"] = g_settings_get_double(settings, "curve-threshold");
json[section][instance_name]["curve-zone"] = g_settings_get_double(settings, "curve-zone");
json[section][instance_name]["hysteresis"] = g_settings_get_boolean(settings, "hysteresis") != 0;
json[section][instance_name]["hysteresis-threshold"] = g_settings_get_double(settings, "hysteresis-threshold");
json[section][instance_name]["hysteresis-zone"] = g_settings_get_double(settings, "hysteresis-zone");
json[section][instance_name]["reduction"] = g_settings_get_double(settings, "reduction");
json[section][instance_name]["makeup"] = g_settings_get_double(settings, "makeup");
json[section][instance_name]["stereo-split"] = g_settings_get_boolean(settings, "stereo-split") != 0;
json[section][instance_name]["sidechain"]["input"] = util::gsettings_get_string(settings, "sidechain-input");
json[section][instance_name]["sidechain"]["mode"] = util::gsettings_get_string(settings, "sidechain-mode");
json[section][instance_name]["sidechain"]["source"] = util::gsettings_get_string(settings, "sidechain-source");
json[section][instance_name]["sidechain"]["stereo-split-source"] =
util::gsettings_get_string(settings, "stereo-split-source");
json[section][instance_name]["sidechain"]["preamp"] = g_settings_get_double(settings, "sidechain-preamp");
json[section][instance_name]["sidechain"]["reactivity"] = g_settings_get_double(settings, "sidechain-reactivity");
json[section][instance_name]["sidechain"]["lookahead"] = g_settings_get_double(settings, "sidechain-lookahead");
json[section][instance_name]["hpf-mode"] = util::gsettings_get_string(settings, "hpf-mode");
json[section][instance_name]["hpf-frequency"] = g_settings_get_double(settings, "hpf-frequency");
json[section][instance_name]["lpf-mode"] = util::gsettings_get_string(settings, "lpf-mode");
json[section][instance_name]["lpf-frequency"] = g_settings_get_double(settings, "lpf-frequency");
}
void GatePreset::load(const nlohmann::json& json) {
update_key<bool>(json.at(section).at(instance_name), settings, "bypass", "bypass");
update_key<double>(json.at(section).at(instance_name), settings, "input-gain", "input-gain");
update_key<double>(json.at(section).at(instance_name), settings, "output-gain", "output-gain");
update_key<double>(json.at(section).at(instance_name), settings, "dry", "dry");
update_key<double>(json.at(section).at(instance_name), settings, "wet", "wet");
update_key<double>(json.at(section).at(instance_name), settings, "attack", "attack");
update_key<double>(json.at(section).at(instance_name), settings, "release", "release");
update_key<double>(json.at(section).at(instance_name), settings, "curve-threshold", "curve-threshold");
update_key<double>(json.at(section).at(instance_name), settings, "curve-zone", "curve-zone");
update_key<bool>(json.at(section).at(instance_name), settings, "hysteresis", "hysteresis");
update_key<double>(json.at(section).at(instance_name), settings, "hysteresis-threshold", "hysteresis-threshold");
update_key<double>(json.at(section).at(instance_name), settings, "hysteresis-zone", "hysteresis-zone");
update_key<double>(json.at(section).at(instance_name), settings, "reduction", "reduction");
update_key<double>(json.at(section).at(instance_name), settings, "makeup", "makeup");
update_key<bool>(json.at(section).at(instance_name), settings, "stereo-split", "stereo-split");
update_key<gchar*>(json.at(section).at(instance_name).at("sidechain"), settings, "sidechain-input", "input");
update_key<gchar*>(json.at(section).at(instance_name).at("sidechain"), settings, "sidechain-mode", "mode");
update_key<gchar*>(json.at(section).at(instance_name).at("sidechain"), settings, "stereo-split-source",
"stereo-split-source");
update_key<gchar*>(json.at(section).at(instance_name).at("sidechain"), settings, "sidechain-source", "source");
update_key<double>(json.at(section).at(instance_name).at("sidechain"), settings, "sidechain-preamp", "preamp");
update_key<double>(json.at(section).at(instance_name).at("sidechain"), settings, "sidechain-reactivity",
"reactivity");
update_key<double>(json.at(section).at(instance_name).at("sidechain"), settings, "sidechain-lookahead", "lookahead");
update_key<gchar*>(json.at(section).at(instance_name), settings, "hpf-mode", "hpf-mode");
update_key<double>(json.at(section).at(instance_name), settings, "hpf-frequency", "hpf-frequency");
update_key<gchar*>(json.at(section).at(instance_name), settings, "lpf-mode", "lpf-mode");
update_key<double>(json.at(section).at(instance_name), settings, "lpf-frequency", "lpf-frequency");
}
| 6,822
|
C++
|
.cpp
| 94
| 68.159574
| 119
| 0.715163
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,712
|
convolver_preset.cpp
|
wwmm_easyeffects/src/convolver_preset.cpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#include "convolver_preset.hpp"
#include <gio/gio.h>
#include <glib.h>
#include <nlohmann/json_fwd.hpp>
#include "plugin_preset_base.hpp"
#include "preset_type.hpp"
#include "tags_plugin_name.hpp"
#include "tags_schema.hpp"
#include "util.hpp"
ConvolverPreset::ConvolverPreset(PresetType preset_type, const int& index)
: PluginPresetBase(tags::schema::convolver::id,
tags::schema::convolver::input_path,
tags::schema::convolver::output_path,
preset_type,
index) {
instance_name.assign(tags::plugin_name::convolver).append("#").append(util::to_string(index));
}
void ConvolverPreset::save(nlohmann::json& json) {
json[section][instance_name]["bypass"] = g_settings_get_boolean(settings, "bypass") != 0;
json[section][instance_name]["input-gain"] = g_settings_get_double(settings, "input-gain");
json[section][instance_name]["output-gain"] = g_settings_get_double(settings, "output-gain");
json[section][instance_name]["kernel-name"] = util::gsettings_get_string(settings, "kernel-name");
json[section][instance_name]["ir-width"] = g_settings_get_int(settings, "ir-width");
json[section][instance_name]["autogain"] = g_settings_get_boolean(settings, "autogain") != 0;
}
void ConvolverPreset::load(const nlohmann::json& json) {
update_key<bool>(json.at(section).at(instance_name), settings, "bypass", "bypass");
update_key<double>(json.at(section).at(instance_name), settings, "input-gain", "input-gain");
update_key<double>(json.at(section).at(instance_name), settings, "output-gain", "output-gain");
update_key<int>(json.at(section).at(instance_name), settings, "ir-width", "ir-width");
update_key<bool>(json.at(section).at(instance_name), settings, "autogain", "autogain");
// kernel-path deprecation
const auto* kernel_name_key = "kernel-name";
std::string new_kernel_name =
json.at(section).at(instance_name).value(kernel_name_key, get_default<gchar*>(settings, kernel_name_key));
if (new_kernel_name.empty()) {
const std::string kernel_path = json.at(section).at(instance_name).value("kernel-path", "");
if (!kernel_path.empty()) {
new_kernel_name = std::filesystem::path{kernel_path}.stem().c_str();
util::warning("using Convolver kernel-path is deprecated, please update your preset; fallback to kernel-name: " +
new_kernel_name);
}
}
const auto current_kernel_name = util::gsettings_get_string(settings, kernel_name_key);
if (new_kernel_name != current_kernel_name) {
g_settings_set_string(settings, kernel_name_key, new_kernel_name.c_str());
}
}
| 3,416
|
C++
|
.cpp
| 66
| 47.318182
| 119
| 0.703303
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,713
|
output_level.cpp
|
wwmm_easyeffects/src/output_level.cpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#include "output_level.hpp"
#include <algorithm>
#include <span>
#include <string>
#include "pipe_manager.hpp"
#include "plugin_base.hpp"
#include "tags_plugin_name.hpp"
#include "util.hpp"
OutputLevel::OutputLevel(const std::string& tag,
const std::string& schema,
const std::string& schema_path,
PipeManager* pipe_manager,
PipelineType pipe_type)
: PluginBase(tag, "output_level", tags::plugin_package::ee, schema, schema_path, pipe_manager, pipe_type) {}
OutputLevel::~OutputLevel() {
if (connected_to_pw) {
disconnect_from_pw();
}
util::debug(log_tag + name + " destroyed");
}
void OutputLevel::setup() {
util::debug(log_tag + name + ": PipeWire blocksize: " + util::to_string(n_samples, ""));
util::debug(log_tag + name + ": PipeWire sampling rate: " + util::to_string(rate, ""));
}
void OutputLevel::process(std::span<float>& left_in,
std::span<float>& right_in,
std::span<float>& left_out,
std::span<float>& right_out) {
std::copy(left_in.begin(), left_in.end(), left_out.begin());
std::copy(right_in.begin(), right_in.end(), right_out.begin());
if (post_messages) {
get_peaks(left_in, right_in, left_out, right_out);
if (send_notifications) {
notify();
}
}
}
auto OutputLevel::get_latency_seconds() -> float {
return 0.0F;
}
| 2,219
|
C++
|
.cpp
| 58
| 32.948276
| 112
| 0.652416
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,714
|
pitch_preset.cpp
|
wwmm_easyeffects/src/pitch_preset.cpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#include "pitch_preset.hpp"
#include <gio/gio.h>
#include <nlohmann/json_fwd.hpp>
#include "plugin_preset_base.hpp"
#include "preset_type.hpp"
#include "tags_plugin_name.hpp"
#include "tags_schema.hpp"
#include "util.hpp"
PitchPreset::PitchPreset(PresetType preset_type, const int& index)
: PluginPresetBase(tags::schema::pitch::id,
tags::schema::pitch::input_path,
tags::schema::pitch::output_path,
preset_type,
index) {
instance_name.assign(tags::plugin_name::pitch).append("#").append(util::to_string(index));
}
void PitchPreset::save(nlohmann::json& json) {
json[section][instance_name]["bypass"] = g_settings_get_boolean(settings, "bypass") != 0;
json[section][instance_name]["input-gain"] = g_settings_get_double(settings, "input-gain");
json[section][instance_name]["output-gain"] = g_settings_get_double(settings, "output-gain");
json[section][instance_name]["quick-seek"] = g_settings_get_boolean(settings, "quick-seek") != 0;
json[section][instance_name]["anti-alias"] = g_settings_get_boolean(settings, "anti-alias") != 0;
json[section][instance_name]["sequence-length"] = g_settings_get_int(settings, "sequence-length");
json[section][instance_name]["seek-window"] = g_settings_get_int(settings, "seek-window");
json[section][instance_name]["overlap-length"] = g_settings_get_int(settings, "overlap-length");
json[section][instance_name]["tempo-difference"] = g_settings_get_double(settings, "tempo-difference");
json[section][instance_name]["rate-difference"] = g_settings_get_double(settings, "rate-difference");
json[section][instance_name]["semitones"] = g_settings_get_double(settings, "semitones");
}
void PitchPreset::load(const nlohmann::json& json) {
update_key<bool>(json.at(section).at(instance_name), settings, "bypass", "bypass");
update_key<double>(json.at(section).at(instance_name), settings, "input-gain", "input-gain");
update_key<double>(json.at(section).at(instance_name), settings, "output-gain", "output-gain");
update_key<bool>(json.at(section).at(instance_name), settings, "quick-seek", "quick-seek");
update_key<bool>(json.at(section).at(instance_name), settings, "anti-alias", "anti-alias");
update_key<int>(json.at(section).at(instance_name), settings, "sequence-length", "sequence-length");
update_key<int>(json.at(section).at(instance_name), settings, "seek-window", "seek-window");
update_key<int>(json.at(section).at(instance_name), settings, "overlap-length", "overlap-length");
update_key<double>(json.at(section).at(instance_name), settings, "tempo-difference", "tempo-difference");
update_key<double>(json.at(section).at(instance_name), settings, "rate-difference", "rate-difference");
update_key<double>(json.at(section).at(instance_name), settings, "semitones", "semitones");
}
| 3,646
|
C++
|
.cpp
| 60
| 56.716667
| 107
| 0.715609
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,715
|
rnnoise_ui.cpp
|
wwmm_easyeffects/src/rnnoise_ui.cpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#include "rnnoise_ui.hpp"
#include <STTypes.h>
#include <adwaita.h>
#include <gio/gio.h>
#include <glib-object.h>
#include <glib.h>
#include <glib/gi18n.h>
#include <glibconfig.h>
#include <gobject/gobject.h>
#include <gtk/gtk.h>
#include <gtk/gtksingleselection.h>
#include <sigc++/connection.h>
#include <filesystem>
#include <memory>
#include <string>
#include <vector>
#include "application.hpp"
#include "config.h"
#include "rnnoise.hpp"
#include "tags_resources.hpp"
#include "tags_schema.hpp"
#include "ui_helpers.hpp"
#include "util.hpp"
namespace ui::rnnoise_box {
using namespace std::string_literals;
static const std::string rnnn_ext = ".rnnn";
// The translated default_model_name is not working as global variable
// because for some reasons it's not translated and, as a result, the
// Standard Model is not set from UI perspective (see #1659).
// So it has to be constructed every time locally when it's needed.
// static const std::string default_model_name = _("Standard Model");
static std::filesystem::path model_dir = g_get_user_config_dir() + "/easyeffects/rnnoise"s;
struct Data {
public:
~Data() { util::debug("data struct destroyed"); }
uint serial = 0U;
app::Application* application;
std::shared_ptr<RNNoise> rnnoise;
std::vector<sigc::connection> connections;
std::vector<gulong> gconnections;
};
struct _RNNoiseBox {
GtkBox parent_instance;
AdwToastOverlay* toast_overlay;
GtkScale *input_gain, *output_gain;
GtkSpinButton *vad_thres, *wet, *release;
GtkLevelBar *input_level_left, *input_level_right, *output_level_left, *output_level_right;
GtkLabel *active_model_name, *model_active_state, *model_error_state, *input_level_left_label,
*input_level_right_label, *output_level_left_label, *output_level_right_label, *plugin_credit;
GtkSwitch* enable_vad;
GtkListView* listview;
GtkStringList* string_list;
GtkSingleSelection* selection_model;
GSettings* settings;
GFileMonitor* folder_monitor;
Data* data;
};
// NOLINTNEXTLINE
G_DEFINE_TYPE(RNNoiseBox, rnnoise_box, GTK_TYPE_BOX)
void on_reset(RNNoiseBox* self, GtkButton* btn) {
util::reset_all_keys_except(self->settings);
}
void update_model_state(RNNoiseBox* self, const bool& load_error) {
gtk_widget_set_visible(GTK_WIDGET(self->model_error_state), load_error ? 1 : 0);
gtk_widget_set_visible(GTK_WIDGET(self->model_active_state), !load_error ? 1 : 0);
if (load_error) {
ui::show_autohiding_toast(
self->toast_overlay,
_("Selected Model Not Loaded. Its Format May Be Unsupported. Fell Back To The Standard Model."));
}
}
gboolean set_model_delete_button_visibility(GtkListItem* item, const char* name) {
const std::string default_model_name = _("Standard Model");
return (name == default_model_name) ? 0 : 1;
}
void on_remove_model_file(GtkListItem* item, GtkButton* btn) {
std::string name = gtk_string_object_get_string(GTK_STRING_OBJECT(gtk_list_item_get_item(item)));
const auto model_file = model_dir / std::filesystem::path{name.c_str() + rnnn_ext};
if (std::filesystem::exists(model_file)) {
std::filesystem::remove(model_file);
util::debug("removed model file: " + model_file.string());
}
}
void import_model_file(const std::string& file_path) {
std::filesystem::path p{file_path};
if (std::filesystem::is_regular_file(p)) {
auto out_path = model_dir / p.filename();
out_path.replace_extension(rnnn_ext);
std::filesystem::copy_file(p, out_path, std::filesystem::copy_options::overwrite_existing);
util::debug("imported model file to: " + out_path.string());
} else {
util::warning(p.string() + " is not a file!");
}
}
void on_import_model_clicked(RNNoiseBox* self, GtkButton* btn) {
auto* active_window = gtk_application_get_active_window(GTK_APPLICATION(self->data->application));
auto* dialog = gtk_file_dialog_new();
gtk_file_dialog_set_title(dialog, _("Import Model File"));
gtk_file_dialog_set_accept_label(dialog, _("Open"));
auto* init_folder = g_file_new_for_path(g_get_home_dir());
gtk_file_dialog_set_initial_folder(dialog, init_folder);
g_object_unref(init_folder);
GListStore* filters = g_list_store_new(GTK_TYPE_FILE_FILTER);
auto* filter = gtk_file_filter_new();
gtk_file_filter_set_name(filter, _("RNNoise Models"));
gtk_file_filter_add_pattern(filter, ("*"s + rnnn_ext).c_str());
g_list_store_append(filters, filter);
g_object_unref(filter);
gtk_file_dialog_set_filters(dialog, G_LIST_MODEL(filters));
g_object_unref(filters);
gtk_file_dialog_open_multiple(
dialog, active_window, nullptr,
+[](GObject* source_object, GAsyncResult* result, gpointer user_data) {
auto* dialog = GTK_FILE_DIALOG(source_object);
auto* files_list = gtk_file_dialog_open_multiple_finish(dialog, result, nullptr);
if (files_list == nullptr) {
return;
}
for (guint n = 0U; n < g_list_model_get_n_items(files_list); n++) {
auto* file = static_cast<GFile*>(g_list_model_get_item(files_list, n));
auto* path = g_file_get_path(file);
import_model_file(path);
g_free(path);
}
g_object_unref(files_list);
},
self);
}
void setup_listview(RNNoiseBox* self) {
for (const auto& name : util::get_files_name(model_dir, rnnn_ext)) {
gtk_string_list_append(self->string_list, name.c_str());
}
if (g_list_model_get_n_items(G_LIST_MODEL(self->string_list)) == 0U) {
g_settings_reset(self->settings, "model-name");
}
}
void setup(RNNoiseBox* self,
std::shared_ptr<RNNoise> rnnoise,
const std::string& schema_path,
app::Application* application) {
self->data->rnnoise = rnnoise;
self->data->application = application;
auto serial = get_new_filter_serial();
self->data->serial = serial;
g_object_set_data(G_OBJECT(self), "serial", GUINT_TO_POINTER(serial));
set_ignore_filter_idle_add(serial, false);
self->settings = g_settings_new_with_path(tags::schema::rnnoise::id, schema_path.c_str());
rnnoise->set_post_messages(true);
// Initialize state labels
if (const auto m = util::gsettings_get_string(self->settings, "model-name"); !m.empty() && rnnoise->standard_model) {
update_model_state(self, true);
}
setup_listview(self);
self->data->connections.push_back(rnnoise->model_changed.connect([=](const bool load_error) {
g_object_ref(self);
util::idle_add(
[=]() {
if (get_ignore_filter_idle_add(serial)) {
return;
}
update_model_state(self, load_error);
},
[=]() { g_object_unref(self); });
}));
self->data->connections.push_back(rnnoise->input_level.connect([=](const float left, const float right) {
g_object_ref(self);
util::idle_add(
[=]() {
if (get_ignore_filter_idle_add(serial)) {
return;
}
update_level(self->input_level_left, self->input_level_left_label, self->input_level_right,
self->input_level_right_label, left, right);
},
[=]() { g_object_unref(self); });
}));
self->data->connections.push_back(rnnoise->output_level.connect([=](const float left, const float right) {
g_object_ref(self);
util::idle_add(
[=]() {
if (get_ignore_filter_idle_add(serial)) {
return;
}
update_level(self->output_level_left, self->output_level_left_label, self->output_level_right,
self->output_level_right_label, left, right);
},
[=]() { g_object_unref(self); });
}));
gtk_label_set_text(self->plugin_credit, ui::get_plugin_credit_translated(self->data->rnnoise->package).c_str());
gsettings_bind_widgets<"input-gain", "output-gain", "enable-vad", "vad-thres", "wet", "release">(
self->settings, self->input_gain, self->output_gain, self->enable_vad, self->vad_thres, self->wet, self->release);
g_settings_bind_with_mapping(
self->settings, "model-name", self->selection_model, "selected", G_SETTINGS_BIND_DEFAULT,
+[](GValue* value, GVariant* variant, gpointer user_data) {
auto* self = EE_RNNOISE_BOX(user_data);
const std::string default_model_name = _("Standard Model");
const std::string gsettings_model_name = g_variant_get_string(variant, nullptr);
const auto* lcp_key = (self->data->rnnoise->pipeline_type == PipelineType::input)
? "last-loaded-input-community-package"
: "last-loaded-output-community-package";
const auto community_package = util::gsettings_get_string(self->data->application->settings, lcp_key);
if (!community_package.empty()) {
// Model from community package used, so unselect the selection.
g_value_set_uint(value, GTK_INVALID_LIST_POSITION);
// Since no item is selected, we set the community model name in
// the active_model_name label manually.
gtk_label_set_text(self->active_model_name, gsettings_model_name.c_str());
return 1;
}
// Local model used.
int standard_model_id = 0;
for (guint n = 0U; n < g_list_model_get_n_items(G_LIST_MODEL(self->selection_model)); n++) {
auto item = g_list_model_get_item(G_LIST_MODEL(self->selection_model), n);
auto* string_object = GTK_STRING_OBJECT(item);
if (string_object == nullptr) {
continue;
}
const std::string model_name = gtk_string_object_get_string(string_object);
g_object_unref(item);
if (gsettings_model_name == model_name) {
// Select the local model and exit.
g_value_set_uint(value, n);
return 1;
} else if (model_name == default_model_name) {
// Save the position of the standard model.
standard_model_id = n;
}
}
if (gsettings_model_name.empty()) {
// If the model name is empty, select the standard model.
g_value_set_uint(value, standard_model_id);
} else {
// A local preset is loaded, but the model file on the filesystem is missing.
// Unselect the selection.
g_value_set_uint(value, GTK_INVALID_LIST_POSITION);
// Update the active_model_name anyway.
gtk_label_set_text(self->active_model_name, gsettings_model_name.c_str());
}
return 1;
},
+[](const GValue* value, const GVariantType* expected_type, gpointer user_data) {
auto* self = EE_RNNOISE_BOX(user_data);
const auto* lcp_key = (self->data->rnnoise->pipeline_type == PipelineType::input)
? "last-loaded-input-community-package"
: "last-loaded-output-community-package";
// models loaded from the rnnoise ui are always local.
g_settings_reset(self->data->application->settings, lcp_key);
auto string_object =
GTK_STRING_OBJECT(gtk_single_selection_get_selected_item(GTK_SINGLE_SELECTION(self->selection_model)));
const std::string selected_name = (string_object != nullptr) ? gtk_string_object_get_string(string_object) : "";
const std::string default_model_name = _("Standard Model");
const std::string gsettings_model_name = (selected_name == default_model_name) ? "" : selected_name;
return g_variant_new_string(gsettings_model_name.c_str());
},
self, nullptr);
}
void dispose(GObject* object) {
auto* self = EE_RNNOISE_BOX(object);
set_ignore_filter_idle_add(self->data->serial, true);
g_file_monitor_cancel(self->folder_monitor);
g_object_unref(self->folder_monitor);
for (auto& c : self->data->connections) {
c.disconnect();
}
for (auto& handler_id : self->data->gconnections) {
g_signal_handler_disconnect(self->settings, handler_id);
}
self->data->connections.clear();
self->data->gconnections.clear();
g_object_unref(self->settings);
util::debug("disposed");
G_OBJECT_CLASS(rnnoise_box_parent_class)->dispose(object);
}
void finalize(GObject* object) {
auto* self = EE_RNNOISE_BOX(object);
delete self->data;
util::debug("finalized");
G_OBJECT_CLASS(rnnoise_box_parent_class)->finalize(object);
}
void rnnoise_box_class_init(RNNoiseBoxClass* klass) {
auto* object_class = G_OBJECT_CLASS(klass);
auto* widget_class = GTK_WIDGET_CLASS(klass);
object_class->dispose = dispose;
object_class->finalize = finalize;
gtk_widget_class_set_template_from_resource(widget_class, tags::resources::rnnoise_ui);
gtk_widget_class_bind_template_child(widget_class, RNNoiseBox, toast_overlay);
gtk_widget_class_bind_template_child(widget_class, RNNoiseBox, input_gain);
gtk_widget_class_bind_template_child(widget_class, RNNoiseBox, output_gain);
gtk_widget_class_bind_template_child(widget_class, RNNoiseBox, input_level_left);
gtk_widget_class_bind_template_child(widget_class, RNNoiseBox, input_level_right);
gtk_widget_class_bind_template_child(widget_class, RNNoiseBox, output_level_left);
gtk_widget_class_bind_template_child(widget_class, RNNoiseBox, output_level_right);
gtk_widget_class_bind_template_child(widget_class, RNNoiseBox, input_level_left_label);
gtk_widget_class_bind_template_child(widget_class, RNNoiseBox, input_level_right_label);
gtk_widget_class_bind_template_child(widget_class, RNNoiseBox, output_level_left_label);
gtk_widget_class_bind_template_child(widget_class, RNNoiseBox, output_level_right_label);
gtk_widget_class_bind_template_child(widget_class, RNNoiseBox, plugin_credit);
gtk_widget_class_bind_template_child(widget_class, RNNoiseBox, enable_vad);
gtk_widget_class_bind_template_child(widget_class, RNNoiseBox, vad_thres);
gtk_widget_class_bind_template_child(widget_class, RNNoiseBox, wet);
gtk_widget_class_bind_template_child(widget_class, RNNoiseBox, release);
gtk_widget_class_bind_template_child(widget_class, RNNoiseBox, string_list);
gtk_widget_class_bind_template_child(widget_class, RNNoiseBox, selection_model);
gtk_widget_class_bind_template_child(widget_class, RNNoiseBox, listview);
gtk_widget_class_bind_template_child(widget_class, RNNoiseBox, active_model_name);
gtk_widget_class_bind_template_child(widget_class, RNNoiseBox, model_active_state);
gtk_widget_class_bind_template_child(widget_class, RNNoiseBox, model_error_state);
gtk_widget_class_bind_template_callback(widget_class, on_reset);
gtk_widget_class_bind_template_callback(widget_class, on_import_model_clicked);
gtk_widget_class_bind_template_callback(widget_class, on_remove_model_file);
gtk_widget_class_bind_template_callback(widget_class, set_model_delete_button_visibility);
}
void rnnoise_box_init(RNNoiseBox* self) {
gtk_widget_init_template(GTK_WIDGET(self));
self->data = new Data();
prepare_scales<"dB">(self->input_gain, self->output_gain);
prepare_spinbuttons<"ms">(self->release);
prepare_spinbuttons<"%">(self->vad_thres);
// The following spinbuttons can assume -inf
prepare_spinbuttons<"dB", false>(self->wet);
// model dir
auto gfile = g_file_new_for_path(model_dir.c_str());
self->folder_monitor = g_file_monitor_directory(gfile, G_FILE_MONITOR_NONE, nullptr, nullptr);
g_signal_connect(self->folder_monitor, "changed",
G_CALLBACK(+[](GFileMonitor* monitor, GFile* file, GFile* other_file, GFileMonitorEvent event_type,
RNNoiseBox* self) {
const auto rnn_filename = util::remove_filename_extension(g_file_get_basename(file));
if (rnn_filename.empty()) {
util::warning("can't retrieve information about the rnn file");
return;
}
switch (event_type) {
case G_FILE_MONITOR_EVENT_CREATED: {
for (guint n = 0U; n < g_list_model_get_n_items(G_LIST_MODEL(self->string_list)); n++) {
if (rnn_filename == gtk_string_list_get_string(self->string_list, n)) {
return;
}
}
gtk_string_list_append(self->string_list, rnn_filename.c_str());
break;
}
case G_FILE_MONITOR_EVENT_DELETED: {
for (guint n = 0U; n < g_list_model_get_n_items(G_LIST_MODEL(self->string_list)); n++) {
if (rnn_filename == gtk_string_list_get_string(self->string_list, n)) {
gtk_string_list_remove(self->string_list, n);
// Workaround for GTK not calling the listview signal_selection_changed (issue #1110)
// on_selection_changed();
return;
}
}
break;
}
default:
break;
}
}),
self);
g_object_unref(gfile);
}
auto create() -> RNNoiseBox* {
return static_cast<RNNoiseBox*>(g_object_new(EE_TYPE_RNNOISE_BOX, nullptr));
}
} // namespace ui::rnnoise_box
| 18,226
|
C++
|
.cpp
| 381
| 40.451444
| 120
| 0.657057
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,716
|
stereo_tools.cpp
|
wwmm_easyeffects/src/stereo_tools.cpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#include "stereo_tools.hpp"
#include <gio/gio.h>
#include <glib-object.h>
#include <glib.h>
#include <algorithm>
#include <cstddef>
#include <memory>
#include <span>
#include <string>
#include "lv2_wrapper.hpp"
#include "pipe_manager.hpp"
#include "plugin_base.hpp"
#include "tags_plugin_name.hpp"
#include "util.hpp"
StereoTools::StereoTools(const std::string& tag,
const std::string& schema,
const std::string& schema_path,
PipeManager* pipe_manager,
PipelineType pipe_type)
: PluginBase(tag,
tags::plugin_name::stereo_tools,
tags::plugin_package::calf,
schema,
schema_path,
pipe_manager,
pipe_type) {
lv2_wrapper = std::make_unique<lv2::Lv2Wrapper>("http://calf.sourceforge.net/plugins/StereoTools");
package_installed = lv2_wrapper->found_plugin;
if (!package_installed) {
util::debug(log_tag + "http://calf.sourceforge.net/plugins/StereoTools is not installed");
}
lv2_wrapper->bind_key_double<"balance_in", "balance-in">(settings);
lv2_wrapper->bind_key_double<"balance_out", "balance-out">(settings);
lv2_wrapper->bind_key_double<"sbal", "sbal">(settings);
lv2_wrapper->bind_key_double<"mpan", "mpan">(settings);
lv2_wrapper->bind_key_double<"stereo_base", "stereo-base">(settings);
lv2_wrapper->bind_key_double<"delay", "delay">(settings);
lv2_wrapper->bind_key_double<"sc_level", "sc-level">(settings);
lv2_wrapper->bind_key_double<"stereo_phase", "stereo-phase">(settings);
lv2_wrapper->bind_key_double_db<"slev", "slev">(settings);
lv2_wrapper->bind_key_double_db<"mlev", "mlev">(settings);
lv2_wrapper->bind_key_bool<"softclip", "softclip">(settings);
lv2_wrapper->bind_key_bool<"mutel", "mutel">(settings);
lv2_wrapper->bind_key_bool<"muter", "muter">(settings);
lv2_wrapper->bind_key_bool<"phasel", "phasel">(settings);
lv2_wrapper->bind_key_bool<"phaser", "phaser">(settings);
lv2_wrapper->bind_key_enum<"mode", "mode">(settings);
const auto key_dry = g_settings_get_double(settings, "dry");
dry = (key_dry <= util::minimum_db_d_level) ? 0.0F : static_cast<float>(util::db_to_linear(key_dry));
const auto key_wet = g_settings_get_double(settings, "wet");
wet = (key_wet <= util::minimum_db_d_level) ? 0.0F : static_cast<float>(util::db_to_linear(key_wet));
gconnections.push_back(g_signal_connect(
settings, "changed::dry", G_CALLBACK(+[](GSettings* settings, char* key, gpointer user_data) {
auto* self = static_cast<StereoTools*>(user_data);
const auto key_v = g_settings_get_double(settings, key);
self->dry = (key_v <= util::minimum_db_d_level) ? 0.0F : static_cast<float>(util::db_to_linear(key_v));
}),
this));
gconnections.push_back(g_signal_connect(
settings, "changed::wet", G_CALLBACK(+[](GSettings* settings, char* key, gpointer user_data) {
auto* self = static_cast<StereoTools*>(user_data);
const auto key_v = g_settings_get_double(settings, key);
self->wet = (key_v <= util::minimum_db_d_level) ? 0.0F : static_cast<float>(util::db_to_linear(key_v));
}),
this));
setup_input_output_gain();
}
StereoTools::~StereoTools() {
if (connected_to_pw) {
disconnect_from_pw();
}
util::debug(log_tag + name + " destroyed");
}
void StereoTools::setup() {
if (!lv2_wrapper->found_plugin) {
return;
}
lv2_wrapper->set_n_samples(n_samples);
if (lv2_wrapper->get_rate() != rate) {
lv2_wrapper->create_instance(rate);
}
}
void StereoTools::process(std::span<float>& left_in,
std::span<float>& right_in,
std::span<float>& left_out,
std::span<float>& right_out) {
if (!lv2_wrapper->found_plugin || !lv2_wrapper->has_instance() || bypass) {
std::copy(left_in.begin(), left_in.end(), left_out.begin());
std::copy(right_in.begin(), right_in.end(), right_out.begin());
return;
}
if (input_gain != 1.0F) {
apply_gain(left_in, right_in, input_gain);
}
lv2_wrapper->connect_data_ports(left_in, right_in, left_out, right_out);
lv2_wrapper->run();
for (size_t n = 0; n < left_out.size(); n++) {
left_out[n] = wet * left_out[n] + dry * left_in[n];
right_out[n] = wet * right_out[n] + dry * right_in[n];
}
if (output_gain != 1.0F) {
apply_gain(left_out, right_out, output_gain);
}
if (post_messages) {
get_peaks(left_in, right_in, left_out, right_out);
if (send_notifications) {
notify();
}
}
}
auto StereoTools::get_latency_seconds() -> float {
return 0.0F;
}
| 5,485
|
C++
|
.cpp
| 131
| 36.374046
| 111
| 0.648455
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,717
|
deepfilternet_preset.cpp
|
wwmm_easyeffects/src/deepfilternet_preset.cpp
|
/*
* Copyright © 2023 Torge Matthies
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#include "deepfilternet_preset.hpp"
#include <gio/gio.h>
#include <nlohmann/json_fwd.hpp>
#include "plugin_preset_base.hpp"
#include "preset_type.hpp"
#include "tags_plugin_name.hpp"
#include "tags_schema.hpp"
#include "util.hpp"
DeepFilterNetPreset::DeepFilterNetPreset(PresetType preset_type, const int& index)
: PluginPresetBase(tags::schema::deepfilternet::id,
tags::schema::deepfilternet::input_path,
tags::schema::deepfilternet::output_path,
preset_type,
index) {
instance_name.assign(tags::plugin_name::deepfilternet).append("#").append(util::to_string(index));
}
void DeepFilterNetPreset::save(nlohmann::json& json) {
json[section][instance_name]["attenuation-limit"] = g_settings_get_double(settings, "attenuation-limit");
json[section][instance_name]["min-processing-threshold"] =
g_settings_get_double(settings, "min-processing-threshold");
json[section][instance_name]["max-erb-processing-threshold"] =
g_settings_get_double(settings, "max-erb-processing-threshold");
json[section][instance_name]["max-df-processing-threshold"] =
g_settings_get_double(settings, "max-df-processing-threshold");
json[section][instance_name]["min-processing-buffer"] = g_settings_get_int(settings, "min-processing-buffer");
json[section][instance_name]["post-filter-beta"] = g_settings_get_double(settings, "post-filter-beta");
}
void DeepFilterNetPreset::load(const nlohmann::json& json) {
update_key<double>(json.at(section).at(instance_name), settings, "attenuation-limit", "attenuation-limit");
update_key<double>(json.at(section).at(instance_name), settings, "min-processing-threshold",
"min-processing-threshold");
update_key<double>(json.at(section).at(instance_name), settings, "max-erb-processing-threshold",
"max-erb-processing-threshold");
update_key<double>(json.at(section).at(instance_name), settings, "max-df-processing-threshold",
"max-df-processing-threshold");
update_key<int>(json.at(section).at(instance_name), settings, "min-processing-buffer", "min-processing-buffer");
update_key<double>(json.at(section).at(instance_name), settings, "post-filter-beta", "post-filter-beta");
}
| 3,044
|
C++
|
.cpp
| 56
| 49.357143
| 114
| 0.716488
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,718
|
rnnoise_preset.cpp
|
wwmm_easyeffects/src/rnnoise_preset.cpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#include "rnnoise_preset.hpp"
#include <gio/gio.h>
#include <glib.h>
#include <nlohmann/json_fwd.hpp>
#include "plugin_preset_base.hpp"
#include "preset_type.hpp"
#include "tags_plugin_name.hpp"
#include "tags_schema.hpp"
#include "util.hpp"
RNNoisePreset::RNNoisePreset(PresetType preset_type, const int& index)
: PluginPresetBase(tags::schema::rnnoise::id,
tags::schema::rnnoise::input_path,
tags::schema::rnnoise::output_path,
preset_type,
index) {
instance_name.assign(tags::plugin_name::rnnoise).append("#").append(util::to_string(index));
}
void RNNoisePreset::save(nlohmann::json& json) {
json[section][instance_name]["bypass"] = g_settings_get_boolean(settings, "bypass") != 0;
json[section][instance_name]["input-gain"] = g_settings_get_double(settings, "input-gain");
json[section][instance_name]["output-gain"] = g_settings_get_double(settings, "output-gain");
json[section][instance_name]["model-name"] = util::gsettings_get_string(settings, "model-name");
json[section][instance_name]["enable-vad"] = g_settings_get_boolean(settings, "enable-vad") != 0;
json[section][instance_name]["vad-thres"] = g_settings_get_double(settings, "vad-thres");
json[section][instance_name]["wet"] = g_settings_get_double(settings, "wet");
json[section][instance_name]["release"] = g_settings_get_double(settings, "release");
}
void RNNoisePreset::load(const nlohmann::json& json) {
update_key<bool>(json.at(section).at(instance_name), settings, "bypass", "bypass");
update_key<double>(json.at(section).at(instance_name), settings, "input-gain", "input-gain");
update_key<double>(json.at(section).at(instance_name), settings, "output-gain", "output-gain");
update_key<bool>(json.at(section).at(instance_name), settings, "enable-vad", "enable-vad");
update_key<double>(json.at(section).at(instance_name), settings, "vad-thres", "vad-thres");
update_key<double>(json.at(section).at(instance_name), settings, "wet", "wet");
update_key<double>(json.at(section).at(instance_name), settings, "release", "release");
// model-path deprecation
const auto* model_name_key = "model-name";
std::string new_model_name =
json.at(section).at(instance_name).value(model_name_key, get_default<gchar*>(settings, model_name_key));
if (new_model_name.empty()) {
const std::string model_path = json.at(section).at(instance_name).value("model-path", "");
if (!model_path.empty()) {
new_model_name = std::filesystem::path{model_path}.stem().c_str();
util::warning("using RNNoise model-path is deprecated, please update your preset; fallback to model-name: " +
new_model_name);
}
}
const auto current_model_name = util::gsettings_get_string(settings, model_name_key);
if (new_model_name != current_model_name) {
g_settings_set_string(settings, model_name_key, new_model_name.c_str());
}
}
| 3,735
|
C++
|
.cpp
| 70
| 48.942857
| 115
| 0.700632
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,719
|
rnnoise.cpp
|
wwmm_easyeffects/src/rnnoise.cpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#include "rnnoise.hpp"
#include <gio/gio.h>
#include <glib-object.h>
#include <glib.h>
#ifdef ENABLE_RNNOISE
#include <rnnoise.h>
#endif
#include <sys/types.h>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <memory>
#include <mutex>
#include <span>
#include <string>
#include "pipe_manager.hpp"
#include "plugin_base.hpp"
#include "resampler.hpp"
#include "tags_plugin_name.hpp"
#include "tags_resources.hpp"
#include "util.hpp"
RNNoise::RNNoise(const std::string& tag,
const std::string& schema,
const std::string& schema_path,
PipeManager* pipe_manager,
PipelineType pipe_type)
: PluginBase(tag,
tags::plugin_name::rnnoise,
tags::plugin_package::rnnoise,
schema,
schema_path,
pipe_manager,
pipe_type),
enable_vad(g_settings_get_boolean(settings, "enable-vad")),
vad_thres(g_settings_get_double(settings, "vad-thres") / 100.0F),
data_L(0),
data_R(0) {
data_L.reserve(blocksize);
data_R.reserve(blocksize);
data_tmp.reserve(blocksize);
// Initialize directories for local and community models
local_dir_rnnoise = std::string{g_get_user_config_dir()} + "/easyeffects/rnnoise";
// Flatpak specific path (.flatpak-info always present for apps running in the flatpak sandbox)
if (std::filesystem::is_regular_file(tags::resources::flatpak_info_file)) {
system_data_dir_rnnoise.push_back("/app/extensions/Presets/rnnoise");
}
// Regular paths
for (const gchar* const* xdg_data_dirs = g_get_system_data_dirs(); *xdg_data_dirs != nullptr;) {
std::string dir = *xdg_data_dirs++;
dir += dir.ends_with("/") ? "" : "/";
system_data_dir_rnnoise.push_back(dir + "easyeffects/rnnoise");
}
const auto key_v = g_settings_get_double(settings, "wet");
wet_ratio = (key_v <= util::minimum_db_d_level) ? 0.0F : static_cast<float>(util::db_to_linear(key_v));
gconnections.push_back(g_signal_connect(settings, "changed::model-name",
G_CALLBACK(+[](GSettings* settings, char* key, gpointer user_data) {
auto* self = static_cast<RNNoise*>(user_data);
self->data_mutex.lock();
self->rnnoise_ready = false;
self->data_mutex.unlock();
#ifdef ENABLE_RNNOISE
self->free_rnnoise();
auto* m = self->get_model_from_name();
self->model = m;
self->state_left = rnnoise_create(self->model);
self->state_right = rnnoise_create(self->model);
self->rnnoise_ready = true;
#endif
}),
this));
setup_input_output_gain();
#ifdef ENABLE_RNNOISE
init_release();
gconnections.push_back(g_signal_connect(settings, "changed::enable-vad",
G_CALLBACK(+[](GSettings* settings, char* key, RNNoise* self) {
self->enable_vad = g_settings_get_boolean(settings, key);
}),
this));
g_signal_connect(settings, "changed::vad-thres", G_CALLBACK(+[](GSettings* settings, char* key, gpointer user_data) {
auto self = static_cast<RNNoise*>(user_data);
self->vad_thres = static_cast<float>(g_settings_get_double(settings, key)) / 100.0F;
}),
this);
g_signal_connect(settings, "changed::wet", G_CALLBACK(+[](GSettings* settings, char* key, gpointer user_data) {
auto self = static_cast<RNNoise*>(user_data);
const auto key_v = g_settings_get_double(settings, key);
self->wet_ratio =
(key_v <= util::minimum_db_d_level) ? 0.0F : static_cast<float>(util::db_to_linear(key_v));
}),
this);
g_signal_connect(settings, "changed::release", G_CALLBACK(+[](GSettings* settings, char* key, gpointer user_data) {
auto self = static_cast<RNNoise*>(user_data);
self->init_release();
}),
this);
auto* m = get_model_from_name();
model = m;
state_left = rnnoise_create(model);
state_right = rnnoise_create(model);
vad_prob_left = 1.0F;
vad_prob_right = 1.0F;
vad_grace_left = release;
vad_grace_right = release;
rnnoise_ready = true;
#else
util::warning("The RNNoise library was not available at compilation time. The noise reduction filter won't work");
enable_vad = false;
#endif
}
RNNoise::~RNNoise() {
if (connected_to_pw) {
disconnect_from_pw();
}
std::scoped_lock<std::mutex> lock(data_mutex);
resampler_ready = false;
#ifdef ENABLE_RNNOISE
free_rnnoise();
#endif
util::debug(log_tag + name + " destroyed");
}
void RNNoise::setup() {
std::scoped_lock<std::mutex> lock(data_mutex);
resampler_ready = false;
latency_n_frames = 0U;
resample = rate != rnnoise_rate;
data_L.resize(0U);
data_R.resize(0U);
deque_out_L.resize(0U);
deque_out_R.resize(0U);
resampler_inL = std::make_unique<Resampler>(rate, rnnoise_rate);
resampler_inR = std::make_unique<Resampler>(rate, rnnoise_rate);
resampler_outL = std::make_unique<Resampler>(rnnoise_rate, rate);
resampler_outR = std::make_unique<Resampler>(rnnoise_rate, rate);
resampler_ready = true;
}
void RNNoise::process(std::span<float>& left_in,
std::span<float>& right_in,
std::span<float>& left_out,
std::span<float>& right_out) {
std::scoped_lock<std::mutex> lock(data_mutex);
if (bypass || !rnnoise_ready) {
std::copy(left_in.begin(), left_in.end(), left_out.begin());
std::copy(right_in.begin(), right_in.end(), right_out.begin());
return;
}
if (input_gain != 1.0F) {
apply_gain(left_in, right_in, input_gain);
}
if (resample) {
if (resampler_ready) {
const auto resampled_inL = resampler_inL->process(left_in, false);
const auto resampled_inR = resampler_inR->process(right_in, false);
resampled_data_L.resize(0U);
resampled_data_R.resize(0U);
#ifdef ENABLE_RNNOISE
remove_noise(resampled_inL, resampled_inR, resampled_data_L, resampled_data_R);
#endif
auto resampled_outL = resampler_outL->process(resampled_data_L, false);
auto resampled_outR = resampler_outR->process(resampled_data_R, false);
for (const auto& v : resampled_outL) {
deque_out_L.push_back(v);
}
for (const auto& v : resampled_outR) {
deque_out_R.push_back(v);
}
} else {
for (const auto& v : left_in) {
deque_out_L.push_back(v);
}
for (const auto& v : right_in) {
deque_out_R.push_back(v);
}
}
} else {
#ifdef ENABLE_RNNOISE
remove_noise(left_in, right_in, deque_out_L, deque_out_R);
#endif
}
if (deque_out_L.size() >= left_out.size()) {
for (float& v : left_out) {
v = deque_out_L.front();
deque_out_L.pop_front();
}
for (float& v : right_out) {
v = deque_out_R.front();
deque_out_R.pop_front();
}
} else {
const uint offset = 2U * (left_out.size() - deque_out_L.size());
if (offset != latency_n_frames) {
latency_n_frames = offset;
notify_latency = true;
}
for (uint n = 0U; !deque_out_L.empty() && n < left_out.size(); n++) {
if (n < offset) {
left_out[n] = 0.0F;
right_out[n] = 0.0F;
} else {
left_out[n] = deque_out_L.front();
right_out[n] = deque_out_R.front();
deque_out_R.pop_front();
deque_out_L.pop_front();
}
}
}
if (output_gain != 1.0F) {
apply_gain(left_out, right_out, output_gain);
}
if (notify_latency) {
latency_value = static_cast<float>(latency_n_frames) / static_cast<float>(rate);
util::debug(log_tag + name + " latency: " + util::to_string(latency_value, "") + " s");
util::idle_add([this]() {
if (!post_messages || latency.empty()) {
return;
}
latency.emit();
});
update_filter_params();
notify_latency = false;
}
if (post_messages) {
get_peaks(left_in, right_in, left_out, right_out);
if (send_notifications) {
notify();
}
}
}
auto RNNoise::search_model_path(const std::string& name) -> std::string {
// Given the model name without extension, search the full path on the filesystem.
const auto model_filename = name + rnnn_ext;
const auto* lcp_key = (pipeline_type == PipelineType::input) ? "last-loaded-input-community-package"
: "last-loaded-output-community-package";
const auto community_package = util::gsettings_get_string(global_settings, lcp_key);
std::string model_full_path;
if (community_package.empty()) {
// Search local model
const auto local_model_file = std::filesystem::path{local_dir_rnnoise + "/" + model_filename};
if (std::filesystem::exists(local_model_file)) {
model_full_path = local_model_file.c_str();
}
} else {
// Search model in community package paths
for (const auto& xdg_model_dir : system_data_dir_rnnoise) {
if (util::search_filename(std::filesystem::path{xdg_model_dir + "/" + community_package}, model_filename,
model_full_path, 3U)) {
break;
}
}
}
return model_full_path;
}
#ifdef ENABLE_RNNOISE
auto RNNoise::get_model_from_name() -> RNNModel* {
RNNModel* m = nullptr;
const auto name = util::gsettings_get_string(settings, "model-name");
// Standard Model
if (name.empty()) {
standard_model = true;
util::warning(log_tag + " empty model name set, using the standard model");
model_changed.emit(false);
return m;
}
const auto path = search_model_path(name);
// Standard Model
if (path.empty()) {
standard_model = true;
util::debug(log_tag + name + " model does not exist on the filesystem, using the standard model.");
model_changed.emit(false);
return m;
}
// Custom Model
util::debug(log_tag + name + " loading custom model from path: " + path);
if (FILE* f = fopen(path.c_str(), "r"); f != nullptr) {
m = rnnoise_model_from_file(f);
fclose(f);
}
standard_model = (m == nullptr);
if (standard_model) {
util::warning(log_tag + name + " failed to load the custom model. Using the standard one.");
}
model_changed.emit(standard_model);
return m;
}
void RNNoise::free_rnnoise() {
rnnoise_ready = false;
if (state_left != nullptr) {
rnnoise_destroy(state_left);
}
if (state_right != nullptr) {
rnnoise_destroy(state_right);
}
if (model != nullptr) {
rnnoise_model_free(model);
}
state_left = nullptr;
state_right = nullptr;
model = nullptr;
}
#endif
auto RNNoise::get_latency_seconds() -> float {
return latency_value;
}
void RNNoise::init_release() {
#ifdef ENABLE_RNNOISE
const auto key_v = g_settings_get_double(settings, "release");
const auto rate = static_cast<double>(rnnoise_rate);
const auto bs = static_cast<double>(blocksize);
// std::lrint returns a long type
const auto release = static_cast<int>(std::lrint(rate * key_v / 1000.0 / bs));
vad_grace_left = release;
vad_grace_right = release;
#endif
}
| 12,597
|
C++
|
.cpp
| 331
| 30.311178
| 119
| 0.600872
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,720
|
tags_plugin_name.cpp
|
wwmm_easyeffects/src/tags_plugin_name.cpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#include "tags_plugin_name.hpp"
#include <glib/gi18n.h>
#include <sys/types.h>
#include <map>
#include <regex>
#include <string>
#include <string_view>
#include "util.hpp"
namespace {
const auto id_regex = std::regex(R"(#(\d+)$)");
}
namespace tags::plugin_name {
auto get_translated() -> std::map<std::string, std::string> {
std::map<std::string, std::string> translated = {{autogain, _("Autogain")},
{bass_enhancer, _("Bass Enhancer")},
{bass_loudness, _("Bass Loudness")},
{compressor, _("Compressor")},
{convolver, _("Convolver")},
{crossfeed, _("Crossfeed")},
{crystalizer, _("Crystalizer")},
{deepfilternet, _("Deep Noise Remover")},
{deesser, _("Deesser")},
{delay, _("Delay")},
{echo_canceller, _("Echo Canceller")},
{equalizer, _("Equalizer")},
{exciter, _("Exciter")},
{expander, _("Expander")},
{filter, _("Filter")},
{gate, _("Gate")},
{level_meter, _("Level Meter")},
{limiter, _("Limiter")},
{loudness, _("Loudness")},
{maximizer, _("Maximizer")},
{multiband_compressor, _("Multiband Compressor")},
{multiband_gate, _("Multiband Gate")},
{pitch, _("Pitch")},
{reverb, _("Reverberation")},
{rnnoise, _("Noise Reduction")},
{speex, _("Speech Processor")},
{stereo_tools, _("Stereo Tools")}};
return translated;
}
auto get_base_name(std::string_view name) -> std::string {
if (name.starts_with(tags::plugin_name::autogain)) {
return tags::plugin_name::autogain;
}
if (name.starts_with(tags::plugin_name::bass_enhancer)) {
return tags::plugin_name::bass_enhancer;
}
if (name.starts_with(tags::plugin_name::bass_loudness)) {
return tags::plugin_name::bass_loudness;
}
if (name.starts_with(tags::plugin_name::compressor)) {
return tags::plugin_name::compressor;
}
if (name.starts_with(tags::plugin_name::convolver)) {
return tags::plugin_name::convolver;
}
if (name.starts_with(tags::plugin_name::crossfeed)) {
return tags::plugin_name::crossfeed;
}
if (name.starts_with(tags::plugin_name::crystalizer)) {
return tags::plugin_name::crystalizer;
}
if (name.starts_with(tags::plugin_name::deepfilternet)) {
return tags::plugin_name::deepfilternet;
}
if (name.starts_with(tags::plugin_name::deesser)) {
return tags::plugin_name::deesser;
}
if (name.starts_with(tags::plugin_name::delay)) {
return tags::plugin_name::delay;
}
if (name.starts_with(tags::plugin_name::echo_canceller)) {
return tags::plugin_name::echo_canceller;
}
if (name.starts_with(tags::plugin_name::equalizer)) {
return tags::plugin_name::equalizer;
}
if (name.starts_with(tags::plugin_name::exciter)) {
return tags::plugin_name::exciter;
}
if (name.starts_with(tags::plugin_name::expander)) {
return tags::plugin_name::expander;
}
if (name.starts_with(tags::plugin_name::filter)) {
return tags::plugin_name::filter;
}
if (name.starts_with(tags::plugin_name::gate)) {
return tags::plugin_name::gate;
}
if (name.starts_with(tags::plugin_name::level_meter)) {
return tags::plugin_name::level_meter;
}
if (name.starts_with(tags::plugin_name::limiter)) {
return tags::plugin_name::limiter;
}
if (name.starts_with(tags::plugin_name::loudness)) {
return tags::plugin_name::loudness;
}
if (name.starts_with(tags::plugin_name::maximizer)) {
return tags::plugin_name::maximizer;
}
if (name.starts_with(tags::plugin_name::multiband_compressor)) {
return tags::plugin_name::multiband_compressor;
}
if (name.starts_with(tags::plugin_name::multiband_gate)) {
return tags::plugin_name::multiband_gate;
}
if (name.starts_with(tags::plugin_name::pitch)) {
return tags::plugin_name::pitch;
}
if (name.starts_with(tags::plugin_name::reverb)) {
return tags::plugin_name::reverb;
}
if (name.starts_with(tags::plugin_name::rnnoise)) {
return tags::plugin_name::rnnoise;
}
if (name.starts_with(tags::plugin_name::speex)) {
return tags::plugin_name::speex;
}
if (name.starts_with(tags::plugin_name::stereo_tools)) {
return tags::plugin_name::stereo_tools;
}
return "";
}
auto get_id(const std::string& name) -> uint {
std::smatch matches;
std::regex_search(name, matches, id_regex);
if (matches.size() != 2U) {
return 0U;
}
if (uint id = 0U; util::str_to_num(matches[1], id)) {
return id;
}
return 0U;
}
} // namespace tags::plugin_name
| 6,453
|
C++
|
.cpp
| 156
| 29.929487
| 101
| 0.54188
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,721
|
multiband_gate_ui.cpp
|
wwmm_easyeffects/src/multiband_gate_ui.cpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#include "multiband_gate_ui.hpp"
#include <STTypes.h>
#include <gio/gio.h>
#include <gio/gliststore.h>
#include <glib-object.h>
#include <glib.h>
#include <glibconfig.h>
#include <gobject/gobject.h>
#include <gtk/gtk.h>
#include <gtk/gtkdropdown.h>
#include <gtk/gtksingleselection.h>
#include <sigc++/connection.h>
#include <array>
#include <cstddef>
#include <memory>
#include <string>
#include <vector>
#include "multiband_gate.hpp"
#include "multiband_gate_band_box.hpp"
#include "node_info_holder.hpp"
#include "pipe_manager.hpp"
#include "pipe_objects.hpp"
#include "tags_multiband_gate.hpp"
#include "tags_pipewire.hpp"
#include "tags_resources.hpp"
#include "tags_schema.hpp"
#include "ui_helpers.hpp"
#include "util.hpp"
namespace ui::multiband_gate_box {
using namespace std::string_literals;
struct Data {
public:
~Data() { util::debug("data struct destroyed"); }
uint serial = 0U;
std::shared_ptr<MultibandGate> multiband_gate;
std::vector<sigc::connection> connections;
std::vector<gulong> gconnections;
};
struct _MultibandGateBox {
GtkBox parent_instance;
GtkScale *input_gain, *output_gain;
GtkLevelBar *input_level_left, *input_level_right, *output_level_left, *output_level_right;
GtkLabel *input_level_left_label, *input_level_right_label, *output_level_left_label, *output_level_right_label,
*plugin_credit;
GtkStack* stack;
GtkCheckButton *enable_band1, *enable_band2, *enable_band3, *enable_band4, *enable_band5, *enable_band6,
*enable_band7;
GtkSpinButton *dry, *wet;
GtkDropDown *gate_mode, *envelope_boost;
GtkDropDown* dropdown_input_devices;
GtkToggleButton *show_native_ui, *stereo_split;
GListStore* input_devices_model;
GSettings* settings;
std::array<ui::multiband_gate_band_box::MultibandGateBandBox*, tags::multiband_gate::n_bands> bands;
Data* data;
};
// NOLINTNEXTLINE
G_DEFINE_TYPE(MultibandGateBox, multiband_gate_box, GTK_TYPE_BOX)
void on_reset(MultibandGateBox* self, GtkButton* btn) {
util::reset_all_keys_except(self->settings);
}
void on_show_native_window(MultibandGateBox* self, GtkToggleButton* btn) {
if (gtk_toggle_button_get_active(btn) != 0) {
self->data->multiband_gate->show_native_ui();
} else {
self->data->multiband_gate->close_native_ui();
}
}
void on_listbox_row_selected(MultibandGateBox* self, GtkListBoxRow* row, GtkListBox* listbox) {
if (auto* selected_row = gtk_list_box_get_selected_row(listbox); selected_row != nullptr) {
if (auto index = gtk_list_box_row_get_index(selected_row); index != -1) {
gtk_stack_set_visible_child_name(self->stack, ("band" + util::to_string(index)).c_str());
}
}
}
void set_dropdown_input_devices_sensitivity(MultibandGateBox* self) {
for (uint n = 0U; n < tags::multiband_gate::n_bands; n++) {
if (g_settings_get_boolean(self->settings, tags::multiband_gate::band_external_sidechain[n].data()) != 0) {
gtk_widget_set_sensitive(GTK_WIDGET(self->dropdown_input_devices), 1);
return;
}
}
gtk_widget_set_sensitive(GTK_WIDGET(self->dropdown_input_devices), 0);
}
void create_bands(MultibandGateBox* self) {
for (uint n = 0U; n < tags::multiband_gate::n_bands; n++) {
auto* band_box = ui::multiband_gate_band_box::create();
ui::multiband_gate_band_box::setup(band_box, self->settings, static_cast<int>(n));
gtk_stack_add_named(self->stack, GTK_WIDGET(band_box), ("band" + util::to_string(n)).c_str());
self->bands[n] = band_box;
self->data->gconnections.push_back(g_signal_connect(
self->settings, ("changed::"s + tags::multiband_gate::band_external_sidechain[n].data()).c_str(),
G_CALLBACK(+[](GSettings* settings, char* key, MultibandGateBox* self) {
set_dropdown_input_devices_sensitivity(self);
}),
self));
}
}
void setup_dropdown_input_device(MultibandGateBox* self) {
auto* selection = gtk_single_selection_new(G_LIST_MODEL(self->input_devices_model));
g_signal_connect(self->dropdown_input_devices, "notify::selected-item",
G_CALLBACK(+[](GtkDropDown* dropdown, GParamSpec* pspec, MultibandGateBox* self) {
if (auto selected_item = gtk_drop_down_get_selected_item(dropdown); selected_item != nullptr) {
auto* holder = static_cast<ui::holders::NodeInfoHolder*>(selected_item);
g_settings_set_string(self->settings, "sidechain-input-device", holder->info->name.c_str());
}
}),
self);
gtk_drop_down_set_model(self->dropdown_input_devices, G_LIST_MODEL(self->input_devices_model));
g_object_unref(selection);
}
void setup(MultibandGateBox* self,
std::shared_ptr<MultibandGate> multiband_gate,
const std::string& schema_path,
PipeManager* pm) {
self->data->multiband_gate = multiband_gate;
auto serial = get_new_filter_serial();
self->data->serial = serial;
g_object_set_data(G_OBJECT(self), "serial", GUINT_TO_POINTER(serial));
set_ignore_filter_idle_add(serial, false);
self->settings = g_settings_new_with_path(tags::schema::multiband_gate::id, schema_path.c_str());
multiband_gate->set_post_messages(true);
setup_dropdown_input_device(self);
set_dropdown_input_devices_sensitivity(self);
create_bands(self);
for (const auto& [serial, node] : pm->node_map) {
if (node.name == tags::pipewire::ee_sink_name || node.name == tags::pipewire::ee_source_name) {
continue;
}
if (node.media_class == tags::pipewire::media_class::source ||
node.media_class == tags::pipewire::media_class::virtual_source ||
node.media_role == tags::pipewire::media_role::dsp) {
auto* holder = ui::holders::create(node);
g_list_store_append(self->input_devices_model, holder);
g_object_unref(holder);
}
}
self->data->connections.push_back(multiband_gate->input_level.connect([=](const float left, const float right) {
g_object_ref(self);
util::idle_add(
[=]() {
if (get_ignore_filter_idle_add(serial)) {
return;
}
update_level(self->input_level_left, self->input_level_left_label, self->input_level_right,
self->input_level_right_label, left, right);
},
[=]() { g_object_unref(self); });
}));
self->data->connections.push_back(multiband_gate->output_level.connect([=](const float left, const float right) {
g_object_ref(self);
util::idle_add(
[=]() {
if (get_ignore_filter_idle_add(serial)) {
return;
}
update_level(self->output_level_left, self->output_level_left_label, self->output_level_right,
self->output_level_right_label, left, right);
},
[=]() { g_object_unref(self); });
}));
self->data->connections.push_back(
multiband_gate->frequency_range.connect([=](const std::array<float, tags::multiband_gate::n_bands> values) {
g_object_ref(self);
util::idle_add(
[=]() {
if (get_ignore_filter_idle_add(serial)) {
return;
}
for (size_t n = 0U; n < values.size(); n++) {
ui::multiband_gate_band_box::set_end_label(self->bands[n], values[n]);
}
},
[=]() { g_object_unref(self); });
}));
self->data->connections.push_back(
multiband_gate->envelope.connect([=](const std::array<float, tags::multiband_gate::n_bands> values) {
g_object_ref(self);
util::idle_add(
[=]() {
if (get_ignore_filter_idle_add(serial)) {
return;
}
for (size_t n = 0U; n < values.size(); n++) {
ui::multiband_gate_band_box::set_envelope_label(self->bands[n], values[n]);
}
},
[=]() { g_object_unref(self); });
}));
self->data->connections.push_back(
multiband_gate->curve.connect([=](const std::array<float, tags::multiband_gate::n_bands> values) {
g_object_ref(self);
util::idle_add(
[=]() {
if (get_ignore_filter_idle_add(serial)) {
return;
}
for (size_t n = 0U; n < values.size(); n++) {
ui::multiband_gate_band_box::set_curve_label(self->bands[n], values[n]);
}
},
[=]() { g_object_unref(self); });
}));
self->data->connections.push_back(
multiband_gate->reduction.connect([=](const std::array<float, tags::multiband_gate::n_bands> values) {
g_object_ref(self);
util::idle_add(
[=]() {
if (get_ignore_filter_idle_add(serial)) {
return;
}
for (size_t n = 0U; n < values.size(); n++) {
ui::multiband_gate_band_box::set_gain_label(self->bands[n], values[n]);
}
},
[=]() { g_object_unref(self); });
}));
self->data->connections.push_back(pm->source_added.connect([=](const NodeInfo info) {
for (guint n = 0U; n < g_list_model_get_n_items(G_LIST_MODEL(self->input_devices_model)); n++) {
auto* holder =
static_cast<ui::holders::NodeInfoHolder*>(g_list_model_get_item(G_LIST_MODEL(self->input_devices_model), n));
if (holder->info->id == info.id) {
g_object_unref(holder);
return;
}
g_object_unref(holder);
}
auto* holder = ui::holders::create(info);
g_list_store_append(self->input_devices_model, holder);
g_object_unref(holder);
}));
self->data->connections.push_back(pm->source_removed.connect([=](const NodeInfo info) {
for (guint n = 0U; n < g_list_model_get_n_items(G_LIST_MODEL(self->input_devices_model)); n++) {
auto* holder =
static_cast<ui::holders::NodeInfoHolder*>(g_list_model_get_item(G_LIST_MODEL(self->input_devices_model), n));
if (holder->info->id == info.id) {
g_list_store_remove(self->input_devices_model, n);
g_object_unref(holder);
return;
}
g_object_unref(holder);
}
}));
gtk_label_set_text(self->plugin_credit,
ui::get_plugin_credit_translated(self->data->multiband_gate->package).c_str());
gsettings_bind_widgets<"input-gain", "output-gain">(self->settings, self->input_gain, self->output_gain);
g_settings_bind(self->settings, "dry", gtk_spin_button_get_adjustment(self->dry), "value", G_SETTINGS_BIND_DEFAULT);
g_settings_bind(self->settings, "wet", gtk_spin_button_get_adjustment(self->wet), "value", G_SETTINGS_BIND_DEFAULT);
g_settings_bind(self->settings, "stereo-split", self->stereo_split, "active", G_SETTINGS_BIND_DEFAULT);
ui::gsettings_bind_enum_to_combo_widget(self->settings, "gate-mode", self->gate_mode);
ui::gsettings_bind_enum_to_combo_widget(self->settings, "envelope-boost", self->envelope_boost);
g_settings_bind(self->settings, "enable-band1", self->enable_band1, "active", G_SETTINGS_BIND_DEFAULT);
g_settings_bind(self->settings, "enable-band2", self->enable_band2, "active", G_SETTINGS_BIND_DEFAULT);
g_settings_bind(self->settings, "enable-band3", self->enable_band3, "active", G_SETTINGS_BIND_DEFAULT);
g_settings_bind(self->settings, "enable-band4", self->enable_band4, "active", G_SETTINGS_BIND_DEFAULT);
g_settings_bind(self->settings, "enable-band5", self->enable_band5, "active", G_SETTINGS_BIND_DEFAULT);
g_settings_bind(self->settings, "enable-band6", self->enable_band6, "active", G_SETTINGS_BIND_DEFAULT);
g_settings_bind(self->settings, "enable-band7", self->enable_band7, "active", G_SETTINGS_BIND_DEFAULT);
g_settings_bind(ui::get_global_app_settings(), "show-native-plugin-ui", self->show_native_ui, "visible",
G_SETTINGS_BIND_DEFAULT);
}
void dispose(GObject* object) {
auto* self = EE_MULTIBAND_GATE_BOX(object);
self->data->multiband_gate->close_native_ui();
set_ignore_filter_idle_add(self->data->serial, true);
for (auto& c : self->data->connections) {
c.disconnect();
}
for (auto& handler_id : self->data->gconnections) {
g_signal_handler_disconnect(self->settings, handler_id);
}
self->data->connections.clear();
self->data->gconnections.clear();
g_object_unref(self->settings);
util::debug("disposed");
G_OBJECT_CLASS(multiband_gate_box_parent_class)->dispose(object);
}
void finalize(GObject* object) {
auto* self = EE_MULTIBAND_GATE_BOX(object);
delete self->data;
util::debug("finalized");
G_OBJECT_CLASS(multiband_gate_box_parent_class)->finalize(object);
}
void multiband_gate_box_class_init(MultibandGateBoxClass* klass) {
auto* object_class = G_OBJECT_CLASS(klass);
auto* widget_class = GTK_WIDGET_CLASS(klass);
object_class->dispose = dispose;
object_class->finalize = finalize;
gtk_widget_class_set_template_from_resource(widget_class, tags::resources::multiband_gate_ui);
gtk_widget_class_bind_template_child(widget_class, MultibandGateBox, input_gain);
gtk_widget_class_bind_template_child(widget_class, MultibandGateBox, output_gain);
gtk_widget_class_bind_template_child(widget_class, MultibandGateBox, input_level_left);
gtk_widget_class_bind_template_child(widget_class, MultibandGateBox, input_level_right);
gtk_widget_class_bind_template_child(widget_class, MultibandGateBox, output_level_left);
gtk_widget_class_bind_template_child(widget_class, MultibandGateBox, output_level_right);
gtk_widget_class_bind_template_child(widget_class, MultibandGateBox, input_level_left_label);
gtk_widget_class_bind_template_child(widget_class, MultibandGateBox, input_level_right_label);
gtk_widget_class_bind_template_child(widget_class, MultibandGateBox, output_level_left_label);
gtk_widget_class_bind_template_child(widget_class, MultibandGateBox, output_level_right_label);
gtk_widget_class_bind_template_child(widget_class, MultibandGateBox, plugin_credit);
gtk_widget_class_bind_template_child(widget_class, MultibandGateBox, stack);
gtk_widget_class_bind_template_child(widget_class, MultibandGateBox, enable_band1);
gtk_widget_class_bind_template_child(widget_class, MultibandGateBox, enable_band2);
gtk_widget_class_bind_template_child(widget_class, MultibandGateBox, enable_band3);
gtk_widget_class_bind_template_child(widget_class, MultibandGateBox, enable_band4);
gtk_widget_class_bind_template_child(widget_class, MultibandGateBox, enable_band5);
gtk_widget_class_bind_template_child(widget_class, MultibandGateBox, enable_band6);
gtk_widget_class_bind_template_child(widget_class, MultibandGateBox, enable_band7);
gtk_widget_class_bind_template_child(widget_class, MultibandGateBox, dry);
gtk_widget_class_bind_template_child(widget_class, MultibandGateBox, wet);
gtk_widget_class_bind_template_child(widget_class, MultibandGateBox, stereo_split);
gtk_widget_class_bind_template_child(widget_class, MultibandGateBox, gate_mode);
gtk_widget_class_bind_template_child(widget_class, MultibandGateBox, envelope_boost);
gtk_widget_class_bind_template_child(widget_class, MultibandGateBox, dropdown_input_devices);
gtk_widget_class_bind_template_child(widget_class, MultibandGateBox, show_native_ui);
gtk_widget_class_bind_template_callback(widget_class, on_reset);
gtk_widget_class_bind_template_callback(widget_class, on_show_native_window);
gtk_widget_class_bind_template_callback(widget_class, on_listbox_row_selected);
}
void multiband_gate_box_init(MultibandGateBox* self) {
gtk_widget_init_template(GTK_WIDGET(self));
self->data = new Data();
self->input_devices_model = g_list_store_new(ui::holders::node_info_holder_get_type());
// The following spinbuttons can assume -inf
prepare_spinbuttons<"dB", false>(self->dry, self->wet);
prepare_scales<"dB">(self->input_gain, self->output_gain);
}
auto create() -> MultibandGateBox* {
return static_cast<MultibandGateBox*>(g_object_new(EE_TYPE_MULTIBAND_GATE_BOX, nullptr));
}
} // namespace ui::multiband_gate_box
| 16,859
|
C++
|
.cpp
| 349
| 42.34384
| 119
| 0.679031
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,722
|
equalizer.cpp
|
wwmm_easyeffects/src/equalizer.cpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#include "equalizer.hpp"
#include <gio/gio.h>
#include <glib-object.h>
#include <glib.h>
#include <sys/types.h>
#include <algorithm>
#include <map>
#include <memory>
#include <span>
#include <string>
#include <utility>
#include <vector>
#include "lv2_wrapper.hpp"
#include "pipe_manager.hpp"
#include "plugin_base.hpp"
#include "tags_equalizer.hpp"
#include "tags_plugin_name.hpp"
#include "util.hpp"
using namespace std::string_literals;
Equalizer::Equalizer(const std::string& tag,
const std::string& schema,
const std::string& schema_path,
const std::string& schema_channel,
const std::string& schema_channel_left_path,
const std::string& schema_channel_right_path,
PipeManager* pipe_manager,
PipelineType pipe_type)
: PluginBase(tag,
tags::plugin_name::equalizer,
tags::plugin_package::lsp,
schema,
schema_path,
pipe_manager,
pipe_type),
settings_left(g_settings_new_with_path(schema_channel.c_str(), schema_channel_left_path.c_str())),
settings_right(g_settings_new_with_path(schema_channel.c_str(), schema_channel_right_path.c_str())) {
lv2_wrapper = std::make_unique<lv2::Lv2Wrapper>("http://lsp-plug.in/plugins/lv2/para_equalizer_x32_lr");
package_installed = lv2_wrapper->found_plugin;
if (!package_installed) {
util::debug(log_tag + "http://lsp-plug.in/plugins/lv2/para_equalizer_x32_lr is not installed");
}
lv2_wrapper->bind_key_enum<"mode", "mode">(settings);
lv2_wrapper->bind_key_double<"bal", "balance">(settings);
lv2_wrapper->bind_key_double<"frqs_l", "pitch-left">(settings);
lv2_wrapper->bind_key_double<"frqs_r", "pitch-right">(settings);
bind_bands(std::make_index_sequence<max_bands>());
on_split_channels();
gconnections.push_back(g_signal_connect(settings, "changed::num-bands",
G_CALLBACK(+[](GSettings* settings, char* key, gpointer user_data) {
auto* self = static_cast<Equalizer*>(user_data);
const uint nbands = g_settings_get_int(settings, key);
const bool split = g_settings_get_boolean(settings, "split-channels") != 0;
using namespace tags::equalizer;
for (uint n = 0U; n < self->max_bands; n++) {
if (n >= nbands) {
// turn off unused bands
g_settings_set_enum(self->settings_left, band_type[n].data(), 0);
if (split) {
g_settings_set_enum(self->settings_right, band_type[n].data(), 0);
}
}
}
}),
this));
gconnections.push_back(g_signal_connect(
settings, "changed::split-channels",
G_CALLBACK(+[](GSettings* settings, char* key, Equalizer* self) { self->on_split_channels(); }), this));
setup_input_output_gain();
}
Equalizer::~Equalizer() {
if (connected_to_pw) {
disconnect_from_pw();
}
for (auto& handler_id : this->gconnections_unified) {
g_signal_handler_disconnect(this->settings_left, handler_id);
}
this->gconnections_unified.clear();
util::debug(log_tag + name + " destroyed");
}
void Equalizer::on_split_channels() {
if (g_settings_get_boolean(settings, "split-channels") != 0) {
for (auto& handler_id : gconnections_unified) {
g_signal_handler_disconnect(settings_left, handler_id);
}
gconnections_unified.clear();
return;
}
using namespace tags::equalizer;
for (uint n = 0U; n < max_bands; n++) {
g_settings_set_enum(settings_right, band_type[n].data(), g_settings_get_enum(settings_left, band_type[n].data()));
g_settings_set_enum(settings_right, band_mode[n].data(), g_settings_get_enum(settings_left, band_mode[n].data()));
g_settings_set_enum(settings_right, band_slope[n].data(), g_settings_get_enum(settings_left, band_slope[n].data()));
g_settings_set_boolean(settings_right, band_solo[n].data(),
g_settings_get_boolean(settings_left, band_solo[n].data()));
g_settings_set_boolean(settings_right, band_mute[n].data(),
g_settings_get_boolean(settings_left, band_mute[n].data()));
g_settings_set_double(settings_right, band_frequency[n].data(),
g_settings_get_double(settings_left, band_frequency[n].data()));
g_settings_set_double(settings_right, band_gain[n].data(),
g_settings_get_double(settings_left, band_gain[n].data()));
g_settings_set_double(settings_right, band_q[n].data(), g_settings_get_double(settings_left, band_q[n].data()));
g_settings_set_double(settings_right, band_width[n].data(),
g_settings_get_double(settings_left, band_width[n].data()));
/*
When in unified mode we want settings applied to the left channel to be propagated to the right channel
database
*/
gconnections_unified.push_back(g_signal_connect(settings_left, ("changed::"s + band_gain[n].data()).c_str(),
G_CALLBACK(+[](GSettings* settings, char* key, Equalizer* self) {
g_settings_set_double(self->settings_right, key,
g_settings_get_double(settings, key));
}),
this));
gconnections_unified.push_back(g_signal_connect(settings_left, ("changed::"s + band_frequency[n].data()).c_str(),
G_CALLBACK(+[](GSettings* settings, char* key, Equalizer* self) {
g_settings_set_double(self->settings_right, key,
g_settings_get_double(settings, key));
}),
this));
gconnections_unified.push_back(g_signal_connect(settings_left, ("changed::"s + band_q[n].data()).c_str(),
G_CALLBACK(+[](GSettings* settings, char* key, Equalizer* self) {
g_settings_set_double(self->settings_right, key,
g_settings_get_double(settings, key));
}),
this));
gconnections_unified.push_back(g_signal_connect(settings_left, ("changed::"s + band_width[n].data()).c_str(),
G_CALLBACK(+[](GSettings* settings, char* key, Equalizer* self) {
g_settings_set_double(self->settings_right, key,
g_settings_get_double(settings, key));
}),
this));
gconnections_unified.push_back(g_signal_connect(settings_left, ("changed::"s + band_type[n].data()).c_str(),
G_CALLBACK(+[](GSettings* settings, char* key, Equalizer* self) {
g_settings_set_enum(self->settings_right, key,
g_settings_get_enum(settings, key));
}),
this));
gconnections_unified.push_back(g_signal_connect(settings_left, ("changed::"s + band_mode[n].data()).c_str(),
G_CALLBACK(+[](GSettings* settings, char* key, Equalizer* self) {
g_settings_set_enum(self->settings_right, key,
g_settings_get_enum(settings, key));
}),
this));
gconnections_unified.push_back(g_signal_connect(settings_left, ("changed::"s + band_slope[n].data()).c_str(),
G_CALLBACK(+[](GSettings* settings, char* key, Equalizer* self) {
g_settings_set_enum(self->settings_right, key,
g_settings_get_enum(settings, key));
}),
this));
gconnections_unified.push_back(g_signal_connect(settings_left, ("changed::"s + band_mute[n].data()).c_str(),
G_CALLBACK(+[](GSettings* settings, char* key, Equalizer* self) {
g_settings_set_boolean(self->settings_right, key,
g_settings_get_boolean(settings, key));
}),
this));
gconnections_unified.push_back(g_signal_connect(settings_left, ("changed::"s + band_solo[n].data()).c_str(),
G_CALLBACK(+[](GSettings* settings, char* key, Equalizer* self) {
g_settings_set_boolean(self->settings_right, key,
g_settings_get_boolean(settings, key));
}),
this));
}
}
void Equalizer::setup() {
if (!lv2_wrapper->found_plugin) {
return;
}
lv2_wrapper->set_n_samples(n_samples);
if (lv2_wrapper->get_rate() != rate) {
lv2_wrapper->create_instance(rate);
}
}
void Equalizer::process(std::span<float>& left_in,
std::span<float>& right_in,
std::span<float>& left_out,
std::span<float>& right_out) {
if (!lv2_wrapper->found_plugin || !lv2_wrapper->has_instance() || bypass) {
std::copy(left_in.begin(), left_in.end(), left_out.begin());
std::copy(right_in.begin(), right_in.end(), right_out.begin());
return;
}
if (input_gain != 1.0F) {
apply_gain(left_in, right_in, input_gain);
}
lv2_wrapper->connect_data_ports(left_in, right_in, left_out, right_out);
lv2_wrapper->run();
if (output_gain != 1.0F) {
apply_gain(left_out, right_out, output_gain);
}
/*
This plugin gives the latency in number of samples
*/
const auto lv = static_cast<uint>(lv2_wrapper->get_control_port_value("out_latency"));
if (latency_n_frames != lv) {
latency_n_frames = lv;
latency_value = static_cast<float>(latency_n_frames) / static_cast<float>(rate);
util::debug(log_tag + name + " latency: " + util::to_string(latency_value, "") + " s");
util::idle_add([this]() {
if (!post_messages || latency.empty()) {
return;
}
latency.emit();
});
update_filter_params();
}
if (post_messages) {
get_peaks(left_in, right_in, left_out, right_out);
if (send_notifications) {
notify();
}
}
}
void Equalizer::sort_bands() {
struct EQ_Band {
gdouble freq;
gint type;
gint mode;
gint slope;
gdouble gain;
gdouble q;
gdouble width;
gboolean solo;
gboolean mute;
};
const auto used_bands = static_cast<uint>(g_settings_get_int(settings, "num-bands"));
if (used_bands < 1U || used_bands > max_bands) {
return;
}
std::vector<GSettings*> settings_channels{settings_left};
if (g_settings_get_boolean(settings, "split-channels") != 0) {
settings_channels.push_back(settings_right);
}
using namespace tags::equalizer;
for (auto* channel : settings_channels) {
std::multimap<gdouble, struct EQ_Band> sorted_bands;
for (uint n = 0U; n < used_bands; n++) {
const auto f = g_settings_get_double(channel, band_frequency[n].data());
sorted_bands.emplace(
std::pair<double, struct EQ_Band>(f, {.freq = f,
.type = g_settings_get_enum(channel, band_type[n].data()),
.mode = g_settings_get_enum(channel, band_mode[n].data()),
.slope = g_settings_get_enum(channel, band_slope[n].data()),
.gain = g_settings_get_double(channel, band_gain[n].data()),
.q = g_settings_get_double(channel, band_q[n].data()),
.width = g_settings_get_double(channel, band_width[n].data()),
.solo = g_settings_get_boolean(channel, band_solo[n].data()),
.mute = g_settings_get_boolean(channel, band_mute[n].data())}));
}
for (uint n = 0U; const auto& p : sorted_bands) {
g_settings_set_double(channel, band_frequency[n].data(), p.second.freq);
g_settings_set_enum(channel, band_type[n].data(), p.second.type);
g_settings_set_enum(channel, band_mode[n].data(), p.second.mode);
g_settings_set_enum(channel, band_slope[n].data(), p.second.slope);
g_settings_set_double(channel, band_gain[n].data(), p.second.gain);
g_settings_set_double(channel, band_q[n].data(), p.second.q);
g_settings_set_double(channel, band_width[n].data(), p.second.width);
g_settings_set_boolean(channel, band_solo[n].data(), p.second.solo);
g_settings_set_boolean(channel, band_mute[n].data(), p.second.mute);
n++;
}
}
}
auto Equalizer::get_latency_seconds() -> float {
return latency_value;
}
| 15,585
|
C++
|
.cpp
| 283
| 37.34629
| 120
| 0.506993
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,723
|
effects_base.cpp
|
wwmm_easyeffects/src/effects_base.cpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#include "effects_base.hpp"
#include <gio/gio.h>
#include <glib-object.h>
#include <glib.h>
#include <algorithm>
#include <map>
#include <memory>
#include <ranges>
#include <string>
#include <utility>
#include "autogain.hpp"
#include "bass_enhancer.hpp"
#include "bass_loudness.hpp"
#include "compressor.hpp"
#include "convolver.hpp"
#include "crossfeed.hpp"
#include "crystalizer.hpp"
#include "deepfilternet.hpp"
#include "deesser.hpp"
#include "delay.hpp"
#include "echo_canceller.hpp"
#include "equalizer.hpp"
#include "exciter.hpp"
#include "expander.hpp"
#include "filter.hpp"
#include "gate.hpp"
#include "level_meter.hpp"
#include "limiter.hpp"
#include "loudness.hpp"
#include "maximizer.hpp"
#include "multiband_compressor.hpp"
#include "multiband_gate.hpp"
#include "output_level.hpp"
#include "pipe_manager.hpp"
#include "pitch.hpp"
#include "plugin_base.hpp"
#include "reverb.hpp"
#include "rnnoise.hpp"
#include "spectrum.hpp"
#include "speex.hpp"
#include "stereo_tools.hpp"
#include "tags_app.hpp"
#include "tags_plugin_name.hpp"
#include "tags_schema.hpp"
#include "util.hpp"
EffectsBase::EffectsBase(std::string tag, const std::string& schema, PipeManager* pipe_manager, PipelineType pipe_type)
: log_tag(std::move(tag)),
pm(pipe_manager),
pipeline_type(pipe_type),
settings(g_settings_new(schema.c_str())),
global_settings(g_settings_new(tags::app::id)) {
using namespace std::string_literals;
schema_base_path = "/" + schema + "/";
std::replace(schema_base_path.begin(), schema_base_path.end(), '.', '/');
output_level = std::make_shared<OutputLevel>(log_tag, tags::schema::output_level::id,
schema_base_path + "outputlevel/", pm, pipeline_type);
spectrum = std::make_shared<Spectrum>(log_tag, tags::schema::spectrum::id, tags::app::path + "/spectrum/"s, pm,
pipeline_type);
if (!output_level->connected_to_pw) {
output_level->connect_to_pw();
}
if (!spectrum->connected_to_pw) {
spectrum->connect_to_pw();
}
create_filters_if_necessary();
gconnections.push_back(g_signal_connect(settings, "changed::plugins",
G_CALLBACK(+[](GSettings* settings, char* key, gpointer user_data) {
auto* self = static_cast<EffectsBase*>(user_data);
self->create_filters_if_necessary();
self->broadcast_pipeline_latency();
}),
this));
gconnections_global.push_back(g_signal_connect(global_settings, "changed::meters-update-interval",
G_CALLBACK(+[](GSettings* settings, char* key, gpointer user_data) {
auto* self = static_cast<EffectsBase*>(user_data);
auto v = g_settings_get_int(settings, key);
self->spectrum->notification_time_window = 0.001F * v;
for (auto& plugin : self->plugins | std::views::values) {
plugin->notification_time_window = 0.001F * v;
}
}),
this));
gconnections_global.push_back(g_signal_connect(global_settings, "changed::lv2ui-update-frequency",
G_CALLBACK(+[](GSettings* settings, char* key, gpointer user_data) {
auto* self = static_cast<EffectsBase*>(user_data);
auto v = g_settings_get_int(settings, key);
for (auto& plugin : self->plugins | std::views::values) {
plugin->set_native_ui_update_frequency(v);
}
}),
this));
auto notification_time_window =
0.001F * static_cast<float>(g_settings_get_int(global_settings, "meters-update-interval"));
spectrum->notification_time_window = notification_time_window;
for (auto& plugin : plugins | std::views::values) {
plugin->notification_time_window = notification_time_window;
}
}
EffectsBase::~EffectsBase() {
for (auto& c : connections) {
c.disconnect();
}
for (auto& handler_id : gconnections) {
g_signal_handler_disconnect(settings, handler_id);
}
for (auto& handler_id : gconnections_global) {
g_signal_handler_disconnect(global_settings, handler_id);
}
g_object_unref(settings);
util::debug("effects_base: destroyed");
}
void EffectsBase::reset_settings() {
util::reset_all_keys_except(settings, {"input-device", "output-device"});
spectrum->reset_settings();
for (auto& plugin : plugins | std::views::values) {
plugin->reset_settings();
}
}
void EffectsBase::create_filters_if_necessary() {
const auto list = util::gchar_array_to_vector(g_settings_get_strv(settings, "plugins"));
if (list.empty()) {
return;
}
for (const auto& name : list) {
if (plugins.contains(name)) {
continue;
}
auto instance_id = util::to_string(tags::plugin_name::get_id(name));
auto path = schema_base_path + tags::plugin_name::get_base_name(name) + "/" + instance_id + "/";
path.erase(std::remove(path.begin(), path.end(), '_'), path.end());
std::shared_ptr<PluginBase> filter;
if (name.starts_with(tags::plugin_name::autogain)) {
filter = std::make_shared<AutoGain>(log_tag, tags::schema::autogain::id, path, pm, pipeline_type);
} else if (name.starts_with(tags::plugin_name::bass_enhancer)) {
filter = std::make_shared<BassEnhancer>(log_tag, tags::schema::bass_enhancer::id, path, pm, pipeline_type);
} else if (name.starts_with(tags::plugin_name::bass_loudness)) {
filter = std::make_shared<BassLoudness>(log_tag, tags::schema::bass_loudness::id, path, pm, pipeline_type);
} else if (name.starts_with(tags::plugin_name::compressor)) {
filter = std::make_shared<Compressor>(log_tag, tags::schema::compressor::id, path, pm, pipeline_type);
} else if (name.starts_with(tags::plugin_name::convolver)) {
filter = std::make_shared<Convolver>(log_tag, tags::schema::convolver::id, path, pm, pipeline_type);
} else if (name.starts_with(tags::plugin_name::crossfeed)) {
filter = std::make_shared<Crossfeed>(log_tag, tags::schema::crossfeed::id, path, pm, pipeline_type);
} else if (name.starts_with(tags::plugin_name::crystalizer)) {
filter = std::make_shared<Crystalizer>(log_tag, tags::schema::crystalizer::id, path, pm, pipeline_type);
} else if (name.starts_with(tags::plugin_name::deepfilternet)) {
filter = std::make_shared<DeepFilterNet>(log_tag, tags::schema::deepfilternet::id, path, pm, pipeline_type);
} else if (name.starts_with(tags::plugin_name::deesser)) {
filter = std::make_shared<Deesser>(log_tag, tags::schema::deesser::id, path, pm, pipeline_type);
} else if (name.starts_with(tags::plugin_name::delay)) {
filter = std::make_shared<Delay>(log_tag, tags::schema::delay::id, path, pm, pipeline_type);
} else if (name.starts_with(tags::plugin_name::echo_canceller)) {
filter = std::make_shared<EchoCanceller>(log_tag, tags::schema::echo_canceller::id, path, pm, pipeline_type);
} else if (name.starts_with(tags::plugin_name::exciter)) {
filter = std::make_shared<Exciter>(log_tag, tags::schema::exciter::id, path, pm, pipeline_type);
} else if (name.starts_with(tags::plugin_name::expander)) {
filter = std::make_shared<Expander>(log_tag, tags::schema::expander::id, path, pm, pipeline_type);
} else if (name.starts_with(tags::plugin_name::equalizer)) {
filter = std::make_shared<Equalizer>(
log_tag, tags::schema::equalizer::id, path, tags::schema::equalizer::channel_id,
schema_base_path + "equalizer/" + instance_id + "/leftchannel/",
schema_base_path + "equalizer/" + instance_id + "/rightchannel/", pm, pipeline_type);
} else if (name.starts_with(tags::plugin_name::filter)) {
filter = std::make_shared<Filter>(log_tag, tags::schema::filter::id, path, pm, pipeline_type);
} else if (name.starts_with(tags::plugin_name::gate)) {
filter = std::make_shared<Gate>(log_tag, tags::schema::gate::id, path, pm, pipeline_type);
} else if (name.starts_with(tags::plugin_name::level_meter)) {
filter = std::make_shared<LevelMeter>(log_tag, tags::schema::level_meter::id, path, pm, pipeline_type);
} else if (name.starts_with(tags::plugin_name::limiter)) {
filter = std::make_shared<Limiter>(log_tag, tags::schema::limiter::id, path, pm, pipeline_type);
} else if (name.starts_with(tags::plugin_name::loudness)) {
filter = std::make_shared<Loudness>(log_tag, tags::schema::loudness::id, path, pm, pipeline_type);
} else if (name.starts_with(tags::plugin_name::maximizer)) {
filter = std::make_shared<Maximizer>(log_tag, tags::schema::maximizer::id, path, pm, pipeline_type);
} else if (name.starts_with(tags::plugin_name::multiband_compressor)) {
filter = std::make_shared<MultibandCompressor>(log_tag, tags::schema::multiband_compressor::id, path, pm,
pipeline_type);
} else if (name.starts_with(tags::plugin_name::multiband_gate)) {
filter = std::make_shared<MultibandGate>(log_tag, tags::schema::multiband_gate::id, path, pm, pipeline_type);
} else if (name.starts_with(tags::plugin_name::pitch)) {
filter = std::make_shared<Pitch>(log_tag, tags::schema::pitch::id, path, pm, pipeline_type);
} else if (name.starts_with(tags::plugin_name::reverb)) {
filter = std::make_shared<Reverb>(log_tag, tags::schema::reverb::id, path, pm, pipeline_type);
} else if (name.starts_with(tags::plugin_name::rnnoise)) {
filter = std::make_shared<RNNoise>(log_tag, tags::schema::rnnoise::id, path, pm, pipeline_type);
} else if (name.starts_with(tags::plugin_name::speex)) {
filter = std::make_shared<Speex>(log_tag, tags::schema::speex::id, path, pm, pipeline_type);
} else if (name.starts_with(tags::plugin_name::stereo_tools)) {
filter = std::make_shared<StereoTools>(log_tag, tags::schema::stereo_tools::id, path, pm, pipeline_type);
}
connections.push_back(filter->latency.connect([this]() { broadcast_pipeline_latency(); }));
plugins.insert(std::make_pair(name, filter));
}
}
void EffectsBase::remove_unused_filters() {
const auto list = util::gchar_array_to_vector(g_settings_get_strv(settings, "plugins"));
if (list.empty()) {
plugins.clear();
return;
}
for (auto it = plugins.begin(); it != plugins.end();) {
auto key = it->first;
if (std::ranges::find(list, key) == list.end()) {
auto plugin = it->second;
plugin->bypass = true;
plugin->set_post_messages(false);
plugin->latency.clear();
if (plugin->connected_to_pw) {
plugin->disconnect_from_pw();
}
it = plugins.erase(it);
} else {
it++;
}
}
}
void EffectsBase::activate_filters() {
for (auto& plugin : plugins | std::views::values) {
plugin->set_active(true);
}
}
void EffectsBase::deactivate_filters() {
for (auto& plugin : plugins | std::views::values) {
plugin->set_active(false);
}
}
auto EffectsBase::get_pipeline_latency() -> float {
float total = 0.0F;
for (const auto& name : util::gchar_array_to_vector(g_settings_get_strv(settings, "plugins"))) {
if (plugins.contains(name)) {
total += plugins[name]->get_latency_seconds();
}
}
return total * 1000.0F;
}
void EffectsBase::broadcast_pipeline_latency() {
const auto latency_value = get_pipeline_latency();
util::debug(log_tag + "pipeline latency: " + util::to_string(latency_value, "") + " ms");
pipeline_latency.emit(latency_value);
}
auto EffectsBase::get_plugins_map() -> std::map<std::string, std::shared_ptr<PluginBase>> {
return plugins;
}
| 13,192
|
C++
|
.cpp
| 261
| 42.099617
| 119
| 0.625058
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,724
|
apps_box.cpp
|
wwmm_easyeffects/src/apps_box.cpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#include "apps_box.hpp"
#include <STTypes.h>
#include <adwaita.h>
#include <gio/gio.h>
#include <gio/gliststore.h>
#include <glib-object.h>
#include <glib.h>
#include <gobject/gobject.h>
#include <gtk/gtk.h>
#include <gtk/gtknoselection.h>
#include <sigc++/connection.h>
#include <algorithm>
#include <cstdint>
#include <string>
#include <unordered_map>
#include <vector>
#include "app_info.hpp"
#include "application.hpp"
#include "node_info_holder.hpp"
#include "pipe_objects.hpp"
#include "pipeline_type.hpp"
#include "tags_app.hpp"
#include "tags_pipewire.hpp"
#include "tags_resources.hpp"
#include "tags_schema.hpp"
#include "util.hpp"
namespace ui::apps_box {
struct Data {
public:
~Data() { util::debug("data struct destroyed"); }
app::Application* application;
std::unordered_map<uint, bool> enabled_app_list;
std::vector<sigc::connection> connections;
std::vector<gulong> gconnections;
};
struct _AppsBox {
GtkBox parent_instance;
GtkOverlay* overlay;
AdwStatusPage* overlay_empty_list;
GtkListView* listview;
GtkIconTheme* icon_theme;
GListStore *apps_model, *all_apps_model;
GSettings *settings, *app_settings;
Data* data;
};
// NOLINTNEXTLINE
G_DEFINE_TYPE(AppsBox, apps_box, GTK_TYPE_BOX)
auto app_is_blocklisted(AppsBox* self, const std::string& name) -> bool {
const auto list = util::gchar_array_to_vector(g_settings_get_strv(self->settings, "blocklist"));
return std::ranges::find(list, name) != list.end();
}
void update_empty_list_overlay(AppsBox* self) {
gtk_widget_set_visible(GTK_WIDGET(self->overlay_empty_list),
(g_list_model_get_n_items(G_LIST_MODEL(self->apps_model)) == 0U) ? 1 : 0);
}
void on_app_added(AppsBox* self, const NodeInfo& node_info) {
// do not add the same stream twice
for (guint n = 0U; n < g_list_model_get_n_items(G_LIST_MODEL(self->all_apps_model)); n++) {
auto* holder =
static_cast<ui::holders::NodeInfoHolder*>(g_list_model_get_item(G_LIST_MODEL(self->all_apps_model), n));
if (holder->info->serial == node_info.serial) {
g_object_unref(holder);
return;
}
g_object_unref(holder);
}
auto* holder = ui::holders::create(node_info);
g_list_store_append(self->all_apps_model, holder);
if (g_settings_get_boolean(self->settings, "show-blocklisted-apps") != 0 ||
!app_is_blocklisted(self, node_info.name)) {
g_list_store_append(self->apps_model, holder);
}
/*
As g_list_store_append calls increases the object reference count we remove the one added by g_object_new in the
object creation. The reference added by g_list_store_append will be removed by an additional call to
g_object_unref after g_list_store_remove is called
*/
g_object_unref(holder);
update_empty_list_overlay(self);
}
void on_app_removed(AppsBox* self, const uint64_t serial) {
for (guint n = 0U; n < g_list_model_get_n_items(G_LIST_MODEL(self->all_apps_model)); n++) {
auto* holder =
static_cast<ui::holders::NodeInfoHolder*>(g_list_model_get_item(G_LIST_MODEL(self->all_apps_model), n));
if (holder->info->serial == serial) {
holder->info_updated.clear(); // Disconnecting all the slots before removing the holder from the model
g_list_store_remove(self->all_apps_model, n);
g_object_unref(holder);
break;
}
g_object_unref(holder);
}
for (guint n = 0U; n < g_list_model_get_n_items(G_LIST_MODEL(self->apps_model)); n++) {
auto* holder = static_cast<ui::holders::NodeInfoHolder*>(g_list_model_get_item(G_LIST_MODEL(self->apps_model), n));
if (holder->info->serial == serial) {
holder->info_updated.clear(); // Disconnecting all the slots before removing the holder from the model
g_list_store_remove(self->apps_model, n);
g_object_unref(holder);
break;
}
g_object_unref(holder);
}
update_empty_list_overlay(self);
}
void on_app_changed(AppsBox* self, const NodeInfo node_info) {
for (guint n = 0U; n < g_list_model_get_n_items(G_LIST_MODEL(self->apps_model)); n++) {
auto* holder = static_cast<ui::holders::NodeInfoHolder*>(g_list_model_get_item(G_LIST_MODEL(self->apps_model), n));
if (holder->info->serial == node_info.serial) {
holder->info_updated.emit(node_info);
g_object_unref(holder);
return;
}
g_object_unref(holder);
}
}
void connect_stream(AppsBox* self, const uint& id, const std::string& media_class) {
if (media_class == tags::pipewire::media_class::output_stream) {
self->data->application->pm->connect_stream_output(id);
} else if (media_class == tags::pipewire::media_class::input_stream) {
self->data->application->pm->connect_stream_input(id);
}
}
void disconnect_stream(AppsBox* self, const uint& id, const std::string& media_class) {
if (media_class == tags::pipewire::media_class::output_stream ||
media_class == tags::pipewire::media_class::input_stream) {
self->data->application->pm->disconnect_stream(id);
}
}
void setup_listview(AppsBox* self) {
auto* factory = gtk_signal_list_item_factory_new();
// setting the factory callbacks
g_signal_connect(factory, "setup",
G_CALLBACK(+[](GtkSignalListItemFactory* factory, GtkListItem* item, AppsBox* self) {
auto app_info = ui::app_info::create();
ui::app_info::setup(app_info, self->data->application, self->settings, self->icon_theme,
self->data->enabled_app_list);
gtk_list_item_set_activatable(item, 0);
gtk_list_item_set_child(item, GTK_WIDGET(app_info));
g_object_set_data(G_OBJECT(item), "app-info", app_info);
}),
self);
g_signal_connect(
factory, "bind", G_CALLBACK(+[](GtkSignalListItemFactory* factory, GtkListItem* item, AppsBox* self) {
auto* app_info = static_cast<ui::app_info::AppInfo*>(g_object_get_data(G_OBJECT(item), "app-info"));
auto child_item = gtk_list_item_get_item(item);
auto* holder = static_cast<ui::holders::NodeInfoHolder*>(child_item);
// Update the app info ui for the very first time Needed for interface initialization in service mode
if (const auto node_it = self->data->application->pm->node_map.find(holder->info->serial);
node_it != self->data->application->pm->node_map.end()) {
ui::app_info::update(app_info, node_it->second);
}
// A call to holder->info_updated.clear() will be made in the unbind signal
holder->info_updated.connect([=](const NodeInfo node_info) { ui::app_info::update(app_info, node_info); });
}),
self);
g_signal_connect(factory, "unbind",
G_CALLBACK(+[](GtkSignalListItemFactory* self, GtkListItem* item, gpointer user_data) {
auto* holder = static_cast<ui::holders::NodeInfoHolder*>(gtk_list_item_get_item(item));
holder->info_updated.clear();
}),
self);
gtk_list_view_set_factory(self->listview, factory);
g_object_unref(factory);
// setting the model
auto* selection = gtk_no_selection_new(G_LIST_MODEL(self->apps_model));
gtk_list_view_set_model(self->listview, GTK_SELECTION_MODEL(selection));
g_object_unref(selection);
}
void setup(AppsBox* self, app::Application* application, PipelineType pipeline_type, GtkIconTheme* icon_theme) {
self->data->application = application;
self->icon_theme = icon_theme;
switch (pipeline_type) {
case PipelineType::input: {
auto* pm = application->sie->pm;
self->settings = g_settings_new(tags::schema::id_input);
for (const auto& [serial, node] : pm->node_map) {
if (node.media_class == tags::pipewire::media_class::input_stream) {
on_app_added(self, node);
}
}
self->data->connections.push_back(
application->sie->pm->stream_input_added.connect([=](const NodeInfo info) { on_app_added(self, info); }));
self->data->connections.push_back(application->sie->pm->stream_input_removed.connect(
[=](const uint64_t serial) { on_app_removed(self, serial); }));
self->data->connections.push_back(application->sie->pm->stream_input_changed.connect(
[=](const NodeInfo node_info) { on_app_changed(self, node_info); }));
break;
}
case PipelineType::output: {
auto* pm = application->soe->pm;
self->settings = g_settings_new(tags::schema::id_output);
for (const auto& [serial, node] : pm->node_map) {
if (node.media_class == tags::pipewire::media_class::output_stream) {
on_app_added(self, node);
}
}
self->data->connections.push_back(
pm->stream_output_added.connect([=](const NodeInfo info) { on_app_added(self, info); }));
self->data->connections.push_back(application->soe->pm->stream_output_removed.connect(
[=](const uint64_t serial) { on_app_removed(self, serial); }));
self->data->connections.push_back(application->soe->pm->stream_output_changed.connect(
[=](const NodeInfo node_info) { on_app_changed(self, node_info); }));
break;
}
}
// updating the list when changes are made to the blocklist
self->data->gconnections.push_back(g_signal_connect(
self->settings, "changed::blocklist", G_CALLBACK(+[](GSettings* settings, char* key, AppsBox* self) {
const auto show_blocklisted_apps = g_settings_get_boolean(self->settings, "show-blocklisted-apps") != 0;
g_list_store_remove_all(self->apps_model);
for (guint n = 0U; n < g_list_model_get_n_items(G_LIST_MODEL(self->all_apps_model)); n++) {
auto* holder =
static_cast<ui::holders::NodeInfoHolder*>(g_list_model_get_item(G_LIST_MODEL(self->all_apps_model), n));
const auto app_is_enabled =
self->data->application->pm->stream_is_connected(holder->info->id, holder->info->media_class);
if (app_is_blocklisted(self, holder->info->name)) {
if (app_is_enabled) {
disconnect_stream(self, holder->info->id, holder->info->media_class);
}
if (show_blocklisted_apps) {
g_list_store_append(self->apps_model, holder);
}
} else {
if (!app_is_enabled) {
// Try to restore the previous enabled state, if needed
try {
if (self->data->enabled_app_list.at(holder->info->id)) {
connect_stream(self, holder->info->id, holder->info->media_class);
}
} catch (...) {
connect_stream(self, holder->info->id, holder->info->media_class);
util::warning("can't retrieve enabled state of node " + holder->info->name);
self->data->enabled_app_list.insert({holder->info->id, true});
}
}
g_list_store_append(self->apps_model, holder);
}
g_object_unref(holder);
}
update_empty_list_overlay(self);
}),
self));
self->data->gconnections.push_back(g_signal_connect(
self->settings, "changed::show-blocklisted-apps", G_CALLBACK(+[](GSettings* settings, char* key, AppsBox* self) {
const auto show_blocklisted_apps = g_settings_get_boolean(self->settings, "show-blocklisted-apps") != 0;
g_list_store_remove_all(self->apps_model);
if (show_blocklisted_apps) {
for (guint n = 0U; n < g_list_model_get_n_items(G_LIST_MODEL(self->all_apps_model)); n++) {
auto item = g_list_model_get_item(G_LIST_MODEL(self->all_apps_model), n);
g_object_unref(item);
g_list_store_append(self->apps_model, item);
}
} else {
for (guint n = 0U; n < g_list_model_get_n_items(G_LIST_MODEL(self->all_apps_model)); n++) {
auto* holder =
static_cast<ui::holders::NodeInfoHolder*>(g_list_model_get_item(G_LIST_MODEL(self->all_apps_model), n));
g_object_unref(holder);
if (!app_is_blocklisted(self, holder->info->name)) {
auto item = g_list_model_get_item(G_LIST_MODEL(self->all_apps_model), n);
g_object_unref(item);
g_list_store_append(self->apps_model, item);
}
}
}
update_empty_list_overlay(self);
}),
self));
}
void dispose(GObject* object) {
auto* self = EE_APPS_BOX(object);
for (auto& c : self->data->connections) {
c.disconnect();
}
for (auto& handler_id : self->data->gconnections) {
g_signal_handler_disconnect(self->settings, handler_id);
}
self->data->connections.clear();
self->data->gconnections.clear();
g_object_unref(self->all_apps_model); // do not do this to self->apps_model. It is owned by the listview
g_object_unref(self->settings);
g_object_unref(self->app_settings);
util::debug("disposed");
G_OBJECT_CLASS(apps_box_parent_class)->dispose(object);
}
void finalize(GObject* object) {
auto* self = EE_APPS_BOX(object);
delete self->data;
util::debug("finalized");
G_OBJECT_CLASS(apps_box_parent_class)->finalize(object);
}
void apps_box_class_init(AppsBoxClass* klass) {
auto* object_class = G_OBJECT_CLASS(klass);
auto* widget_class = GTK_WIDGET_CLASS(klass);
object_class->dispose = dispose;
object_class->finalize = finalize;
gtk_widget_class_set_template_from_resource(widget_class, tags::resources::apps_box_ui);
gtk_widget_class_bind_template_child(widget_class, AppsBox, overlay);
gtk_widget_class_bind_template_child(widget_class, AppsBox, overlay_empty_list);
gtk_widget_class_bind_template_child(widget_class, AppsBox, listview);
}
void apps_box_init(AppsBox* self) {
gtk_widget_init_template(GTK_WIDGET(self));
self->data = new Data();
self->app_settings = g_settings_new(tags::app::id);
self->apps_model = g_list_store_new(ui::holders::node_info_holder_get_type());
self->all_apps_model = g_list_store_new(ui::holders::node_info_holder_get_type());
gtk_overlay_set_clip_overlay(self->overlay, GTK_WIDGET(self->overlay_empty_list), 1);
setup_listview(self);
}
auto create() -> AppsBox* {
return static_cast<AppsBox*>(g_object_new(EE_TYPE_APPS_BOX, nullptr));
}
} // namespace ui::apps_box
| 15,177
|
C++
|
.cpp
| 331
| 39.268882
| 120
| 0.652803
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,725
|
client_info_holder.cpp
|
wwmm_easyeffects/src/client_info_holder.cpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#include "client_info_holder.hpp"
#include <glib-object.h>
#include <glib.h>
#include <glibconfig.h>
#include <gobject/gobject.h>
#include <spa/utils/defs.h>
#include "pipe_objects.hpp"
#include "util.hpp"
namespace ui::holders {
enum { PROP_0, PROP_ID, PROP_NAME, PROP_API, PROP_ACCESS };
// NOLINTNEXTLINE
G_DEFINE_TYPE(ClientInfoHolder, client_info_holder, G_TYPE_OBJECT);
void client_info_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec) {
auto* self = EE_CLIENT_INFO_HOLDER(object);
switch (prop_id) {
case PROP_ID:
self->info->id = g_value_get_uint(value);
break;
case PROP_NAME:
self->info->name = g_value_get_string(value);
break;
case PROP_API:
self->info->api = g_value_get_string(value);
break;
case PROP_ACCESS:
self->info->access = g_value_get_string(value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
}
}
void client_info_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec) {
auto* self = EE_CLIENT_INFO_HOLDER(object);
switch (prop_id) {
case PROP_ID:
g_value_set_uint(value, self->info->id);
break;
case PROP_NAME:
g_value_set_string(value, self->info->name.c_str());
break;
case PROP_API:
g_value_set_string(value, self->info->api.c_str());
break;
case PROP_ACCESS:
g_value_set_string(value, self->info->access.c_str());
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
}
}
void client_info_holder_finalize(GObject* object) {
auto* self = EE_CLIENT_INFO_HOLDER(object);
self->info_updated.clear();
util::debug(util::to_string(self->info->id) + ", " + self->info->name + " finalized");
delete self->info;
G_OBJECT_CLASS(client_info_holder_parent_class)->finalize(object);
}
void client_info_holder_class_init(ClientInfoHolderClass* klass) {
auto* object_class = G_OBJECT_CLASS(klass);
object_class->finalize = client_info_holder_finalize;
object_class->set_property = client_info_set_property;
object_class->get_property = client_info_get_property;
g_object_class_install_property(
object_class, PROP_ID,
g_param_spec_uint("id", "Id", "Id", G_MININT, G_MAXUINT, SPA_ID_INVALID, G_PARAM_READWRITE));
g_object_class_install_property(object_class, PROP_NAME,
g_param_spec_string("name", "Name", "Name", nullptr, G_PARAM_READWRITE));
g_object_class_install_property(object_class, PROP_API,
g_param_spec_string("api", "API", "API", nullptr, G_PARAM_READWRITE));
g_object_class_install_property(object_class, PROP_ACCESS,
g_param_spec_string("access", "Access", "Access", nullptr, G_PARAM_READWRITE));
}
void client_info_holder_init(ClientInfoHolder* self) {
self->info = new ClientInfo();
}
auto create(const ClientInfo& info) -> ClientInfoHolder* {
auto* holder = static_cast<ClientInfoHolder*>(g_object_new(EE_TYPE_CLIENT_INFO_HOLDER, nullptr));
holder->info->id = info.id;
holder->info->name = info.name;
holder->info->api = info.api;
holder->info->access = info.access;
return holder;
}
} // namespace ui::holders
| 4,068
|
C++
|
.cpp
| 104
| 34.586538
| 113
| 0.686802
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,726
|
convolver_menu_impulses.cpp
|
wwmm_easyeffects/src/convolver_menu_impulses.cpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#include "convolver_menu_impulses.hpp"
#include <gio/gio.h>
#include <gio/gliststore.h>
#include <glib-object.h>
#include <glib.h>
#include <glib/gi18n.h>
#include <gobject/gobject.h>
#include <gtk/gtk.h>
#include <gtk/gtkdropdown.h>
#include <gtk/gtkexpression.h>
#include <gtk/gtknoselection.h>
#include <gtk/gtkshortcut.h>
#include <filesystem>
#include <sndfile.hh>
#include <string>
#include "application.hpp"
#include "config.h"
#include "tags_app.hpp"
#include "tags_resources.hpp"
#include "tags_schema.hpp"
#include "ui_helpers.hpp"
#include "util.hpp"
namespace ui::convolver_menu_impulses {
using namespace std::string_literals;
enum class ImpulseImportState { success, no_regular_file, no_frame, no_stereo };
auto constexpr irs_ext = ".irs";
std::filesystem::path irs_dir = g_get_user_config_dir() + "/easyeffects/irs"s;
struct _ConvolverMenuImpulses {
GtkBox parent_instance;
GtkScrolledWindow* scrolled_window;
GtkListView* listview;
GtkSpinButton* ir_width;
GtkSearchEntry* entry_search;
GtkStringList* string_list;
GSettings *settings, *app_settings;
std::shared_ptr<Convolver> convolver;
app::Application* application;
};
// NOLINTNEXTLINE
G_DEFINE_TYPE(ConvolverMenuImpulses, convolver_menu_impulses, GTK_TYPE_POPOVER)
void append_to_string_list(ConvolverMenuImpulses* self, const std::string& irs_filename) {
ui::append_to_string_list(self->string_list, irs_filename);
}
void remove_from_string_list(ConvolverMenuImpulses* self, const std::string& irs_filename) {
ui::remove_from_string_list(self->string_list, irs_filename);
}
auto import_irs_file(const std::string& file_path) -> ImpulseImportState {
std::filesystem::path p{file_path};
if (!std::filesystem::is_regular_file(p)) {
util::warning(p.string() + " is not a file!");
return ImpulseImportState::no_regular_file;
}
auto file = SndfileHandle(file_path.c_str());
if (file.frames() == 0) {
util::warning("Cannot import the impulse response! The format may be corrupted or unsupported.");
util::warning(file_path + " loading failed");
return ImpulseImportState::no_frame;
}
if (file.channels() != 2) {
util::warning("Only stereo impulse files are supported!");
util::warning(file_path + " loading failed");
return ImpulseImportState::no_stereo;
}
auto out_path = irs_dir / p.filename();
out_path.replace_extension(irs_ext);
std::filesystem::copy_file(p, out_path, std::filesystem::copy_options::overwrite_existing);
util::debug("Irs file successfully imported to: " + out_path.string());
return ImpulseImportState::success;
}
void notify_import_error(const ImpulseImportState& import_state, ConvolverMenuImpulses* self) {
std::string descr;
switch (import_state) {
case ImpulseImportState::no_regular_file: {
descr = _("The File Is Not Regular");
break;
}
case ImpulseImportState::no_frame: {
descr = _("The Impulse File May Be Corrupted or Unsupported");
break;
}
case ImpulseImportState::no_stereo: {
descr = _("Only Stereo Impulse Files Are Supported");
break;
}
default:
return;
}
auto* active_window = gtk_application_get_active_window(GTK_APPLICATION(self->application));
ui::show_simple_message_dialog(GTK_WIDGET(active_window), _("Impulse File Not Imported"), descr);
}
void on_import_irs_clicked(ConvolverMenuImpulses* self, GtkButton* btn) {
auto* active_window = gtk_application_get_active_window(GTK_APPLICATION(self->application));
auto* dialog = gtk_file_dialog_new();
gtk_file_dialog_set_title(dialog, _("Import Impulse File"));
gtk_file_dialog_set_accept_label(dialog, _("Open"));
auto* init_folder = g_file_new_for_path(g_get_home_dir());
gtk_file_dialog_set_initial_folder(dialog, init_folder);
g_object_unref(init_folder);
GListStore* filters = g_list_store_new(GTK_TYPE_FILE_FILTER);
auto* filter = gtk_file_filter_new();
gtk_file_filter_set_name(filter, _("Impulse Response"));
gtk_file_filter_add_pattern(filter, ("*"s + irs_ext).c_str());
gtk_file_filter_add_pattern(filter, "*.wav");
g_list_store_append(filters, filter);
g_object_unref(filter);
gtk_file_dialog_set_filters(dialog, G_LIST_MODEL(filters));
g_object_unref(filters);
gtk_file_dialog_open_multiple(
dialog, active_window, nullptr,
+[](GObject* source_object, GAsyncResult* result, gpointer user_data) {
auto* self = static_cast<ConvolverMenuImpulses*>(user_data);
auto* dialog = GTK_FILE_DIALOG(source_object);
auto* files_list = gtk_file_dialog_open_multiple_finish(dialog, result, nullptr);
if (files_list == nullptr) {
return;
}
for (guint n = 0U; n < g_list_model_get_n_items(files_list); n++) {
auto* file = static_cast<GFile*>(g_list_model_get_item(files_list, n));
auto* path = g_file_get_path(file);
if (auto import_state = import_irs_file(path); import_state != ImpulseImportState::success) {
notify_import_error(import_state, self);
}
g_free(path);
}
g_object_unref(files_list);
},
self);
}
void remove_irs_file(const std::string& name) {
const auto irs_file = irs_dir / std::filesystem::path{name + irs_ext};
if (std::filesystem::exists(irs_file)) {
std::filesystem::remove(irs_file);
util::debug("removed irs file: " + irs_file.string());
}
}
void setup_listview(ConvolverMenuImpulses* self) {
auto* factory = gtk_signal_list_item_factory_new();
// setting the factory callbacks
g_signal_connect(factory, "setup",
G_CALLBACK(+[](GtkSignalListItemFactory* factory, GtkListItem* item, ConvolverMenuImpulses* self) {
auto* box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
auto* label = gtk_label_new(nullptr);
auto* load = gtk_button_new_with_label(_("Load"));
auto* remove = gtk_button_new_from_icon_name("user-trash-symbolic");
gtk_widget_set_halign(GTK_WIDGET(label), GTK_ALIGN_START);
gtk_widget_set_hexpand(GTK_WIDGET(label), 1);
gtk_box_append(GTK_BOX(box), GTK_WIDGET(label));
gtk_box_append(GTK_BOX(box), GTK_WIDGET(load));
gtk_box_append(GTK_BOX(box), GTK_WIDGET(remove));
gtk_list_item_set_activatable(item, 0);
gtk_list_item_set_child(item, GTK_WIDGET(box));
g_object_set_data(G_OBJECT(item), "name", label);
g_object_set_data(G_OBJECT(item), "load", load);
g_object_set_data(G_OBJECT(item), "remove", remove);
g_signal_connect(load, "clicked", G_CALLBACK(+[](GtkButton* btn, ConvolverMenuImpulses* self) {
auto* string_object =
GTK_STRING_OBJECT(g_object_get_data(G_OBJECT(btn), "string-object"));
if (string_object == nullptr) {
return;
}
const auto* lcp_key = (self->convolver->pipeline_type == PipelineType::input)
? "last-loaded-input-community-package"
: "last-loaded-output-community-package";
// irs loaded from the convolver menu are always local.
g_settings_reset(self->app_settings, lcp_key);
auto* name = gtk_string_object_get_string(string_object);
g_settings_set_string(self->settings, "kernel-name", name);
}),
self);
g_signal_connect(remove, "clicked", G_CALLBACK(+[](GtkButton* btn, ConvolverMenuImpulses* self) {
if (auto* string_object =
GTK_STRING_OBJECT(g_object_get_data(G_OBJECT(btn), "string-object"));
string_object != nullptr) {
auto* name = gtk_string_object_get_string(string_object);
remove_irs_file(name);
}
}),
self);
}),
self);
g_signal_connect(factory, "bind",
G_CALLBACK(+[](GtkSignalListItemFactory* factory, GtkListItem* item, ConvolverMenuImpulses* self) {
auto* label = static_cast<GtkLabel*>(g_object_get_data(G_OBJECT(item), "name"));
auto* load = static_cast<GtkButton*>(g_object_get_data(G_OBJECT(item), "load"));
auto* remove = static_cast<GtkButton*>(g_object_get_data(G_OBJECT(item), "remove"));
auto* child_item = gtk_list_item_get_item(item);
auto* string_object = GTK_STRING_OBJECT(child_item);
g_object_set_data(G_OBJECT(load), "string-object", string_object);
g_object_set_data(G_OBJECT(remove), "string-object", string_object);
auto* name = gtk_string_object_get_string(GTK_STRING_OBJECT(child_item));
gtk_label_set_text(label, name);
gtk_accessible_update_property(GTK_ACCESSIBLE(load), GTK_ACCESSIBLE_PROPERTY_LABEL,
(_("Load Impulse") + " "s + name).c_str(), -1);
gtk_accessible_update_property(GTK_ACCESSIBLE(remove), GTK_ACCESSIBLE_PROPERTY_LABEL,
(_("Remove Impulse") + " "s + name).c_str(), -1);
}),
self);
gtk_list_view_set_factory(self->listview, factory);
g_object_unref(factory);
for (const auto& name : util::get_files_name(irs_dir, irs_ext)) {
gtk_string_list_append(self->string_list, name.c_str());
}
// filter
auto* filter = gtk_string_filter_new(gtk_property_expression_new(GTK_TYPE_STRING_OBJECT, nullptr, "string"));
auto* filter_model = gtk_filter_list_model_new(G_LIST_MODEL(self->string_list), GTK_FILTER(filter));
gtk_filter_list_model_set_incremental(filter_model, 1);
g_object_bind_property(self->entry_search, "text", filter, "search", G_BINDING_DEFAULT);
// sorter
auto* sorter = gtk_string_sorter_new(gtk_property_expression_new(GTK_TYPE_STRING_OBJECT, nullptr, "string"));
auto* sorter_model = gtk_sort_list_model_new(G_LIST_MODEL(filter_model), GTK_SORTER(sorter));
// setting the listview model and factory
auto* selection = gtk_no_selection_new(G_LIST_MODEL(sorter_model));
gtk_list_view_set_model(self->listview, GTK_SELECTION_MODEL(selection));
g_object_unref(selection);
}
void setup(ConvolverMenuImpulses* self,
const std::string& schema_path,
app::Application* application,
std::shared_ptr<Convolver> convolver) {
self->application = application;
self->convolver = convolver;
self->settings = g_settings_new_with_path(tags::schema::convolver::id, schema_path.c_str());
setup_listview(self);
}
void show(GtkWidget* widget) {
auto* self = EE_CONVOLVER_MENU_IMPULSES(widget);
auto* active_window = gtk_application_get_active_window(GTK_APPLICATION(self->application));
auto active_window_height = gtk_widget_get_height(GTK_WIDGET(active_window));
const int menu_height = static_cast<int>(0.5F * static_cast<float>(active_window_height));
gtk_scrolled_window_set_max_content_height(self->scrolled_window, menu_height);
GTK_WIDGET_CLASS(convolver_menu_impulses_parent_class)->show(widget);
}
void dispose(GObject* object) {
auto* self = EE_CONVOLVER_MENU_IMPULSES(object);
g_object_unref(self->settings);
g_object_unref(self->app_settings);
util::debug("disposed");
G_OBJECT_CLASS(convolver_menu_impulses_parent_class)->dispose(object);
}
void convolver_menu_impulses_class_init(ConvolverMenuImpulsesClass* klass) {
auto* object_class = G_OBJECT_CLASS(klass);
auto* widget_class = GTK_WIDGET_CLASS(klass);
object_class->dispose = dispose;
widget_class->show = show;
gtk_widget_class_set_template_from_resource(widget_class, tags::resources::convolver_menu_impulses_ui);
gtk_widget_class_bind_template_child(widget_class, ConvolverMenuImpulses, scrolled_window);
gtk_widget_class_bind_template_child(widget_class, ConvolverMenuImpulses, listview);
gtk_widget_class_bind_template_child(widget_class, ConvolverMenuImpulses, entry_search);
gtk_widget_class_bind_template_callback(widget_class, on_import_irs_clicked);
}
void convolver_menu_impulses_init(ConvolverMenuImpulses* self) {
gtk_widget_init_template(GTK_WIDGET(self));
self->string_list = gtk_string_list_new(nullptr);
self->app_settings = g_settings_new(tags::app::id);
g_settings_bind(self->app_settings, "autohide-popovers", self, "autohide", G_SETTINGS_BIND_DEFAULT);
}
auto create() -> ConvolverMenuImpulses* {
return static_cast<ConvolverMenuImpulses*>(g_object_new(EE_TYPE_CONVOLVER_MENU_IMPULSES, nullptr));
}
} // namespace ui::convolver_menu_impulses
| 14,296
|
C++
|
.cpp
| 278
| 41.881295
| 118
| 0.637757
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,727
|
loudness_ui.cpp
|
wwmm_easyeffects/src/loudness_ui.cpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#include "loudness_ui.hpp"
#include <STTypes.h>
#include <gio/gio.h>
#include <glib-object.h>
#include <glib.h>
#include <glibconfig.h>
#include <gobject/gobject.h>
#include <gtk/gtk.h>
#include <gtk/gtkdropdown.h>
#include <sigc++/connection.h>
#include <memory>
#include <string>
#include <vector>
#include "loudness.hpp"
#include "tags_resources.hpp"
#include "tags_schema.hpp"
#include "ui_helpers.hpp"
#include "util.hpp"
namespace ui::loudness_box {
struct Data {
public:
~Data() { util::debug("data struct destroyed"); }
uint serial = 0U;
std::shared_ptr<Loudness> loudness;
std::vector<sigc::connection> connections;
std::vector<gulong> gconnections;
};
struct _LoudnessBox {
GtkBox parent_instance;
GtkScale *input_gain, *output_gain;
GtkLevelBar *input_level_left, *input_level_right, *output_level_left, *output_level_right;
GtkLabel *input_level_left_label, *input_level_right_label, *output_level_left_label, *output_level_right_label,
*plugin_credit;
GtkDropDown *fft_size, *standard;
GtkSwitch* clipping;
GtkSpinButton *volume, *clipping_range;
GtkToggleButton* show_native_ui;
GSettings* settings;
Data* data;
};
// NOLINTNEXTLINE
G_DEFINE_TYPE(LoudnessBox, loudness_box, GTK_TYPE_BOX)
void on_reset(LoudnessBox* self, GtkButton* btn) {
util::reset_all_keys_except(self->settings);
}
void on_show_native_window(LoudnessBox* self, GtkToggleButton* btn) {
if (gtk_toggle_button_get_active(btn) != 0) {
self->data->loudness->show_native_ui();
} else {
self->data->loudness->close_native_ui();
}
}
void setup(LoudnessBox* self, std::shared_ptr<Loudness> loudness, const std::string& schema_path) {
auto serial = get_new_filter_serial();
self->data->serial = serial;
g_object_set_data(G_OBJECT(self), "serial", GUINT_TO_POINTER(serial));
set_ignore_filter_idle_add(serial, false);
self->data->loudness = loudness;
self->settings = g_settings_new_with_path(tags::schema::loudness::id, schema_path.c_str());
loudness->set_post_messages(true);
self->data->connections.push_back(loudness->input_level.connect([=](const float left, const float right) {
g_object_ref(self);
util::idle_add(
[=]() {
if (get_ignore_filter_idle_add(serial)) {
return;
}
update_level(self->input_level_left, self->input_level_left_label, self->input_level_right,
self->input_level_right_label, left, right);
},
[=]() { g_object_unref(self); });
}));
self->data->connections.push_back(loudness->output_level.connect([=](const float left, const float right) {
g_object_ref(self);
util::idle_add(
[=]() {
if (get_ignore_filter_idle_add(serial)) {
return;
}
update_level(self->output_level_left, self->output_level_left_label, self->output_level_right,
self->output_level_right_label, left, right);
},
[=]() { g_object_unref(self); });
}));
gtk_label_set_text(self->plugin_credit, ui::get_plugin_credit_translated(self->data->loudness->package).c_str());
gsettings_bind_widgets<"input-gain", "output-gain">(self->settings, self->input_gain, self->output_gain);
ui::gsettings_bind_enum_to_combo_widget(self->settings, "fft", self->fft_size);
ui::gsettings_bind_enum_to_combo_widget(self->settings, "std", self->standard);
g_settings_bind(self->settings, "volume", gtk_spin_button_get_adjustment(self->volume), "value",
G_SETTINGS_BIND_DEFAULT);
g_settings_bind(self->settings, "clipping", self->clipping, "active", G_SETTINGS_BIND_DEFAULT);
g_settings_bind(self->settings, "clipping-range", gtk_spin_button_get_adjustment(self->clipping_range), "value",
G_SETTINGS_BIND_DEFAULT);
g_settings_bind(ui::get_global_app_settings(), "show-native-plugin-ui", self->show_native_ui, "visible",
G_SETTINGS_BIND_DEFAULT);
}
void dispose(GObject* object) {
auto* self = EE_LOUDNESS_BOX(object);
self->data->loudness->close_native_ui();
set_ignore_filter_idle_add(self->data->serial, true);
for (auto& c : self->data->connections) {
c.disconnect();
}
for (auto& handler_id : self->data->gconnections) {
g_signal_handler_disconnect(self->settings, handler_id);
}
self->data->connections.clear();
self->data->gconnections.clear();
g_object_unref(self->settings);
util::debug("disposed");
G_OBJECT_CLASS(loudness_box_parent_class)->dispose(object);
}
void finalize(GObject* object) {
auto* self = EE_LOUDNESS_BOX(object);
delete self->data;
util::debug("finalized");
G_OBJECT_CLASS(loudness_box_parent_class)->finalize(object);
}
void loudness_box_class_init(LoudnessBoxClass* klass) {
auto* object_class = G_OBJECT_CLASS(klass);
auto* widget_class = GTK_WIDGET_CLASS(klass);
object_class->dispose = dispose;
object_class->finalize = finalize;
gtk_widget_class_set_template_from_resource(widget_class, tags::resources::loudness_ui);
gtk_widget_class_bind_template_child(widget_class, LoudnessBox, input_gain);
gtk_widget_class_bind_template_child(widget_class, LoudnessBox, output_gain);
gtk_widget_class_bind_template_child(widget_class, LoudnessBox, input_level_left);
gtk_widget_class_bind_template_child(widget_class, LoudnessBox, input_level_right);
gtk_widget_class_bind_template_child(widget_class, LoudnessBox, output_level_left);
gtk_widget_class_bind_template_child(widget_class, LoudnessBox, output_level_right);
gtk_widget_class_bind_template_child(widget_class, LoudnessBox, input_level_left_label);
gtk_widget_class_bind_template_child(widget_class, LoudnessBox, input_level_right_label);
gtk_widget_class_bind_template_child(widget_class, LoudnessBox, output_level_left_label);
gtk_widget_class_bind_template_child(widget_class, LoudnessBox, output_level_right_label);
gtk_widget_class_bind_template_child(widget_class, LoudnessBox, plugin_credit);
gtk_widget_class_bind_template_child(widget_class, LoudnessBox, volume);
gtk_widget_class_bind_template_child(widget_class, LoudnessBox, standard);
gtk_widget_class_bind_template_child(widget_class, LoudnessBox, fft_size);
gtk_widget_class_bind_template_child(widget_class, LoudnessBox, clipping);
gtk_widget_class_bind_template_child(widget_class, LoudnessBox, clipping_range);
gtk_widget_class_bind_template_child(widget_class, LoudnessBox, show_native_ui);
gtk_widget_class_bind_template_callback(widget_class, on_reset);
gtk_widget_class_bind_template_callback(widget_class, on_show_native_window);
}
void loudness_box_init(LoudnessBox* self) {
gtk_widget_init_template(GTK_WIDGET(self));
self->data = new Data();
prepare_scales<"dB">(self->input_gain, self->output_gain);
prepare_spinbuttons<"dB">(self->volume, self->clipping_range);
}
auto create() -> LoudnessBox* {
return static_cast<LoudnessBox*>(g_object_new(EE_TYPE_LOUDNESS_BOX, nullptr));
}
} // namespace ui::loudness_box
| 7,772
|
C++
|
.cpp
| 172
| 41.156977
| 115
| 0.720165
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,728
|
preferences_window.cpp
|
wwmm_easyeffects/src/preferences_window.cpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#include "preferences_window.hpp"
#include <adwaita.h>
#include <glib-object.h>
#include <gobject/gobject.h>
#include <gtk/gtk.h>
#include <string>
#include "config.h"
#include "preferences_general.hpp"
#include "preferences_spectrum.hpp"
#include "tags_app.hpp"
#include "tags_resources.hpp"
#include "util.hpp"
namespace ui::preferences::window {
struct _PreferencesWindow {
AdwPreferencesDialog parent_instance;
ui::preferences::general::PreferencesGeneral* page_general;
ui::preferences::spectrum::PreferencesSpectrum* page_spectrum;
};
// NOLINTNEXTLINE
G_DEFINE_TYPE(PreferencesWindow, preferences_window, ADW_TYPE_PREFERENCES_DIALOG)
void dispose(GObject* object) {
auto* self = EE_PREFERENCES_WINDOW(object);
gtk_window_set_icon_name(GTK_WINDOW(self),
IS_DEVEL_BUILD ? std::string(tags::app::id).append(".Devel").c_str() : tags::app::id);
adw_preferences_dialog_remove(ADW_PREFERENCES_DIALOG(self), ADW_PREFERENCES_PAGE(self->page_general));
adw_preferences_dialog_remove(ADW_PREFERENCES_DIALOG(self), ADW_PREFERENCES_PAGE(self->page_spectrum));
util::debug("disposed");
G_OBJECT_CLASS(preferences_window_parent_class)->dispose(object);
}
void preferences_window_class_init(PreferencesWindowClass* klass) {
auto* object_class = G_OBJECT_CLASS(klass);
auto* widget_class = GTK_WIDGET_CLASS(klass);
object_class->dispose = dispose;
gtk_widget_class_set_template_from_resource(widget_class, tags::resources::preferences_window_ui);
}
void preferences_window_init(PreferencesWindow* self) {
gtk_widget_init_template(GTK_WIDGET(self));
self->page_general = ui::preferences::general::create();
self->page_spectrum = ui::preferences::spectrum::create();
adw_preferences_dialog_add(ADW_PREFERENCES_DIALOG(self), ADW_PREFERENCES_PAGE(self->page_general));
adw_preferences_dialog_add(ADW_PREFERENCES_DIALOG(self), ADW_PREFERENCES_PAGE(self->page_spectrum));
}
auto create() -> PreferencesWindow* {
return static_cast<PreferencesWindow*>(g_object_new(EE_TYPE_PREFERENCES_WINDOW, nullptr));
}
} // namespace ui::preferences::window
| 2,866
|
C++
|
.cpp
| 64
| 42.203125
| 113
| 0.759612
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,729
|
apps_box.hpp
|
wwmm_easyeffects/include/apps_box.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <adwaita.h>
#include <glib-object.h>
#include <glibconfig.h>
#include <gtk/gtkbox.h>
#include <gtk/gtkicontheme.h>
#include "application.hpp"
#include "pipeline_type.hpp"
namespace ui::apps_box {
G_BEGIN_DECLS
#define EE_TYPE_APPS_BOX (apps_box_get_type())
G_DECLARE_FINAL_TYPE(AppsBox, apps_box, EE, APPS_BOX, GtkBox)
G_END_DECLS
auto create() -> AppsBox*;
void setup(AppsBox* self, app::Application* application, PipelineType pipeline_type, GtkIconTheme* icon_theme);
} // namespace ui::apps_box
| 1,283
|
C++
|
.h
| 34
| 35.970588
| 111
| 0.754032
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,730
|
fir_filter_bandpass.hpp
|
wwmm_easyeffects/include/fir_filter_bandpass.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <string>
#include "fir_filter_base.hpp"
class FirFilterBandpass : public FirFilterBase {
public:
FirFilterBandpass(std::string tag);
FirFilterBandpass(const FirFilterBandpass&) = delete;
auto operator=(const FirFilterBandpass&) -> FirFilterBandpass& = delete;
FirFilterBandpass(const FirFilterBandpass&&) = delete;
auto operator=(const FirFilterBandpass&&) -> FirFilterBandpass& = delete;
~FirFilterBandpass() override;
void setup() override;
};
| 1,240
|
C++
|
.h
| 31
| 37.83871
| 75
| 0.760996
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| true
| false
| false
|
24,731
|
effects_box.hpp
|
wwmm_easyeffects/include/effects_box.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <adwaita.h>
#include <glib-object.h>
#include <glibconfig.h>
#include <gsl/gsl_spline.h>
#include <gtk/gtkbox.h>
#include <gtk/gtkicontheme.h>
#include "application.hpp"
#include "pipeline_type.hpp"
namespace ui::effects_box {
G_BEGIN_DECLS
#define EE_TYPE_EFFECTS_BOX (effects_box_get_type())
G_DECLARE_FINAL_TYPE(EffectsBox, effects_box, EE, EFFECTS_BOX, GtkBox)
G_END_DECLS
auto create() -> EffectsBox*;
void setup(EffectsBox* self, app::Application* application, PipelineType pipeline_type, GtkIconTheme* icon_theme);
} // namespace ui::effects_box
| 1,338
|
C++
|
.h
| 35
| 36.485714
| 114
| 0.758887
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,732
|
autogain_ui.hpp
|
wwmm_easyeffects/include/autogain_ui.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <adwaita.h>
#include <glib-object.h>
#include <glibconfig.h>
#include <gtk/gtkbox.h>
#include <memory>
#include <string>
#include "autogain.hpp"
namespace ui::autogain_box {
G_BEGIN_DECLS
#define EE_TYPE_AUTOGAIN_BOX (autogain_box_get_type())
G_DECLARE_FINAL_TYPE(AutogainBox, autogain_box, EE, AUTOGAIN_BOX, GtkBox)
G_END_DECLS
auto create() -> AutogainBox*;
void setup(AutogainBox* self, std::shared_ptr<AutoGain> autogain, const std::string& schema_path);
} // namespace ui::autogain_box
| 1,277
|
C++
|
.h
| 34
| 35.764706
| 98
| 0.755069
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,733
|
limiter_preset.hpp
|
wwmm_easyeffects/include/limiter_preset.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <nlohmann/json_fwd.hpp>
#include "plugin_preset_base.hpp"
#include "preset_type.hpp"
class LimiterPreset : public PluginPresetBase {
public:
explicit LimiterPreset(PresetType preset_type, const int& index = 0);
private:
void save(nlohmann::json& json) override;
void load(const nlohmann::json& json) override;
};
| 1,101
|
C++
|
.h
| 29
| 35.931034
| 73
| 0.756326
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,734
|
ui_helpers.hpp
|
wwmm_easyeffects/include/ui_helpers.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <adwaita.h>
#include <gio/gio.h>
#include <glib-object.h>
#include <glib.h>
#include <glib/gvariant.h>
#include <glib/gvarianttype.h>
#include <gtk/deprecated/gtkcomboboxtext.h>
#include <gtk/gtk.h>
#include <gtk/gtkdropdown.h>
#include <gtk/gtklabel.h>
#include <gtk/gtklevelbar.h>
#include <gtk/gtkscale.h>
#include <gtk/gtkshortcut.h>
#include <gtk/gtkspinbutton.h>
#include <gtk/gtkstringlist.h>
#include <gtk/gtkswitch.h>
#include <gtk/gtktogglebutton.h>
#include <sys/types.h>
#include <locale>
#define FMT_HEADER_ONLY
#include <fmt/core.h>
#include <fmt/format.h>
#include <glib/gi18n.h>
#include <string>
#include "string_literal_wrapper.hpp"
#include "util.hpp"
namespace ui {
void show_fixed_toast(AdwToastOverlay* toast_overlay,
const std::string& text,
const AdwToastPriority& priority = ADW_TOAST_PRIORITY_HIGH);
void show_autohiding_toast(AdwToastOverlay* toast_overlay,
const std::string& text,
const uint& timeout = 5U,
const AdwToastPriority& priority = ADW_TOAST_PRIORITY_HIGH);
auto missing_plugin_box(const std::string& base_name, const std::string& package) -> GtkWidget*;
void show_simple_message_dialog(GtkWidget* parent, const std::string& title, const std::string& descr);
auto parse_spinbutton_output(GtkSpinButton* button, const char* unit, const bool& lower_bound = true) -> gboolean;
auto parse_spinbutton_input(GtkSpinButton* button, gdouble* new_value, const bool& lower_bound = true) -> gint;
auto get_new_filter_serial() -> uint;
void set_ignore_filter_idle_add(const uint& serial, const bool& state);
auto get_ignore_filter_idle_add(const uint& serial) -> bool;
void save_user_locale();
auto get_user_locale() -> std::locale;
auto get_plugin_credit_translated(const std::string& plugin_package) -> std::string;
void update_level(GtkLevelBar* w_left,
GtkLabel* w_left_label,
GtkLevelBar* w_right,
GtkLabel* w_right_label,
const float& left,
const float& right);
void append_to_string_list(GtkStringList* string_list, const std::string& name);
void remove_from_string_list(GtkStringList* string_list, const std::string& name);
void init_global_app_settings();
void unref_global_app_settings();
auto get_global_app_settings() -> GSettings*;
template <StringLiteralWrapper sl_wrapper, bool lower_bound = true>
void prepare_spinbutton(GtkSpinButton* button) {
if (button == nullptr) {
util::warning("Null pointer provided: Spinbutton widget not prepared.");
return;
}
g_signal_connect(button, "output", G_CALLBACK(+[](GtkSpinButton* button, gpointer user_data) {
return parse_spinbutton_output(button, sl_wrapper.msg.data(), lower_bound);
}),
nullptr);
g_signal_connect(button, "input", G_CALLBACK(+[](GtkSpinButton* button, gdouble* new_value, gpointer user_data) {
return parse_spinbutton_input(button, new_value, lower_bound);
}),
nullptr);
}
template <StringLiteralWrapper sl_wrapper>
void prepare_scale(GtkScale* scale) {
/*
The sanitizer caught a "use after free" inside this function. As the problem happens randomly and is hard to
reproduce I am not sure about what could be the cause yet. So for now I am just checking for null pointers.
*/
if (scale == nullptr) {
util::warning("Null pointer provided: Scale widget not prepared.");
return;
}
gtk_scale_set_format_value_func(
scale,
(GtkScaleFormatValueFunc) +
[](GtkScale* scale, double value, gpointer user_data) {
if (scale == nullptr) {
return g_strdup("");
}
auto precision = gtk_scale_get_digits(scale);
auto unit = sl_wrapper.msg.data();
using namespace std::string_literals;
auto text = fmt::format(ui::get_user_locale(), "{0:.{1}Lf}{2}", value, precision,
((unit != nullptr) ? " "s + unit : ""));
return g_strdup(text.c_str());
},
nullptr, nullptr);
}
template <StringLiteralWrapper key_wrapper, bool lower_bound = true, typename... Targs>
void prepare_spinbuttons(Targs... button) {
(prepare_spinbutton<key_wrapper, lower_bound>(button), ...);
}
template <StringLiteralWrapper key_wrapper, typename... Targs>
void prepare_scales(Targs... scale) {
(prepare_scale<key_wrapper>(scale), ...);
}
template <typename T>
void gsettings_bind_widget(GSettings* settings,
const char* key,
T widget,
GSettingsBindFlags flags = G_SETTINGS_BIND_DEFAULT) {
static_assert(std::is_same_v<T, GtkSpinButton*> || std::is_same_v<T, GtkToggleButton*> ||
std::is_same_v<T, GtkSwitch*> || std::is_same_v<T, GtkComboBoxText*> || std::is_same_v<T, GtkScale*>);
if constexpr (std::is_same_v<T, GtkSpinButton*>) {
g_settings_bind(settings, key, gtk_spin_button_get_adjustment(widget), "value", flags);
}
if constexpr (std::is_same_v<T, GtkScale*>) {
g_settings_bind(settings, key, gtk_range_get_adjustment(GTK_RANGE(widget)), "value", flags);
}
if constexpr (std::is_same_v<T, GtkToggleButton*> || std::is_same_v<T, GtkSwitch*>) {
g_settings_bind(settings, key, widget, "active", flags);
}
if constexpr (std::is_same_v<T, GtkComboBoxText*>) {
g_settings_bind(settings, key, widget, "active-id", flags);
}
}
template <StringLiteralWrapper... key_wrapper, typename... Targs>
void gsettings_bind_widgets(GSettings* settings, Targs... widget) {
(gsettings_bind_widget(settings, key_wrapper.msg.data(), widget), ...);
}
template <typename T>
void gsettings_bind_enum_to_combo_widget(GSettings* settings,
const gchar* key,
T widget,
GSettingsBindFlags flags = G_SETTINGS_BIND_DEFAULT) {
static_assert(std::is_same_v<T, GtkDropDown*> || std::is_same_v<T, AdwComboRow*>);
struct Data {
GSettings* settings;
const gchar* key;
};
g_settings_bind_with_mapping(
settings, key, widget, "selected", flags,
+[](GValue* value, GVariant* variant, gpointer user_data) {
auto* d = static_cast<Data*>(user_data);
g_value_set_uint(value, static_cast<guint>(g_settings_get_enum(d->settings, d->key)));
return 1;
},
+[](const GValue* value, const GVariantType* expected_type, gpointer user_data) {
auto* d = static_cast<Data*>(user_data);
g_settings_set_enum(d->settings, d->key, static_cast<gint>(g_value_get_uint(value)));
const auto str_value = util::gsettings_get_string(d->settings, d->key);
return g_variant_new_string(str_value.c_str());
},
new Data({.settings = settings, .key = key}),
+[](gpointer user_data) {
auto* d = static_cast<Data*>(user_data);
delete d;
});
}
} // namespace ui
| 7,912
|
C++
|
.h
| 177
| 37.988701
| 118
| 0.65747
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,735
|
reverb_preset.hpp
|
wwmm_easyeffects/include/reverb_preset.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <nlohmann/json_fwd.hpp>
#include "plugin_preset_base.hpp"
#include "preset_type.hpp"
class ReverbPreset : public PluginPresetBase {
public:
explicit ReverbPreset(PresetType preset_type, const int& index = 0);
private:
void save(nlohmann::json& json) override;
void load(const nlohmann::json& json) override;
};
| 1,099
|
C++
|
.h
| 29
| 35.862069
| 73
| 0.755869
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,736
|
preferences_window.hpp
|
wwmm_easyeffects/include/preferences_window.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <adwaita.h>
#include <glib-object.h>
#include <glibconfig.h>
namespace ui::preferences::window {
G_BEGIN_DECLS
#define EE_TYPE_PREFERENCES_WINDOW (preferences_window_get_type())
G_DECLARE_FINAL_TYPE(PreferencesWindow, preferences_window, EE, PREFERENCES_WINDOW, AdwPreferencesDialog)
G_END_DECLS
auto create() -> PreferencesWindow*;
} // namespace ui::preferences::window
| 1,156
|
C++
|
.h
| 29
| 38
| 105
| 0.764969
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,737
|
module_info_holder.hpp
|
wwmm_easyeffects/include/module_info_holder.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <glib-object.h>
#include <glibconfig.h>
#include <gobject/gobject.h>
#include <gtk/gtk.h>
#include <sigc++/signal.h>
#include "pipe_objects.hpp"
namespace ui::holders {
G_BEGIN_DECLS
#define EE_TYPE_MODULE_INFO_HOLDER (module_info_holder_get_type())
G_DECLARE_FINAL_TYPE(ModuleInfoHolder, module_info_holder, EE, MODULE_INFO_HOLDER, GObject)
G_END_DECLS
struct _ModuleInfoHolder {
GObject parent_instance;
ModuleInfo* info;
sigc::signal<void(const ModuleInfo)> info_updated;
};
auto create(const ModuleInfo& info) -> ModuleInfoHolder*;
} // namespace ui::holders
| 1,356
|
C++
|
.h
| 37
| 34.72973
| 91
| 0.759174
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,738
|
equalizer.hpp
|
wwmm_easyeffects/include/equalizer.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <gio/gio.h>
#include <glib.h>
#include <sys/types.h>
#include <cstddef>
#include <span>
#include <string>
#include <utility>
#include <vector>
#include "pipe_manager.hpp"
#include "plugin_base.hpp"
#include "tags_equalizer.hpp"
class Equalizer : public PluginBase {
public:
Equalizer(const std::string& tag,
const std::string& schema,
const std::string& schema_path,
const std::string& schema_channel,
const std::string& schema_channel_left_path,
const std::string& schema_channel_right_path,
PipeManager* pipe_manager,
PipelineType pipe_type);
Equalizer(const Equalizer&) = delete;
auto operator=(const Equalizer&) -> Equalizer& = delete;
Equalizer(const Equalizer&&) = delete;
auto operator=(const Equalizer&&) -> Equalizer& = delete;
~Equalizer() override;
void setup() override;
void process(std::span<float>& left_in,
std::span<float>& right_in,
std::span<float>& left_out,
std::span<float>& right_out) override;
auto get_latency_seconds() -> float override;
void sort_bands();
static constexpr uint max_bands = 32U;
private:
GSettings *settings_left = nullptr, *settings_right = nullptr;
uint latency_n_frames = 0U;
std::vector<gulong> gconnections_unified;
template <size_t n>
constexpr void bind_band() {
using namespace tags::equalizer;
// left channel
lv2_wrapper->bind_key_enum<ftl[n], band_type[n]>(settings_left);
lv2_wrapper->bind_key_enum<fml[n], band_mode[n]>(settings_left);
lv2_wrapper->bind_key_enum<sl[n], band_slope[n]>(settings_left);
lv2_wrapper->bind_key_bool<xsl[n], band_solo[n]>(settings_left);
lv2_wrapper->bind_key_bool<xml[n], band_mute[n]>(settings_left);
lv2_wrapper->bind_key_double<fl[n], band_frequency[n]>(settings_left);
lv2_wrapper->bind_key_double<ql[n], band_q[n]>(settings_left);
lv2_wrapper->bind_key_double<wl[n], band_width[n]>(settings_left);
lv2_wrapper->bind_key_double_db<gl[n], band_gain[n]>(settings_left);
// right channel
lv2_wrapper->bind_key_enum<ftr[n], band_type[n]>(settings_right);
lv2_wrapper->bind_key_enum<fmr[n], band_mode[n]>(settings_right);
lv2_wrapper->bind_key_enum<sr[n], band_slope[n]>(settings_right);
lv2_wrapper->bind_key_bool<xsr[n], band_solo[n]>(settings_right);
lv2_wrapper->bind_key_bool<xmr[n], band_mute[n]>(settings_right);
lv2_wrapper->bind_key_double<fr[n], band_frequency[n]>(settings_right);
lv2_wrapper->bind_key_double<qr[n], band_q[n]>(settings_right);
lv2_wrapper->bind_key_double<wr[n], band_width[n]>(settings_right);
lv2_wrapper->bind_key_double_db<gr[n], band_gain[n]>(settings_right);
}
template <size_t... Ns>
constexpr void bind_bands(std::index_sequence<Ns...> /*unused*/) {
(bind_band<Ns>(), ...);
}
void on_split_channels();
};
| 3,685
|
C++
|
.h
| 87
| 37.885057
| 75
| 0.688584
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,739
|
pipe_manager.hpp
|
wwmm_easyeffects/include/pipe_manager.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <pipewire/context.h>
#include <pipewire/core.h>
#include <pipewire/extensions/metadata.h>
#include <pipewire/proxy.h>
#include <pipewire/thread-loop.h>
#include <sigc++/signal.h>
#include <spa/utils/hook.h>
#include <spa/utils/json.h>
#include <sys/types.h>
#include <array>
#include <cstddef>
#include <cstdint>
#include <map>
#include <string>
#include <vector>
#include "pipe_objects.hpp"
class PipeManager {
public:
PipeManager();
PipeManager(const PipeManager&) = delete;
auto operator=(const PipeManager&) -> PipeManager& = delete;
PipeManager(const PipeManager&&) = delete;
auto operator=(const PipeManager&&) -> PipeManager& = delete;
~PipeManager();
pw_thread_loop* thread_loop = nullptr;
pw_core* core = nullptr;
pw_registry* registry = nullptr;
pw_metadata* metadata = nullptr;
inline static bool exiting = false;
inline static bool exclude_monitor_stream = true;
spa_hook metadata_listener{};
std::map<uint64_t, NodeInfo> node_map;
std::vector<LinkInfo> list_links;
std::vector<PortInfo> list_ports;
std::vector<ModuleInfo> list_modules;
std::vector<ClientInfo> list_clients;
std::vector<DeviceInfo> list_devices;
std::string default_output_device_name, default_input_device_name;
NodeInfo ee_sink_node, ee_source_node;
NodeInfo output_device, input_device;
constexpr static auto blocklist_node_name =
std::to_array({"Easy Effects", "EasyEffects", "easyeffects", "easyeffects_soe", "easyeffects_sie",
"EasyEffectsWebrtcProbe", "libcanberra", "gsd-media-keys", "GNOME Shell", "speech-dispatcher",
"speech-dispatcher-dummy", "speech-dispatcher-espeak-ng", "Mutter", "gameoverlayui"});
std::array<std::string, 2U> blocklist_app_id = {"org.PulseAudio.pavucontrol", "org.gnome.VolumeControl"};
std::array<std::string, 2U> blocklist_media_role = {"event", "Notification"};
std::string header_version, library_version, core_name, version;
std::string default_clock_rate = "0";
std::string default_min_quantum = "0";
std::string default_max_quantum = "0";
std::string default_quantum = "0";
auto node_map_at_id(const uint& id) -> NodeInfo&;
auto stream_is_connected(const uint& id, const std::string& media_class) -> bool;
void connect_stream_output(const uint& id) const;
void connect_stream_input(const uint& id) const;
void disconnect_stream(const uint& id) const;
void set_node_volume(pw_proxy* proxy, const uint& n_vol_ch, const float& value) const;
void set_node_mute(pw_proxy* proxy, const bool& state) const;
auto count_node_ports(const uint& node_id) -> uint;
/*
Links the output ports of the node output_node_id to the input ports of the node input_node_id
*/
auto link_nodes(const uint& output_node_id,
const uint& input_node_id,
const bool& probe_link = false,
const bool& link_passive = true) -> std::vector<pw_proxy*>;
void destroy_object(const int& id) const;
/*
Destroy all the filters links
*/
void destroy_links(const std::vector<pw_proxy*>& list) const;
void lock() const;
void unlock() const;
void sync_wait_unlock() const;
auto wait_full() const -> int;
static void lock_node_map();
static void unlock_node_map();
static auto json_object_find(const char* obj, const char* key, char* value, const size_t& len) -> int;
sigc::signal<void(const NodeInfo)> stream_output_added;
sigc::signal<void(const NodeInfo)> stream_input_added;
sigc::signal<void(const NodeInfo)> stream_output_changed;
sigc::signal<void(const NodeInfo)> stream_input_changed;
sigc::signal<void(const uint64_t)> stream_output_removed;
sigc::signal<void(const uint64_t)> stream_input_removed;
/*
Do not pass NodeInfo by reference. Sometimes it dies before we use it and a segmentation fault happens.
*/
sigc::signal<void(NodeInfo)> source_added;
sigc::signal<void(NodeInfo)> source_changed;
sigc::signal<void(NodeInfo)> source_removed;
sigc::signal<void(NodeInfo)> sink_added;
sigc::signal<void(NodeInfo)> sink_changed;
sigc::signal<void(NodeInfo)> sink_removed;
sigc::signal<void(std::string)> new_default_sink_name;
sigc::signal<void(std::string)> new_default_source_name;
sigc::signal<void(DeviceInfo)> device_input_route_changed;
sigc::signal<void(DeviceInfo)> device_output_route_changed;
sigc::signal<void(const LinkInfo)> link_changed;
private:
pw_context* context = nullptr;
pw_proxy *proxy_stream_output_sink = nullptr, *proxy_stream_input_source = nullptr;
spa_hook core_listener{}, registry_listener{};
void set_metadata_target_node(const uint& origin_id, const uint& target_id, const uint64_t& target_serial) const;
};
| 5,508
|
C++
|
.h
| 123
| 41.105691
| 115
| 0.726166
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,740
|
client_info_holder.hpp
|
wwmm_easyeffects/include/client_info_holder.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <glib-object.h>
#include <glibconfig.h>
#include <sigc++/signal.h>
#include "pipe_objects.hpp"
namespace ui::holders {
G_BEGIN_DECLS
#define EE_TYPE_CLIENT_INFO_HOLDER (client_info_holder_get_type())
G_DECLARE_FINAL_TYPE(ClientInfoHolder, client_info_holder, EE, CLIENT_INFO_HOLDER, GObject)
G_END_DECLS
struct _ClientInfoHolder {
GObject parent_instance;
ClientInfo* info;
sigc::signal<void(const ClientInfo)> info_updated;
};
auto create(const ClientInfo& info) -> ClientInfoHolder*;
} // namespace ui::holders
| 1,306
|
C++
|
.h
| 35
| 35.342857
| 91
| 0.759524
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,741
|
bass_enhancer.hpp
|
wwmm_easyeffects/include/bass_enhancer.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <sigc++/signal.h>
#include <span>
#include <string>
#include "pipe_manager.hpp"
#include "plugin_base.hpp"
class BassEnhancer : public PluginBase {
public:
BassEnhancer(const std::string& tag,
const std::string& schema,
const std::string& schema_path,
PipeManager* pipe_manager,
PipelineType pipe_type);
BassEnhancer(const BassEnhancer&) = delete;
auto operator=(const BassEnhancer&) -> BassEnhancer& = delete;
BassEnhancer(const BassEnhancer&&) = delete;
auto operator=(const BassEnhancer&&) -> BassEnhancer& = delete;
~BassEnhancer() override;
void setup() override;
void process(std::span<float>& left_in,
std::span<float>& right_in,
std::span<float>& left_out,
std::span<float>& right_out) override;
auto get_latency_seconds() -> float override;
sigc::signal<void(const double)> harmonics;
double harmonics_port_value = 0.0;
private:
};
| 1,754
|
C++
|
.h
| 46
| 33.76087
| 73
| 0.702178
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,742
|
presets_manager.hpp
|
wwmm_easyeffects/include/presets_manager.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <gio/gio.h>
#include <sigc++/signal.h>
#include <filesystem>
#include <memory>
#include <nlohmann/json_fwd.hpp>
#include <optional>
#include <string>
#include <string_view>
#include <vector>
#include "plugin_preset_base.hpp"
#include "preset_type.hpp"
class PresetsManager {
public:
PresetsManager();
PresetsManager(const PresetsManager&) = delete;
auto operator=(const PresetsManager&) -> PresetsManager& = delete;
PresetsManager(const PresetsManager&&) = delete;
auto operator=(const PresetsManager&&) -> PresetsManager& = delete;
~PresetsManager();
enum class PresetError {
blocklist_format,
blocklist_generic,
pipeline_format,
pipeline_generic,
plugin_format,
plugin_generic
};
const std::string json_ext = ".json";
// signal sending title and description strings
sigc::signal<void(const std::string, const std::string)> preset_load_error;
auto get_all_community_presets_paths(const PresetType& preset_type) -> std::vector<std::string>;
auto scan_community_package_recursive(std::filesystem::directory_iterator& it,
const uint& top_scan_level,
const std::string& origin = "") -> std::vector<std::string>;
auto get_community_preset_info(const PresetType& preset_type, const std::string& path)
-> std::pair<std::string, std::string>;
auto get_local_presets_name(const PresetType& preset_type) -> std::vector<std::string>;
auto search_names(std::filesystem::directory_iterator& it) -> std::vector<std::string>;
void add(const PresetType& preset_type, const std::string& name);
void save_preset_file(const PresetType& preset_type, const std::string& name);
static void write_plugins_preset(const PresetType& preset_type,
const std::vector<std::string>& plugins,
nlohmann::json& json);
void remove(const PresetType& preset_type, const std::string& name);
auto load_local_preset_file(const PresetType& preset_type, const std::string& name) -> bool;
auto load_community_preset_file(const PresetType& preset_type,
const std::string& full_path_stem,
const std::string& package_name) -> bool;
auto read_effects_pipeline_from_preset(const PresetType& preset_type,
const std::filesystem::path& input_file,
nlohmann::json& json,
std::vector<std::string>& plugins) -> bool;
auto read_plugins_preset(const PresetType& preset_type,
const std::vector<std::string>& plugins,
const nlohmann::json& json) -> bool;
void import_from_filesystem(const PresetType& preset_type, const std::string& file_path);
void import_from_community_package(const PresetType& preset_type,
const std::string& file_path,
const std::string& package);
void add_autoload(const PresetType& preset_type,
const std::string& preset_name,
const std::string& device_name,
const std::string& device_description,
const std::string& device_profile);
void remove_autoload(const PresetType& preset_type,
const std::string& preset_name,
const std::string& device_name,
const std::string& device_profile);
auto find_autoload(const PresetType& preset_type, const std::string& device_name, const std::string& device_profile)
-> std::string;
void autoload(const PresetType& preset_type, const std::string& device_name, const std::string& device_profile);
auto get_autoload_profiles(const PresetType& preset_type) -> std::vector<nlohmann::json>;
auto preset_file_exists(const PresetType& preset_type, const std::string& name) -> bool;
sigc::signal<void(const std::string& preset_name)> user_output_preset_created;
sigc::signal<void(const std::string& preset_name)> user_output_preset_removed;
sigc::signal<void(const std::string& preset_name)> user_input_preset_created;
sigc::signal<void(const std::string& preset_name)> user_input_preset_removed;
sigc::signal<void(const std::vector<nlohmann::json>& profiles)> autoload_input_profiles_changed;
sigc::signal<void(const std::vector<nlohmann::json>& profiles)> autoload_output_profiles_changed;
private:
std::string user_config_dir;
std::filesystem::path user_input_dir, user_output_dir, user_irs_dir, user_rnnoise_dir, autoload_input_dir,
autoload_output_dir;
std::vector<std::string> system_data_dir_input, system_data_dir_output, system_data_dir_irs, system_data_dir_rnnoise;
GSettings *settings = nullptr, *soe_settings = nullptr, *sie_settings = nullptr;
GFileMonitor *user_output_monitor = nullptr, *user_input_monitor = nullptr;
GFileMonitor *autoload_output_monitor = nullptr, *autoload_input_monitor = nullptr;
static void create_user_directory(const std::filesystem::path& path);
auto import_addons_from_community_package(const PresetType& preset_type,
const std::filesystem::path& path,
const std::string& package) -> bool;
void set_last_preset_keys(const PresetType& preset_type,
const std::string& preset_name = "",
const std::string& package_name = "");
auto load_preset_file(const PresetType& preset_type, const std::filesystem::path& input_file) -> bool;
void save_blocklist(const PresetType& preset_type, nlohmann::json& json);
auto load_blocklist(const PresetType& preset_type, const nlohmann::json& json) -> bool;
void notify_error(const PresetError& preset_error, const std::string& plugin_name = "");
static auto create_wrapper(const PresetType& preset_type, std::string_view filter_name)
-> std::optional<std::unique_ptr<PluginPresetBase>>;
};
| 6,892
|
C++
|
.h
| 120
| 48.3
| 119
| 0.669639
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,743
|
compressor_ui.hpp
|
wwmm_easyeffects/include/compressor_ui.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <adwaita.h>
#include <glib-object.h>
#include <glibconfig.h>
#include <gtk/gtkbox.h>
#include <memory>
#include <string>
#include "compressor.hpp"
#include "pipe_manager.hpp"
namespace ui::compressor_box {
G_BEGIN_DECLS
#define EE_TYPE_COMPRESSOR_BOX (compressor_box_get_type())
G_DECLARE_FINAL_TYPE(CompressorBox, compressor_box, EE, COMPRESSOR_BOX, GtkBox)
G_END_DECLS
auto create() -> CompressorBox*;
void setup(CompressorBox* self,
std::shared_ptr<Compressor> compressor,
const std::string& schema_path,
PipeManager* pm);
} // namespace ui::compressor_box
| 1,379
|
C++
|
.h
| 38
| 33.710526
| 79
| 0.74305
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,744
|
multiband_compressor_preset.hpp
|
wwmm_easyeffects/include/multiband_compressor_preset.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <sys/types.h>
#include <nlohmann/json_fwd.hpp>
#include "plugin_preset_base.hpp"
#include "preset_type.hpp"
#include "tags_multiband_compressor.hpp"
class MultibandCompressorPreset : public PluginPresetBase {
public:
explicit MultibandCompressorPreset(PresetType preset_type, const int& index = 0);
private:
static constexpr uint n_bands = tags::multiband_compressor::n_bands;
void save(nlohmann::json& json) override;
void load(const nlohmann::json& json) override;
};
| 1,261
|
C++
|
.h
| 32
| 37.375
| 83
| 0.763696
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,745
|
maximizer_preset.hpp
|
wwmm_easyeffects/include/maximizer_preset.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <nlohmann/json_fwd.hpp>
#include "plugin_preset_base.hpp"
#include "preset_type.hpp"
class MaximizerPreset : public PluginPresetBase {
public:
explicit MaximizerPreset(PresetType preset_type, const int& index = 0);
private:
void save(nlohmann::json& json) override;
void load(const nlohmann::json& json) override;
};
| 1,105
|
C++
|
.h
| 29
| 36.068966
| 73
| 0.757236
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,746
|
deesser.hpp
|
wwmm_easyeffects/include/deesser.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <sigc++/signal.h>
#include <span>
#include <string>
#include "pipe_manager.hpp"
#include "plugin_base.hpp"
class Deesser : public PluginBase {
public:
Deesser(const std::string& tag,
const std::string& schema,
const std::string& schema_path,
PipeManager* pipe_manager,
PipelineType pipe_type);
Deesser(const Deesser&) = delete;
auto operator=(const Deesser&) -> Deesser& = delete;
Deesser(const Deesser&&) = delete;
auto operator=(const Deesser&&) -> Deesser& = delete;
~Deesser() override;
void setup() override;
void process(std::span<float>& left_in,
std::span<float>& right_in,
std::span<float>& left_out,
std::span<float>& right_out) override;
auto get_latency_seconds() -> float override;
sigc::signal<void(const double)> compression, detected;
double compression_port_value = 0.0;
double detected_port_value = 0.0;
private:
};
| 1,729
|
C++
|
.h
| 47
| 32.87234
| 73
| 0.702331
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,747
|
delay_ui.hpp
|
wwmm_easyeffects/include/delay_ui.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <adwaita.h>
#include <glib-object.h>
#include <glibconfig.h>
#include <gtk/gtkbox.h>
#include <memory>
#include <string>
#include "delay.hpp"
namespace ui::delay_box {
G_BEGIN_DECLS
#define EE_TYPE_DELAY_BOX (delay_box_get_type())
G_DECLARE_FINAL_TYPE(DelayBox, delay_box, EE, DELAY_BOX, GtkBox)
G_END_DECLS
auto create() -> DelayBox*;
void setup(DelayBox* self, std::shared_ptr<Delay> delay, const std::string& schema_path);
} // namespace ui::delay_box
| 1,241
|
C++
|
.h
| 34
| 34.705882
| 89
| 0.747703
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,748
|
level_meter_preset.hpp
|
wwmm_easyeffects/include/level_meter_preset.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <nlohmann/json_fwd.hpp>
#include "plugin_preset_base.hpp"
#include "preset_type.hpp"
class LevelMeterPreset : public PluginPresetBase {
public:
explicit LevelMeterPreset(PresetType preset_type, const int& index = 0);
private:
void save(nlohmann::json& json) override;
void load(const nlohmann::json& json) override;
};
| 1,107
|
C++
|
.h
| 29
| 36.137931
| 74
| 0.757689
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,749
|
maximizer.hpp
|
wwmm_easyeffects/include/maximizer.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <sigc++/signal.h>
#include <sys/types.h>
#include <span>
#include <string>
#include "pipe_manager.hpp"
#include "plugin_base.hpp"
class Maximizer : public PluginBase {
public:
Maximizer(const std::string& tag,
const std::string& schema,
const std::string& schema_path,
PipeManager* pipe_manager,
PipelineType pipe_type);
Maximizer(const Maximizer&) = delete;
auto operator=(const Maximizer&) -> Maximizer& = delete;
Maximizer(const Maximizer&&) = delete;
auto operator=(const Maximizer&&) -> Maximizer& = delete;
~Maximizer() override;
void setup() override;
void process(std::span<float>& left_in,
std::span<float>& right_in,
std::span<float>& left_out,
std::span<float>& right_out) override;
auto get_latency_seconds() -> float override;
sigc::signal<void(const double)> reduction;
double reduction_port_value = 0.0;
private:
uint latency_n_frames = 0U;
};
| 1,762
|
C++
|
.h
| 48
| 32.6875
| 73
| 0.701466
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,750
|
stream_input_effects.hpp
|
wwmm_easyeffects/include/stream_input_effects.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "effects_base.hpp"
#include "pipe_manager.hpp"
#include "pipe_objects.hpp"
class StreamInputEffects : public EffectsBase {
public:
StreamInputEffects(PipeManager* pipe_manager);
StreamInputEffects(const StreamInputEffects&) = delete;
auto operator=(const StreamInputEffects&) -> StreamInputEffects& = delete;
StreamInputEffects(const StreamInputEffects&&) = delete;
auto operator=(const StreamInputEffects&&) -> StreamInputEffects& = delete;
~StreamInputEffects() override;
void set_bypass(const bool& state);
void set_listen_to_mic(const bool& state);
private:
bool bypass = false;
void connect_filters(const bool& bypass = false);
void disconnect_filters();
auto apps_want_to_play() -> bool;
void on_app_added(NodeInfo node_info);
void on_link_changed(LinkInfo link_info);
};
| 1,594
|
C++
|
.h
| 40
| 37.4
| 77
| 0.758911
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,751
|
echo_canceller_preset.hpp
|
wwmm_easyeffects/include/echo_canceller_preset.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <nlohmann/json_fwd.hpp>
#include "plugin_preset_base.hpp"
#include "preset_type.hpp"
class EchoCancellerPreset : public PluginPresetBase {
public:
explicit EchoCancellerPreset(PresetType preset_type, const int& index = 0);
private:
void save(nlohmann::json& json) override;
void load(const nlohmann::json& json) override;
};
| 1,113
|
C++
|
.h
| 29
| 36.344828
| 77
| 0.759036
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,752
|
level_meter_ui.hpp
|
wwmm_easyeffects/include/level_meter_ui.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <adwaita.h>
#include <glib-object.h>
#include <glibconfig.h>
#include <gtk/gtkbox.h>
#include <memory>
#include <string>
#include "level_meter.hpp"
namespace ui::level_meter_box {
G_BEGIN_DECLS
#define EE_TYPE_LEVEL_METER_BOX (level_meter_box_get_type())
G_DECLARE_FINAL_TYPE(LevelMeterBox, level_meter_box, EE, LEVEL_METER_BOX, GtkBox)
G_END_DECLS
auto create() -> LevelMeterBox*;
void setup(LevelMeterBox* self, std::shared_ptr<LevelMeter> level_meter, const std::string& schema_path);
} // namespace ui::level_meter_box
| 1,309
|
C++
|
.h
| 34
| 36.705882
| 105
| 0.754941
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,753
|
pitch_preset.hpp
|
wwmm_easyeffects/include/pitch_preset.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <nlohmann/json_fwd.hpp>
#include "plugin_preset_base.hpp"
#include "preset_type.hpp"
class PitchPreset : public PluginPresetBase {
public:
explicit PitchPreset(PresetType preset_type, const int& index = 0);
private:
void save(nlohmann::json& json) override;
void load(const nlohmann::json& json) override;
};
| 1,097
|
C++
|
.h
| 29
| 35.793103
| 73
| 0.755409
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,754
|
lv2_wrapper.hpp
|
wwmm_easyeffects/include/lv2_wrapper.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <gio/gio.h>
#include <glib-object.h>
#include <glib.h>
#include <lilv/lilv.h>
#include <lv2/buf-size/buf-size.h>
#include <lv2/core/lv2.h>
#include <lv2/ui/ui.h>
#include <lv2/urid/urid.h>
#include <sys/types.h>
#include <array>
#include <functional>
#include <limits>
#include <mutex>
#include <span>
#include <string>
#include <unordered_map>
#include <vector>
#include "string_literal_wrapper.hpp"
#include "util.hpp"
namespace lv2 {
using namespace std::string_literals;
#define LV2_UI_makeResident LV2_UI_PREFIX "makeResident"
#define LV2_UI_makeSONameResident LV2_UI_PREFIX "makeSONameResident"
enum PortType { TYPE_CONTROL, TYPE_AUDIO, TYPE_ATOM };
struct Port {
PortType type; // Datatype
uint index; // Port index
std::string name;
std::string symbol;
float value = 0.0F; // Control value (if applicable)
float min = -std::numeric_limits<float>::infinity();
float max = std::numeric_limits<float>::infinity();
bool is_input; // True if an input port
bool optional; // True if the connection is optional
};
class Lv2Wrapper {
public:
Lv2Wrapper(const std::string& plugin_uri);
Lv2Wrapper(const Lv2Wrapper&) = delete;
auto operator=(const Lv2Wrapper&) -> Lv2Wrapper& = delete;
Lv2Wrapper(const Lv2Wrapper&&) = delete;
auto operator=(const Lv2Wrapper&&) -> Lv2Wrapper& = delete;
virtual ~Lv2Wrapper();
bool found_plugin = false;
auto create_instance(const uint& rate) -> bool;
void set_n_samples(const uint& value);
[[nodiscard]] auto get_n_samples() const -> uint;
[[nodiscard]] auto get_rate() const -> uint;
void connect_data_ports(std::span<float>& left_in,
std::span<float>& right_in,
std::span<float>& left_out,
std::span<float>& right_out);
void connect_data_ports(std::span<float>& left_in,
std::span<float>& right_in,
std::span<float>& left_out,
std::span<float>& right_out,
std::span<float>& probe_left,
std::span<float>& probe_right);
void activate();
void run() const;
void deactivate();
void set_control_port_value(const std::string& symbol, const float& value);
auto get_control_port_value(const std::string& symbol) -> float;
auto has_instance() -> bool;
void load_ui();
void notify_ui();
void update_ui();
auto has_ui() -> bool;
void close_ui();
void set_ui_update_rate(const uint& value);
void ui_port_event(const uint& port_index, const float& value);
void native_ui_to_gsettings();
template <StringLiteralWrapper key_wrapper, StringLiteralWrapper gkey_wrapper>
void bind_key_bool(GSettings* settings) {
set_control_port_value(key_wrapper.msg.data(),
static_cast<float>(g_settings_get_boolean(settings, gkey_wrapper.msg.data())));
g_signal_connect(settings, ("changed::"s + gkey_wrapper.msg.data()).c_str(),
G_CALLBACK(+[](GSettings* settings, char* key, gpointer user_data) {
auto* self = static_cast<Lv2Wrapper*>(user_data);
self->set_control_port_value(key_wrapper.msg.data(),
static_cast<float>(g_settings_get_boolean(settings, key)));
}),
this);
auto gkey = gkey_wrapper.msg.data();
auto key = key_wrapper.msg.data();
gsettings_sync_funcs.emplace_back([settings, gkey, key, this]() {
g_settings_set_boolean(settings, gkey, static_cast<gboolean>(get_control_port_value(key)));
});
}
template <StringLiteralWrapper key_wrapper, StringLiteralWrapper gkey_wrapper>
void bind_key_enum(GSettings* settings) {
set_control_port_value(key_wrapper.msg.data(),
static_cast<float>(g_settings_get_enum(settings, gkey_wrapper.msg.data())));
g_signal_connect(settings, ("changed::"s + gkey_wrapper.msg.data()).c_str(),
G_CALLBACK(+[](GSettings* settings, char* key, gpointer user_data) {
auto* self = static_cast<Lv2Wrapper*>(user_data);
self->set_control_port_value(key_wrapper.msg.data(),
static_cast<float>(g_settings_get_enum(settings, key)));
}),
this);
auto gkey = gkey_wrapper.msg.data();
auto key = key_wrapper.msg.data();
gsettings_sync_funcs.emplace_back([settings, gkey, key, this]() {
g_settings_set_enum(settings, gkey, static_cast<gint>(get_control_port_value(key)));
});
}
template <StringLiteralWrapper key_wrapper, StringLiteralWrapper gkey_wrapper>
void bind_key_int(GSettings* settings) {
set_control_port_value(key_wrapper.msg.data(),
static_cast<float>(g_settings_get_int(settings, gkey_wrapper.msg.data())));
g_signal_connect(settings, ("changed::"s + gkey_wrapper.msg.data()).c_str(),
G_CALLBACK(+[](GSettings* settings, char* key, gpointer user_data) {
auto* self = static_cast<Lv2Wrapper*>(user_data);
self->set_control_port_value(key_wrapper.msg.data(),
static_cast<float>(g_settings_get_int(settings, key)));
}),
this);
auto gkey = gkey_wrapper.msg.data();
auto key = key_wrapper.msg.data();
gsettings_sync_funcs.emplace_back([settings, gkey, key, this]() {
g_settings_set_int(settings, gkey, static_cast<gint>(get_control_port_value(key)));
});
}
template <StringLiteralWrapper key_wrapper, StringLiteralWrapper gkey_wrapper>
void bind_key_double(GSettings* settings) {
set_control_port_value(key_wrapper.msg.data(),
static_cast<float>(g_settings_get_double(settings, gkey_wrapper.msg.data())));
g_signal_connect(settings, ("changed::"s + gkey_wrapper.msg.data()).c_str(),
G_CALLBACK(+[](GSettings* settings, char* key, gpointer user_data) {
auto* self = static_cast<Lv2Wrapper*>(user_data);
self->set_control_port_value(key_wrapper.msg.data(),
static_cast<float>(g_settings_get_double(settings, key)));
}),
this);
auto gkey = gkey_wrapper.msg.data();
auto key = key_wrapper.msg.data();
gsettings_sync_funcs.emplace_back([settings, gkey, key, this]() {
g_settings_set_double(settings, gkey, static_cast<gdouble>(get_control_port_value(key)));
});
}
template <StringLiteralWrapper key_wrapper, StringLiteralWrapper gkey_wrapper, bool lower_bound = true>
void bind_key_double_db(GSettings* settings) {
auto key_v = g_settings_get_double(settings, gkey_wrapper.msg.data());
auto linear_v =
(!lower_bound && key_v <= util::minimum_db_d_level) ? 0.0F : static_cast<float>(util::db_to_linear(key_v));
set_control_port_value(key_wrapper.msg.data(), linear_v);
g_signal_connect(settings, ("changed::"s + gkey_wrapper.msg.data()).c_str(),
G_CALLBACK(+[](GSettings* settings, char* key, gpointer user_data) {
auto* self = static_cast<Lv2Wrapper*>(user_data);
auto key_v = g_settings_get_double(settings, gkey_wrapper.msg.data());
auto linear_v = (!lower_bound && key_v <= util::minimum_db_d_level)
? 0.0F
: static_cast<float>(util::db_to_linear(key_v));
self->set_control_port_value(key_wrapper.msg.data(), linear_v);
}),
this);
auto gkey = gkey_wrapper.msg.data();
auto key = key_wrapper.msg.data();
gsettings_sync_funcs.emplace_back([settings, gkey, key, this]() {
const auto linear_v = get_control_port_value(key);
const auto db_v = (!lower_bound & (linear_v == 0.0F)) ? util::minimum_db_d_level : util::linear_to_db(linear_v);
g_settings_set_double(settings, gkey, static_cast<gdouble>(db_v));
});
}
private:
std::string plugin_uri;
LilvWorld* world = nullptr;
const LilvPlugin* plugin = nullptr;
LilvInstance* instance = nullptr;
LV2UI_Handle ui_handle = nullptr;
const LV2UI_Descriptor* ui_descriptor = nullptr;
const LV2UI_Idle_Interface* idle_iface = nullptr;
void* libhandle = nullptr;
uint n_ports = 0U;
uint n_audio_in = 0U;
uint n_audio_out = 0U;
uint n_samples = 0U;
uint rate = 0U;
uint ui_update_rate = 30U;
std::vector<Port> ports;
// Multiband compressor/gate use 1+8*7=57 control ports. Round up to 64.
std::array<std::pair<size_t, uint>, 64> control_ports_cache;
struct {
struct { uint left, right; } in;
struct { uint left, right; } probe;
struct { uint left, right; } out;
} data_ports;
std::vector<std::function<void()>> gsettings_sync_funcs;
std::unordered_map<std::string, LV2_URID> map_uri_to_urid;
std::unordered_map<LV2_URID, std::string> map_urid_to_uri;
const std::array<const LV2_Feature, 1U> static_features{{{LV2_BUF_SIZE__boundedBlockLength, nullptr}}};
std::mutex ui_mutex;
void check_required_features();
void create_ports();
void connect_control_ports();
auto map_urid(const std::string& uri) -> LV2_URID;
};
} // namespace lv2
| 10,321
|
C++
|
.h
| 217
| 38.907834
| 118
| 0.62771
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,755
|
effects_base.hpp
|
wwmm_easyeffects/include/effects_base.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <gio/gio.h>
#include <glib.h>
#include <pipewire/proxy.h>
#include <sigc++/connection.h>
#include <sigc++/signal.h>
#include <map>
#include <memory>
#include <string>
#include <vector>
#include "autogain.hpp"
#include "bass_enhancer.hpp"
#include "bass_loudness.hpp"
#include "compressor.hpp"
#include "convolver.hpp"
#include "crossfeed.hpp"
#include "crystalizer.hpp"
#include "deepfilternet.hpp"
#include "deesser.hpp"
#include "delay.hpp"
#include "echo_canceller.hpp"
#include "equalizer.hpp"
#include "exciter.hpp"
#include "expander.hpp"
#include "filter.hpp"
#include "gate.hpp"
#include "limiter.hpp"
#include "loudness.hpp"
#include "maximizer.hpp"
#include "multiband_compressor.hpp"
#include "multiband_gate.hpp"
#include "output_level.hpp"
#include "pipe_manager.hpp"
#include "pitch.hpp"
#include "plugin_base.hpp"
#include "reverb.hpp"
#include "rnnoise.hpp"
#include "spectrum.hpp"
#include "speex.hpp"
#include "stereo_tools.hpp"
class EffectsBase {
public:
EffectsBase(std::string tag, const std::string& schema, PipeManager* pipe_manager, PipelineType pipe_type);
EffectsBase(const EffectsBase&) = delete;
auto operator=(const EffectsBase&) -> EffectsBase& = delete;
EffectsBase(const EffectsBase&&) = delete;
auto operator=(const EffectsBase&&) -> EffectsBase& = delete;
virtual ~EffectsBase();
const std::string log_tag;
PipeManager* pm = nullptr;
PipelineType pipeline_type;
std::shared_ptr<OutputLevel> output_level;
std::shared_ptr<Spectrum> spectrum;
std::shared_ptr<AutoGain> autogain;
std::shared_ptr<BassEnhancer> bass_enhancer;
std::shared_ptr<BassLoudness> bass_loudness;
std::shared_ptr<Compressor> compressor;
std::shared_ptr<Convolver> convolver;
std::shared_ptr<Crossfeed> crossfeed;
std::shared_ptr<Crystalizer> crystalizer;
std::shared_ptr<DeepFilterNet> deepfilternet;
std::shared_ptr<Deesser> deesser;
std::shared_ptr<Delay> delay;
std::shared_ptr<EchoCanceller> echo_canceller;
std::shared_ptr<Equalizer> equalizer;
std::shared_ptr<Exciter> exciter;
std::shared_ptr<Expander> expander;
std::shared_ptr<Filter> filter;
std::shared_ptr<Gate> gate;
std::shared_ptr<Limiter> limiter;
std::shared_ptr<Loudness> loudness;
std::shared_ptr<Maximizer> maximizer;
std::shared_ptr<MultibandCompressor> multiband_compressor;
std::shared_ptr<MultibandGate> multiband_gate;
std::shared_ptr<Pitch> pitch;
std::shared_ptr<Reverb> reverb;
std::shared_ptr<RNNoise> rnnoise;
std::shared_ptr<Speex> speex;
std::shared_ptr<StereoTools> stereo_tools;
auto get_pipeline_latency() -> float;
void reset_settings();
sigc::signal<void(const float&)> pipeline_latency;
auto get_plugins_map() -> std::map<std::string, std::shared_ptr<PluginBase>>;
template <typename T>
auto get_plugin_instance(const std::string& name) -> std::shared_ptr<T> {
return std::dynamic_pointer_cast<T>(plugins[name]);
}
protected:
GSettings *settings = nullptr, *global_settings = nullptr;
std::string schema_base_path;
std::map<std::string, std::shared_ptr<PluginBase>> plugins;
std::vector<pw_proxy*> list_proxies, list_proxies_listen_mic;
std::vector<sigc::connection> connections;
std::vector<gulong> gconnections, gconnections_global;
void create_filters_if_necessary();
void remove_unused_filters();
void activate_filters();
void deactivate_filters();
void broadcast_pipeline_latency();
};
| 4,199
|
C++
|
.h
| 118
| 33.254237
| 109
| 0.755238
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,756
|
pipeline_type.hpp
|
wwmm_easyeffects/include/pipeline_type.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
enum class PipelineType { input, output };
| 811
|
C++
|
.h
| 20
| 38.6
| 73
| 0.749049
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,757
|
delay_preset.hpp
|
wwmm_easyeffects/include/delay_preset.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <nlohmann/json_fwd.hpp>
#include "plugin_preset_base.hpp"
#include "preset_type.hpp"
class DelayPreset : public PluginPresetBase {
public:
explicit DelayPreset(PresetType preset_type, const int& index = 0);
private:
void save(nlohmann::json& json) override;
void load(const nlohmann::json& json) override;
};
| 1,097
|
C++
|
.h
| 29
| 35.793103
| 73
| 0.755409
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,758
|
tags_pipewire.hpp
|
wwmm_easyeffects/include/tags_pipewire.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
namespace tags::pipewire {
inline constexpr auto ee_source_name = "easyeffects_source";
inline constexpr auto ee_sink_name = "easyeffects_sink";
} // namespace tags::pipewire
namespace tags::pipewire::media_class {
inline constexpr auto device = "Audio/Device";
inline constexpr auto sink = "Audio/Sink";
inline constexpr auto source = "Audio/Source";
inline constexpr auto virtual_source = "Audio/Source/Virtual";
inline constexpr auto input_stream = "Stream/Input/Audio";
inline constexpr auto output_stream = "Stream/Output/Audio";
} // namespace tags::pipewire::media_class
namespace tags::pipewire::media_role {
inline constexpr auto dsp = "DSP";
} // namespace tags::pipewire::media_role
| 1,479
|
C++
|
.h
| 34
| 41.529412
| 73
| 0.761372
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,759
|
equalizer_ui.hpp
|
wwmm_easyeffects/include/equalizer_ui.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <adwaita.h>
#include <glib-object.h>
#include <glibconfig.h>
#include <gtk/gtkbox.h>
#include <memory>
#include <string>
#include "application.hpp"
#include "equalizer.hpp"
namespace ui::equalizer_box {
G_BEGIN_DECLS
#define EE_TYPE_EQUALIZER_BOX (equalizer_box_get_type())
G_DECLARE_FINAL_TYPE(EqualizerBox, equalizer_box, EE, EQUALIZER_BOX, GtkBox)
G_END_DECLS
auto create() -> EqualizerBox*;
void setup(EqualizerBox* self,
std::shared_ptr<Equalizer> equalizer,
const std::string& schema_path,
app::Application* application);
} // namespace ui::equalizer_box
| 1,380
|
C++
|
.h
| 38
| 33.736842
| 76
| 0.742492
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,760
|
convolver_menu_combine.hpp
|
wwmm_easyeffects/include/convolver_menu_combine.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <glib-object.h>
#include <glibconfig.h>
#include <gtk/gtk.h>
#include <string>
namespace ui::convolver_menu_combine {
G_BEGIN_DECLS
#define EE_TYPE_CONVOLVER_MENU_COMBINE (convolver_menu_combine_get_type())
G_DECLARE_FINAL_TYPE(ConvolverMenuCombine, convolver_menu_combine, EE, CONVOLVER_MENU_COMBINE, GtkPopover)
G_END_DECLS
auto create() -> ConvolverMenuCombine*;
void append_to_string_list(ConvolverMenuCombine* self, const std::string& irs_filename);
void remove_from_string_list(ConvolverMenuCombine* self, const std::string& irs_filename);
} // namespace ui::convolver_menu_combine
| 1,375
|
C++
|
.h
| 32
| 41.09375
| 106
| 0.77027
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,761
|
convolver_ui.hpp
|
wwmm_easyeffects/include/convolver_ui.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <adwaita.h>
#include <glib-object.h>
#include <glibconfig.h>
#include <gtk/gtkbox.h>
#include <memory>
#include <string>
#include "application.hpp"
#include "convolver.hpp"
namespace ui::convolver_box {
G_BEGIN_DECLS
#define EE_TYPE_CONVOLVER_BOX (convolver_box_get_type())
G_DECLARE_FINAL_TYPE(ConvolverBox, convolver_box, EE, CONVOLVER_BOX, GtkBox)
G_END_DECLS
auto create() -> ConvolverBox*;
void setup(ConvolverBox* self,
std::shared_ptr<Convolver> convolver,
const std::string& schema_path,
app::Application* application);
} // namespace ui::convolver_box
| 1,380
|
C++
|
.h
| 38
| 33.736842
| 76
| 0.742492
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,762
|
tags_app.hpp
|
wwmm_easyeffects/include/tags_app.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
namespace tags::app {
inline constexpr auto minimum_pw_version = "0.3.44";
inline constexpr auto id = "com.github.wwmm.easyeffects";
inline constexpr auto path = "/com/github/wwmm/easyeffects";
inline constexpr auto path_stream_inputs = "/com/github/wwmm/easyeffects/streaminputs/";
inline constexpr auto path_stream_outputs = "/com/github/wwmm/easyeffects/streamoutputs/";
} // namespace tags::app
| 1,174
|
C++
|
.h
| 26
| 43.192308
| 90
| 0.759649
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,763
|
equalizer_band_box.hpp
|
wwmm_easyeffects/include/equalizer_band_box.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <adwaita.h>
#include <gio/gio.h>
#include <glib-object.h>
#include <glibconfig.h>
#include <gtk/gtkbox.h>
namespace ui::equalizer_band_box {
G_BEGIN_DECLS
#define EE_TYPE_EQUALIZER_BAND_BOX (equalizer_band_box_get_type())
G_DECLARE_FINAL_TYPE(EqualizerBandBox, equalizer_band_box, EE, EQUALIZER_BAND_BOX, GtkBox)
G_END_DECLS
auto create() -> EqualizerBandBox*;
void setup(EqualizerBandBox* self, GSettings* settings);
void bind(EqualizerBandBox* self, int index);
} // namespace ui::equalizer_band_box
| 1,289
|
C++
|
.h
| 33
| 37.212121
| 90
| 0.760643
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,764
|
delay.hpp
|
wwmm_easyeffects/include/delay.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <sys/types.h>
#include <span>
#include <string>
#include "pipe_manager.hpp"
#include "plugin_base.hpp"
class Delay : public PluginBase {
public:
Delay(const std::string& tag,
const std::string& schema,
const std::string& schema_path,
PipeManager* pipe_manager,
PipelineType pipe_type);
Delay(const Delay&) = delete;
auto operator=(const Delay&) -> Delay& = delete;
Delay(const Delay&&) = delete;
auto operator=(const Delay&&) -> Delay& = delete;
~Delay() override;
void setup() override;
void process(std::span<float>& left_in,
std::span<float>& right_in,
std::span<float>& left_out,
std::span<float>& right_out) override;
auto get_latency_seconds() -> float override;
private:
uint latency_n_frames = 0U;
};
| 1,590
|
C++
|
.h
| 45
| 31.6
| 73
| 0.698309
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,765
|
tags_resources.hpp
|
wwmm_easyeffects/include/tags_resources.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
namespace tags::resources {
// Custom icon path
inline constexpr auto icons = "/com/github/wwmm/easyeffects/icons";
// Custom css file path
inline constexpr auto css = "/com/github/wwmm/easyeffects/ui/custom.css";
// Flatpak info file
inline constexpr auto flatpak_info_file = "/.flatpak-info";
// Path to the widgets xml files
inline constexpr auto app_info_ui = "/com/github/wwmm/easyeffects/ui/app_info.ui";
inline constexpr auto application_window_ui = "/com/github/wwmm/easyeffects/ui/application_window.ui";
inline constexpr auto apps_box_ui = "/com/github/wwmm/easyeffects/ui/apps_box.ui";
inline constexpr auto autogain_ui = "/com/github/wwmm/easyeffects/ui/autogain.ui";
inline constexpr auto autoload_row_ui = "/com/github/wwmm/easyeffects/ui/autoload_row.ui";
inline constexpr auto bass_enhancer_ui = "/com/github/wwmm/easyeffects/ui/bass_enhancer.ui";
inline constexpr auto bass_loudness_ui = "/com/github/wwmm/easyeffects/ui/bass_loudness.ui";
inline constexpr auto blocklist_menu_ui = "/com/github/wwmm/easyeffects/ui/blocklist_menu.ui";
inline constexpr auto chart_ui = "/com/github/wwmm/easyeffects/ui/chart.ui";
inline constexpr auto compressor_ui = "/com/github/wwmm/easyeffects/ui/compressor.ui";
inline constexpr auto convolver_ui = "/com/github/wwmm/easyeffects/ui/convolver.ui";
inline constexpr auto convolver_menu_impulses_ui = "/com/github/wwmm/easyeffects/ui/convolver_menu_impulses.ui";
inline constexpr auto convolver_menu_combine_ui = "/com/github/wwmm/easyeffects/ui/convolver_menu_combine.ui";
inline constexpr auto crossfeed_ui = "/com/github/wwmm/easyeffects/ui/crossfeed.ui";
inline constexpr auto crystalizer_ui = "/com/github/wwmm/easyeffects/ui/crystalizer.ui";
inline constexpr auto crystalizer_band_ui = "/com/github/wwmm/easyeffects/ui/crystalizer_band.ui";
inline constexpr auto deepfilternet_ui = "/com/github/wwmm/easyeffects/ui/deepfilternet.ui";
inline constexpr auto deesser_ui = "/com/github/wwmm/easyeffects/ui/deesser.ui";
inline constexpr auto delay_ui = "/com/github/wwmm/easyeffects/ui/delay.ui";
inline constexpr auto echo_canceller_ui = "/com/github/wwmm/easyeffects/ui/echo_canceller.ui";
inline constexpr auto effects_box_ui = "/com/github/wwmm/easyeffects/ui/effects_box.ui";
inline constexpr auto equalizer_band_ui = "/com/github/wwmm/easyeffects/ui/equalizer_band.ui";
inline constexpr auto equalizer_ui = "/com/github/wwmm/easyeffects/ui/equalizer.ui";
inline constexpr auto exciter_ui = "/com/github/wwmm/easyeffects/ui/exciter.ui";
inline constexpr auto expander_ui = "/com/github/wwmm/easyeffects/ui/expander.ui";
inline constexpr auto filter_ui = "/com/github/wwmm/easyeffects/ui/filter.ui";
inline constexpr auto gate_ui = "/com/github/wwmm/easyeffects/ui/gate.ui";
inline constexpr auto level_meter_ui = "/com/github/wwmm/easyeffects/ui/level_meter.ui";
inline constexpr auto limiter_ui = "/com/github/wwmm/easyeffects/ui/limiter.ui";
inline constexpr auto loudness_ui = "/com/github/wwmm/easyeffects/ui/loudness.ui";
inline constexpr auto maximizer_ui = "/com/github/wwmm/easyeffects/ui/maximizer.ui";
inline constexpr auto multiband_compressor_ui = "/com/github/wwmm/easyeffects/ui/multiband_compressor.ui";
inline constexpr auto multiband_compressor_band_ui = "/com/github/wwmm/easyeffects/ui/multiband_compressor_band.ui";
inline constexpr auto multiband_gate_ui = "/com/github/wwmm/easyeffects/ui/multiband_gate.ui";
inline constexpr auto multiband_gate_band_ui = "/com/github/wwmm/easyeffects/ui/multiband_gate_band.ui";
inline constexpr auto pipe_manager_box_ui = "/com/github/wwmm/easyeffects/ui/pipe_manager_box.ui";
inline constexpr auto pitch_ui = "/com/github/wwmm/easyeffects/ui/pitch.ui";
inline constexpr auto plugin_row_ui = "/com/github/wwmm/easyeffects/ui/plugin_row.ui";
inline constexpr auto plugins_box_ui = "/com/github/wwmm/easyeffects/ui/plugins_box.ui";
inline constexpr auto plugins_menu_ui = "/com/github/wwmm/easyeffects/ui/plugins_menu.ui";
inline constexpr auto preferences_general_ui = "/com/github/wwmm/easyeffects/ui/preferences_general.ui";
inline constexpr auto preferences_spectrum_ui = "/com/github/wwmm/easyeffects/ui/preferences_spectrum.ui";
inline constexpr auto preferences_window_ui = "/com/github/wwmm/easyeffects/ui/preferences_window.ui";
inline constexpr auto preset_row_ui = "/com/github/wwmm/easyeffects/ui/preset_row.ui";
inline constexpr auto preset_row_community_ui = "/com/github/wwmm/easyeffects/ui/preset_community_row.ui";
inline constexpr auto presets_menu_ui = "/com/github/wwmm/easyeffects/ui/presets_menu.ui";
inline constexpr auto reverb_ui = "/com/github/wwmm/easyeffects/ui/reverb.ui";
inline constexpr auto rnnoise_ui = "/com/github/wwmm/easyeffects/ui/rnnoise.ui";
inline constexpr auto speex_ui = "/com/github/wwmm/easyeffects/ui/speex.ui";
inline constexpr auto shortcuts_ui = "/com/github/wwmm/easyeffects/ui/shortcuts.ui";
inline constexpr auto stereo_tools_ui = "/com/github/wwmm/easyeffects/ui/stereo_tools.ui";
} // namespace tags::resources
| 5,808
|
C++
|
.h
| 79
| 71.531646
| 116
| 0.78705
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,766
|
string_literal_wrapper.hpp
|
wwmm_easyeffects/include/string_literal_wrapper.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <array>
#include <cstddef>
template <size_t N>
struct StringLiteralWrapper {
// NOLINTNEXTLINE(hicpp-explicit-conversions)
constexpr StringLiteralWrapper(const char (&str)[N]) : msg(std::to_array(str)) {}
// NOLINTNEXTLINE(hicpp-explicit-conversions)
constexpr StringLiteralWrapper(std::array<char, N> arr) : msg(arr) {}
std::array<char, N> msg;
};
| 1,139
|
C++
|
.h
| 29
| 37.172414
| 83
| 0.747511
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,767
|
bass_loudness_ui.hpp
|
wwmm_easyeffects/include/bass_loudness_ui.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <adwaita.h>
#include <glib-object.h>
#include <glibconfig.h>
#include <gtk/gtkbox.h>
#include <memory>
#include <string>
#include "bass_loudness.hpp"
namespace ui::bass_loudness_box {
G_BEGIN_DECLS
#define EE_TYPE_BASS_LOUDNESS_BOX (bass_loudness_box_get_type())
G_DECLARE_FINAL_TYPE(BassLoudnessBox, bass_loudness_box, EE, BASS_LOUDNESS_BOX, GtkBox)
G_END_DECLS
auto create() -> BassLoudnessBox*;
void setup(BassLoudnessBox* self, std::shared_ptr<BassLoudness> bass_loudness, const std::string& schema_path);
} // namespace ui::bass_loudness_box
| 1,333
|
C++
|
.h
| 34
| 37.411765
| 111
| 0.759503
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,768
|
tags_equalizer.hpp
|
wwmm_easyeffects/include/tags_equalizer.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <array>
namespace tags::equalizer {
// bands
constexpr auto band_id = std::to_array(
{"band0", "band1", "band2", "band3", "band4", "band5", "band6", "band7", "band8", "band9", "band10",
"band11", "band12", "band13", "band14", "band15", "band16", "band17", "band18", "band19", "band20", "band21",
"band22", "band23", "band24", "band25", "band26", "band27", "band28", "band29", "band30", "band31"});
constexpr auto band_type =
std::to_array({{"band0-type"}, {"band1-type"}, {"band2-type"}, {"band3-type"},
{"band4-type"}, {"band5-type"}, {"band6-type"}, {"band7-type"},
{"band8-type"}, {"band9-type"}, {"band10-type"}, {"band11-type"},
{"band12-type"}, {"band13-type"}, {"band14-type"}, {"band15-type"},
{"band16-type"}, {"band17-type"}, {"band18-type"}, {"band19-type"},
{"band20-type"}, {"band21-type"}, {"band22-type"}, {"band23-type"},
{"band24-type"}, {"band25-type"}, {"band26-type"}, {"band27-type"},
{"band28-type"}, {"band29-type"}, {"band30-type"}, std::to_array("band31-type")});
constexpr auto band_mode =
std::to_array({{"band0-mode"}, {"band1-mode"}, {"band2-mode"}, {"band3-mode"},
{"band4-mode"}, {"band5-mode"}, {"band6-mode"}, {"band7-mode"},
{"band8-mode"}, {"band9-mode"}, {"band10-mode"}, {"band11-mode"},
{"band12-mode"}, {"band13-mode"}, {"band14-mode"}, {"band15-mode"},
{"band16-mode"}, {"band17-mode"}, {"band18-mode"}, {"band19-mode"},
{"band20-mode"}, {"band21-mode"}, {"band22-mode"}, {"band23-mode"},
{"band24-mode"}, {"band25-mode"}, {"band26-mode"}, {"band27-mode"},
{"band28-mode"}, {"band29-mode"}, {"band30-mode"}, std::to_array("band31-mode")});
constexpr auto band_slope =
std::to_array({{"band0-slope"}, {"band1-slope"}, {"band2-slope"}, {"band3-slope"},
{"band4-slope"}, {"band5-slope"}, {"band6-slope"}, {"band7-slope"},
{"band8-slope"}, {"band9-slope"}, {"band10-slope"}, {"band11-slope"},
{"band12-slope"}, {"band13-slope"}, {"band14-slope"}, {"band15-slope"},
{"band16-slope"}, {"band17-slope"}, {"band18-slope"}, {"band19-slope"},
{"band20-slope"}, {"band21-slope"}, {"band22-slope"}, {"band23-slope"},
{"band24-slope"}, {"band25-slope"}, {"band26-slope"}, {"band27-slope"},
{"band28-slope"}, {"band29-slope"}, {"band30-slope"}, std::to_array("band31-slope")});
constexpr auto band_solo =
std::to_array({{"band0-solo"}, {"band1-solo"}, {"band2-solo"}, {"band3-solo"},
{"band4-solo"}, {"band5-solo"}, {"band6-solo"}, {"band7-solo"},
{"band8-solo"}, {"band9-solo"}, {"band10-solo"}, {"band11-solo"},
{"band12-solo"}, {"band13-solo"}, {"band14-solo"}, {"band15-solo"},
{"band16-solo"}, {"band17-solo"}, {"band18-solo"}, {"band19-solo"},
{"band20-solo"}, {"band21-solo"}, {"band22-solo"}, {"band23-solo"},
{"band24-solo"}, {"band25-solo"}, {"band26-solo"}, {"band27-solo"},
{"band28-solo"}, {"band29-solo"}, {"band30-solo"}, std::to_array("band31-solo")});
constexpr auto band_mute =
std::to_array({{"band0-mute"}, {"band1-mute"}, {"band2-mute"}, {"band3-mute"},
{"band4-mute"}, {"band5-mute"}, {"band6-mute"}, {"band7-mute"},
{"band8-mute"}, {"band9-mute"}, {"band10-mute"}, {"band11-mute"},
{"band12-mute"}, {"band13-mute"}, {"band14-mute"}, {"band15-mute"},
{"band16-mute"}, {"band17-mute"}, {"band18-mute"}, {"band19-mute"},
{"band20-mute"}, {"band21-mute"}, {"band22-mute"}, {"band23-mute"},
{"band24-mute"}, {"band25-mute"}, {"band26-mute"}, {"band27-mute"},
{"band28-mute"}, {"band29-mute"}, {"band30-mute"}, std::to_array("band31-mute")});
constexpr auto band_frequency = std::to_array(
{{"band0-frequency"}, {"band1-frequency"}, {"band2-frequency"}, {"band3-frequency"},
{"band4-frequency"}, {"band5-frequency"}, {"band6-frequency"}, {"band7-frequency"},
{"band8-frequency"}, {"band9-frequency"}, {"band10-frequency"}, {"band11-frequency"},
{"band12-frequency"}, {"band13-frequency"}, {"band14-frequency"}, {"band15-frequency"},
{"band16-frequency"}, {"band17-frequency"}, {"band18-frequency"}, {"band19-frequency"},
{"band20-frequency"}, {"band21-frequency"}, {"band22-frequency"}, {"band23-frequency"},
{"band24-frequency"}, {"band25-frequency"}, {"band26-frequency"}, {"band27-frequency"},
{"band28-frequency"}, {"band29-frequency"}, {"band30-frequency"}, std::to_array("band31-frequency")});
constexpr auto band_q = std::to_array({{"band0-q"}, {"band1-q"}, {"band2-q"}, {"band3-q"},
{"band4-q"}, {"band5-q"}, {"band6-q"}, {"band7-q"},
{"band8-q"}, {"band9-q"}, {"band10-q"}, {"band11-q"},
{"band12-q"}, {"band13-q"}, {"band14-q"}, {"band15-q"},
{"band16-q"}, {"band17-q"}, {"band18-q"}, {"band19-q"},
{"band20-q"}, {"band21-q"}, {"band22-q"}, {"band23-q"},
{"band24-q"}, {"band25-q"}, {"band26-q"}, {"band27-q"},
{"band28-q"}, {"band29-q"}, {"band30-q"}, std::to_array("band31-q")});
constexpr auto band_width =
std::to_array({{"band0-width"}, {"band1-width"}, {"band2-width"}, {"band3-width"},
{"band4-width"}, {"band5-width"}, {"band6-width"}, {"band7-width"},
{"band8-width"}, {"band9-width"}, {"band10-width"}, {"band11-width"},
{"band12-width"}, {"band13-width"}, {"band14-width"}, {"band15-width"},
{"band16-width"}, {"band17-width"}, {"band18-width"}, {"band19-width"},
{"band20-width"}, {"band21-width"}, {"band22-width"}, {"band23-width"},
{"band24-width"}, {"band25-width"}, {"band26-width"}, {"band27-width"},
{"band28-width"}, {"band29-width"}, {"band30-width"}, std::to_array("band31-width")});
constexpr auto band_gain =
std::to_array({{"band0-gain"}, {"band1-gain"}, {"band2-gain"}, {"band3-gain"},
{"band4-gain"}, {"band5-gain"}, {"band6-gain"}, {"band7-gain"},
{"band8-gain"}, {"band9-gain"}, {"band10-gain"}, {"band11-gain"},
{"band12-gain"}, {"band13-gain"}, {"band14-gain"}, {"band15-gain"},
{"band16-gain"}, {"band17-gain"}, {"band18-gain"}, {"band19-gain"},
{"band20-gain"}, {"band21-gain"}, {"band22-gain"}, {"band23-gain"},
{"band24-gain"}, {"band25-gain"}, {"band26-gain"}, {"band27-gain"},
{"band28-gain"}, {"band29-gain"}, {"band30-gain"}, std::to_array("band31-gain")});
// left channel
constexpr auto ftl = std::to_array(
{{"ftl_0"}, {"ftl_1"}, {"ftl_2"}, {"ftl_3"}, {"ftl_4"}, {"ftl_5"}, {"ftl_6"}, {"ftl_7"},
{"ftl_8"}, {"ftl_9"}, {"ftl_10"}, {"ftl_11"}, {"ftl_12"}, {"ftl_13"}, {"ftl_14"}, {"ftl_15"},
{"ftl_16"}, {"ftl_17"}, {"ftl_18"}, {"ftl_19"}, {"ftl_20"}, {"ftl_21"}, {"ftl_22"}, {"ftl_23"},
{"ftl_24"}, {"ftl_25"}, {"ftl_26"}, {"ftl_27"}, {"ftl_28"}, {"ftl_29"}, {"ftl_30"}, std::to_array("ftl_31")});
constexpr auto fml = std::to_array(
{{"fml_0"}, {"fml_1"}, {"fml_2"}, {"fml_3"}, {"fml_4"}, {"fml_5"}, {"fml_6"}, {"fml_7"},
{"fml_8"}, {"fml_9"}, {"fml_10"}, {"fml_11"}, {"fml_12"}, {"fml_13"}, {"fml_14"}, {"fml_15"},
{"fml_16"}, {"fml_17"}, {"fml_18"}, {"fml_19"}, {"fml_20"}, {"fml_21"}, {"fml_22"}, {"fml_23"},
{"fml_24"}, {"fml_25"}, {"fml_26"}, {"fml_27"}, {"fml_28"}, {"fml_29"}, {"fml_30"}, std::to_array("fml_31")});
constexpr auto sl = std::to_array(
{{"sl_0"}, {"sl_1"}, {"sl_2"}, {"sl_3"}, {"sl_4"}, {"sl_5"}, {"sl_6"}, {"sl_7"},
{"sl_8"}, {"sl_9"}, {"sl_10"}, {"sl_11"}, {"sl_12"}, {"sl_13"}, {"sl_14"}, {"sl_15"},
{"sl_16"}, {"sl_17"}, {"sl_18"}, {"sl_19"}, {"sl_20"}, {"sl_21"}, {"sl_22"}, {"sl_23"},
{"sl_24"}, {"sl_25"}, {"sl_26"}, {"sl_27"}, {"sl_28"}, {"sl_29"}, {"sl_30"}, std::to_array("sl_31")});
constexpr auto xsl = std::to_array(
{{"xsl_0"}, {"xsl_1"}, {"xsl_2"}, {"xsl_3"}, {"xsl_4"}, {"xsl_5"}, {"xsl_6"}, {"xsl_7"},
{"xsl_8"}, {"xsl_9"}, {"xsl_10"}, {"xsl_11"}, {"xsl_12"}, {"xsl_13"}, {"xsl_14"}, {"xsl_15"},
{"xsl_16"}, {"xsl_17"}, {"xsl_18"}, {"xsl_19"}, {"xsl_20"}, {"xsl_21"}, {"xsl_22"}, {"xsl_23"},
{"xsl_24"}, {"xsl_25"}, {"xsl_26"}, {"xsl_27"}, {"xsl_28"}, {"xsl_29"}, {"xsl_30"}, std::to_array("xsl_31")});
constexpr auto xml = std::to_array(
{{"xml_0"}, {"xml_1"}, {"xml_2"}, {"xml_3"}, {"xml_4"}, {"xml_5"}, {"xml_6"}, {"xml_7"},
{"xml_8"}, {"xml_9"}, {"xml_10"}, {"xml_11"}, {"xml_12"}, {"xml_13"}, {"xml_14"}, {"xml_15"},
{"xml_16"}, {"xml_17"}, {"xml_18"}, {"xml_19"}, {"xml_20"}, {"xml_21"}, {"xml_22"}, {"xml_23"},
{"xml_24"}, {"xml_25"}, {"xml_26"}, {"xml_27"}, {"xml_28"}, {"xml_29"}, {"xml_30"}, std::to_array("xml_31")});
constexpr auto ql = std::to_array(
{{"ql_0"}, {"ql_1"}, {"ql_2"}, {"ql_3"}, {"ql_4"}, {"ql_5"}, {"ql_6"}, {"ql_7"},
{"ql_8"}, {"ql_9"}, {"ql_10"}, {"ql_11"}, {"ql_12"}, {"ql_13"}, {"ql_14"}, {"ql_15"},
{"ql_16"}, {"ql_17"}, {"ql_18"}, {"ql_19"}, {"ql_20"}, {"ql_21"}, {"ql_22"}, {"ql_23"},
{"ql_24"}, {"ql_25"}, {"ql_26"}, {"ql_27"}, {"ql_28"}, {"ql_29"}, {"ql_30"}, std::to_array("ql_31")});
constexpr auto wl = std::to_array(
{{"wl_0"}, {"wl_1"}, {"wl_2"}, {"wl_3"}, {"wl_4"}, {"wl_5"}, {"wl_6"}, {"wl_7"},
{"wl_8"}, {"wl_9"}, {"wl_10"}, {"wl_11"}, {"wl_12"}, {"wl_13"}, {"wl_14"}, {"wl_15"},
{"wl_16"}, {"wl_17"}, {"wl_18"}, {"wl_19"}, {"wl_20"}, {"wl_21"}, {"wl_22"}, {"wl_23"},
{"wl_24"}, {"wl_25"}, {"wl_26"}, {"wl_27"}, {"wl_28"}, {"wl_29"}, {"wl_30"}, std::to_array("wl_31")});
constexpr auto fl = std::to_array(
{{"fl_0"}, {"fl_1"}, {"fl_2"}, {"fl_3"}, {"fl_4"}, {"fl_5"}, {"fl_6"}, {"fl_7"},
{"fl_8"}, {"fl_9"}, {"fl_10"}, {"fl_11"}, {"fl_12"}, {"fl_13"}, {"fl_14"}, {"fl_15"},
{"fl_16"}, {"fl_17"}, {"fl_18"}, {"fl_19"}, {"fl_20"}, {"fl_21"}, {"fl_22"}, {"fl_23"},
{"fl_24"}, {"fl_25"}, {"fl_26"}, {"fl_27"}, {"fl_28"}, {"fl_29"}, {"fl_30"}, std::to_array("fl_31")});
constexpr auto gl = std::to_array(
{{"gl_0"}, {"gl_1"}, {"gl_2"}, {"gl_3"}, {"gl_4"}, {"gl_5"}, {"gl_6"}, {"gl_7"},
{"gl_8"}, {"gl_9"}, {"gl_10"}, {"gl_11"}, {"gl_12"}, {"gl_13"}, {"gl_14"}, {"gl_15"},
{"gl_16"}, {"gl_17"}, {"gl_18"}, {"gl_19"}, {"gl_20"}, {"gl_21"}, {"gl_22"}, {"gl_23"},
{"gl_24"}, {"gl_25"}, {"gl_26"}, {"gl_27"}, {"gl_28"}, {"gl_29"}, {"gl_30"}, std::to_array("gl_31")});
// right channel
constexpr auto ftr = std::to_array(
{{"ftr_0"}, {"ftr_1"}, {"ftr_2"}, {"ftr_3"}, {"ftr_4"}, {"ftr_5"}, {"ftr_6"}, {"ftr_7"},
{"ftr_8"}, {"ftr_9"}, {"ftr_10"}, {"ftr_11"}, {"ftr_12"}, {"ftr_13"}, {"ftr_14"}, {"ftr_15"},
{"ftr_16"}, {"ftr_17"}, {"ftr_18"}, {"ftr_19"}, {"ftr_20"}, {"ftr_21"}, {"ftr_22"}, {"ftr_23"},
{"ftr_24"}, {"ftr_25"}, {"ftr_26"}, {"ftr_27"}, {"ftr_28"}, {"ftr_29"}, {"ftr_30"}, std::to_array("ftr_31")});
constexpr auto fmr = std::to_array(
{{"fmr_0"}, {"fmr_1"}, {"fmr_2"}, {"fmr_3"}, {"fmr_4"}, {"fmr_5"}, {"fmr_6"}, {"fmr_7"},
{"fmr_8"}, {"fmr_9"}, {"fmr_10"}, {"fmr_11"}, {"fmr_12"}, {"fmr_13"}, {"fmr_14"}, {"fmr_15"},
{"fmr_16"}, {"fmr_17"}, {"fmr_18"}, {"fmr_19"}, {"fmr_20"}, {"fmr_21"}, {"fmr_22"}, {"fmr_23"},
{"fmr_24"}, {"fmr_25"}, {"fmr_26"}, {"fmr_27"}, {"fmr_28"}, {"fmr_29"}, {"fmr_30"}, std::to_array("fmr_31")});
constexpr auto sr = std::to_array(
{{"sr_0"}, {"sr_1"}, {"sr_2"}, {"sr_3"}, {"sr_4"}, {"sr_5"}, {"sr_6"}, {"sr_7"},
{"sr_8"}, {"sr_9"}, {"sr_10"}, {"sr_11"}, {"sr_12"}, {"sr_13"}, {"sr_14"}, {"sr_15"},
{"sr_16"}, {"sr_17"}, {"sr_18"}, {"sr_19"}, {"sr_20"}, {"sr_21"}, {"sr_22"}, {"sr_23"},
{"sr_24"}, {"sr_25"}, {"sr_26"}, {"sr_27"}, {"sr_28"}, {"sr_29"}, {"sr_30"}, std::to_array("sr_31")});
constexpr auto xsr = std::to_array(
{{"xsr_0"}, {"xsr_1"}, {"xsr_2"}, {"xsr_3"}, {"xsr_4"}, {"xsr_5"}, {"xsr_6"}, {"xsr_7"},
{"xsr_8"}, {"xsr_9"}, {"xsr_10"}, {"xsr_11"}, {"xsr_12"}, {"xsr_13"}, {"xsr_14"}, {"xsr_15"},
{"xsr_16"}, {"xsr_17"}, {"xsr_18"}, {"xsr_19"}, {"xsr_20"}, {"xsr_21"}, {"xsr_22"}, {"xsr_23"},
{"xsr_24"}, {"xsr_25"}, {"xsr_26"}, {"xsr_27"}, {"xsr_28"}, {"xsr_29"}, {"xsr_30"}, std::to_array("xsr_31")});
constexpr auto xmr = std::to_array(
{{"xmr_0"}, {"xmr_1"}, {"xmr_2"}, {"xmr_3"}, {"xmr_4"}, {"xmr_5"}, {"xmr_6"}, {"xmr_7"},
{"xmr_8"}, {"xmr_9"}, {"xmr_10"}, {"xmr_11"}, {"xmr_12"}, {"xmr_13"}, {"xmr_14"}, {"xmr_15"},
{"xmr_16"}, {"xmr_17"}, {"xmr_18"}, {"xmr_19"}, {"xmr_20"}, {"xmr_21"}, {"xmr_22"}, {"xmr_23"},
{"xmr_24"}, {"xmr_25"}, {"xmr_26"}, {"xmr_27"}, {"xmr_28"}, {"xmr_29"}, {"xmr_30"}, std::to_array("xmr_31")});
constexpr auto qr = std::to_array(
{{"qr_0"}, {"qr_1"}, {"qr_2"}, {"qr_3"}, {"qr_4"}, {"qr_5"}, {"qr_6"}, {"qr_7"},
{"qr_8"}, {"qr_9"}, {"qr_10"}, {"qr_11"}, {"qr_12"}, {"qr_13"}, {"qr_14"}, {"qr_15"},
{"qr_16"}, {"qr_17"}, {"qr_18"}, {"qr_19"}, {"qr_20"}, {"qr_21"}, {"qr_22"}, {"qr_23"},
{"qr_24"}, {"qr_25"}, {"qr_26"}, {"qr_27"}, {"qr_28"}, {"qr_29"}, {"qr_30"}, std::to_array("qr_31")});
constexpr auto wr = std::to_array(
{{"wr_0"}, {"wr_1"}, {"wr_2"}, {"wr_3"}, {"wr_4"}, {"wr_5"}, {"wr_6"}, {"wr_7"},
{"wr_8"}, {"wr_9"}, {"wr_10"}, {"wr_11"}, {"wr_12"}, {"wr_13"}, {"wr_14"}, {"wr_15"},
{"wr_16"}, {"wr_17"}, {"wr_18"}, {"wr_19"}, {"wr_20"}, {"wr_21"}, {"wr_22"}, {"wr_23"},
{"wr_24"}, {"wr_25"}, {"wr_26"}, {"wr_27"}, {"wr_28"}, {"wr_29"}, {"wr_30"}, std::to_array("wr_31")});
constexpr auto fr = std::to_array(
{{"fr_0"}, {"fr_1"}, {"fr_2"}, {"fr_3"}, {"fr_4"}, {"fr_5"}, {"fr_6"}, {"fr_7"},
{"fr_8"}, {"fr_9"}, {"fr_10"}, {"fr_11"}, {"fr_12"}, {"fr_13"}, {"fr_14"}, {"fr_15"},
{"fr_16"}, {"fr_17"}, {"fr_18"}, {"fr_19"}, {"fr_20"}, {"fr_21"}, {"fr_22"}, {"fr_23"},
{"fr_24"}, {"fr_25"}, {"fr_26"}, {"fr_27"}, {"fr_28"}, {"fr_29"}, {"fr_30"}, std::to_array("fr_31")});
constexpr auto gr = std::to_array(
{{"gr_0"}, {"gr_1"}, {"gr_2"}, {"gr_3"}, {"gr_4"}, {"gr_5"}, {"gr_6"}, {"gr_7"},
{"gr_8"}, {"gr_9"}, {"gr_10"}, {"gr_11"}, {"gr_12"}, {"gr_13"}, {"gr_14"}, {"gr_15"},
{"gr_16"}, {"gr_17"}, {"gr_18"}, {"gr_19"}, {"gr_20"}, {"gr_21"}, {"gr_22"}, {"gr_23"},
{"gr_24"}, {"gr_25"}, {"gr_26"}, {"gr_27"}, {"gr_28"}, {"gr_29"}, {"gr_30"}, std::to_array("gr_31")});
} // namespace tags::equalizer
| 15,934
|
C++
|
.h
| 199
| 70.633166
| 115
| 0.456242
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,769
|
multiband_gate_ui.hpp
|
wwmm_easyeffects/include/multiband_gate_ui.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <adwaita.h>
#include <glib-object.h>
#include <glibconfig.h>
#include <gtk/gtkbox.h>
#include <memory>
#include <string>
#include "multiband_gate.hpp"
#include "pipe_manager.hpp"
namespace ui::multiband_gate_box {
G_BEGIN_DECLS
#define EE_TYPE_MULTIBAND_GATE_BOX (multiband_gate_box_get_type())
G_DECLARE_FINAL_TYPE(MultibandGateBox, multiband_gate_box, EE, MULTIBAND_GATE_BOX, GtkBox)
G_END_DECLS
auto create() -> MultibandGateBox*;
void setup(MultibandGateBox* self,
std::shared_ptr<MultibandGate> multiband_gate,
const std::string& schema_path,
PipeManager* pm);
} // namespace ui::multiband_gate_box
| 1,423
|
C++
|
.h
| 38
| 34.868421
| 90
| 0.745455
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,770
|
limiter.hpp
|
wwmm_easyeffects/include/limiter.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <pipewire/proxy.h>
#include <sigc++/signal.h>
#include <sys/types.h>
#include <span>
#include <string>
#include <vector>
#include "pipe_manager.hpp"
#include "plugin_base.hpp"
class Limiter : public PluginBase {
public:
Limiter(const std::string& tag,
const std::string& schema,
const std::string& schema_path,
PipeManager* pipe_manager,
PipelineType pipe_type);
Limiter(const Limiter&) = delete;
auto operator=(const Limiter&) -> Limiter& = delete;
Limiter(const Limiter&&) = delete;
auto operator=(const Limiter&&) -> Limiter& = delete;
~Limiter() override;
void setup() override;
void process(std::span<float>& left_in,
std::span<float>& right_in,
std::span<float>& left_out,
std::span<float>& right_out,
std::span<float>& probe_left,
std::span<float>& probe_right) override;
void update_probe_links() override;
auto get_latency_seconds() -> float override;
sigc::signal<void(const float)> gain_left, gain_right, sidechain_left, sidechain_right;
float gain_l_port_value = 0.0F;
float gain_r_port_value = 0.0F;
float sidechain_l_port_value = 0.0F;
float sidechain_r_port_value = 0.0F;
private:
uint latency_n_frames = 0U;
std::vector<pw_proxy*> list_proxies;
void update_sidechain_links(const std::string& key);
};
| 2,157
|
C++
|
.h
| 58
| 33.051724
| 89
| 0.696215
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,771
|
gate_ui.hpp
|
wwmm_easyeffects/include/gate_ui.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <adwaita.h>
#include <glib-object.h>
#include <glibconfig.h>
#include <gtk/gtkbox.h>
#include <memory>
#include <string>
#include "gate.hpp"
#include "pipe_manager.hpp"
namespace ui::gate_box {
G_BEGIN_DECLS
#define EE_TYPE_GATE_BOX (gate_box_get_type())
G_DECLARE_FINAL_TYPE(GateBox, gate_box, EE, GATE_BOX, GtkBox)
G_END_DECLS
auto create() -> GateBox*;
void setup(GateBox* self, std::shared_ptr<Gate> gate, const std::string& schema_path, PipeManager* pm);
} // namespace ui::gate_box
| 1,274
|
C++
|
.h
| 35
| 34.628571
| 103
| 0.746135
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,772
|
fir_filter_lowpass.hpp
|
wwmm_easyeffects/include/fir_filter_lowpass.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <string>
#include "fir_filter_base.hpp"
class FirFilterLowpass : public FirFilterBase {
public:
FirFilterLowpass(std::string tag);
FirFilterLowpass(const FirFilterLowpass&) = delete;
auto operator=(const FirFilterLowpass&) -> FirFilterLowpass& = delete;
FirFilterLowpass(const FirFilterLowpass&&) = delete;
auto operator=(const FirFilterLowpass&&) -> FirFilterLowpass& = delete;
~FirFilterLowpass() override;
void setup() override;
};
| 1,229
|
C++
|
.h
| 31
| 37.483871
| 73
| 0.758794
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| true
| false
| false
|
24,773
|
compressor.hpp
|
wwmm_easyeffects/include/compressor.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <pipewire/proxy.h>
#include <sigc++/signal.h>
#include <sys/types.h>
#include <span>
#include <string>
#include <vector>
#include "pipe_manager.hpp"
#include "plugin_base.hpp"
class Compressor : public PluginBase {
public:
Compressor(const std::string& tag,
const std::string& schema,
const std::string& schema_path,
PipeManager* pipe_manager,
PipelineType pipe_type);
Compressor(const Compressor&) = delete;
auto operator=(const Compressor&) -> Compressor& = delete;
Compressor(const Compressor&&) = delete;
auto operator=(const Compressor&&) -> Compressor& = delete;
~Compressor() override;
void setup() override;
void process(std::span<float>& left_in,
std::span<float>& right_in,
std::span<float>& left_out,
std::span<float>& right_out,
std::span<float>& probe_left,
std::span<float>& probe_right) override;
auto get_latency_seconds() -> float override;
void update_probe_links() override;
sigc::signal<void(const float)> reduction, sidechain, curve, envelope;
float reduction_port_value = 0.0F;
float sidechain_port_value = 0.0F;
float curve_port_value = 0.0F;
float envelope_port_value = 0.0F;
private:
uint latency_n_frames = 0U;
std::vector<pw_proxy*> list_proxies;
void update_sidechain_links(const std::string& key);
};
| 2,182
|
C++
|
.h
| 58
| 33.275862
| 73
| 0.697917
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,774
|
multiband_gate_band_box.hpp
|
wwmm_easyeffects/include/multiband_gate_band_box.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <adwaita.h>
#include <gio/gio.h>
#include <glib-object.h>
#include <glibconfig.h>
#include <gtk/gtkbox.h>
namespace ui::multiband_gate_band_box {
G_BEGIN_DECLS
#define EE_TYPE_MULTIBAND_GATE_BAND_BOX (multiband_gate_band_box_get_type())
G_DECLARE_FINAL_TYPE(MultibandGateBandBox, multiband_gate_band_box, EE, MULTIBAND_GATE_BAND_BOX, GtkBox)
G_END_DECLS
auto create() -> MultibandGateBandBox*;
void setup(MultibandGateBandBox* self, GSettings* settings, int index);
void set_end_label(MultibandGateBandBox* self, const float& value);
void set_envelope_label(MultibandGateBandBox* self, const float& value);
void set_curve_label(MultibandGateBandBox* self, const float& value);
void set_gain_label(MultibandGateBandBox* self, const float& value);
} // namespace ui::multiband_gate_band_box
| 1,579
|
C++
|
.h
| 36
| 42
| 104
| 0.771092
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,775
|
expander_ui.hpp
|
wwmm_easyeffects/include/expander_ui.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <adwaita.h>
#include <glib-object.h>
#include <glibconfig.h>
#include <gtk/gtkbox.h>
#include <memory>
#include <string>
#include "expander.hpp"
#include "pipe_manager.hpp"
namespace ui::expander_box {
G_BEGIN_DECLS
#define EE_TYPE_EXPANDER_BOX (expander_box_get_type())
G_DECLARE_FINAL_TYPE(ExpanderBox, expander_box, EE, EXPANDER_BOX, GtkBox)
G_END_DECLS
auto create() -> ExpanderBox*;
void setup(ExpanderBox* self, std::shared_ptr<Expander> expander, const std::string& schema_path, PipeManager* pm);
} // namespace ui::expander_box
| 1,322
|
C++
|
.h
| 35
| 36
| 115
| 0.755677
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,776
|
deepfilternet.hpp
|
wwmm_easyeffects/include/deepfilternet.hpp
|
/*
* Copyright © 2023 Torge Matthies
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <memory>
#include <span>
#include <string>
#include <vector>
#include "ladspa_wrapper.hpp"
#include "pipe_manager.hpp"
#include "plugin_base.hpp"
#include "resampler.hpp"
class DeepFilterNet : public PluginBase {
public:
DeepFilterNet(const std::string& tag,
const std::string& schema,
const std::string& schema_path,
PipeManager* pipe_manager,
PipelineType pipe_type);
DeepFilterNet(const DeepFilterNet&) = delete;
auto operator=(const DeepFilterNet&) -> DeepFilterNet& = delete;
DeepFilterNet(const DeepFilterNet&&) = delete;
auto operator=(const DeepFilterNet&&) -> DeepFilterNet& = delete;
~DeepFilterNet() override;
void setup() override;
void process(std::span<float>& left_in,
std::span<float>& right_in,
std::span<float>& left_out,
std::span<float>& right_out) override;
auto get_latency_seconds() -> float override;
private:
std::unique_ptr<ladspa::LadspaWrapper> ladspa_wrapper;
bool resample = false;
bool resampler_ready = true;
std::unique_ptr<Resampler> resampler_inL, resampler_outL;
std::unique_ptr<Resampler> resampler_inR, resampler_outR;
std::vector<float> resampled_outL, resampled_outR;
std::vector<float> carryover_l, carryover_r;
};
| 2,075
|
C++
|
.h
| 54
| 34.277778
| 73
| 0.713575
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,777
|
filter_ui.hpp
|
wwmm_easyeffects/include/filter_ui.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <adwaita.h>
#include <glib-object.h>
#include <glibconfig.h>
#include <gtk/gtkbox.h>
#include <memory>
#include <string>
#include "filter.hpp"
namespace ui::filter_box {
G_BEGIN_DECLS
#define EE_TYPE_FILTER_BOX (filter_box_get_type())
G_DECLARE_FINAL_TYPE(FilterBox, filter_box, EE, FILTER_BOX, GtkBox)
G_END_DECLS
auto create() -> FilterBox*;
void setup(FilterBox* self, std::shared_ptr<Filter> filter, const std::string& schema_path);
} // namespace ui::filter_box
| 1,253
|
C++
|
.h
| 34
| 35.058824
| 92
| 0.750207
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,778
|
application.hpp
|
wwmm_easyeffects/include/application.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <adwaita.h>
#include <gio/gio.h>
#include <glib-object.h>
#include <glib.h>
#include <glib/gi18n.h>
#include <glibconfig.h>
#include <sigc++/connection.h>
#include <vector>
#include "pipe_manager.hpp"
#include "presets_manager.hpp"
#include "stream_input_effects.hpp"
#include "stream_output_effects.hpp"
namespace app {
G_BEGIN_DECLS
#define EE_TYPE_APPLICATION (application_get_type())
G_DECLARE_FINAL_TYPE(Application, application, EE, APP, AdwApplication)
G_END_DECLS
struct Data {
public:
std::vector<sigc::connection> connections;
std::vector<gulong> gconnections, gconnections_sie, gconnections_soe;
};
struct _Application {
AdwApplication parent_instance;
GSettings* settings;
GSettings* soe_settings;
GSettings* sie_settings;
PipeManager* pm;
StreamOutputEffects* soe;
StreamInputEffects* sie;
PresetsManager* presets_manager;
Data* data;
};
auto application_new() -> GApplication*;
void hide_all_windows(GApplication* app);
} // namespace app
| 1,768
|
C++
|
.h
| 55
| 30.127273
| 73
| 0.76429
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,779
|
crossfeed_preset.hpp
|
wwmm_easyeffects/include/crossfeed_preset.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <nlohmann/json_fwd.hpp>
#include "plugin_preset_base.hpp"
#include "preset_type.hpp"
class CrossfeedPreset : public PluginPresetBase {
public:
explicit CrossfeedPreset(PresetType preset_type, const int& index = 0);
private:
void save(nlohmann::json& json) override;
void load(const nlohmann::json& json) override;
};
| 1,105
|
C++
|
.h
| 29
| 36.068966
| 73
| 0.757236
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,780
|
speex_preset.hpp
|
wwmm_easyeffects/include/speex_preset.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <nlohmann/json_fwd.hpp>
#include "plugin_preset_base.hpp"
#include "preset_type.hpp"
class SpeexPreset : public PluginPresetBase {
public:
explicit SpeexPreset(PresetType preset_type, const int& index = 0);
private:
void save(nlohmann::json& json) override;
void load(const nlohmann::json& json) override;
};
| 1,097
|
C++
|
.h
| 29
| 35.793103
| 73
| 0.755409
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,781
|
gate.hpp
|
wwmm_easyeffects/include/gate.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <pipewire/proxy.h>
#include <sigc++/signal.h>
#include <sys/types.h>
#include <span>
#include <string>
#include <vector>
#include "pipe_manager.hpp"
#include "plugin_base.hpp"
class Gate : public PluginBase {
public:
Gate(const std::string& tag,
const std::string& schema,
const std::string& schema_path,
PipeManager* pipe_manager,
PipelineType pipe_type);
Gate(const Gate&) = delete;
auto operator=(const Gate&) -> Gate& = delete;
Gate(const Gate&&) = delete;
auto operator=(const Gate&&) -> Gate& = delete;
~Gate() override;
void setup() override;
void process(std::span<float>& left_in,
std::span<float>& right_in,
std::span<float>& left_out,
std::span<float>& right_out,
std::span<float>& probe_left,
std::span<float>& probe_right) override;
auto get_latency_seconds() -> float override;
void update_probe_links() override;
sigc::signal<void(const float)> attack_zone_start, attack_threshold, release_zone_start, release_threshold, reduction,
sidechain, curve, envelope;
float attack_zone_start_port_value = 0.0F;
float attack_threshold_port_value = 0.0F;
float release_zone_start_port_value = 0.0F;
float release_threshold_port_value = 0.0F;
float reduction_port_value = 0.0F;
float sidechain_port_value = 0.0F;
float curve_port_value = 0.0F;
float envelope_port_value = 0.0F;
private:
uint latency_n_frames = 0U;
std::vector<pw_proxy*> list_proxies;
void update_sidechain_links(const std::string& key);
};
| 2,354
|
C++
|
.h
| 63
| 33.444444
| 120
| 0.702062
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,782
|
tags_multiband_compressor.hpp
|
wwmm_easyeffects/include/tags_multiband_compressor.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <array>
namespace tags::multiband_compressor {
// mb comp band num const
constexpr unsigned n_bands = 8U;
// gsettings keys tags
constexpr auto band_enable = std::to_array({{"enable-band0"},
{"enable-band1"},
{"enable-band2"},
{"enable-band3"},
{"enable-band4"},
{"enable-band5"},
{"enable-band6"},
std::to_array("enable-band7")});
constexpr auto band_compression_mode = std::to_array({{"compression-mode0"},
{"compression-mode1"},
{"compression-mode2"},
{"compression-mode3"},
{"compression-mode4"},
{"compression-mode5"},
{"compression-mode6"},
std::to_array("compression-mode7")});
constexpr auto band_compressor_enable = std::to_array({{"compressor-enable0"},
{"compressor-enable1"},
{"compressor-enable2"},
{"compressor-enable3"},
{"compressor-enable4"},
{"compressor-enable5"},
{"compressor-enable6"},
std::to_array("compressor-enable7")});
constexpr auto band_split_frequency = std::to_array({{"split-frequency0"},
{"split-frequency1"},
{"split-frequency2"},
{"split-frequency3"},
{"split-frequency4"},
{"split-frequency5"},
{"split-frequency6"},
std::to_array("split-frequency7")});
constexpr auto band_mute = std::to_array(
{{"mute0"}, {"mute1"}, {"mute2"}, {"mute3"}, {"mute4"}, {"mute5"}, {"mute6"}, std::to_array("mute7")});
constexpr auto band_solo = std::to_array(
{{"solo0"}, {"solo1"}, {"solo2"}, {"solo3"}, {"solo4"}, {"solo5"}, {"solo6"}, std::to_array("solo7")});
constexpr auto band_lowcut_filter = std::to_array({{"sidechain-custom-lowcut-filter0"},
{"sidechain-custom-lowcut-filter1"},
{"sidechain-custom-lowcut-filter2"},
{"sidechain-custom-lowcut-filter3"},
{"sidechain-custom-lowcut-filter4"},
{"sidechain-custom-lowcut-filter5"},
{"sidechain-custom-lowcut-filter6"},
std::to_array("sidechain-custom-lowcut-filter7")});
constexpr auto band_highcut_filter = std::to_array({{"sidechain-custom-highcut-filter0"},
{"sidechain-custom-highcut-filter1"},
{"sidechain-custom-highcut-filter2"},
{"sidechain-custom-highcut-filter3"},
{"sidechain-custom-highcut-filter4"},
{"sidechain-custom-highcut-filter5"},
{"sidechain-custom-highcut-filter6"},
std::to_array("sidechain-custom-highcut-filter7")});
constexpr auto band_external_sidechain = std::to_array({{"external-sidechain0"},
{"external-sidechain1"},
{"external-sidechain2"},
{"external-sidechain3"},
{"external-sidechain4"},
{"external-sidechain5"},
{"external-sidechain6"},
std::to_array("external-sidechain7")});
constexpr auto band_sidechain_mode = std::to_array({{"sidechain-mode0"},
{"sidechain-mode1"},
{"sidechain-mode2"},
{"sidechain-mode3"},
{"sidechain-mode4"},
{"sidechain-mode5"},
{"sidechain-mode6"},
std::to_array("sidechain-mode7")});
constexpr auto band_sidechain_source = std::to_array({{"sidechain-source0"},
{"sidechain-source1"},
{"sidechain-source2"},
{"sidechain-source3"},
{"sidechain-source4"},
{"sidechain-source5"},
{"sidechain-source6"},
std::to_array("sidechain-source7")});
constexpr auto band_stereo_split_source = std::to_array({{"stereo-split-source0"},
{"stereo-split-source1"},
{"stereo-split-source2"},
{"stereo-split-source3"},
{"stereo-split-source4"},
{"stereo-split-source5"},
{"stereo-split-source6"},
std::to_array("stereo-split-source7")});
constexpr auto band_lowcut_filter_frequency = std::to_array({{"sidechain-lowcut-frequency0"},
{"sidechain-lowcut-frequency1"},
{"sidechain-lowcut-frequency2"},
{"sidechain-lowcut-frequency3"},
{"sidechain-lowcut-frequency4"},
{"sidechain-lowcut-frequency5"},
{"sidechain-lowcut-frequency6"},
std::to_array("sidechain-lowcut-frequency7")});
constexpr auto band_highcut_filter_frequency = std::to_array({{"sidechain-highcut-frequency0"},
{"sidechain-highcut-frequency1"},
{"sidechain-highcut-frequency2"},
{"sidechain-highcut-frequency3"},
{"sidechain-highcut-frequency4"},
{"sidechain-highcut-frequency5"},
{"sidechain-highcut-frequency6"},
std::to_array("sidechain-highcut-frequency7")});
constexpr auto band_attack_time = std::to_array({{"attack-time0"},
{"attack-time1"},
{"attack-time2"},
{"attack-time3"},
{"attack-time4"},
{"attack-time5"},
{"attack-time6"},
std::to_array("attack-time7")});
inline constexpr auto band_attack_threshold = std::to_array({{"attack-threshold0"},
{"attack-threshold1"},
{"attack-threshold2"},
{"attack-threshold3"},
{"attack-threshold4"},
{"attack-threshold5"},
{"attack-threshold6"},
std::to_array("attack-threshold7")});
inline constexpr auto band_release_time = std::to_array({{"release-time0"},
{"release-time1"},
{"release-time2"},
{"release-time3"},
{"release-time4"},
{"release-time5"},
{"release-time6"},
std::to_array("release-time7")});
inline constexpr auto band_release_threshold = std::to_array({{"release-threshold0"},
{"release-threshold1"},
{"release-threshold2"},
{"release-threshold3"},
{"release-threshold4"},
{"release-threshold5"},
{"release-threshold6"},
std::to_array("release-threshold7")});
constexpr auto band_ratio = std::to_array(
{{"ratio0"}, {"ratio1"}, {"ratio2"}, {"ratio3"}, {"ratio4"}, {"ratio5"}, {"ratio6"}, std::to_array("ratio7")});
constexpr auto band_knee = std::to_array(
{{"knee0"}, {"knee1"}, {"knee2"}, {"knee3"}, {"knee4"}, {"knee5"}, {"knee6"}, std::to_array("knee7")});
constexpr auto band_makeup = std::to_array({{"makeup0"},
{"makeup1"},
{"makeup2"},
{"makeup3"},
{"makeup4"},
{"makeup5"},
{"makeup6"},
std::to_array("makeup7")});
constexpr auto band_sidechain_preamp = std::to_array({{"sidechain-preamp0"},
{"sidechain-preamp1"},
{"sidechain-preamp2"},
{"sidechain-preamp3"},
{"sidechain-preamp4"},
{"sidechain-preamp5"},
{"sidechain-preamp6"},
std::to_array("sidechain-preamp7")});
constexpr auto band_sidechain_reactivity = std::to_array({{"sidechain-reactivity0"},
{"sidechain-reactivity1"},
{"sidechain-reactivity2"},
{"sidechain-reactivity3"},
{"sidechain-reactivity4"},
{"sidechain-reactivity5"},
{"sidechain-reactivity6"},
std::to_array("sidechain-reactivity7")});
constexpr auto band_sidechain_lookahead = std::to_array({{"sidechain-lookahead0"},
{"sidechain-lookahead1"},
{"sidechain-lookahead2"},
{"sidechain-lookahead3"},
{"sidechain-lookahead4"},
{"sidechain-lookahead5"},
{"sidechain-lookahead6"},
std::to_array("sidechain-lookahead7")});
constexpr auto band_boost_amount = std::to_array({{"boost-amount0"},
{"boost-amount1"},
{"boost-amount2"},
{"boost-amount3"},
{"boost-amount4"},
{"boost-amount5"},
{"boost-amount6"},
std::to_array("boost-amount7")});
constexpr auto band_boost_threshold = std::to_array({{"boost-threshold0"},
{"boost-threshold1"},
{"boost-threshold2"},
{"boost-threshold3"},
{"boost-threshold4"},
{"boost-threshold5"},
{"boost-threshold6"},
std::to_array("boost-threshold7")});
// LSP port tags
constexpr auto sce = std::to_array(
{{"sce_0"}, {"sce_1"}, {"sce_2"}, {"sce_3"}, {"sce_4"}, {"sce_5"}, {"sce_6"}, std::to_array("sce_7")});
constexpr auto cbe = std::to_array(
{{"cbe_0"}, {"cbe_1"}, {"cbe_2"}, {"cbe_3"}, {"cbe_4"}, {"cbe_5"}, {"cbe_6"}, std::to_array("cbe_7")});
constexpr auto sf =
std::to_array({{"sf_0"}, {"sf_1"}, {"sf_2"}, {"sf_3"}, {"sf_4"}, {"sf_5"}, {"sf_6"}, std::to_array("sf_7")});
constexpr auto sscs = std::to_array(
{{"sscs_0"}, {"sscs_1"}, {"sscs_2"}, {"sscs_3"}, {"sscs_4"}, {"sscs_5"}, {"sscs_6"}, std::to_array("sscs_7")});
constexpr auto scs = std::to_array(
{{"scs_0"}, {"scs_1"}, {"scs_2"}, {"scs_3"}, {"scs_4"}, {"scs_5"}, {"scs_6"}, std::to_array("scs_7")});
constexpr auto scm = std::to_array(
{{"scm_0"}, {"scm_1"}, {"scm_2"}, {"scm_3"}, {"scm_4"}, {"scm_5"}, {"scm_6"}, std::to_array("scm_7")});
constexpr auto sla = std::to_array(
{{"sla_0"}, {"sla_1"}, {"sla_2"}, {"sla_3"}, {"sla_4"}, {"sla_5"}, {"sla_6"}, std::to_array("sla_7")});
constexpr auto scr = std::to_array(
{{"scr_0"}, {"scr_1"}, {"scr_2"}, {"scr_3"}, {"scr_4"}, {"scr_5"}, {"scr_6"}, std::to_array("scr_7")});
constexpr auto scp = std::to_array(
{{"scp_0"}, {"scp_1"}, {"scp_2"}, {"scp_3"}, {"scp_4"}, {"scp_5"}, {"scp_6"}, std::to_array("scp_7")});
constexpr auto sclc = std::to_array(
{{"sclc_0"}, {"sclc_1"}, {"sclc_2"}, {"sclc_3"}, {"sclc_4"}, {"sclc_5"}, {"sclc_6"}, std::to_array("sclc_7")});
constexpr auto schc = std::to_array(
{{"schc_0"}, {"schc_1"}, {"schc_2"}, {"schc_3"}, {"schc_4"}, {"schc_5"}, {"schc_6"}, std::to_array("schc_7")});
constexpr auto sclf = std::to_array(
{{"sclf_0"}, {"sclf_1"}, {"sclf_2"}, {"sclf_3"}, {"sclf_4"}, {"sclf_5"}, {"sclf_6"}, std::to_array("sclf_7")});
constexpr auto schf = std::to_array(
{{"schf_0"}, {"schf_1"}, {"schf_2"}, {"schf_3"}, {"schf_4"}, {"schf_5"}, {"schf_6"}, std::to_array("schf_7")});
constexpr auto cm =
std::to_array({{"cm_0"}, {"cm_1"}, {"cm_2"}, {"cm_3"}, {"cm_4"}, {"cm_5"}, {"cm_6"}, std::to_array("cm_7")});
constexpr auto ce =
std::to_array({{"ce_0"}, {"ce_1"}, {"ce_2"}, {"ce_3"}, {"ce_4"}, {"ce_5"}, {"ce_6"}, std::to_array("ce_7")});
constexpr auto bs =
std::to_array({{"bs_0"}, {"bs_1"}, {"bs_2"}, {"bs_3"}, {"bs_4"}, {"bs_5"}, {"bs_6"}, std::to_array("bs_7")});
constexpr auto bm =
std::to_array({{"bm_0"}, {"bm_1"}, {"bm_2"}, {"bm_3"}, {"bm_4"}, {"bm_5"}, {"bm_6"}, std::to_array("bm_7")});
constexpr auto al =
std::to_array({{"al_0"}, {"al_1"}, {"al_2"}, {"al_3"}, {"al_4"}, {"al_5"}, {"al_6"}, std::to_array("al_7")});
constexpr auto at =
std::to_array({{"at_0"}, {"at_1"}, {"at_2"}, {"at_3"}, {"at_4"}, {"at_5"}, {"at_6"}, std::to_array("at_7")});
constexpr auto rrl = std::to_array(
{{"rrl_0"}, {"rrl_1"}, {"rrl_2"}, {"rrl_3"}, {"rrl_4"}, {"rrl_5"}, {"rrl_6"}, std::to_array("rrl_7")});
constexpr auto rt =
std::to_array({{"rt_0"}, {"rt_1"}, {"rt_2"}, {"rt_3"}, {"rt_4"}, {"rt_5"}, {"rt_6"}, std::to_array("rt_7")});
constexpr auto cr =
std::to_array({{"cr_0"}, {"cr_1"}, {"cr_2"}, {"cr_3"}, {"cr_4"}, {"cr_5"}, {"cr_6"}, std::to_array("cr_7")});
constexpr auto kn =
std::to_array({{"kn_0"}, {"kn_1"}, {"kn_2"}, {"kn_3"}, {"kn_4"}, {"kn_5"}, {"kn_6"}, std::to_array("kn_7")});
constexpr auto bth = std::to_array(
{{"bth_0"}, {"bth_1"}, {"bth_2"}, {"bth_3"}, {"bth_4"}, {"bth_5"}, {"bth_6"}, std::to_array("bth_7")});
constexpr auto bsa = std::to_array(
{{"bsa_0"}, {"bsa_1"}, {"bsa_2"}, {"bsa_3"}, {"bsa_4"}, {"bsa_5"}, {"bsa_6"}, std::to_array("bsa_7")});
constexpr auto mk =
std::to_array({{"mk_0"}, {"mk_1"}, {"mk_2"}, {"mk_3"}, {"mk_4"}, {"mk_5"}, {"mk_6"}, std::to_array("mk_7")});
} // namespace tags::multiband_compressor
| 19,514
|
C++
|
.h
| 262
| 40.774809
| 115
| 0.360827
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,783
|
spectrum.hpp
|
wwmm_easyeffects/include/spectrum.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <atomic>
#include <fftw3.h>
#include <sigc++/signal.h>
#include <sys/types.h>
#include <deque>
#include <span>
#include <string>
#include <vector>
#include "pipe_manager.hpp"
#include "plugin_base.hpp"
class Spectrum : public PluginBase {
public:
Spectrum(const std::string& tag,
const std::string& schema,
const std::string& schema_path,
PipeManager* pipe_manager,
PipelineType pipe_type);
Spectrum(const Spectrum&) = delete;
auto operator=(const Spectrum&) -> Spectrum& = delete;
Spectrum(const Spectrum&&) = delete;
auto operator=(const Spectrum&&) -> Spectrum& = delete;
~Spectrum() override;
void setup() override;
void process(std::span<float>& left_in,
std::span<float>& right_in,
std::span<float>& left_out,
std::span<float>& right_out) override;
auto get_latency_seconds() -> float override;
std::tuple<uint, uint, double*> compute_magnitudes(); // rate, nbands, magnitudes
private:
std::atomic<bool> fftw_ready = false;
fftwf_plan plan = nullptr;
fftwf_complex* complex_output = nullptr;
static constexpr uint n_bands = 8192U;
std::array<float, n_bands> real_input;
std::array<double, n_bands / 2U + 1U> output;
std::vector<float> left_delayed_vector;
std::vector<float> right_delayed_vector;
std::span<float> left_delayed;
std::span<float> right_delayed;
std::array<float, n_bands> latest_samples_mono;
std::array<float, n_bands> hann_window;
enum {
DB_BIT_IDX = (1 << 0), // To which db_buffers array process() should write.
DB_BIT_NEWDATA = (1 << 1), // If new data has been written by process().
DB_BIT_BUSY = (1 << 2), // If process() is currently writing data.
};
std::array<std::array<float, n_bands>, 2> db_buffers;
std::atomic<int> db_control = {0};
static_assert(std::atomic<int>::is_always_lock_free);
};
| 2,688
|
C++
|
.h
| 70
| 34.642857
| 84
| 0.69142
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,784
|
tags_multiband_gate.hpp
|
wwmm_easyeffects/include/tags_multiband_gate.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <array>
namespace tags::multiband_gate {
// mb gate band num const
constexpr unsigned n_bands = 8U;
// gsettings keys tags
constexpr auto band_enable = std::to_array({{"enable-band0"},
{"enable-band1"},
{"enable-band2"},
{"enable-band3"},
{"enable-band4"},
{"enable-band5"},
{"enable-band6"},
std::to_array("enable-band7")});
constexpr auto band_gate_enable = std::to_array({{"gate-enable0"},
{"gate-enable1"},
{"gate-enable2"},
{"gate-enable3"},
{"gate-enable4"},
{"gate-enable5"},
{"gate-enable6"},
std::to_array("gate-enable7")});
constexpr auto band_split_frequency = std::to_array({{"split-frequency0"},
{"split-frequency1"},
{"split-frequency2"},
{"split-frequency3"},
{"split-frequency4"},
{"split-frequency5"},
{"split-frequency6"},
std::to_array("split-frequency7")});
constexpr auto band_mute = std::to_array(
{{"mute0"}, {"mute1"}, {"mute2"}, {"mute3"}, {"mute4"}, {"mute5"}, {"mute6"}, std::to_array("mute7")});
constexpr auto band_solo = std::to_array(
{{"solo0"}, {"solo1"}, {"solo2"}, {"solo3"}, {"solo4"}, {"solo5"}, {"solo6"}, std::to_array("solo7")});
constexpr auto band_lowcut_filter = std::to_array({{"sidechain-custom-lowcut-filter0"},
{"sidechain-custom-lowcut-filter1"},
{"sidechain-custom-lowcut-filter2"},
{"sidechain-custom-lowcut-filter3"},
{"sidechain-custom-lowcut-filter4"},
{"sidechain-custom-lowcut-filter5"},
{"sidechain-custom-lowcut-filter6"},
std::to_array("sidechain-custom-lowcut-filter7")});
constexpr auto band_highcut_filter = std::to_array({{"sidechain-custom-highcut-filter0"},
{"sidechain-custom-highcut-filter1"},
{"sidechain-custom-highcut-filter2"},
{"sidechain-custom-highcut-filter3"},
{"sidechain-custom-highcut-filter4"},
{"sidechain-custom-highcut-filter5"},
{"sidechain-custom-highcut-filter6"},
std::to_array("sidechain-custom-highcut-filter7")});
constexpr auto band_external_sidechain = std::to_array({{"external-sidechain0"},
{"external-sidechain1"},
{"external-sidechain2"},
{"external-sidechain3"},
{"external-sidechain4"},
{"external-sidechain5"},
{"external-sidechain6"},
std::to_array("external-sidechain7")});
constexpr auto band_sidechain_mode = std::to_array({{"sidechain-mode0"},
{"sidechain-mode1"},
{"sidechain-mode2"},
{"sidechain-mode3"},
{"sidechain-mode4"},
{"sidechain-mode5"},
{"sidechain-mode6"},
std::to_array("sidechain-mode7")});
constexpr auto band_sidechain_source = std::to_array({{"sidechain-source0"},
{"sidechain-source1"},
{"sidechain-source2"},
{"sidechain-source3"},
{"sidechain-source4"},
{"sidechain-source5"},
{"sidechain-source6"},
std::to_array("sidechain-source7")});
constexpr auto band_stereo_split_source = std::to_array({{"stereo-split-source0"},
{"stereo-split-source1"},
{"stereo-split-source2"},
{"stereo-split-source3"},
{"stereo-split-source4"},
{"stereo-split-source5"},
{"stereo-split-source6"},
std::to_array("stereo-split-source7")});
constexpr auto band_lowcut_filter_frequency = std::to_array({{"sidechain-lowcut-frequency0"},
{"sidechain-lowcut-frequency1"},
{"sidechain-lowcut-frequency2"},
{"sidechain-lowcut-frequency3"},
{"sidechain-lowcut-frequency4"},
{"sidechain-lowcut-frequency5"},
{"sidechain-lowcut-frequency6"},
std::to_array("sidechain-lowcut-frequency7")});
constexpr auto band_highcut_filter_frequency = std::to_array({{"sidechain-highcut-frequency0"},
{"sidechain-highcut-frequency1"},
{"sidechain-highcut-frequency2"},
{"sidechain-highcut-frequency3"},
{"sidechain-highcut-frequency4"},
{"sidechain-highcut-frequency5"},
{"sidechain-highcut-frequency6"},
std::to_array("sidechain-highcut-frequency7")});
constexpr auto band_attack_time = std::to_array({{"attack-time0"},
{"attack-time1"},
{"attack-time2"},
{"attack-time3"},
{"attack-time4"},
{"attack-time5"},
{"attack-time6"},
std::to_array("attack-time7")});
constexpr auto band_release_time = std::to_array({{"release-time0"},
{"release-time1"},
{"release-time2"},
{"release-time3"},
{"release-time4"},
{"release-time5"},
{"release-time6"},
std::to_array("release-time7")});
constexpr auto band_hysteresis = std::to_array({{"hysteresis0"},
{"hysteresis1"},
{"hysteresis2"},
{"hysteresis3"},
{"hysteresis4"},
{"hysteresis5"},
{"hysteresis6"},
std::to_array("hysteresis7")});
constexpr auto band_hysteresis_threshold = std::to_array({{"hysteresis-threshold0"},
{"hysteresis-threshold1"},
{"hysteresis-threshold2"},
{"hysteresis-threshold3"},
{"hysteresis-threshold4"},
{"hysteresis-threshold5"},
{"hysteresis-threshold6"},
std::to_array("hysteresis-threshold7")});
constexpr auto band_hysteresis_zone = std::to_array({{"hysteresis-zone0"},
{"hysteresis-zone1"},
{"hysteresis-zone2"},
{"hysteresis-zone3"},
{"hysteresis-zone4"},
{"hysteresis-zone5"},
{"hysteresis-zone6"},
std::to_array("hysteresis-zone7")});
constexpr auto band_curve_threshold = std::to_array({{"curve-threshold0"},
{"curve-threshold1"},
{"curve-threshold2"},
{"curve-threshold3"},
{"curve-threshold4"},
{"curve-threshold5"},
{"curve-threshold6"},
std::to_array("curve-threshold7")});
constexpr auto band_curve_zone = std::to_array({{"curve-zone0"},
{"curve-zone1"},
{"curve-zone2"},
{"curve-zone3"},
{"curve-zone4"},
{"curve-zone5"},
{"curve-zone6"},
std::to_array("curve-zone7")});
constexpr auto band_reduction = std::to_array({{"reduction0"},
{"reduction1"},
{"reduction2"},
{"reduction3"},
{"reduction4"},
{"reduction5"},
{"reduction6"},
std::to_array("reduction7")});
constexpr auto band_makeup = std::to_array({{"makeup0"},
{"makeup1"},
{"makeup2"},
{"makeup3"},
{"makeup4"},
{"makeup5"},
{"makeup6"},
std::to_array("makeup7")});
constexpr auto band_sidechain_preamp = std::to_array({{"sidechain-preamp0"},
{"sidechain-preamp1"},
{"sidechain-preamp2"},
{"sidechain-preamp3"},
{"sidechain-preamp4"},
{"sidechain-preamp5"},
{"sidechain-preamp6"},
std::to_array("sidechain-preamp7")});
constexpr auto band_sidechain_reactivity = std::to_array({{"sidechain-reactivity0"},
{"sidechain-reactivity1"},
{"sidechain-reactivity2"},
{"sidechain-reactivity3"},
{"sidechain-reactivity4"},
{"sidechain-reactivity5"},
{"sidechain-reactivity6"},
std::to_array("sidechain-reactivity7")});
constexpr auto band_sidechain_lookahead = std::to_array({{"sidechain-lookahead0"},
{"sidechain-lookahead1"},
{"sidechain-lookahead2"},
{"sidechain-lookahead3"},
{"sidechain-lookahead4"},
{"sidechain-lookahead5"},
{"sidechain-lookahead6"},
std::to_array("sidechain-lookahead7")});
// LSP port tags
constexpr auto cbe = std::to_array(
{{"cbe_0"}, {"cbe_1"}, {"cbe_2"}, {"cbe_3"}, {"cbe_4"}, {"cbe_5"}, {"cbe_6"}, std::to_array("cbe_7")});
constexpr auto sf =
std::to_array({{"sf_0"}, {"sf_1"}, {"sf_2"}, {"sf_3"}, {"sf_4"}, {"sf_5"}, {"sf_6"}, std::to_array("sf_7")});
constexpr auto sce = std::to_array(
{{"sce_0"}, {"sce_1"}, {"sce_2"}, {"sce_3"}, {"sce_4"}, {"sce_5"}, {"sce_6"}, std::to_array("sce_7")});
constexpr auto sscs = std::to_array(
{{"sscs_0"}, {"sscs_1"}, {"sscs_2"}, {"sscs_3"}, {"sscs_4"}, {"sscs_5"}, {"sscs_6"}, std::to_array("sscs_7")});
constexpr auto scs = std::to_array(
{{"scs_0"}, {"scs_1"}, {"scs_2"}, {"scs_3"}, {"scs_4"}, {"scs_5"}, {"scs_6"}, std::to_array("scs_7")});
constexpr auto scm = std::to_array(
{{"scm_0"}, {"scm_1"}, {"scm_2"}, {"scm_3"}, {"scm_4"}, {"scm_5"}, {"scm_6"}, std::to_array("scm_7")});
constexpr auto sla = std::to_array(
{{"sla_0"}, {"sla_1"}, {"sla_2"}, {"sla_3"}, {"sla_4"}, {"sla_5"}, {"sla_6"}, std::to_array("sla_7")});
constexpr auto scr = std::to_array(
{{"scr_0"}, {"scr_1"}, {"scr_2"}, {"scr_3"}, {"scr_4"}, {"scr_5"}, {"scr_6"}, std::to_array("scr_7")});
constexpr auto scp = std::to_array(
{{"scp_0"}, {"scp_1"}, {"scp_2"}, {"scp_3"}, {"scp_4"}, {"scp_5"}, {"scp_6"}, std::to_array("scp_7")});
constexpr auto sclc = std::to_array(
{{"sclc_0"}, {"sclc_1"}, {"sclc_2"}, {"sclc_3"}, {"sclc_4"}, {"sclc_5"}, {"sclc_6"}, std::to_array("sclc_7")});
constexpr auto schc = std::to_array(
{{"schc_0"}, {"schc_1"}, {"schc_2"}, {"schc_3"}, {"schc_4"}, {"schc_5"}, {"schc_6"}, std::to_array("schc_7")});
constexpr auto sclf = std::to_array(
{{"sclf_0"}, {"sclf_1"}, {"sclf_2"}, {"sclf_3"}, {"sclf_4"}, {"sclf_5"}, {"sclf_6"}, std::to_array("sclf_7")});
constexpr auto schf = std::to_array(
{{"schf_0"}, {"schf_1"}, {"schf_2"}, {"schf_3"}, {"schf_4"}, {"schf_5"}, {"schf_6"}, std::to_array("schf_7")});
constexpr auto ce =
std::to_array({{"ge_0"}, {"ge_1"}, {"ge_2"}, {"ge_3"}, {"ge_4"}, {"ge_5"}, {"ge_6"}, std::to_array("ge_7")});
constexpr auto bs =
std::to_array({{"bs_0"}, {"bs_1"}, {"bs_2"}, {"bs_3"}, {"bs_4"}, {"bs_5"}, {"bs_6"}, std::to_array("bs_7")});
constexpr auto bm =
std::to_array({{"bm_0"}, {"bm_1"}, {"bm_2"}, {"bm_3"}, {"bm_4"}, {"bm_5"}, {"bm_6"}, std::to_array("bm_7")});
constexpr auto gh =
std::to_array({{"gh_0"}, {"gh_1"}, {"gh_2"}, {"gh_3"}, {"gh_4"}, {"gh_5"}, {"gh_6"}, std::to_array("gh_7")});
constexpr auto ht =
std::to_array({{"ht_0"}, {"ht_1"}, {"ht_2"}, {"ht_3"}, {"ht_4"}, {"ht_5"}, {"ht_6"}, std::to_array("ht_7")});
constexpr auto hz =
std::to_array({{"hz_0"}, {"hz_1"}, {"hz_2"}, {"hz_3"}, {"hz_4"}, {"hz_5"}, {"hz_6"}, std::to_array("hz_7")});
constexpr auto gt =
std::to_array({{"gt_0"}, {"gt_1"}, {"gt_2"}, {"gt_3"}, {"gt_4"}, {"gt_5"}, {"gt_6"}, std::to_array("gt_7")});
constexpr auto gz =
std::to_array({{"gz_0"}, {"gz_1"}, {"gz_2"}, {"gz_3"}, {"gz_4"}, {"gz_5"}, {"gz_6"}, std::to_array("gz_7")});
constexpr auto at =
std::to_array({{"at_0"}, {"at_1"}, {"at_2"}, {"at_3"}, {"at_4"}, {"at_5"}, {"at_6"}, std::to_array("at_7")});
constexpr auto rt =
std::to_array({{"rt_0"}, {"rt_1"}, {"rt_2"}, {"rt_3"}, {"rt_4"}, {"rt_5"}, {"rt_6"}, std::to_array("rt_7")});
constexpr auto gr =
std::to_array({{"gr_0"}, {"gr_1"}, {"gr_2"}, {"gr_3"}, {"gr_4"}, {"gr_5"}, {"gr_6"}, std::to_array("gr_7")});
constexpr auto mk =
std::to_array({{"mk_0"}, {"mk_1"}, {"mk_2"}, {"mk_3"}, {"mk_4"}, {"mk_5"}, {"mk_6"}, std::to_array("mk_7")});
} // namespace tags::multiband_gate
| 19,186
|
C++
|
.h
| 264
| 38.897727
| 115
| 0.353318
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,785
|
preferences_general.hpp
|
wwmm_easyeffects/include/preferences_general.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <adwaita.h>
#include <glib-object.h>
#include <glibconfig.h>
#ifdef ENABLE_LIBPORTAL
#include "libportal.hpp"
#endif
namespace ui::preferences::general {
G_BEGIN_DECLS
#define EE_TYPE_PREFERENCES_GENERAL (preferences_general_get_type())
G_DECLARE_FINAL_TYPE(PreferencesGeneral, preferences_general, EE, PREFERENCES_GENERAL, AdwPreferencesPage)
G_END_DECLS
auto create() -> PreferencesGeneral*;
} // namespace ui::preferences::general
| 1,219
|
C++
|
.h
| 32
| 36.28125
| 106
| 0.7691
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,786
|
autogain.hpp
|
wwmm_easyeffects/include/autogain.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <ebur128.h>
#include <sigc++/signal.h>
#include <sys/types.h>
#include <span>
#include <string>
#include <thread>
#include <vector>
#include "pipe_manager.hpp"
#include "plugin_base.hpp"
class AutoGain : public PluginBase {
public:
AutoGain(const std::string& tag,
const std::string& schema,
const std::string& schema_path,
PipeManager* pipe_manager,
PipelineType pipe_type);
AutoGain(const AutoGain&) = delete;
auto operator=(const AutoGain&) -> AutoGain& = delete;
AutoGain(const AutoGain&&) = delete;
auto operator=(const AutoGain&&) -> AutoGain& = delete;
~AutoGain() override;
enum class Reference {
momentary,
shortterm,
integrated,
geometric_mean_msi,
geometric_mean_ms,
geometric_mean_mi,
geometric_mean_si
};
void setup() override;
void process(std::span<float>& left_in,
std::span<float>& right_in,
std::span<float>& left_out,
std::span<float>& right_out) override;
auto get_latency_seconds() -> float override;
sigc::signal<void(const double, // loudness
const double, // gain
const double, // momentary
const double, // shortterm
const double, // integrated
const double, // relative
const double)>
results; // range
double momentary = 0.0;
double shortterm = 0.0;
double global = 0.0;
double relative = 0.0;
double range = 0.0;
double loudness = 0.0;
private:
bool ebur128_ready = false;
uint old_rate = 0U;
double target = -23.0; // target loudness level
double silence_threshold = -70.0;
double internal_output_gain = 1.0;
Reference reference = Reference::geometric_mean_msi;
std::vector<float> data;
ebur128_state* ebur_state = nullptr;
std::vector<std::thread> mythreads;
auto init_ebur128() -> bool;
static auto parse_reference_key(const std::string& key) -> Reference;
void set_maximum_history(const int& seconds);
};
| 2,844
|
C++
|
.h
| 83
| 29.156627
| 73
| 0.671043
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,787
|
tags_plugin_name.hpp
|
wwmm_easyeffects/include/tags_plugin_name.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <sys/types.h>
#include <array>
#include <map>
#include <string>
#include <string_view>
namespace tags::plugin_package {
inline constexpr auto bs2b = "bs2b";
inline constexpr auto calf = "Calf Studio Gear";
inline constexpr auto deepfilternet = "DeepFilterNet";
inline constexpr auto ebur128 = "libebur128";
inline constexpr auto ee = "Easy Effects";
inline constexpr auto lsp = "Linux Studio Plugins";
inline constexpr auto mda = "MDA";
inline constexpr auto rnnoise = "RNNoise";
inline constexpr auto sound_touch = "SoundTouch";
inline constexpr auto speex = "SpeexDSP";
inline constexpr auto zam = "ZamAudio";
inline constexpr auto zita = "Zita";
} // namespace tags::plugin_package
namespace tags::plugin_name {
inline constexpr auto autogain = "autogain";
inline constexpr auto bass_enhancer = "bass_enhancer";
inline constexpr auto bass_loudness = "bass_loudness";
inline constexpr auto compressor = "compressor";
inline constexpr auto convolver = "convolver";
inline constexpr auto crossfeed = "crossfeed";
inline constexpr auto crystalizer = "crystalizer";
inline constexpr auto deepfilternet = "deepfilternet";
inline constexpr auto deesser = "deesser";
inline constexpr auto delay = "delay";
inline constexpr auto echo_canceller = "echo_canceller";
inline constexpr auto equalizer = "equalizer";
inline constexpr auto exciter = "exciter";
inline constexpr auto expander = "expander";
inline constexpr auto filter = "filter";
inline constexpr auto gate = "gate";
inline constexpr auto level_meter = "level_meter";
inline constexpr auto limiter = "limiter";
inline constexpr auto loudness = "loudness";
inline constexpr auto maximizer = "maximizer";
inline constexpr auto multiband_compressor = "multiband_compressor";
inline constexpr auto multiband_gate = "multiband_gate";
inline constexpr auto pitch = "pitch";
inline constexpr auto speex = "speex";
inline constexpr auto reverb = "reverb";
inline constexpr auto rnnoise = "rnnoise";
inline constexpr auto stereo_tools = "stereo_tools";
inline constexpr auto list = std::to_array(
{autogain, bass_enhancer, bass_loudness, compressor, convolver, crossfeed, crystalizer,
deesser, delay, deepfilternet, echo_canceller, equalizer, exciter, expander,
filter, gate, level_meter, limiter, loudness, maximizer, multiband_compressor,
multiband_gate, pitch, reverb, rnnoise, speex, stereo_tools});
auto get_translated() -> std::map<std::string, std::string>;
auto get_base_name(std::string_view name) -> std::string;
auto get_id(const std::string& name) -> uint;
} // namespace tags::plugin_name
| 3,478
|
C++
|
.h
| 75
| 44.24
| 112
| 0.750149
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,788
|
multiband_compressor_band_box.hpp
|
wwmm_easyeffects/include/multiband_compressor_band_box.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <adwaita.h>
#include <gio/gio.h>
#include <glib-object.h>
#include <glibconfig.h>
#include <gtk/gtkbox.h>
namespace ui::multiband_compressor_band_box {
G_BEGIN_DECLS
#define EE_TYPE_MULTIBAND_COMPRESSOR_BAND_BOX (multiband_compressor_band_box_get_type())
G_DECLARE_FINAL_TYPE(MultibandCompressorBandBox,
multiband_compressor_band_box,
EE,
MULTIBAND_COMPRESSOR_BAND_BOX,
GtkBox)
G_END_DECLS
auto create() -> MultibandCompressorBandBox*;
void setup(MultibandCompressorBandBox* self, GSettings* settings, int index);
void set_end_label(MultibandCompressorBandBox* self, const float& value);
void set_envelope_label(MultibandCompressorBandBox* self, const float& value);
void set_curve_label(MultibandCompressorBandBox* self, const float& value);
void set_gain_label(MultibandCompressorBandBox* self, const float& value);
} // namespace ui::multiband_compressor_band_box
| 1,741
|
C++
|
.h
| 40
| 39.65
| 88
| 0.74511
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,789
|
fir_filter_base.hpp
|
wwmm_easyeffects/include/fir_filter_base.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <sys/types.h>
#include <zita-convolver.h>
#include <algorithm>
#include <span>
#include <string>
#include <vector>
#include "util.hpp"
class FirFilterBase {
public:
FirFilterBase(std::string tag);
FirFilterBase(const FirFilterBase&) = delete;
auto operator=(const FirFilterBase&) -> FirFilterBase& = delete;
FirFilterBase(const FirFilterBase&&) = delete;
auto operator=(const FirFilterBase&&) -> FirFilterBase& = delete;
virtual ~FirFilterBase();
void set_rate(const uint& value);
void set_n_samples(const uint& value);
void set_min_frequency(const float& value);
void set_max_frequency(const float& value);
void set_transition_band(const float& value);
virtual void setup();
[[nodiscard]] auto get_delay() const -> float;
template <typename T1>
void process(T1& data_left, T1& data_right) {
std::span conv_left_in(conv->inpdata(0), n_samples);
std::span conv_right_in(conv->inpdata(1), n_samples);
std::span conv_left_out(conv->outdata(0), n_samples);
std::span conv_right_out(conv->outdata(1), n_samples);
std::copy(data_left.begin(), data_left.end(), conv_left_in.begin());
std::copy(data_right.begin(), data_right.end(), conv_right_in.begin());
if (zita_ready) {
const int& ret = conv->process(true); // thread sync mode set to true
if (ret != 0) {
util::debug(log_tag + "IR: process failed: " + util::to_string(ret, ""));
zita_ready = false;
} else {
std::copy(conv_left_out.begin(), conv_left_out.end(), data_left.begin());
std::copy(conv_right_out.begin(), conv_right_out.end(), data_right.begin());
}
}
}
protected:
const std::string log_tag;
bool zita_ready = false;
uint n_samples = 0U;
uint rate = 0U;
float min_frequency = 20.0F;
float max_frequency = 22000.0F;
float transition_band = 100.0F; // Hz
float delay = 0.0F;
std::vector<float> kernel;
Convproc* conv = nullptr;
[[nodiscard]] auto create_lowpass_kernel(const float& cutoff, const float& transition_band) const
-> std::vector<float>;
void setup_zita();
static void direct_conv(const std::vector<float>& a, const std::vector<float>& b, std::vector<float>& c);
};
| 2,990
|
C++
|
.h
| 76
| 35.763158
| 107
| 0.696089
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,790
|
loudness_preset.hpp
|
wwmm_easyeffects/include/loudness_preset.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <nlohmann/json_fwd.hpp>
#include "plugin_preset_base.hpp"
#include "preset_type.hpp"
class LoudnessPreset : public PluginPresetBase {
public:
explicit LoudnessPreset(PresetType preset_type, const int& index = 0);
private:
void save(nlohmann::json& json) override;
void load(const nlohmann::json& json) override;
};
| 1,103
|
C++
|
.h
| 29
| 36
| 73
| 0.756782
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,791
|
bass_enhancer_preset.hpp
|
wwmm_easyeffects/include/bass_enhancer_preset.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <nlohmann/json_fwd.hpp>
#include "plugin_preset_base.hpp"
#include "preset_type.hpp"
class BassEnhancerPreset : public PluginPresetBase {
public:
explicit BassEnhancerPreset(PresetType preset_type, const int& index = 0);
private:
void save(nlohmann::json& json) override;
void load(const nlohmann::json& json) override;
};
| 1,110
|
C++
|
.h
| 29
| 36.241379
| 76
| 0.759294
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,792
|
plugin_base.hpp
|
wwmm_easyeffects/include/plugin_base.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <gio/gio.h>
#include <glib.h>
#include <atomic>
#include <pipewire/filter.h>
#include <sigc++/signal.h>
#include <spa/utils/hook.h>
#include <sys/types.h>
#include <chrono>
#include <memory>
#include <mutex>
#include <span>
#include <string>
#include <vector>
#include "lv2_wrapper.hpp"
#include "pipe_manager.hpp"
#include "pipeline_type.hpp"
#include "util.hpp"
class PluginBase {
public:
PluginBase(std::string tag,
std::string plugin_name,
std::string plugin_package,
const std::string& schema,
const std::string& schema_path,
PipeManager* pipe_manager,
PipelineType pipe_type,
const bool& enable_probe = false);
PluginBase(const PluginBase&) = delete;
auto operator=(const PluginBase&) -> PluginBase& = delete;
PluginBase(const PluginBase&&) = delete;
auto operator=(const PluginBase&&) -> PluginBase& = delete;
virtual ~PluginBase();
struct data;
struct port {
struct data* data;
};
struct data {
struct port* in_left = nullptr;
struct port* in_right = nullptr;
struct port* out_left = nullptr;
struct port* out_right = nullptr;
struct port* probe_left = nullptr;
struct port* probe_right = nullptr;
PluginBase* pb = nullptr;
};
const std::string log_tag;
std::string name, package;
PipelineType pipeline_type{};
pw_filter* filter = nullptr;
pw_filter_state state = PW_FILTER_STATE_UNCONNECTED;
bool can_get_node_id = false;
bool enable_probe = false;
uint n_samples = 0U;
uint rate = 0U;
bool package_installed = true;
std::atomic<bool> bypass = {false};
static_assert(std::atomic<bool>::is_always_lock_free);
bool connected_to_pw = false;
bool send_notifications = false;
float delta_t = 0.0F;
float notification_time_window = 1.0F / 20.0F; // seconds
float latency_value = 0.0F; // seconds
std::chrono::time_point<std::chrono::system_clock> clock_start;
std::vector<float> dummy_left, dummy_right;
[[nodiscard]] auto get_node_id() const -> uint;
void set_active(const bool& state) const;
void set_post_messages(const bool& state);
auto connect_to_pw() -> bool;
void disconnect_from_pw();
void reset_settings();
void show_native_ui();
void close_native_ui();
void set_native_ui_update_frequency(const uint& value);
virtual void setup();
virtual void process(std::span<float>& left_in,
std::span<float>& right_in,
std::span<float>& left_out,
std::span<float>& right_out);
virtual void process(std::span<float>& left_in,
std::span<float>& right_in,
std::span<float>& left_out,
std::span<float>& right_out,
std::span<float>& probe_left,
std::span<float>& probe_right);
virtual void update_probe_links();
virtual auto get_latency_seconds() -> float;
sigc::signal<void(const float, const float)> input_level;
sigc::signal<void(const float, const float)> output_level;
sigc::signal<void()> latency;
protected:
std::mutex data_mutex;
GSettings *settings = nullptr, *global_settings = nullptr;
PipeManager* pm = nullptr;
spa_hook listener{};
data pf_data = {};
bool post_messages = false;
uint n_ports = 4U;
float input_gain = 1.0F;
float output_gain = 1.0F;
std::unique_ptr<lv2::Lv2Wrapper> lv2_wrapper;
std::vector<gulong> gconnections;
void setup_input_output_gain();
void initialize_listener();
void notify();
void get_peaks(const std::span<float>& left_in,
const std::span<float>& right_in,
std::span<float>& left_out,
std::span<float>& right_out);
static void apply_gain(std::span<float>& left, std::span<float>& right, const float& gain);
void update_filter_params();
private:
uint node_id = 0U;
float input_peak_left = util::minimum_linear_level, input_peak_right = util::minimum_linear_level;
float output_peak_left = util::minimum_linear_level, output_peak_right = util::minimum_linear_level;
};
| 4,938
|
C++
|
.h
| 134
| 31.58209
| 102
| 0.673904
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,793
|
expander.hpp
|
wwmm_easyeffects/include/expander.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <pipewire/proxy.h>
#include <sigc++/signal.h>
#include <sys/types.h>
#include <span>
#include <string>
#include <vector>
#include "pipe_manager.hpp"
#include "plugin_base.hpp"
class Expander : public PluginBase {
public:
Expander(const std::string& tag,
const std::string& schema,
const std::string& schema_path,
PipeManager* pipe_manager,
PipelineType pipe_type);
Expander(const Expander&) = delete;
auto operator=(const Expander&) -> Expander& = delete;
Expander(const Expander&&) = delete;
auto operator=(const Expander&&) -> Expander& = delete;
~Expander() override;
void setup() override;
void process(std::span<float>& left_in,
std::span<float>& right_in,
std::span<float>& left_out,
std::span<float>& right_out,
std::span<float>& probe_left,
std::span<float>& probe_right) override;
auto get_latency_seconds() -> float override;
void update_probe_links() override;
sigc::signal<void(const float)> reduction, sidechain, curve, envelope;
float reduction_port_value = 0.0F;
float sidechain_port_value = 0.0F;
float curve_port_value = 0.0F;
float envelope_port_value = 0.0F;
private:
uint latency_n_frames = 0U;
std::vector<pw_proxy*> list_proxies;
void update_sidechain_links(const std::string& key);
};
| 2,152
|
C++
|
.h
| 58
| 32.896552
| 73
| 0.697406
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,794
|
convolver_ui_common.hpp
|
wwmm_easyeffects/include/convolver_ui_common.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <filesystem>
#include <string>
#include <tuple>
#include <vector>
namespace ui::convolver {
auto read_kernel(std::filesystem::path irs_dir, const std::string& irs_ext, const std::string& file_name)
-> std::tuple<int, std::vector<float>, std::vector<float>>;
}
| 1,043
|
C++
|
.h
| 27
| 36.703704
| 105
| 0.743083
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,795
|
pipe_manager_box.hpp
|
wwmm_easyeffects/include/pipe_manager_box.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <adwaita.h>
#include <glib-object.h>
#include <glibconfig.h>
#include <gtk/gtkbox.h>
#include "application.hpp"
namespace ui::pipe_manager_box {
G_BEGIN_DECLS
#define EE_TYPE_PIPE_MANAGER_BOX (pipe_manager_box_get_type())
G_DECLARE_FINAL_TYPE(PipeManagerBox, pipe_manager_box, EE, PIPE_MANAGER_BOX, GtkBox)
G_END_DECLS
auto create() -> PipeManagerBox*;
void setup(PipeManagerBox* self, app::Application* application);
} // namespace ui::pipe_manager_box
| 1,239
|
C++
|
.h
| 32
| 36.90625
| 84
| 0.75793
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,796
|
stereo_tools.hpp
|
wwmm_easyeffects/include/stereo_tools.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <span>
#include <string>
#include "pipe_manager.hpp"
#include "plugin_base.hpp"
class StereoTools : public PluginBase {
public:
StereoTools(const std::string& tag,
const std::string& schema,
const std::string& schema_path,
PipeManager* pipe_manager,
PipelineType pipe_type);
StereoTools(const StereoTools&) = delete;
auto operator=(const StereoTools&) -> StereoTools& = delete;
StereoTools(const StereoTools&&) = delete;
auto operator=(const StereoTools&&) -> StereoTools& = delete;
~StereoTools() override;
void setup() override;
void process(std::span<float>& left_in,
std::span<float>& right_in,
std::span<float>& left_out,
std::span<float>& right_out) override;
auto get_latency_seconds() -> float override;
double correlation_port_value = 0.0;
private:
float dry = 0.0F, wet = 1.0F;
};
| 1,699
|
C++
|
.h
| 45
| 33.422222
| 73
| 0.698056
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,797
|
filter.hpp
|
wwmm_easyeffects/include/filter.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <span>
#include <string>
#include "pipe_manager.hpp"
#include "plugin_base.hpp"
class Filter : public PluginBase {
public:
Filter(const std::string& tag,
const std::string& schema,
const std::string& schema_path,
PipeManager* pipe_manager,
PipelineType pipe_type);
Filter(const Filter&) = delete;
auto operator=(const Filter&) -> Filter& = delete;
Filter(const Filter&&) = delete;
auto operator=(const Filter&&) -> Filter& = delete;
~Filter() override;
void setup() override;
void process(std::span<float>& left_in,
std::span<float>& right_in,
std::span<float>& left_out,
std::span<float>& right_out) override;
auto get_latency_seconds() -> float override;
private:
};
| 1,552
|
C++
|
.h
| 43
| 32.186047
| 73
| 0.698402
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,798
|
preferences_spectrum.hpp
|
wwmm_easyeffects/include/preferences_spectrum.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <adwaita.h>
#include <glib-object.h>
#include <glibconfig.h>
namespace ui::preferences::spectrum {
G_BEGIN_DECLS
#define EE_TYPE_PREFERENCES_SPECTRUM (preferences_spectrum_get_type())
G_DECLARE_FINAL_TYPE(PreferencesSpectrum, preferences_spectrum, EE, PREFERENCES_SPECTRUM, AdwPreferencesPage)
G_END_DECLS
auto create() -> PreferencesSpectrum*;
} // namespace ui::preferences::spectrum
| 1,170
|
C++
|
.h
| 29
| 38.482759
| 109
| 0.767873
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,799
|
node_info_holder.hpp
|
wwmm_easyeffects/include/node_info_holder.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <glib-object.h>
#include <glibconfig.h>
#include <gobject/gobject.h>
#include <gtk/gtk.h>
#include <sigc++/signal.h>
#include <string>
#include "pipe_objects.hpp"
namespace ui::holders {
G_BEGIN_DECLS
#define EE_TYPE_NODE_INFO_HOLDER (node_info_holder_get_type())
G_DECLARE_FINAL_TYPE(NodeInfoHolder, node_info_holder, EE, NODE_INFO_HOLDER, GObject)
G_END_DECLS
struct _NodeInfoHolder {
GObject parent_instance;
NodeInfo* info;
std::string icon_name; // The name of the icon that will represent the node when we show it in a list
sigc::signal<void(const NodeInfo)> info_updated;
};
auto create(const NodeInfo& info) -> NodeInfoHolder*;
} // namespace ui::holders
| 1,460
|
C++
|
.h
| 39
| 35.487179
| 104
| 0.753726
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,800
|
multiband_compressor.hpp
|
wwmm_easyeffects/include/multiband_compressor.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <gio/gio.h>
#include <glib-object.h>
#include <glib.h>
#include <pipewire/context.h>
#include <sigc++/signal.h>
#include <sys/types.h>
#include <array>
#include <cstddef>
#include <span>
#include <string>
#include <utility>
#include <vector>
#include "pipe_manager.hpp"
#include "plugin_base.hpp"
#include "tags_multiband_compressor.hpp"
class MultibandCompressor : public PluginBase {
public:
MultibandCompressor(const std::string& tag,
const std::string& schema,
const std::string& schema_path,
PipeManager* pipe_manager,
PipelineType pipe_type);
MultibandCompressor(const MultibandCompressor&) = delete;
auto operator=(const MultibandCompressor&) -> MultibandCompressor& = delete;
MultibandCompressor(const MultibandCompressor&&) = delete;
auto operator=(const MultibandCompressor&&) -> MultibandCompressor& = delete;
~MultibandCompressor() override;
static constexpr uint n_bands = tags::multiband_compressor::n_bands;
void setup() override;
void process(std::span<float>& left_in,
std::span<float>& right_in,
std::span<float>& left_out,
std::span<float>& right_out,
std::span<float>& probe_left,
std::span<float>& probe_right) override;
auto get_latency_seconds() -> float override;
void update_probe_links() override;
sigc::signal<void(const std::array<float, n_bands>)> reduction, envelope, curve, frequency_range;
std::array<float, n_bands> frequency_range_end_port_array = {0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F};
std::array<float, n_bands> envelope_port_array = {0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F};
std::array<float, n_bands> curve_port_array = {0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F};
std::array<float, n_bands> reduction_port_array = {0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F};
private:
uint latency_n_frames = 0U;
std::vector<pw_proxy*> list_proxies;
void update_sidechain_links(const std::string& key);
template <size_t n>
constexpr void bind_band() {
using namespace tags::multiband_compressor;
using namespace std::string_literals;
if (n > 0U) {
lv2_wrapper->bind_key_bool<cbe[n], band_enable[n]>(settings);
lv2_wrapper->bind_key_double<sf[n], band_split_frequency[n]>(settings);
}
lv2_wrapper->bind_key_bool<sce[n], band_external_sidechain[n]>(settings);
lv2_wrapper->bind_key_bool<sclc[n], band_lowcut_filter[n]>(settings);
lv2_wrapper->bind_key_bool<schc[n], band_highcut_filter[n]>(settings);
lv2_wrapper->bind_key_bool<ce[n], band_compressor_enable[n]>(settings);
lv2_wrapper->bind_key_bool<bs[n], band_solo[n]>(settings);
lv2_wrapper->bind_key_bool<bm[n], band_mute[n]>(settings);
lv2_wrapper->bind_key_enum<sscs[n], band_stereo_split_source[n]>(settings);
lv2_wrapper->bind_key_enum<scs[n], band_sidechain_source[n]>(settings);
lv2_wrapper->bind_key_enum<scm[n], band_sidechain_mode[n]>(settings);
lv2_wrapper->bind_key_enum<cm[n], band_compression_mode[n]>(settings);
lv2_wrapper->bind_key_double<sla[n], band_sidechain_lookahead[n]>(settings);
lv2_wrapper->bind_key_double<scr[n], band_sidechain_reactivity[n]>(settings);
lv2_wrapper->bind_key_double<sclf[n], band_lowcut_filter_frequency[n]>(settings);
lv2_wrapper->bind_key_double<schf[n], band_highcut_filter_frequency[n]>(settings);
lv2_wrapper->bind_key_double<at[n], band_attack_time[n]>(settings);
lv2_wrapper->bind_key_double<rt[n], band_release_time[n]>(settings);
lv2_wrapper->bind_key_double<cr[n], band_ratio[n]>(settings);
lv2_wrapper->bind_key_double_db<scp[n], band_sidechain_preamp[n]>(settings);
lv2_wrapper->bind_key_double_db<al[n], band_attack_threshold[n]>(settings);
lv2_wrapper->bind_key_double_db<kn[n], band_knee[n]>(settings);
lv2_wrapper->bind_key_double_db<bth[n], band_boost_threshold[n]>(settings);
lv2_wrapper->bind_key_double_db<bsa[n], band_boost_amount[n]>(settings);
lv2_wrapper->bind_key_double_db<mk[n], band_makeup[n]>(settings);
// This control can assume -inf
lv2_wrapper->bind_key_double_db<rrl[n], band_release_threshold[n], false>(settings);
gconnections.push_back(g_signal_connect(settings, ("changed::"s + band_external_sidechain[n].data()).c_str(),
G_CALLBACK(+[](GSettings* settings, char* key, gpointer user_data) {
auto* self = static_cast<MultibandCompressor*>(user_data);
self->update_sidechain_links(key);
}),
this));
}
template <size_t... Ns>
constexpr void bind_bands(std::index_sequence<Ns...> /*unused*/) {
(bind_band<Ns>(), ...);
}
};
| 5,678
|
C++
|
.h
| 110
| 45.018182
| 113
| 0.664502
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,801
|
pitch_ui.hpp
|
wwmm_easyeffects/include/pitch_ui.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <adwaita.h>
#include <glib-object.h>
#include <glibconfig.h>
#include <gtk/gtkbox.h>
#include <memory>
#include <string>
#include "pitch.hpp"
namespace ui::pitch_box {
G_BEGIN_DECLS
#define EE_TYPE_PITCH_BOX (pitch_box_get_type())
G_DECLARE_FINAL_TYPE(PitchBox, pitch_box, EE, PITCH_BOX, GtkBox)
G_END_DECLS
auto create() -> PitchBox*;
void setup(PitchBox* self, std::shared_ptr<Pitch> pitch, const std::string& schema_path);
} // namespace ui::pitch_box
| 1,241
|
C++
|
.h
| 34
| 34.705882
| 89
| 0.747703
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,802
|
bass_loudness.hpp
|
wwmm_easyeffects/include/bass_loudness.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <span>
#include <string>
#include "pipe_manager.hpp"
#include "plugin_base.hpp"
class BassLoudness : public PluginBase {
public:
BassLoudness(const std::string& tag,
const std::string& schema,
const std::string& schema_path,
PipeManager* pipe_manager,
PipelineType pipe_type);
BassLoudness(const BassLoudness&) = delete;
auto operator=(const BassLoudness&) -> BassLoudness& = delete;
BassLoudness(const BassLoudness&&) = delete;
auto operator=(const BassLoudness&&) -> BassLoudness& = delete;
~BassLoudness() override;
void setup() override;
void process(std::span<float>& left_in,
std::span<float>& right_in,
std::span<float>& left_out,
std::span<float>& right_out) override;
auto get_latency_seconds() -> float override;
private:
};
| 1,642
|
C++
|
.h
| 43
| 33.72093
| 73
| 0.700377
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,803
|
plugin_preset_base.hpp
|
wwmm_easyeffects/include/plugin_preset_base.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <gio/gio.h>
#include <glib.h>
#include <glib/gvariant.h>
#include <glibconfig.h>
#include <nlohmann/json.hpp>
#include <nlohmann/json_fwd.hpp>
#include <string>
#include "preset_type.hpp"
#include "util.hpp"
class PluginPresetBase {
public:
PluginPresetBase(const char* schema_id,
const char* schema_path_input,
const char* schema_path_output,
PresetType preset_type,
const int& index);
PluginPresetBase(const PluginPresetBase&) = delete;
auto operator=(const PluginPresetBase&) -> PluginPresetBase& = delete;
PluginPresetBase(const PluginPresetBase&&) = delete;
auto operator=(const PluginPresetBase&&) -> PluginPresetBase& = delete;
virtual ~PluginPresetBase();
void write(nlohmann::json& json) {
try {
save(json);
} catch (const nlohmann::json::exception& e) {
util::warning(e.what());
}
}
void read(const nlohmann::json& json) {
/*
Old presets do not have the filter instance id.
*/
if (!json.at(section).contains(instance_name)) {
instance_name.erase(instance_name.find('#'));
}
// For simplicity, exceptions raised while reading presets parameters
// should be handled outside this method.
g_settings_delay(settings);
load(json);
g_settings_apply(settings);
}
protected:
int index = 0;
GSettings* settings = nullptr;
std::string section, instance_name;
PresetType preset_type;
virtual void save(nlohmann::json& json) = 0;
virtual void load(const nlohmann::json& json) = 0;
template <typename T>
auto get_default(GSettings* settings, const std::string& key) -> T {
GVariant* variant = g_settings_get_default_value(settings, key.c_str());
T value{};
if constexpr (std::is_same_v<T, double>) {
value = g_variant_get_double(variant);
} else if constexpr (std::is_same_v<T, int>) {
value = g_variant_get_int32(variant);
} else if constexpr (std::is_same_v<T, bool>) {
value = g_variant_get_boolean(variant);
} else if constexpr (std::is_same_v<T, gchar*>) {
gsize* length = nullptr;
value = const_cast<gchar*>(g_variant_get_string(variant, length));
}
g_variant_unref(variant);
return value;
}
template <typename T>
void update_key(const nlohmann::json& json,
GSettings* settings,
const std::string& key,
const std::string& json_key) {
T new_value;
if constexpr (!std::is_same_v<T, gchar*>) {
new_value = json.value(json_key, get_default<T>(settings, key));
} else {
std::string tmp = json.value(json_key, get_default<T>(settings, key));
new_value = g_strdup(tmp.c_str());
}
T current_value;
if constexpr (std::is_same_v<T, double>) {
current_value = g_settings_get_double(settings, key.c_str());
} else if constexpr (std::is_same_v<T, int>) {
current_value = g_settings_get_int(settings, key.c_str());
} else if constexpr (std::is_same_v<T, bool>) {
current_value = g_settings_get_boolean(settings, key.c_str());
} else if constexpr (std::is_same_v<T, gchar*>) {
current_value = g_settings_get_string(settings, key.c_str());
}
if (is_different(current_value, new_value)) {
if constexpr (std::is_same_v<T, double>) {
g_settings_set_double(settings, key.c_str(), new_value);
} else if constexpr (std::is_same_v<T, int>) {
g_settings_set_int(settings, key.c_str(), new_value);
} else if constexpr (std::is_same_v<T, bool>) {
g_settings_set_boolean(settings, key.c_str(), new_value);
} else if constexpr (std::is_same_v<T, gchar*>) {
g_settings_set_string(settings, key.c_str(), new_value);
}
}
if constexpr (std::is_same_v<T, gchar*>) {
g_free(new_value);
g_free(current_value);
}
}
private:
/*
Very naive test for equal values...
*/
template <typename T>
auto is_different(const T& a, const T& b) -> bool {
if constexpr (std::is_same_v<T, gchar*>) {
return static_cast<bool>(g_strcmp0(a, b) != 0);
}
return a != b;
}
};
| 4,946
|
C++
|
.h
| 134
| 31.671642
| 76
| 0.65272
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,804
|
convolver.hpp
|
wwmm_easyeffects/include/convolver.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <sys/types.h>
#include <zita-convolver.h>
#include <deque>
#include <span>
#include <string>
#include <thread>
#include <vector>
#include "pipe_manager.hpp"
#include "plugin_base.hpp"
#include "util.hpp"
class Convolver : public PluginBase {
public:
Convolver(const std::string& tag,
const std::string& schema,
const std::string& schema_path,
PipeManager* pipe_manager,
PipelineType pipe_type);
Convolver(const Convolver&) = delete;
auto operator=(const Convolver&) -> Convolver& = delete;
Convolver(const Convolver&&) = delete;
auto operator=(const Convolver&&) -> Convolver& = delete;
~Convolver() override;
void setup() override;
void process(std::span<float>& left_in,
std::span<float>& right_in,
std::span<float>& left_out,
std::span<float>& right_out) override;
auto get_latency_seconds() -> float override;
bool do_autogain = false;
const std::string irs_ext = ".irs";
auto search_irs_path(const std::string& name) -> std::string;
private:
std::string local_dir_irs;
std::vector<std::string> system_data_dir_irs;
bool kernel_is_initialized = false;
bool n_samples_is_power_of_2 = true;
bool zita_ready = false;
bool ready = false;
bool notify_latency = false;
uint blocksize = 512U;
uint ir_width = 100U;
uint latency_n_frames = 0U;
std::vector<float> kernel_L, kernel_R;
std::vector<float> original_kernel_L, original_kernel_R;
std::vector<float> data_L, data_R;
std::deque<float> deque_out_L, deque_out_R;
Convproc* conv = nullptr;
std::vector<std::thread> mythreads;
void read_kernel_file();
void apply_kernel_autogain();
void set_kernel_stereo_width();
void setup_zita();
auto get_zita_buffer_size() -> uint;
void prepare_kernel();
template <typename T1>
void do_convolution(T1& data_left, T1& data_right) {
std::span conv_left_in(conv->inpdata(0), get_zita_buffer_size());
std::span conv_right_in(conv->inpdata(1), get_zita_buffer_size());
std::span conv_left_out(conv->outdata(0), get_zita_buffer_size());
std::span conv_right_out(conv->outdata(1), get_zita_buffer_size());
std::copy(data_left.begin(), data_left.end(), conv_left_in.begin());
std::copy(data_right.begin(), data_right.end(), conv_right_in.begin());
if (zita_ready) {
const int& ret = conv->process(true); // thread sync mode set to true
if (ret != 0) {
util::debug(log_tag + "IR: process failed: " + util::to_string(ret, ""));
zita_ready = false;
} else {
std::copy(conv_left_out.begin(), conv_left_out.end(), data_left.begin());
std::copy(conv_right_out.begin(), conv_right_out.end(), data_right.begin());
}
}
}
};
| 3,555
|
C++
|
.h
| 93
| 33.978495
| 84
| 0.679965
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| true
| false
| false
|
24,805
|
crystalizer_ui.hpp
|
wwmm_easyeffects/include/crystalizer_ui.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <adwaita.h>
#include <glib-object.h>
#include <glibconfig.h>
#include <gtk/gtkbox.h>
#include <memory>
#include <string>
#include "crystalizer.hpp"
namespace ui::crystalizer_box {
G_BEGIN_DECLS
#define EE_TYPE_CRYSTALIZER_BOX (crystalizer_box_get_type())
G_DECLARE_FINAL_TYPE(CrystalizerBox, crystalizer_box, EE, CRYSTALIZER_BOX, GtkBox)
G_END_DECLS
auto create() -> CrystalizerBox*;
void setup(CrystalizerBox* self, std::shared_ptr<Crystalizer> crystalizer, const std::string& schema_path);
} // namespace ui::crystalizer_box
| 1,313
|
C++
|
.h
| 34
| 36.823529
| 107
| 0.762017
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,806
|
bass_loudness_preset.hpp
|
wwmm_easyeffects/include/bass_loudness_preset.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <nlohmann/json_fwd.hpp>
#include "plugin_preset_base.hpp"
#include "preset_type.hpp"
class BassLoudnessPreset : public PluginPresetBase {
public:
explicit BassLoudnessPreset(PresetType preset_type, const int& index = 0);
private:
void save(nlohmann::json& json) override;
void load(const nlohmann::json& json) override;
};
| 1,110
|
C++
|
.h
| 29
| 36.241379
| 76
| 0.759294
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,807
|
equalizer_preset.hpp
|
wwmm_easyeffects/include/equalizer_preset.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <gio/gio.h>
#include <nlohmann/json_fwd.hpp>
#include "plugin_preset_base.hpp"
#include "preset_type.hpp"
class EqualizerPreset : public PluginPresetBase {
public:
explicit EqualizerPreset(PresetType preset_type, const int& index = 0);
EqualizerPreset(const EqualizerPreset&) = delete;
auto operator=(const EqualizerPreset&) -> EqualizerPreset& = delete;
EqualizerPreset(const EqualizerPreset&&) = delete;
auto operator=(const EqualizerPreset&&) -> EqualizerPreset& = delete;
~EqualizerPreset() override;
private:
GSettings *input_settings_left = nullptr, *input_settings_right = nullptr, *output_settings_left = nullptr,
*output_settings_right = nullptr;
void save(nlohmann::json& json) override;
void load(const nlohmann::json& json) override;
static void save_channel(nlohmann::json& json, GSettings* settings, const int& nbands);
void load_channel(const nlohmann::json& json, GSettings* settings, const int& nbands);
void load_legacy_preset();
};
| 1,773
|
C++
|
.h
| 40
| 41.725
| 109
| 0.75406
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,808
|
plugins_menu.hpp
|
wwmm_easyeffects/include/plugins_menu.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <adwaita.h>
#include <glib-object.h>
#include <glibconfig.h>
#include <gtk/gtkpopover.h>
#include "application.hpp"
#include "pipeline_type.hpp"
namespace ui::plugins_menu {
G_BEGIN_DECLS
#define EE_TYPE_PLUGINS_MENU (plugins_menu_get_type())
G_DECLARE_FINAL_TYPE(PluginsMenu, plugins_menu, EE, PLUGINS_MENU, GtkPopover)
G_END_DECLS
auto create() -> PluginsMenu*;
void setup(PluginsMenu* self, app::Application* application, PipelineType pipeline_type);
} // namespace ui::plugins_menu
| 1,272
|
C++
|
.h
| 33
| 36.727273
| 89
| 0.760781
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
24,809
|
crossfeed.hpp
|
wwmm_easyeffects/include/crossfeed.hpp
|
/*
* Copyright © 2017-2024 Wellington Wallace
*
* This file is part of Easy Effects.
*
* Easy Effects is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy Effects is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy Effects. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <bs2bclass.h>
#include <span>
#include <string>
#include <vector>
#include "pipe_manager.hpp"
#include "plugin_base.hpp"
class Crossfeed : public PluginBase {
public:
Crossfeed(const std::string& tag,
const std::string& schema,
const std::string& schema_path,
PipeManager* pipe_manager,
PipelineType pipe_type);
Crossfeed(const Crossfeed&) = delete;
auto operator=(const Crossfeed&) -> Crossfeed& = delete;
Crossfeed(const Crossfeed&&) = delete;
auto operator=(const Crossfeed&&) -> Crossfeed& = delete;
~Crossfeed() override;
void setup() override;
void process(std::span<float>& left_in,
std::span<float>& right_in,
std::span<float>& left_out,
std::span<float>& right_out) override;
auto get_latency_seconds() -> float override;
private:
std::vector<float> data;
bs2b_base bs2b;
};
| 1,684
|
C++
|
.h
| 47
| 31.808511
| 73
| 0.701044
|
wwmm/easyeffects
| 6,414
| 268
| 211
|
GPL-3.0
|
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.