namespace cleanup
This commit is contained in:
parent
4cb2cc9f21
commit
92870cab2a
|
@ -1,6 +1,8 @@
|
||||||
#include "modules/jack.hpp"
|
#include "modules/jack.hpp"
|
||||||
|
|
||||||
waybar::modules::JACK::JACK(const std::string &id, const Json::Value &config)
|
namespace waybar::modules {
|
||||||
|
|
||||||
|
JACK::JACK(const std::string &id, const Json::Value &config)
|
||||||
: ALabel(config, "jack", id, "{load}%", 1) {
|
: ALabel(config, "jack", id, "{load}%", 1) {
|
||||||
xruns_ = 0;
|
xruns_ = 0;
|
||||||
state_ = "disconnected";
|
state_ = "disconnected";
|
||||||
|
@ -13,7 +15,7 @@ waybar::modules::JACK::JACK(const std::string &id, const Json::Value &config)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string waybar::modules::JACK::JACKState() {
|
std::string JACK::JACKState() {
|
||||||
if (state_.compare("xrun") == 0) return "xrun";
|
if (state_.compare("xrun") == 0) return "xrun";
|
||||||
if (state_.compare("connected") == 0) return "connected";
|
if (state_.compare("connected") == 0) return "connected";
|
||||||
|
|
||||||
|
@ -34,7 +36,7 @@ std::string waybar::modules::JACK::JACKState() {
|
||||||
return "disconnected";
|
return "disconnected";
|
||||||
}
|
}
|
||||||
|
|
||||||
auto waybar::modules::JACK::update() -> void {
|
auto JACK::update() -> void {
|
||||||
std::string format;
|
std::string format;
|
||||||
float latency = 1000 * (float)bufsize_ / (float)samplerate_;
|
float latency = 1000 * (float)bufsize_ / (float)samplerate_;
|
||||||
auto state = JACKState();
|
auto state = JACKState();
|
||||||
|
@ -85,23 +87,27 @@ auto waybar::modules::JACK::update() -> void {
|
||||||
ALabel::update();
|
ALabel::update();
|
||||||
}
|
}
|
||||||
|
|
||||||
int waybar::modules::JACK::bufSize(unsigned int size) {
|
int JACK::bufSize(unsigned int size) {
|
||||||
bufsize_ = size;
|
bufsize_ = size;
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
int waybar::modules::JACK::xrun() {
|
int JACK::xrun() {
|
||||||
xruns_ += 1;
|
xruns_ += 1;
|
||||||
state_ = "xrun";
|
state_ = "xrun";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void waybar::modules::JACK::shutdown() {
|
void JACK::shutdown() {
|
||||||
client_ = NULL;
|
client_ = NULL;
|
||||||
state_ = "disconnected";
|
state_ = "disconnected";
|
||||||
xruns_ = 0;
|
xruns_ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace waybar::modules
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
int bufSizeCallback(unsigned int size, void *obj) {
|
int bufSizeCallback(unsigned int size, void *obj) {
|
||||||
return static_cast<waybar::modules::JACK *>(obj)->bufSize(size);
|
return static_cast<waybar::modules::JACK *>(obj)->bufSize(size);
|
||||||
}
|
}
|
||||||
|
@ -109,3 +115,5 @@ int bufSizeCallback(unsigned int size, void *obj) {
|
||||||
int xrunCallback(void *obj) { return static_cast<waybar::modules::JACK *>(obj)->xrun(); }
|
int xrunCallback(void *obj) { return static_cast<waybar::modules::JACK *>(obj)->xrun(); }
|
||||||
|
|
||||||
void shutdownCallback(void *obj) { return static_cast<waybar::modules::JACK *>(obj)->shutdown(); }
|
void shutdownCallback(void *obj) { return static_cast<waybar::modules::JACK *>(obj)->shutdown(); }
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
Loading…
Reference in New Issue