Skip to content
Snippets Groups Projects
Commit 151e8412 authored by Sébastien Blin's avatar Sébastien Blin
Browse files

audio: add settings to disable echo cancelling

In the audio settings, useEchoCanceller can be set to avoid
to use the integrated auto canceller

Change-Id: Iac4de7db1ee85fea001fb4aa3caf97caa9bc87df
parent 6b2e8166
No related branches found
No related tags found
No related merge requests found
......@@ -336,7 +336,8 @@ void PulseLayer::createStreams(pa_context* c)
// Create playback stream
if (auto dev_infos = getDeviceInfos(sinkList_, getPreferredPlaybackDevice())) {
playback_.reset(new AudioStream(c, mainloop_.get(), "Playback", StreamType::Playback, audioFormat_.sample_rate, dev_infos, true, onReady));
bool ec = preference_.getEchoCanceller() == "system";
playback_.reset(new AudioStream(c, mainloop_.get(), "Playback", StreamType::Playback, audioFormat_.sample_rate, dev_infos, ec, onReady));
pa_stream_set_write_callback(playback_->stream(), [](pa_stream * /*s*/, size_t /*bytes*/, void* userdata) {
static_cast<PulseLayer*>(userdata)->writeToSpeaker();
}, this);
......
......@@ -123,6 +123,7 @@ static constexpr const char* RECORDPATH_KEY {"recordPath"};
static constexpr const char* ALWAYS_RECORDING_KEY {"alwaysRecording"};
static constexpr const char* VOLUMEMIC_KEY {"volumeMic"};
static constexpr const char* VOLUMESPKR_KEY {"volumeSpkr"};
static constexpr const char* ECHO_CANCELLER {"echoCanceller"};
static constexpr const char* NOISE_REDUCE_KEY {"noiseReduce"};
static constexpr const char* AGC_KEY {"automaticGainControl"};
static constexpr const char* CAPTURE_MUTED_KEY {"captureMuted"};
......@@ -341,6 +342,7 @@ AudioPreference::AudioPreference() :
, alwaysRecording_(false)
, volumemic_(1.0)
, volumespkr_(1.0)
, echoCanceller_("system")
, denoise_(false)
, agcEnabled_(false)
, captureMuted_(false)
......@@ -494,7 +496,7 @@ void AudioPreference::serialize(YAML::Emitter &out) const
out << YAML::Key << RECORDPATH_KEY << YAML::Value << recordpath_;
out << YAML::Key << VOLUMEMIC_KEY << YAML::Value << volumemic_;
out << YAML::Key << VOLUMESPKR_KEY << YAML::Value << volumespkr_;
out << YAML::Key << ECHO_CANCELLER << YAML::Value << echoCanceller_;
out << YAML::EndMap;
}
......@@ -542,6 +544,7 @@ void AudioPreference::unserialize(const YAML::Node &in)
parseValue(node, RECORDPATH_KEY, recordpath_);
parseValue(node, VOLUMEMIC_KEY, volumemic_);
parseValue(node, VOLUMESPKR_KEY, volumespkr_);
parseValue(node, ECHO_CANCELLER, echoCanceller_);
}
ShortcutPreferences::ShortcutPreferences() : hangup_(), pickup_(), popup_(),
......
......@@ -9,7 +9,7 @@
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* This program is distributed in the hope that it will be ful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
......@@ -376,6 +376,14 @@ class AudioPreference : public Serializable {
playbackMuted_= muted;
}
std::string getEchoCanceller() const {
return echoCanceller_;
}
void setEchoCanceller(const std::string& ec) {
echoCanceller_ = ec;
}
private:
std::string audioApi_;
......@@ -396,6 +404,7 @@ class AudioPreference : public Serializable {
bool alwaysRecording_;
double volumemic_;
double volumespkr_;
std::string echoCanceller_;
bool denoise_;
bool agcEnabled_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment