Factory. cava_frontend
This commit is contained in:
@ -108,18 +108,13 @@
|
||||
#ifdef HAVE_LIBWIREPLUMBER
|
||||
#include "modules/wireplumber.hpp"
|
||||
#endif
|
||||
#ifdef HAVE_LIBCAVA
|
||||
#include "modules/cava/cava.hpp"
|
||||
#ifdef HAVE_LIBCAVAGLSL
|
||||
#include "modules/cava/cavaGLSL.hpp"
|
||||
#endif
|
||||
#endif
|
||||
#ifdef HAVE_SYSTEMD_MONITOR
|
||||
#include "modules/systemd_failed_units.hpp"
|
||||
#endif
|
||||
#ifdef HAVE_LIBGPS
|
||||
#include "modules/gps.hpp"
|
||||
#endif
|
||||
#include "modules/cava/cava_frontend.hpp"
|
||||
#include "modules/cffi.hpp"
|
||||
#include "modules/custom.hpp"
|
||||
#include "modules/image.hpp"
|
||||
@ -344,15 +339,9 @@ waybar::AModule* waybar::Factory::makeModule(const std::string& name,
|
||||
return new waybar::modules::Wireplumber(id, config_[name]);
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_LIBCAVA
|
||||
if (ref == "cava") {
|
||||
return new waybar::modules::cava::Cava(id, config_[name]);
|
||||
#ifdef HAVE_LIBCAVAGLSL
|
||||
} else if (ref == "cavaGLSL") {
|
||||
return new waybar::modules::cava::CavaGLSL(id, config_[name]);
|
||||
#endif
|
||||
return waybar::modules::cava::getModule(id, config_[name]);
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_SYSTEMD_MONITOR
|
||||
if (ref == "systemd-failed-units") {
|
||||
return new waybar::modules::SystemdFailedUnits(id, config_[name]);
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#include "modules/cava/cava.hpp"
|
||||
#include "modules/cava/cavaRaw.hpp"
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
@ -181,11 +181,16 @@ void waybar::modules::cava::CavaBackend::loadConfig() {
|
||||
|
||||
// Override cava parameters by the user config
|
||||
prm_.inAtty = 0;
|
||||
prm_.output = ::cava::output_method::OUTPUT_RAW;
|
||||
if (prm_.data_format) free(prm_.data_format);
|
||||
prm_.data_format = strdup("ascii");
|
||||
if (prm_.raw_target) free(prm_.raw_target);
|
||||
prm_.raw_target = strdup("/dev/stdout");
|
||||
auto const output{prm_.output};
|
||||
// prm_.output = ::cava::output_method::OUTPUT_RAW;
|
||||
if (config_["data_format"].isString()) {
|
||||
if (prm_.data_format) free(prm_.data_format);
|
||||
prm_.data_format = strdup(config_["data_format"].asString().c_str());
|
||||
}
|
||||
if (config_["raw_target"].isString()) {
|
||||
if (prm_.raw_target) free(prm_.raw_target);
|
||||
prm_.raw_target = strdup(config_["raw_target"].asString().c_str());
|
||||
}
|
||||
prm_.ascii_range = config_["format-icons"].size() - 1;
|
||||
|
||||
if (config_["bar_spacing"].isInt()) prm_.bar_spacing = config_["bar_spacing"].asInt();
|
||||
@ -251,11 +256,15 @@ void waybar::modules::cava::CavaBackend::loadConfig() {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
prm_.output = ::cava::output_method::OUTPUT_RAW;
|
||||
|
||||
// Make cava parameters configuration
|
||||
// Init cava plan, audio_raw structure
|
||||
audio_raw_init(&audio_data_, &audio_raw_, &prm_, &plan_);
|
||||
if (!plan_) spdlog::error("cava backend plan is not provided");
|
||||
audio_raw_.previous_frame[0] = -1; // For first Update() call need to rePaint text message
|
||||
|
||||
prm_.output = output;
|
||||
}
|
||||
|
||||
const struct ::cava::config_params* waybar::modules::cava::CavaBackend::getPrm() { return &prm_; }
|
||||
|
||||
Reference in New Issue
Block a user