mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 03:18:07 +00:00
fix #LINQT-1657 do not manipulate internal gains
This commit is contained in:
parent
cbd91b868d
commit
99c2a6ddc6
3 changed files with 35 additions and 9 deletions
|
|
@ -237,6 +237,13 @@ void SettingsCore::setSelf(QSharedPointer<SettingsCore> me) {
|
|||
mustBeInLinphoneThread(getClassName());
|
||||
mSettingsModelConnection = SafeConnection<SettingsCore, SettingsModel>::create(me, SettingsModel::getInstance());
|
||||
|
||||
mSettingsModelConnection->makeConnectToModel(&SettingsModel::captureGraphRunningChanged, [this](bool running) {
|
||||
mSettingsModelConnection->invokeToCore([this, running] {
|
||||
mCaptureGraphRunning = running;
|
||||
emit captureGraphRunningChanged(running);
|
||||
});
|
||||
});
|
||||
|
||||
// VFS
|
||||
mSettingsModelConnection->makeConnectToModel(&SettingsModel::vfsEnabledChanged, [this](const bool enabled) {
|
||||
mSettingsModelConnection->invokeToCore([this, enabled]() { setVfsEnabled(enabled); });
|
||||
|
|
|
|||
|
|
@ -114,6 +114,10 @@ void CoreModel::start() {
|
|||
if (mCore->getLogCollectionUploadServerUrl().empty())
|
||||
mCore->setLogCollectionUploadServerUrl(Constants::DefaultUploadLogsServer);
|
||||
|
||||
/// These 2 API should not be used as they manage internal gains insterad of those of the soundcard.
|
||||
// Use playback/capture gain from capture graph and call only
|
||||
mCore->setMicGainDb(0.0);
|
||||
mCore->setPlaybackGainDb(0.0);
|
||||
mIterateTimer = new QTimer(this);
|
||||
mIterateTimer->setInterval(20);
|
||||
connect(mIterateTimer, &QTimer::timeout, [this]() { mCore->iterate(); });
|
||||
|
|
|
|||
|
|
@ -175,6 +175,7 @@ void SettingsModel::stopCaptureGraph() {
|
|||
void SettingsModel::accessCallSettings() {
|
||||
// Audio
|
||||
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
||||
startCaptureGraph();
|
||||
CoreModel::getInstance()->getCore()->reloadSoundDevices();
|
||||
emit captureDevicesChanged(getCaptureDevices());
|
||||
emit playbackDevicesChanged(getPlaybackDevices());
|
||||
|
|
@ -185,7 +186,6 @@ void SettingsModel::accessCallSettings() {
|
|||
emit playbackGainChanged(getPlaybackGain());
|
||||
emit captureGainChanged(getCaptureGain());
|
||||
|
||||
startCaptureGraph();
|
||||
// Video
|
||||
CoreModel::getInstance()->getCore()->reloadVideoDevices();
|
||||
emit videoDevicesChanged(getVideoDevices());
|
||||
|
|
@ -205,13 +205,12 @@ bool SettingsModel::getCaptureGraphRunning() {
|
|||
float SettingsModel::getMicVolume() {
|
||||
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
||||
float v = 0.0;
|
||||
|
||||
if (mSimpleCaptureGraph && mSimpleCaptureGraph->isRunning()) {
|
||||
v = mSimpleCaptureGraph->getCaptureVolume();
|
||||
} else {
|
||||
auto call = CoreModel::getInstance()->getCore()->getCurrentCall();
|
||||
if (call) {
|
||||
v = MediastreamerUtils::computeVu(call->getRecordVolume());
|
||||
v = call->getRecordVolume();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -221,33 +220,49 @@ float SettingsModel::getMicVolume() {
|
|||
|
||||
float SettingsModel::getPlaybackGain() const {
|
||||
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
||||
float dbGain = CoreModel::getInstance()->getCore()->getPlaybackGainDb();
|
||||
return MediastreamerUtils::dbToLinear(dbGain);
|
||||
if (mSimpleCaptureGraph && mSimpleCaptureGraph->isRunning()) {
|
||||
return mSimpleCaptureGraph->getPlaybackGain();
|
||||
} else {
|
||||
auto call = CoreModel::getInstance()->getCore()->getCurrentCall();
|
||||
if (call) return call->getSpeakerVolumeGain();
|
||||
else return 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsModel::setPlaybackGain(float gain) {
|
||||
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
||||
float oldGain = getPlaybackGain();
|
||||
CoreModel::getInstance()->getCore()->setPlaybackGainDb(MediastreamerUtils::linearToDb(gain));
|
||||
if (mSimpleCaptureGraph && mSimpleCaptureGraph->isRunning()) {
|
||||
mSimpleCaptureGraph->setPlaybackGain(gain);
|
||||
}
|
||||
auto currentCall = CoreModel::getInstance()->getCore()->getCurrentCall();
|
||||
if (currentCall) {
|
||||
currentCall->setSpeakerVolumeGain(gain);
|
||||
}
|
||||
if ((int)(oldGain * 1000) != (int)(gain * 1000)) emit playbackGainChanged(gain);
|
||||
}
|
||||
|
||||
float SettingsModel::getCaptureGain() const {
|
||||
mustBeInLinphoneThread(getClassName());
|
||||
float dbGain = CoreModel::getInstance()->getCore()->getMicGainDb();
|
||||
return MediastreamerUtils::dbToLinear(dbGain);
|
||||
if (mSimpleCaptureGraph && mSimpleCaptureGraph->isRunning()) {
|
||||
return mSimpleCaptureGraph->getCaptureGain();
|
||||
} else {
|
||||
auto call = CoreModel::getInstance()->getCore()->getCurrentCall();
|
||||
if (call) return call->getMicrophoneVolumeGain();
|
||||
else return 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsModel::setCaptureGain(float gain) {
|
||||
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
||||
float oldGain = getCaptureGain();
|
||||
CoreModel::getInstance()->getCore()->setMicGainDb(MediastreamerUtils::linearToDb(gain));
|
||||
if (mSimpleCaptureGraph && mSimpleCaptureGraph->isRunning()) {
|
||||
mSimpleCaptureGraph->setCaptureGain(gain);
|
||||
}
|
||||
auto currentCall = CoreModel::getInstance()->getCore()->getCurrentCall();
|
||||
if (currentCall) {
|
||||
currentCall->setMicrophoneVolumeGain(gain);
|
||||
}
|
||||
if ((int)(oldGain * 1000) != (int)(gain * 1000)) emit captureGainChanged(gain);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue