mirror of
				https://github.com/rad4day/Waybar.git
				synced 2025-10-31 07:52:42 +01:00 
			
		
		
		
	changed callbacks to use static_cast
This commit is contained in:
		| @@ -15,16 +15,20 @@ class JACK : public ALabel { | ||||
|   JACK(const std::string&, const Json::Value&); | ||||
|   ~JACK() = default; | ||||
|   auto update() -> void; | ||||
|   jack_nframes_t      bufsize_; | ||||
|   jack_client_t*      client_; | ||||
|   unsigned int        xruns_; | ||||
|   std::string         state_; | ||||
|   pthread_t           jack_thread_; | ||||
|  | ||||
|   int                 bufSize(unsigned int size); | ||||
|   int                 xrun(); | ||||
|   void                shutdown(); | ||||
|  | ||||
|  private: | ||||
|   std::string         JACKState(); | ||||
|  | ||||
|   jack_client_t*      client_; | ||||
|   jack_nframes_t      bufsize_; | ||||
|   jack_nframes_t      samplerate_; | ||||
|   unsigned int        xruns_; | ||||
|   std::string         state_; | ||||
|   pthread_t           jack_thread_; | ||||
|   util::SleeperThread thread_; | ||||
| }; | ||||
|  | ||||
|   | ||||
| @@ -105,23 +105,32 @@ auto waybar::modules::JACK::update() -> void { | ||||
|   ALabel::update(); | ||||
| } | ||||
|  | ||||
| int bufSizeCallback(unsigned int size, void *obj) { | ||||
|   waybar::modules::JACK* x = (waybar::modules::JACK*)obj; | ||||
|   x->bufsize_ = size; | ||||
| int waybar::modules::JACK::bufSize(unsigned int size) { | ||||
|   bufsize_ = size; | ||||
|   return size; | ||||
| } | ||||
|  | ||||
| int xrunCallback(void *obj) { | ||||
|   waybar::modules::JACK* x = (waybar::modules::JACK*)obj; | ||||
|   x->xruns_ += 1; | ||||
|   x->state_ = "xrun"; | ||||
| int waybar::modules::JACK::xrun() { | ||||
|   xruns_ += 1; | ||||
|   state_ = "xrun"; | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| void shutdownCallback(void *obj) { | ||||
|   waybar::modules::JACK* x = (waybar::modules::JACK*)obj; | ||||
|   pthread_cancel(x->jack_thread_); | ||||
|   x->client_ = NULL; | ||||
|   x->state_ = "disconnected"; | ||||
|   x->xruns_ = 0; | ||||
| void waybar::modules::JACK::shutdown() { | ||||
|   pthread_cancel(jack_thread_); | ||||
|   client_ = NULL; | ||||
|   state_ = "disconnected"; | ||||
|   xruns_ = 0; | ||||
| } | ||||
|  | ||||
| int bufSizeCallback(unsigned int size, void *obj) { | ||||
|   return static_cast<waybar::modules::JACK*>(obj)->bufSize(size); | ||||
| } | ||||
|  | ||||
| int xrunCallback(void *obj) { | ||||
|   return static_cast<waybar::modules::JACK*>(obj)->xrun(); | ||||
| } | ||||
|  | ||||
| void shutdownCallback(void *obj) { | ||||
|   return static_cast<waybar::modules::JACK*>(obj)->shutdown(); | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 kennypm
					kennypm