#pragma once #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) { static constexpr auto FORMAT_VOLUME = "format-volume"; static constexpr auto FORMAT_MUTED = "format-muted"; static constexpr auto TAG_RAMP_VOLUME = ""; static constexpr auto TAG_BAR_VOLUME = ""; static constexpr auto TAG_LABEL_VOLUME = ""; static constexpr auto TAG_LABEL_MUTED = ""; static constexpr auto EVENT_PREFIX = "vol"; static constexpr auto EVENT_VOLUME_UP = "volup"; static constexpr auto EVENT_VOLUME_DOWN = "voldown"; static constexpr auto EVENT_TOGGLE_MUTE = "volmute"; std::unique_ptr bar_volume; std::unique_ptr ramp_volume; std::unique_ptr label_volume; std::unique_ptr label_volume_tokenized; std::unique_ptr label_muted; std::unique_ptr label_muted_tokenized; std::unique_ptr master_mixer; std::unique_ptr speaker_mixer; std::unique_ptr headphone_mixer; std::unique_ptr headphone_ctrl; int headphone_ctrl_numid; concurrency::Atomic volume; concurrency::Atomic muted; concurrency::Atomic has_changed; public: explicit VolumeModule(std::string name); ~VolumeModule(); bool has_event(); bool update(); std::string get_format(); bool build(Builder *builder, std::string tag); std::string get_output(); bool handle_command(std::string cmd); }; }