get rid of signals for setting gate and gain
This commit is contained in:
@@ -478,14 +478,6 @@ void Abaddon::ShowVoiceWindow() {
|
|||||||
m_audio.SetPlayback(!is_deaf);
|
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) {
|
wnd->signal_mute_user_cs().connect([this](Snowflake id, bool is_mute) {
|
||||||
if (const auto ssrc = m_discord.GetSSRCOfUser(id); ssrc.has_value()) {
|
if (const auto ssrc = m_discord.GetSSRCOfUser(id); ssrc.has_value()) {
|
||||||
m_audio.SetMuteSSRC(*ssrc, is_mute);
|
m_audio.SetMuteSSRC(*ssrc, is_mute);
|
||||||
|
@@ -120,10 +120,11 @@ VoiceWindow::VoiceWindow(Snowflake channel_id)
|
|||||||
m_vad_param.set_range(0.0, 100.0);
|
m_vad_param.set_range(0.0, 100.0);
|
||||||
m_vad_param.set_value_pos(Gtk::POS_LEFT);
|
m_vad_param.set_value_pos(Gtk::POS_LEFT);
|
||||||
m_vad_param.signal_value_changed().connect([this]() {
|
m_vad_param.signal_value_changed().connect([this]() {
|
||||||
|
auto &audio = Abaddon::Get().GetAudio();
|
||||||
const double val = m_vad_param.get_value() * 0.01;
|
const double val = m_vad_param.get_value() * 0.01;
|
||||||
switch (Abaddon::Get().GetAudio().GetVADMethod()) {
|
switch (audio.GetVADMethod()) {
|
||||||
case AudioManager::VADMethod::Gate:
|
case AudioManager::VADMethod::Gate:
|
||||||
m_signal_gate.emit(val);
|
audio.SetCaptureGate(val);
|
||||||
m_vad_value.SetTick(val);
|
m_vad_value.SetTick(val);
|
||||||
break;
|
break;
|
||||||
#ifdef WITH_RNNOISE
|
#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_pos(Gtk::POS_LEFT);
|
||||||
m_capture_gain.set_value(audio.GetCaptureGain() * 100.0);
|
m_capture_gain.set_value(audio.GetCaptureGain() * 100.0);
|
||||||
m_capture_gain.signal_value_changed().connect([this]() {
|
m_capture_gain.signal_value_changed().connect([this]() {
|
||||||
const double val = m_capture_gain.get_value();
|
const double val = m_capture_gain.get_value() / 100.0;
|
||||||
m_signal_gain.emit(val / 100.0);
|
Abaddon::Get().GetAudio().SetCaptureGain(val);
|
||||||
});
|
});
|
||||||
|
|
||||||
m_vad_combo.set_valign(Gtk::ALIGN_END);
|
m_vad_combo.set_valign(Gtk::ALIGN_END);
|
||||||
@@ -204,7 +205,7 @@ VoiceWindow::VoiceWindow(Snowflake channel_id)
|
|||||||
auto *window = new VoiceSettingsWindow;
|
auto *window = new VoiceSettingsWindow;
|
||||||
const auto cb = [this](double gain) {
|
const auto cb = [this](double gain) {
|
||||||
m_capture_gain.set_value(gain * 100.0);
|
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->signal_gain().connect(sigc::track_obj(cb, *this));
|
||||||
window->show();
|
window->show();
|
||||||
@@ -320,14 +321,6 @@ VoiceWindow::type_signal_deafen VoiceWindow::signal_deafen() {
|
|||||||
return m_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() {
|
VoiceWindow::type_signal_mute_user_cs VoiceWindow::signal_mute_user_cs() {
|
||||||
return m_signal_mute_user_cs;
|
return m_signal_mute_user_cs;
|
||||||
}
|
}
|
||||||
|
@@ -69,23 +69,17 @@ private:
|
|||||||
public:
|
public:
|
||||||
using type_signal_mute = sigc::signal<void(bool)>;
|
using type_signal_mute = sigc::signal<void(bool)>;
|
||||||
using type_signal_deafen = 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_mute_user_cs = sigc::signal<void(Snowflake, bool)>;
|
||||||
using type_signal_user_volume_changed = sigc::signal<void(Snowflake, double)>;
|
using type_signal_user_volume_changed = sigc::signal<void(Snowflake, double)>;
|
||||||
|
|
||||||
type_signal_mute signal_mute();
|
type_signal_mute signal_mute();
|
||||||
type_signal_deafen signal_deafen();
|
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_mute_user_cs signal_mute_user_cs();
|
||||||
type_signal_user_volume_changed signal_user_volume_changed();
|
type_signal_user_volume_changed signal_user_volume_changed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
type_signal_mute m_signal_mute;
|
type_signal_mute m_signal_mute;
|
||||||
type_signal_deafen m_signal_deafen;
|
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_mute_user_cs m_signal_mute_user_cs;
|
||||||
type_signal_user_volume_changed m_signal_user_volume_changed;
|
type_signal_user_volume_changed m_signal_user_volume_changed;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user