aboutsummaryrefslogtreecommitdiffstats
path: root/src/audiomixer-service.hpp
blob: cb0058453aaaa21c262b187abf010f17d8d2baf4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// SPDX-License-Identifier: Apache-2.0

#ifndef _AUDIOMIXER_SERVICE_HPP
#define _AUDIOMIXER_SERVICE_HPP

#include "vis-session.hpp"
#include "audiomixer.h"

class AudiomixerService : public VisSession
{
	struct audiomixer *m_audiomixer;

public:
	AudiomixerService(const VisConfig &config, net::io_context& ioc, ssl::context& ctx);

	~AudiomixerService();

	static void audiomixer_control_change_cb(void *data) {
		if (data)
			((AudiomixerService*) data)->handle_control_change();
	};

	static void audiomixer_value_change_cb(void *data,
					       unsigned int change_mask,
					       const struct mixer_control *control) {
		if (data)
			((AudiomixerService*) data)->handle_value_change(change_mask, control);
	}

protected:
	struct audiomixer_events m_audiomixer_events;

	virtual void handle_authorized_response(void) override;

	virtual void handle_get_response(std::string &path, std::string &value, std::string &timestamp) override;

	virtual void handle_notification(std::string &path, std::string &value, std::string &timestamp) override;

	virtual void handle_control_change(void);

	virtual void handle_value_change(unsigned int change_mask, const struct mixer_control *control);
};

#endif // _AUDIOMIXER_SERVICE_HPP