Add "Enable noise suppression" setting to group calls.
This commit is contained in:
parent
4e0355d09f
commit
b2bf8244dd
|
@ -2057,6 +2057,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_group_call_ptt_delay_s" = "{amount}s";
|
"lng_group_call_ptt_delay_s" = "{amount}s";
|
||||||
"lng_group_call_ptt_delay" = "Push to Talk release delay: {delay}";
|
"lng_group_call_ptt_delay" = "Push to Talk release delay: {delay}";
|
||||||
"lng_group_call_share" = "Share Invite Link";
|
"lng_group_call_share" = "Share Invite Link";
|
||||||
|
"lng_group_call_noise_suppression" = "Enable Noise Suppression";
|
||||||
"lng_group_call_share_speaker" = "Users with this link can speak";
|
"lng_group_call_share_speaker" = "Users with this link can speak";
|
||||||
"lng_group_call_copy_speaker_link" = "Copy Speaker Link";
|
"lng_group_call_copy_speaker_link" = "Copy Speaker Link";
|
||||||
"lng_group_call_copy_listener_link" = "Copy Listener Link";
|
"lng_group_call_copy_listener_link" = "Copy Listener Link";
|
||||||
|
|
|
@ -1606,6 +1606,12 @@ void GroupCall::toggleScheduleStartSubscribed(bool subscribed) {
|
||||||
}).send();
|
}).send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GroupCall::setNoiseSuppression(bool enabled) {
|
||||||
|
if (_instance) {
|
||||||
|
_instance->setIsNoiseSuppressionEnabled(enabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GroupCall::addVideoOutput(
|
void GroupCall::addVideoOutput(
|
||||||
const std::string &endpoint,
|
const std::string &endpoint,
|
||||||
not_null<Webrtc::VideoTrack*> track) {
|
not_null<Webrtc::VideoTrack*> track) {
|
||||||
|
@ -2171,6 +2177,8 @@ bool GroupCall::tryCreateController() {
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
.videoContentType = tgcalls::VideoContentType::Generic,
|
.videoContentType = tgcalls::VideoContentType::Generic,
|
||||||
|
.initialEnableNoiseSuppression
|
||||||
|
= settings.groupCallNoiseSuppression(),
|
||||||
.requestMediaChannelDescriptions = [=, call = base::make_weak(this)](
|
.requestMediaChannelDescriptions = [=, call = base::make_weak(this)](
|
||||||
const std::vector<uint32_t> &ssrcs,
|
const std::vector<uint32_t> &ssrcs,
|
||||||
std::function<void(
|
std::function<void(
|
||||||
|
|
|
@ -235,6 +235,7 @@ public:
|
||||||
}
|
}
|
||||||
void startScheduledNow();
|
void startScheduledNow();
|
||||||
void toggleScheduleStartSubscribed(bool subscribed);
|
void toggleScheduleStartSubscribed(bool subscribed);
|
||||||
|
void setNoiseSuppression(bool enabled);
|
||||||
|
|
||||||
bool emitShareScreenError();
|
bool emitShareScreenError();
|
||||||
bool emitShareCameraError();
|
bool emitShareCameraError();
|
||||||
|
|
|
@ -306,6 +306,20 @@ void SettingsBox(
|
||||||
//AddDivider(layout);
|
//AddDivider(layout);
|
||||||
//AddSkip(layout);
|
//AddSkip(layout);
|
||||||
|
|
||||||
|
AddButton(
|
||||||
|
layout,
|
||||||
|
tr::lng_group_call_noise_suppression(),
|
||||||
|
st::groupCallSettingsButton
|
||||||
|
)->toggleOn(rpl::single(
|
||||||
|
settings.groupCallNoiseSuppression()
|
||||||
|
))->toggledChanges(
|
||||||
|
) | rpl::start_with_next([=](bool enabled) {
|
||||||
|
Core::App().settings().setGroupCallNoiseSuppression(enabled);
|
||||||
|
call->setNoiseSuppression(enabled);
|
||||||
|
Core::App().saveSettingsDelayed();
|
||||||
|
}, layout->lifetime());
|
||||||
|
|
||||||
|
|
||||||
using GlobalShortcut = base::GlobalShortcut;
|
using GlobalShortcut = base::GlobalShortcut;
|
||||||
struct PushToTalkState {
|
struct PushToTalkState {
|
||||||
rpl::variable<QString> recordText = tr::lng_group_call_ptt_shortcut();
|
rpl::variable<QString> recordText = tr::lng_group_call_ptt_shortcut();
|
||||||
|
|
|
@ -195,7 +195,9 @@ QByteArray Settings::serialize() const {
|
||||||
for (const auto &[id, variant] : _emojiVariants) {
|
for (const auto &[id, variant] : _emojiVariants) {
|
||||||
stream << id << quint8(variant);
|
stream << id << quint8(variant);
|
||||||
}
|
}
|
||||||
stream << qint32(_disableOpenGL ? 1 : 0);
|
stream
|
||||||
|
<< qint32(_disableOpenGL ? 1 : 0)
|
||||||
|
<< qint32(_groupCallNoiseSuppression ? 1 : 0);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -272,6 +274,7 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
|
||||||
std::vector<RecentEmojiId> recentEmojiPreload;
|
std::vector<RecentEmojiId> recentEmojiPreload;
|
||||||
base::flat_map<QString, uint8> emojiVariants;
|
base::flat_map<QString, uint8> emojiVariants;
|
||||||
qint32 disableOpenGL = _disableOpenGL ? 1 : 0;
|
qint32 disableOpenGL = _disableOpenGL ? 1 : 0;
|
||||||
|
qint32 groupCallNoiseSuppression = _groupCallNoiseSuppression ? 1 : 0;
|
||||||
|
|
||||||
stream >> themesAccentColors;
|
stream >> themesAccentColors;
|
||||||
if (!stream.atEnd()) {
|
if (!stream.atEnd()) {
|
||||||
|
@ -403,6 +406,9 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
|
||||||
if (!stream.atEnd()) {
|
if (!stream.atEnd()) {
|
||||||
stream >> disableOpenGL;
|
stream >> disableOpenGL;
|
||||||
}
|
}
|
||||||
|
if (!stream.atEnd()) {
|
||||||
|
stream >> groupCallNoiseSuppression;
|
||||||
|
}
|
||||||
if (stream.status() != QDataStream::Ok) {
|
if (stream.status() != QDataStream::Ok) {
|
||||||
LOG(("App Error: "
|
LOG(("App Error: "
|
||||||
"Bad data for Core::Settings::constructFromSerialized()"));
|
"Bad data for Core::Settings::constructFromSerialized()"));
|
||||||
|
@ -513,6 +519,7 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
|
||||||
Ui::GL::ForceDisable(_disableOpenGL
|
Ui::GL::ForceDisable(_disableOpenGL
|
||||||
|| Ui::Integration::Instance().openglLastCheckFailed());
|
|| Ui::Integration::Instance().openglLastCheckFailed());
|
||||||
}
|
}
|
||||||
|
_groupCallNoiseSuppression = (groupCallNoiseSuppression == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Settings::chatWide() const {
|
bool Settings::chatWide() const {
|
||||||
|
@ -741,6 +748,8 @@ void Settings::resetOnLastLogout() {
|
||||||
_groupCallPushToTalkShortcut = QByteArray();
|
_groupCallPushToTalkShortcut = QByteArray();
|
||||||
_groupCallPushToTalkDelay = 20;
|
_groupCallPushToTalkDelay = 20;
|
||||||
|
|
||||||
|
_groupCallNoiseSuppression = true;
|
||||||
|
|
||||||
//_themesAccentColors = Window::Theme::AccentColors();
|
//_themesAccentColors = Window::Theme::AccentColors();
|
||||||
|
|
||||||
_lastSeenWarningSeen = false;
|
_lastSeenWarningSeen = false;
|
||||||
|
|
|
@ -265,6 +265,12 @@ public:
|
||||||
void setGroupCallPushToTalkDelay(crl::time delay) {
|
void setGroupCallPushToTalkDelay(crl::time delay) {
|
||||||
_groupCallPushToTalkDelay = delay;
|
_groupCallPushToTalkDelay = delay;
|
||||||
}
|
}
|
||||||
|
[[nodiscard]] bool groupCallNoiseSuppression() const {
|
||||||
|
return _groupCallNoiseSuppression;
|
||||||
|
}
|
||||||
|
void setGroupCallNoiseSuppression(bool value) {
|
||||||
|
_groupCallNoiseSuppression = value;
|
||||||
|
}
|
||||||
[[nodiscard]] Window::Theme::AccentColors &themesAccentColors() {
|
[[nodiscard]] Window::Theme::AccentColors &themesAccentColors() {
|
||||||
return _themesAccentColors;
|
return _themesAccentColors;
|
||||||
}
|
}
|
||||||
|
@ -594,6 +600,7 @@ private:
|
||||||
bool _callAudioDuckingEnabled = true;
|
bool _callAudioDuckingEnabled = true;
|
||||||
bool _disableCalls = false;
|
bool _disableCalls = false;
|
||||||
bool _groupCallPushToTalk = false;
|
bool _groupCallPushToTalk = false;
|
||||||
|
bool _groupCallNoiseSuppression = true;
|
||||||
QByteArray _groupCallPushToTalkShortcut;
|
QByteArray _groupCallPushToTalkShortcut;
|
||||||
crl::time _groupCallPushToTalkDelay = 20;
|
crl::time _groupCallPushToTalkDelay = 20;
|
||||||
Window::Theme::AccentColors _themesAccentColors;
|
Window::Theme::AccentColors _themesAccentColors;
|
||||||
|
|
Loading…
Reference in New Issue