-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPulseManager.h
51 lines (42 loc) · 1.2 KB
/
PulseManager.h
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
45
46
47
48
49
50
51
#ifndef PULSEMANAGER_H
#define PULSEMANAGER_H
#include <glib.h>
#include <glibmm.h>
#include <pulse/pulseaudio.h>
#include <pulse/thread-mainloop.h>
#include <algorithm>
#include <array>
#include <cstring>
#include <iostream>
#include <memory>
struct mySinkInfo {
std::string name;
uint index;
std::string description;
uint owner_module;
uint monitor_source;
std::string monitor_source_name;
uint rate;
std::string format;
std::string active_port;
};
class PulseManager {
public:
PulseManager();
PulseManager(const PulseManager&) = delete;
auto operator=(const PulseManager&) -> PulseManager& = delete;
PulseManager(const PulseManager&&) = delete;
auto operator=(const PulseManager &&) -> PulseManager& = delete;
~PulseManager();
pa_threaded_mainloop* main_loop = nullptr;
sigc::signal<void, std::shared_ptr<mySinkInfo>> sink_changed;
private:
std::string log_tag = "pulse_manager: ";
bool context_ready = false;
pa_mainloop_api* main_loop_api = nullptr;
pa_context* context = nullptr;
static void context_state_cb(pa_context* ctx, void* data);
void subscribe_to_events();
void drain_context();
};
#endif //PULSEMANAGER_H