2016-12-13 13:26:09 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <mutex>
|
|
|
|
|
|
|
|
#include "common.hpp"
|
2017-01-11 02:07:28 +00:00
|
|
|
#include "settings.hpp"
|
2016-12-13 13:26:09 +00:00
|
|
|
|
|
|
|
// fwd
|
|
|
|
struct _snd_mixer;
|
|
|
|
struct _snd_mixer_elem;
|
|
|
|
struct _snd_mixer_selem_id;
|
|
|
|
typedef struct _snd_mixer snd_mixer_t;
|
|
|
|
typedef struct _snd_mixer_elem snd_mixer_elem_t;
|
|
|
|
typedef struct _snd_mixer_selem_id snd_mixer_selem_id_t;
|
|
|
|
|
|
|
|
POLYBAR_NS
|
|
|
|
|
|
|
|
namespace alsa {
|
|
|
|
class mixer {
|
|
|
|
public:
|
2017-01-14 16:18:17 +00:00
|
|
|
explicit mixer(string&& mixer_selem_name, string&& sound_card_name);
|
2016-12-13 13:26:09 +00:00
|
|
|
~mixer();
|
|
|
|
|
2016-12-15 02:30:41 +00:00
|
|
|
mixer(const mixer& o) = delete;
|
|
|
|
mixer& operator=(const mixer& o) = delete;
|
|
|
|
|
2016-12-14 14:04:10 +00:00
|
|
|
const string& get_name();
|
2017-01-14 16:18:17 +00:00
|
|
|
const string& get_sound_card();
|
2016-12-13 13:26:09 +00:00
|
|
|
|
|
|
|
bool wait(int timeout = -1);
|
|
|
|
int process_events();
|
|
|
|
|
|
|
|
int get_volume();
|
|
|
|
int get_normalized_volume();
|
|
|
|
void set_volume(float percentage);
|
|
|
|
void set_normalized_volume(float percentage);
|
|
|
|
void set_mute(bool mode);
|
|
|
|
void toggle_mute();
|
|
|
|
bool is_muted();
|
|
|
|
|
|
|
|
private:
|
2016-12-14 14:04:10 +00:00
|
|
|
snd_mixer_t* m_mixer{nullptr};
|
|
|
|
snd_mixer_elem_t* m_elem{nullptr};
|
2016-12-13 13:26:09 +00:00
|
|
|
|
2016-12-14 14:04:10 +00:00
|
|
|
string m_name;
|
2017-01-14 16:18:17 +00:00
|
|
|
string s_name;
|
2016-12-13 13:26:09 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
POLYBAR_NS_END
|