2022-02-09 07:53:52 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <fmt/format.h>
|
|
|
|
#include <fstream>
|
|
|
|
#include <jack/jack.h>
|
2022-02-12 06:51:11 +00:00
|
|
|
#include <jack/thread.h>
|
2022-02-09 07:53:52 +00:00
|
|
|
#include "ALabel.hpp"
|
|
|
|
#include "util/sleeper_thread.hpp"
|
|
|
|
|
|
|
|
namespace waybar::modules {
|
|
|
|
|
|
|
|
class JACK : public ALabel {
|
|
|
|
public:
|
|
|
|
JACK(const std::string&, const Json::Value&);
|
|
|
|
~JACK() = default;
|
|
|
|
auto update() -> void;
|
2022-02-18 07:13:43 +00:00
|
|
|
|
|
|
|
int bufSize(unsigned int size);
|
|
|
|
int xrun();
|
|
|
|
void shutdown();
|
2022-02-09 07:53:52 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
std::string JACKState();
|
|
|
|
|
2022-02-18 07:13:43 +00:00
|
|
|
jack_client_t* client_;
|
|
|
|
jack_nframes_t bufsize_;
|
2022-02-09 07:53:52 +00:00
|
|
|
jack_nframes_t samplerate_;
|
2022-02-18 07:13:43 +00:00
|
|
|
unsigned int xruns_;
|
2022-08-07 19:29:42 +00:00
|
|
|
float load_;
|
|
|
|
bool running_;
|
|
|
|
std::mutex mutex_;
|
2022-02-18 07:13:43 +00:00
|
|
|
std::string state_;
|
2022-02-09 07:53:52 +00:00
|
|
|
util::SleeperThread thread_;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace waybar::modules
|
2022-02-12 06:51:11 +00:00
|
|
|
|
|
|
|
int bufSizeCallback(unsigned int size, void *obj);
|
|
|
|
int xrunCallback(void *obj);
|
|
|
|
void shutdownCallback(void *obj);
|