get rid of signals for setting gate and gain

This commit is contained in:
ouwou
2023-07-23 02:27:53 -04:00
parent 18172a8890
commit f696ecb5c3
3 changed files with 6 additions and 27 deletions

View File

@@ -478,14 +478,6 @@ void Abaddon::ShowVoiceWindow() {
m_audio.SetPlayback(!is_deaf);
});
wnd->signal_gate().connect([this](double gate) {
m_audio.SetCaptureGate(gate);
});
wnd->signal_gain().connect([this](double gain) {
m_audio.SetCaptureGain(gain);
});
wnd->signal_mute_user_cs().connect([this](Snowflake id, bool is_mute) {
if (const auto ssrc = m_discord.GetSSRCOfUser(id); ssrc.has_value()) {
m_audio.SetMuteSSRC(*ssrc, is_mute);

View File

@@ -120,10 +120,11 @@ VoiceWindow::VoiceWindow(Snowflake channel_id)
m_vad_param.set_range(0.0, 100.0);
m_vad_param.set_value_pos(Gtk::POS_LEFT);
m_vad_param.signal_value_changed().connect([this]() {
auto &audio = Abaddon::Get().GetAudio();
const double val = m_vad_param.get_value() * 0.01;
switch (Abaddon::Get().GetAudio().GetVADMethod()) {
switch (audio.GetVADMethod()) {
case AudioManager::VADMethod::Gate:
m_signal_gate.emit(val);
audio.SetCaptureGate(val);
m_vad_value.SetTick(val);
break;
#ifdef WITH_RNNOISE
@@ -138,8 +139,8 @@ VoiceWindow::VoiceWindow(Snowflake channel_id)
m_capture_gain.set_value_pos(Gtk::POS_LEFT);
m_capture_gain.set_value(audio.GetCaptureGain() * 100.0);
m_capture_gain.signal_value_changed().connect([this]() {
const double val = m_capture_gain.get_value();
m_signal_gain.emit(val / 100.0);
const double val = m_capture_gain.get_value() / 100.0;
Abaddon::Get().GetAudio().SetCaptureGain(val);
});
m_vad_combo.set_valign(Gtk::ALIGN_END);
@@ -204,7 +205,7 @@ VoiceWindow::VoiceWindow(Snowflake channel_id)
auto *window = new VoiceSettingsWindow;
const auto cb = [this](double gain) {
m_capture_gain.set_value(gain * 100.0);
m_signal_gain.emit(gain);
Abaddon::Get().GetAudio().SetCaptureGain(gain);
};
window->signal_gain().connect(sigc::track_obj(cb, *this));
window->show();
@@ -320,14 +321,6 @@ VoiceWindow::type_signal_deafen VoiceWindow::signal_deafen() {
return m_signal_deafen;
}
VoiceWindow::type_signal_gate VoiceWindow::signal_gate() {
return m_signal_gate;
}
VoiceWindow::type_signal_gate VoiceWindow::signal_gain() {
return m_signal_gain;
}
VoiceWindow::type_signal_mute_user_cs VoiceWindow::signal_mute_user_cs() {
return m_signal_mute_user_cs;
}

View File

@@ -69,23 +69,17 @@ private:
public:
using type_signal_mute = sigc::signal<void(bool)>;
using type_signal_deafen = sigc::signal<void(bool)>;
using type_signal_gate = sigc::signal<void(double)>;
using type_signal_gain = sigc::signal<void(double)>;
using type_signal_mute_user_cs = sigc::signal<void(Snowflake, bool)>;
using type_signal_user_volume_changed = sigc::signal<void(Snowflake, double)>;
type_signal_mute signal_mute();
type_signal_deafen signal_deafen();
type_signal_gate signal_gate();
type_signal_gain signal_gain();
type_signal_mute_user_cs signal_mute_user_cs();
type_signal_user_volume_changed signal_user_volume_changed();
private:
type_signal_mute m_signal_mute;
type_signal_deafen m_signal_deafen;
type_signal_gate m_signal_gate;
type_signal_gain m_signal_gain;
type_signal_mute_user_cs m_signal_mute_user_cs;
type_signal_user_volume_changed m_signal_user_volume_changed;
};