2016-05-31 03:58:58 +00:00
|
|
|
#pragma once
|
2016-05-19 14:41:06 +00:00
|
|
|
|
|
|
|
#include "modules/base.hpp"
|
|
|
|
#include "interfaces/alsa.hpp"
|
|
|
|
#include "drawtypes/icon.hpp"
|
|
|
|
#include "drawtypes/label.hpp"
|
|
|
|
#include "drawtypes/ramp.hpp"
|
|
|
|
#include "drawtypes/bar.hpp"
|
|
|
|
|
|
|
|
namespace modules
|
|
|
|
{
|
|
|
|
DefineModule(VolumeModule, EventModule)
|
|
|
|
{
|
2016-05-26 00:14:56 +00:00
|
|
|
static constexpr auto FORMAT_VOLUME = "format-volume";
|
|
|
|
static constexpr auto FORMAT_MUTED = "format-muted";
|
2016-05-19 14:41:06 +00:00
|
|
|
|
2016-05-26 00:14:56 +00:00
|
|
|
static constexpr auto TAG_RAMP_VOLUME = "<ramp-volume>";
|
|
|
|
static constexpr auto TAG_BAR_VOLUME = "<bar-volume>";
|
|
|
|
static constexpr auto TAG_LABEL_VOLUME = "<label-volume>";
|
|
|
|
static constexpr auto TAG_LABEL_MUTED = "<label-muted>";
|
2016-05-19 14:41:06 +00:00
|
|
|
|
2016-06-09 23:09:54 +00:00
|
|
|
static constexpr auto EVENT_PREFIX = "vol";
|
2016-05-31 03:58:58 +00:00
|
|
|
static constexpr auto EVENT_VOLUME_UP = "volup";
|
|
|
|
static constexpr auto EVENT_VOLUME_DOWN = "voldown";
|
|
|
|
static constexpr auto EVENT_TOGGLE_MUTE = "volmute";
|
2016-05-19 14:41:06 +00:00
|
|
|
|
|
|
|
std::unique_ptr<drawtypes::Bar> bar_volume;
|
|
|
|
std::unique_ptr<drawtypes::Ramp> ramp_volume;
|
|
|
|
std::unique_ptr<drawtypes::Label> label_volume;
|
|
|
|
std::unique_ptr<drawtypes::Label> label_volume_tokenized;
|
|
|
|
std::unique_ptr<drawtypes::Label> label_muted;
|
|
|
|
std::unique_ptr<drawtypes::Label> label_muted_tokenized;
|
|
|
|
|
2016-06-09 23:09:54 +00:00
|
|
|
std::unique_ptr<alsa::Mixer> master_mixer;
|
|
|
|
std::unique_ptr<alsa::Mixer> speaker_mixer;
|
|
|
|
std::unique_ptr<alsa::Mixer> headphone_mixer;
|
|
|
|
std::unique_ptr<alsa::ControlInterface> headphone_ctrl;
|
|
|
|
|
|
|
|
int headphone_ctrl_numid;
|
|
|
|
|
|
|
|
concurrency::Atomic<int> volume;
|
|
|
|
concurrency::Atomic<bool> muted;
|
|
|
|
concurrency::Atomic<bool> has_changed;
|
2016-05-19 14:41:06 +00:00
|
|
|
|
|
|
|
public:
|
2016-05-31 03:58:58 +00:00
|
|
|
explicit VolumeModule(const std::string& name);
|
2016-05-19 14:41:06 +00:00
|
|
|
~VolumeModule();
|
|
|
|
|
|
|
|
bool has_event();
|
|
|
|
bool update();
|
|
|
|
|
|
|
|
std::string get_format();
|
|
|
|
bool build(Builder *builder, const std::string& tag);
|
|
|
|
|
|
|
|
std::string get_output();
|
|
|
|
bool handle_command(const std::string& cmd);
|
|
|
|
};
|
|
|
|
}
|