From ffb8d386216e6fbb58e5a51028da031cf5f44512 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Tue, 17 Oct 2023 22:55:14 -0400 Subject: fix gap in connections if image not found --- src/windows/profile/userinfopane.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/windows') diff --git a/src/windows/profile/userinfopane.cpp b/src/windows/profile/userinfopane.cpp index b6f0d59..8c1605a 100644 --- a/src/windows/profile/userinfopane.cpp +++ b/src/windows/profile/userinfopane.cpp @@ -96,12 +96,13 @@ void ConnectionsContainer::SetConnections(const std::vector &con "facebook" }; - for (size_t i = 0; i < connections.size(); i++) { - const auto &conn = connections[i]; + int i = 0; + for (const auto &conn : connections) { if (supported_services.find(conn.Type) == supported_services.end()) continue; auto widget = Gtk::manage(new ConnectionItem(conn)); widget->show(); - attach(*widget, static_cast(i % 2), static_cast(i / 2), 1, 1); + attach(*widget, i % 2, i / 2, 1, 1); + i++; } set_halign(Gtk::ALIGN_FILL); -- cgit v1.2.3 From 5e244e5cb8d633e83b34a09ef560375931dd6092 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Tue, 17 Oct 2023 22:55:50 -0400 Subject: update connections (#239) --- res/res/crunchyroll.png | Bin 0 -> 44496 bytes res/res/e1e96d89e192de1997f73730db26e94f.png | Bin 0 -> 8262 bytes res/res/ebay.png | Bin 0 -> 9633 bytes res/res/instagram.png | Bin 0 -> 28690 bytes res/res/paypal.png | Bin 0 -> 6928 bytes res/res/playstation.png | Bin 0 -> 6873 bytes res/res/riotgames.png | Bin 0 -> 6245 bytes res/res/tiktok.png | Bin 0 -> 10125 bytes res/res/twitter.png | Bin 3713 -> 5230 bytes src/windows/profile/userinfopane.cpp | 55 ++++++++++++++++++--------- 10 files changed, 37 insertions(+), 18 deletions(-) create mode 100644 res/res/crunchyroll.png create mode 100644 res/res/e1e96d89e192de1997f73730db26e94f.png create mode 100644 res/res/ebay.png create mode 100644 res/res/instagram.png create mode 100644 res/res/paypal.png create mode 100644 res/res/playstation.png create mode 100644 res/res/riotgames.png create mode 100644 res/res/tiktok.png (limited to 'src/windows') diff --git a/res/res/crunchyroll.png b/res/res/crunchyroll.png new file mode 100644 index 0000000..6cbbaeb Binary files /dev/null and b/res/res/crunchyroll.png differ diff --git a/res/res/e1e96d89e192de1997f73730db26e94f.png b/res/res/e1e96d89e192de1997f73730db26e94f.png new file mode 100644 index 0000000..76fec43 Binary files /dev/null and b/res/res/e1e96d89e192de1997f73730db26e94f.png differ diff --git a/res/res/ebay.png b/res/res/ebay.png new file mode 100644 index 0000000..2710a97 Binary files /dev/null and b/res/res/ebay.png differ diff --git a/res/res/instagram.png b/res/res/instagram.png new file mode 100644 index 0000000..e124966 Binary files /dev/null and b/res/res/instagram.png differ diff --git a/res/res/paypal.png b/res/res/paypal.png new file mode 100644 index 0000000..28718f1 Binary files /dev/null and b/res/res/paypal.png differ diff --git a/res/res/playstation.png b/res/res/playstation.png new file mode 100644 index 0000000..92bc8e1 Binary files /dev/null and b/res/res/playstation.png differ diff --git a/res/res/riotgames.png b/res/res/riotgames.png new file mode 100644 index 0000000..436ec17 Binary files /dev/null and b/res/res/riotgames.png differ diff --git a/res/res/tiktok.png b/res/res/tiktok.png new file mode 100644 index 0000000..7245cf6 Binary files /dev/null and b/res/res/tiktok.png differ diff --git a/res/res/twitter.png b/res/res/twitter.png index 610ae24..24ebc93 100644 Binary files a/res/res/twitter.png and b/res/res/twitter.png differ diff --git a/src/windows/profile/userinfopane.cpp b/src/windows/profile/userinfopane.cpp index 8c1605a..ab4f50f 100644 --- a/src/windows/profile/userinfopane.cpp +++ b/src/windows/profile/userinfopane.cpp @@ -1,6 +1,34 @@ #include "userinfopane.hpp" #include +static std::string GetConnectionURL(const ConnectionData &conn) { + if (conn.Type == "github") { + return "https://github.com/" + conn.Name; + } else if (conn.Type == "steam") { + return "https://steamcommunity.com/profiles/" + conn.ID; + } else if (conn.Type == "twitch") { + return "https://twitch.tv/" + conn.Name; + } else if (conn.Type == "twitter") { + return "https://twitter.com/i/user/" + conn.ID; + } else if (conn.Type == "spotify") { + return "https://open.spotify.com/user/" + conn.ID; + } else if (conn.Type == "reddit") { + return "https://reddit.com/u/" + conn.Name; + } else if (conn.Type == "youtube") { + return "https://www.youtube.com/channel/" + conn.ID; + } else if (conn.Type == "facebook") { + return "https://www.facebook.com/" + conn.ID; + } else if (conn.Type == "ebay") { + return "https://www.ebay.com/usr/" + conn.Name; + } else if (conn.Type == "instagram") { + return "https://www.instagram.com/" + conn.Name; + } else if (conn.Type == "tiktok") { + return "https://www.tiktok.com/@" + conn.Name; + } + + return ""; +} + ConnectionItem::ConnectionItem(const ConnectionData &conn) : m_box(Gtk::ORIENTATION_HORIZONTAL) , m_name(conn.Name) { @@ -8,23 +36,7 @@ ConnectionItem::ConnectionItem(const ConnectionData &conn) try { pixbuf = Gdk::Pixbuf::create_from_file(Abaddon::GetResPath("/" + conn.Type + ".png"), 32, 32); } catch (const Glib::Exception &e) {} - std::string url; - if (conn.Type == "github") - url = "https://github.com/" + conn.Name; - else if (conn.Type == "steam") - url = "https://steamcommunity.com/profiles/" + conn.ID; - else if (conn.Type == "twitch") - url = "https://twitch.tv/" + conn.Name; - else if (conn.Type == "twitter") - url = "https://twitter.com/i/user/" + conn.ID; - else if (conn.Type == "spotify") - url = "https://open.spotify.com/user/" + conn.ID; - else if (conn.Type == "reddit") - url = "https://reddit.com/u/" + conn.Name; - else if (conn.Type == "youtube") - url = "https://www.youtube.com/channel/" + conn.ID; - else if (conn.Type == "facebook") - url = "https://www.facebook.com/" + conn.ID; + std::string url = GetConnectionURL(conn); if (pixbuf) { m_image = Gtk::manage(new Gtk::Image(pixbuf)); m_image->get_style_context()->add_class("profile-connection-image"); @@ -83,17 +95,24 @@ void ConnectionsContainer::SetConnections(const std::vector &con static const std::unordered_set supported_services = { "battlenet", + "ebay", + "epicgames", + "facebook", "github", + "instagram", "leagueoflegends", + "paypal", + "playstation", "reddit", + "riotgames", "skype", "spotify", "steam", + "tiktok", "twitch", "twitter", "xbox", "youtube", - "facebook" }; int i = 0; -- cgit v1.2.3 From 9a5e820f6d781fe003b5a8111906f9a3519bad2b Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Sat, 21 Oct 2023 03:03:19 -0400 Subject: add mix mono option to voice window (closes #238) --- src/audio/manager.cpp | 20 +++++++++++++++++++- src/audio/manager.hpp | 4 ++++ src/windows/voicewindow.cpp | 7 +++++++ src/windows/voicewindow.hpp | 1 + 4 files changed, 31 insertions(+), 1 deletion(-) (limited to 'src/windows') diff --git a/src/audio/manager.cpp b/src/audio/manager.cpp index 739e835..0336699 100644 --- a/src/audio/manager.cpp +++ b/src/audio/manager.cpp @@ -419,13 +419,23 @@ void AudioManager::OnCapturedPCM(const int16_t *pcm, ma_uint32 frames) { if (m_opus_buffer == nullptr || !m_should_capture) return; const double gain = m_capture_gain; - // i have a suspicion i can cast the const away... but i wont + std::vector new_pcm(pcm, pcm + frames * 2); for (auto &val : new_pcm) { const int32_t unclamped = static_cast(val * gain); val = std::clamp(unclamped, INT16_MIN, INT16_MAX); } + if (m_mix_mono) { + for (size_t i = 0; i < frames * 2; i += 2) { + const int sample_L = new_pcm[i]; + const int sample_R = new_pcm[i + 1]; + const int16_t mixed = static_cast((sample_L + sample_R) / 2); + new_pcm[i] = mixed; + new_pcm[i + 1] = mixed; + } + } + UpdateCaptureVolume(new_pcm.data(), frames); static std::array denoised_L; @@ -629,6 +639,14 @@ bool AudioManager::GetSuppressNoise() const { } #endif +void AudioManager::SetMixMono(bool value) { + m_mix_mono = value; +} + +bool AudioManager::GetMixMono() const { + return m_mix_mono; +} + AudioManager::type_signal_opus_packet AudioManager::signal_opus_packet() { return m_signal_opus_packet; } diff --git a/src/audio/manager.hpp b/src/audio/manager.hpp index 80a2542..5321cb5 100644 --- a/src/audio/manager.hpp +++ b/src/audio/manager.hpp @@ -87,6 +87,9 @@ public: bool GetSuppressNoise() const; #endif + void SetMixMono(bool value); + bool GetMixMono() const; + private: void OnCapturedPCM(const int16_t *pcm, ma_uint32 frames); @@ -144,6 +147,7 @@ private: std::atomic m_prob_threshold = 0.5; std::atomic m_vad_prob = 0.0; std::atomic m_enable_noise_suppression = false; + std::atomic m_mix_mono = false; std::unordered_set m_muted_ssrcs; std::unordered_map m_volume_ssrc; diff --git a/src/windows/voicewindow.cpp b/src/windows/voicewindow.cpp index 73a09c2..16a9fed 100644 --- a/src/windows/voicewindow.cpp +++ b/src/windows/voicewindow.cpp @@ -89,6 +89,7 @@ VoiceWindow::VoiceWindow(Snowflake channel_id) , m_mute("Mute") , m_deafen("Deafen") , m_noise_suppression("Suppress Noise") + , m_mix_mono("Mix Mono") , m_channel_id(channel_id) , m_menu_view("View") , m_menu_view_settings("More _Settings", true) { @@ -178,6 +179,11 @@ VoiceWindow::VoiceWindow(Snowflake channel_id) Abaddon::Get().GetAudio().SetSuppressNoise(m_noise_suppression.get_active()); }); + m_mix_mono.set_active(audio.GetMixMono()); + m_mix_mono.signal_toggled().connect([this]() { + Abaddon::Get().GetAudio().SetMixMono(m_mix_mono.get_active()); + }); + auto *playback_renderer = Gtk::make_managed(); m_playback_combo.set_valign(Gtk::ALIGN_END); m_playback_combo.set_hexpand(true); @@ -223,6 +229,7 @@ VoiceWindow::VoiceWindow(Snowflake channel_id) m_controls.add(m_mute); m_controls.add(m_deafen); m_controls.add(m_noise_suppression); + m_controls.add(m_mix_mono); m_main.add(m_menu_bar); m_main.add(m_controls); m_main.add(m_vad_value); diff --git a/src/windows/voicewindow.hpp b/src/windows/voicewindow.hpp index 6db2563..02e006f 100644 --- a/src/windows/voicewindow.hpp +++ b/src/windows/voicewindow.hpp @@ -54,6 +54,7 @@ private: Gtk::Scale m_capture_gain; Gtk::CheckButton m_noise_suppression; + Gtk::CheckButton m_mix_mono; Gtk::ComboBoxText m_vad_combo; Gtk::ComboBox m_playback_combo; -- cgit v1.2.3