Waybar/include/modules/jack.hpp

40 lines
889 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 <proc/readproc.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_;
std::string state_;
pthread_t jack_thread_;
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);