mirror of
https://github.com/polybar/polybar.git
synced 2024-11-18 13:55:11 -05:00
fix(pulseaudio): fix max_volume naming
This commit is contained in:
parent
4bf73ddd81
commit
f2010edf94
2 changed files with 4 additions and 4 deletions
|
@ -74,7 +74,7 @@ class pulseaudio {
|
||||||
string s_name;
|
string s_name;
|
||||||
uint32_t m_index{0};
|
uint32_t m_index{0};
|
||||||
|
|
||||||
pa_volume_t max_volume{PA_VOLUME_UI_MAX};
|
pa_volume_t m_max_volume{PA_VOLUME_UI_MAX};
|
||||||
};
|
};
|
||||||
|
|
||||||
POLYBAR_NS_END
|
POLYBAR_NS_END
|
||||||
|
|
|
@ -6,7 +6,7 @@ POLYBAR_NS
|
||||||
/**
|
/**
|
||||||
* Construct pulseaudio object
|
* Construct pulseaudio object
|
||||||
*/
|
*/
|
||||||
pulseaudio::pulseaudio(const logger& logger, string&& sink_name, bool m_max_volume) : m_log(logger), spec_s_name(sink_name) {
|
pulseaudio::pulseaudio(const logger& logger, string&& sink_name, bool max_volume) : m_log(logger), spec_s_name(sink_name) {
|
||||||
m_mainloop = pa_threaded_mainloop_new();
|
m_mainloop = pa_threaded_mainloop_new();
|
||||||
if (!m_mainloop) {
|
if (!m_mainloop) {
|
||||||
throw pulseaudio_error("Could not create pulseaudio threaded mainloop.");
|
throw pulseaudio_error("Could not create pulseaudio threaded mainloop.");
|
||||||
|
@ -64,7 +64,7 @@ pulseaudio::pulseaudio(const logger& logger, string&& sink_name, bool m_max_volu
|
||||||
m_log.trace("pulseaudio: using sink %s", s_name);
|
m_log.trace("pulseaudio: using sink %s", s_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
max_volume = m_max_volume ? PA_VOLUME_UI_MAX : PA_VOLUME_NORM;
|
m_max_volume = max_volume ? PA_VOLUME_UI_MAX : PA_VOLUME_NORM;
|
||||||
|
|
||||||
auto event_types = static_cast<pa_subscription_mask_t>(PA_SUBSCRIPTION_MASK_SINK | PA_SUBSCRIPTION_MASK_SERVER);
|
auto event_types = static_cast<pa_subscription_mask_t>(PA_SUBSCRIPTION_MASK_SINK | PA_SUBSCRIPTION_MASK_SERVER);
|
||||||
op = pa_context_subscribe(m_context, event_types, simple_callback, this);
|
op = pa_context_subscribe(m_context, event_types, simple_callback, this);
|
||||||
|
@ -175,7 +175,7 @@ void pulseaudio::inc_volume(int delta_perc) {
|
||||||
pa_threaded_mainloop_lock(m_mainloop);
|
pa_threaded_mainloop_lock(m_mainloop);
|
||||||
pa_volume_t vol = math_util::percentage_to_value<pa_volume_t>(abs(delta_perc), PA_VOLUME_NORM);
|
pa_volume_t vol = math_util::percentage_to_value<pa_volume_t>(abs(delta_perc), PA_VOLUME_NORM);
|
||||||
if (delta_perc > 0) {
|
if (delta_perc > 0) {
|
||||||
if (pa_cvolume_max(&cv) + vol <= max_volume) {
|
if (pa_cvolume_max(&cv) + vol <= m_max_volume) {
|
||||||
pa_cvolume_inc(&cv, vol);
|
pa_cvolume_inc(&cv, vol);
|
||||||
} else {
|
} else {
|
||||||
m_log.warn("pulseaudio: maximum volume reached");
|
m_log.warn("pulseaudio: maximum volume reached");
|
||||||
|
|
Loading…
Reference in a new issue