|
| 1 | +/* |
| 2 | + * Copyright © 2017-2024 Wellington Wallace |
| 3 | + * |
| 4 | + * This file is part of Easy Effects. |
| 5 | + * |
| 6 | + * Easy Effects is free software: you can redistribute it and/or modify |
| 7 | + * it under the terms of the GNU General Public License as published by |
| 8 | + * the Free Software Foundation, either version 3 of the License, or |
| 9 | + * (at your option) any later version. |
| 10 | + * |
| 11 | + * Easy Effects is distributed in the hope that it will be useful, |
| 12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | + * GNU General Public License for more details. |
| 15 | + * |
| 16 | + * You should have received a copy of the GNU General Public License |
| 17 | + * along with Easy Effects. If not, see <https://www.gnu.org/licenses/>. |
| 18 | + */ |
| 19 | + |
| 20 | +#include "maximizer_preset.hpp" |
| 21 | +#include <nlohmann/json_fwd.hpp> |
| 22 | +#include <string> |
| 23 | +#include "easyeffects_db_maximizer.h" |
| 24 | +#include "pipeline_type.hpp" |
| 25 | +#include "plugin_preset_base.hpp" |
| 26 | +#include "presets_macros.hpp" |
| 27 | + |
| 28 | +MaximizerPreset::MaximizerPreset(PipelineType pipeline_type, const std::string& instance_name) |
| 29 | + : PluginPresetBase(pipeline_type, instance_name) { |
| 30 | + settings = get_db_instance<db::Maximizer>(pipeline_type); |
| 31 | +} |
| 32 | + |
| 33 | +void MaximizerPreset::save(nlohmann::json& json) { |
| 34 | + json[section][instance_name]["bypass"] = settings->bypass(); |
| 35 | + |
| 36 | + json[section][instance_name]["input-gain"] = settings->inputGain(); |
| 37 | + |
| 38 | + json[section][instance_name]["output-gain"] = settings->outputGain(); |
| 39 | + |
| 40 | + json[section][instance_name]["release"] = settings->release(); |
| 41 | + |
| 42 | + json[section][instance_name]["threshold"] = settings->threshold(); |
| 43 | +} |
| 44 | + |
| 45 | +void MaximizerPreset::load(const nlohmann::json& json) { |
| 46 | + UPDATE_PROPERTY("bypass", Bypass); |
| 47 | + UPDATE_PROPERTY("input-gain", InputGain); |
| 48 | + UPDATE_PROPERTY("output-gain", OutputGain); |
| 49 | + UPDATE_PROPERTY("release", Release); |
| 50 | + UPDATE_PROPERTY("threshold", Threshold); |
| 51 | +} |
0 commit comments