Fix debug mode. cava issue
Signed-off-by: Viktar Lukashonak <myxabeer@gmail.com>
This commit is contained in:
parent
b7a527b122
commit
e9a66d68b7
|
@ -3,9 +3,11 @@
|
||||||
#include "ALabel.hpp"
|
#include "ALabel.hpp"
|
||||||
#include "util/sleeper_thread.hpp"
|
#include "util/sleeper_thread.hpp"
|
||||||
|
|
||||||
|
namespace cava {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <cava/common.h>
|
#include <cava/common.h>
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
namespace waybar::modules {
|
namespace waybar::modules {
|
||||||
using namespace std::literals::chrono_literals;
|
using namespace std::literals::chrono_literals;
|
||||||
|
@ -21,13 +23,13 @@ class Cava final : public ALabel {
|
||||||
util::SleeperThread thread_;
|
util::SleeperThread thread_;
|
||||||
util::SleeperThread thread_fetch_input_;
|
util::SleeperThread thread_fetch_input_;
|
||||||
|
|
||||||
struct error_s error_ {}; // cava errors
|
struct cava::error_s error_ {}; // cava errors
|
||||||
struct config_params prm_ {}; // cava parameters
|
struct cava::config_params prm_ {}; // cava parameters
|
||||||
struct audio_raw audio_raw_ {}; // cava handled raw audio data(is based on audio_data)
|
struct cava::audio_raw audio_raw_ {}; // cava handled raw audio data(is based on audio_data)
|
||||||
struct audio_data audio_data_ {}; // cava audio data
|
struct cava::audio_data audio_data_ {}; // cava audio data
|
||||||
struct cava_plan* plan_; //{new cava_plan{}};
|
struct cava::cava_plan* plan_; //{new cava_plan{}};
|
||||||
// Cava API to read audio source
|
// Cava API to read audio source
|
||||||
ptr input_source_;
|
cava::ptr input_source_;
|
||||||
// Delay to handle audio source
|
// Delay to handle audio source
|
||||||
std::chrono::milliseconds frame_time_milsec_{1s};
|
std::chrono::milliseconds frame_time_milsec_{1s};
|
||||||
// Text to display
|
// Text to display
|
||||||
|
|
|
@ -346,7 +346,7 @@ if get_option('experimental')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
cava = dependency('cava',
|
cava = dependency('cava',
|
||||||
version : '>=0.8.5',
|
version : '>=0.9.1',
|
||||||
required: get_option('cava'),
|
required: get_option('cava'),
|
||||||
fallback : ['cava', 'cava_dep'],
|
fallback : ['cava', 'cava_dep'],
|
||||||
not_found_message: 'cava is not found. Building waybar without cava')
|
not_found_message: 'cava is not found. Building waybar without cava')
|
||||||
|
|
|
@ -25,7 +25,7 @@ waybar::modules::Cava::Cava(const std::string& id, const Json::Value& config)
|
||||||
|
|
||||||
// Override cava parameters by the user config
|
// Override cava parameters by the user config
|
||||||
prm_.inAtty = 0;
|
prm_.inAtty = 0;
|
||||||
prm_.output = output_method::OUTPUT_RAW;
|
prm_.output = cava::output_method::OUTPUT_RAW;
|
||||||
strcpy(prm_.data_format, "ascii");
|
strcpy(prm_.data_format, "ascii");
|
||||||
strcpy(prm_.raw_target, "/dev/stdout");
|
strcpy(prm_.raw_target, "/dev/stdout");
|
||||||
prm_.ascii_range = config_["format-icons"].size() - 1;
|
prm_.ascii_range = config_["format-icons"].size() - 1;
|
||||||
|
@ -34,9 +34,9 @@ waybar::modules::Cava::Cava(const std::string& id, const Json::Value& config)
|
||||||
prm_.bar_spacing = 0;
|
prm_.bar_spacing = 0;
|
||||||
prm_.bar_height = 32;
|
prm_.bar_height = 32;
|
||||||
prm_.bar_width = 1;
|
prm_.bar_width = 1;
|
||||||
prm_.orientation = ORIENT_TOP;
|
prm_.orientation = cava::ORIENT_TOP;
|
||||||
prm_.xaxis = xaxis_scale::NONE;
|
prm_.xaxis = cava::xaxis_scale::NONE;
|
||||||
prm_.mono_opt = AVERAGE;
|
prm_.mono_opt = cava::AVERAGE;
|
||||||
prm_.autobars = 0;
|
prm_.autobars = 0;
|
||||||
prm_.gravity = 0;
|
prm_.gravity = 0;
|
||||||
prm_.integral = 1;
|
prm_.integral = 1;
|
||||||
|
@ -51,7 +51,7 @@ waybar::modules::Cava::Cava(const std::string& id, const Json::Value& config)
|
||||||
prm_.upper_cut_off = config_["higher_cutoff_freq"].asLargestInt();
|
prm_.upper_cut_off = config_["higher_cutoff_freq"].asLargestInt();
|
||||||
if (config_["sleep_timer"].isInt()) prm_.sleep_timer = config_["sleep_timer"].asInt();
|
if (config_["sleep_timer"].isInt()) prm_.sleep_timer = config_["sleep_timer"].asInt();
|
||||||
if (config_["method"].isString())
|
if (config_["method"].isString())
|
||||||
prm_.input = input_method_by_name(config_["method"].asString().c_str());
|
prm_.input = cava::input_method_by_name(config_["method"].asString().c_str());
|
||||||
if (config_["source"].isString()) prm_.audio_source = config_["source"].asString().data();
|
if (config_["source"].isString()) prm_.audio_source = config_["source"].asString().data();
|
||||||
if (config_["sample_rate"].isNumeric()) prm_.fifoSample = config_["sample_rate"].asLargestInt();
|
if (config_["sample_rate"].isNumeric()) prm_.fifoSample = config_["sample_rate"].asLargestInt();
|
||||||
if (config_["sample_bits"].isInt()) prm_.fifoSampleBits = config_["sample_bits"].asInt();
|
if (config_["sample_bits"].isInt()) prm_.fifoSampleBits = config_["sample_bits"].asInt();
|
||||||
|
@ -65,7 +65,7 @@ waybar::modules::Cava::Cava(const std::string& id, const Json::Value& config)
|
||||||
if (config_["input_delay"].isInt())
|
if (config_["input_delay"].isInt())
|
||||||
fetch_input_delay_ = std::chrono::seconds(config_["input_delay"].asInt());
|
fetch_input_delay_ = std::chrono::seconds(config_["input_delay"].asInt());
|
||||||
// Make cava parameters configuration
|
// Make cava parameters configuration
|
||||||
plan_ = new cava_plan{};
|
plan_ = new cava::cava_plan{};
|
||||||
|
|
||||||
audio_raw_.height = prm_.ascii_range;
|
audio_raw_.height = prm_.ascii_range;
|
||||||
audio_data_.format = -1;
|
audio_data_.format = -1;
|
||||||
|
@ -155,12 +155,12 @@ auto waybar::modules::Cava::update() -> void {
|
||||||
downThreadDelay(frame_time_milsec_, suspend_silence_delay_);
|
downThreadDelay(frame_time_milsec_, suspend_silence_delay_);
|
||||||
// Process: execute cava
|
// Process: execute cava
|
||||||
pthread_mutex_lock(&audio_data_.lock);
|
pthread_mutex_lock(&audio_data_.lock);
|
||||||
cava_execute(audio_data_.cava_in, audio_data_.samples_counter, audio_raw_.cava_out, plan_);
|
cava::cava_execute(audio_data_.cava_in, audio_data_.samples_counter, audio_raw_.cava_out, plan_);
|
||||||
if (audio_data_.samples_counter > 0) audio_data_.samples_counter = 0;
|
if (audio_data_.samples_counter > 0) audio_data_.samples_counter = 0;
|
||||||
pthread_mutex_unlock(&audio_data_.lock);
|
pthread_mutex_unlock(&audio_data_.lock);
|
||||||
|
|
||||||
// Do transformation under raw data
|
// Do transformation under raw data
|
||||||
audio_raw_fetch(&audio_raw_, &prm_, &rePaint_);
|
audio_raw_fetch(&audio_raw_, &prm_, &rePaint_, plan_);
|
||||||
|
|
||||||
if (rePaint_ == 1) {
|
if (rePaint_ == 1) {
|
||||||
text_.clear();
|
text_.clear();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[wrap-file]
|
[wrap-file]
|
||||||
directory = cava-0.8.5
|
directory = cava-0.9.1
|
||||||
source_url = https://github.com/LukashonakV/cava/archive/0.8.5.tar.gz
|
source_url = https://github.com/LukashonakV/cava/archive/0.9.1.tar.gz
|
||||||
source_filename = cava-0.8.5.tar.gz
|
source_filename = cava-0.9.1.tar.gz
|
||||||
source_hash = 9ce3df7d374dc83ed0704fe3caef5e00600ce061d85608aad4142d2c59aa4647
|
source_hash = 4df540b7f4892f72e48772929a15bc9ad61e2bce7a084be2df01c72ca5c02333
|
||||||
[provide]
|
[provide]
|
||||||
cava = cava_dep
|
cava = cava_dep
|
||||||
|
|
Loading…
Reference in New Issue