From 8be5427c33a1a094a98d707208fd9f4b95ea569d Mon Sep 17 00:00:00 2001 From: NBonaparte Date: Sat, 14 Oct 2017 11:27:43 -0700 Subject: [PATCH] refactor(pulseaudio): remove headphone ramp --- include/modules/pulseaudio.hpp | 3 --- src/modules/pulseaudio.cpp | 8 ++------ 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/include/modules/pulseaudio.hpp b/include/modules/pulseaudio.hpp index a2598086..02331c63 100644 --- a/include/modules/pulseaudio.hpp +++ b/include/modules/pulseaudio.hpp @@ -31,7 +31,6 @@ namespace modules { static constexpr auto FORMAT_MUTED = "format-muted"; static constexpr auto TAG_RAMP_VOLUME = ""; - static constexpr auto TAG_RAMP_HEADPHONES = ""; static constexpr auto TAG_BAR_VOLUME = ""; static constexpr auto TAG_LABEL_VOLUME = ""; static constexpr auto TAG_LABEL_MUTED = ""; @@ -43,14 +42,12 @@ namespace modules { progressbar_t m_bar_volume; ramp_t m_ramp_volume; - ramp_t m_ramp_headphones; label_t m_label_volume; label_t m_label_muted; pulseaudio_t m_pulseaudio; atomic m_muted{false}; - atomic m_headphones{false}; atomic m_volume{0}; }; } diff --git a/src/modules/pulseaudio.cpp b/src/modules/pulseaudio.cpp index a6cc8607..ab007949 100644 --- a/src/modules/pulseaudio.cpp +++ b/src/modules/pulseaudio.cpp @@ -38,7 +38,6 @@ namespace modules { } if (m_formatter->has(TAG_RAMP_VOLUME)) { m_ramp_volume = load_ramp(m_conf, name(), TAG_RAMP_VOLUME); - m_ramp_headphones = load_ramp(m_conf, name(), TAG_RAMP_HEADPHONES, false); } } @@ -61,10 +60,9 @@ namespace modules { // Consume pending events m_pulseaudio->process_events(); - // Get volume, mute and headphone state + // Get volume and mute state m_volume = 100; m_muted = false; - m_headphones = false; try { if (m_pulseaudio) { @@ -113,10 +111,8 @@ namespace modules { bool pulseaudio_module::build(builder* builder, const string& tag) const { if (tag == TAG_BAR_VOLUME) { builder->node(m_bar_volume->output(m_volume)); - } else if (tag == TAG_RAMP_VOLUME && (!m_headphones || !*m_ramp_headphones)) { + } else if (tag == TAG_RAMP_VOLUME) { builder->node(m_ramp_volume->get_by_percentage(m_volume)); - } else if (tag == TAG_RAMP_VOLUME && m_headphones && *m_ramp_headphones) { - builder->node(m_ramp_headphones->get_by_percentage(m_volume)); } else if (tag == TAG_LABEL_VOLUME) { builder->node(m_label_volume); } else if (tag == TAG_LABEL_MUTED) {