Waybar/include/modules/jack.hpp

41 lines
917 B
C++
Raw Normal View History

#pragma once
#include <fmt/format.h>
#include <fstream>
#include <jack/jack.h>
2022-02-12 06:51:11 +00:00
#include <jack/thread.h>
#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();
private:
std::string JACKState();
2022-02-18 07:13:43 +00:00
jack_client_t* client_;
jack_nframes_t bufsize_;
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_;
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);