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());
|
mustBeInLinphoneThread(getClassName());
|
||||||
mSettingsModelConnection = SafeConnection<SettingsCore, SettingsModel>::create(me, SettingsModel::getInstance());
|
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
|
// VFS
|
||||||
mSettingsModelConnection->makeConnectToModel(&SettingsModel::vfsEnabledChanged, [this](const bool enabled) {
|
mSettingsModelConnection->makeConnectToModel(&SettingsModel::vfsEnabledChanged, [this](const bool enabled) {
|
||||||
mSettingsModelConnection->invokeToCore([this, enabled]() { setVfsEnabled(enabled); });
|
mSettingsModelConnection->invokeToCore([this, enabled]() { setVfsEnabled(enabled); });
|
||||||
|
|
|
||||||
|
|
@ -114,6 +114,10 @@ void CoreModel::start() {
|
||||||
if (mCore->getLogCollectionUploadServerUrl().empty())
|
if (mCore->getLogCollectionUploadServerUrl().empty())
|
||||||
mCore->setLogCollectionUploadServerUrl(Constants::DefaultUploadLogsServer);
|
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 = new QTimer(this);
|
||||||
mIterateTimer->setInterval(20);
|
mIterateTimer->setInterval(20);
|
||||||
connect(mIterateTimer, &QTimer::timeout, [this]() { mCore->iterate(); });
|
connect(mIterateTimer, &QTimer::timeout, [this]() { mCore->iterate(); });
|
||||||
|
|
|
||||||
|
|
@ -175,6 +175,7 @@ void SettingsModel::stopCaptureGraph() {
|
||||||
void SettingsModel::accessCallSettings() {
|
void SettingsModel::accessCallSettings() {
|
||||||
// Audio
|
// Audio
|
||||||
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
||||||
|
startCaptureGraph();
|
||||||
CoreModel::getInstance()->getCore()->reloadSoundDevices();
|
CoreModel::getInstance()->getCore()->reloadSoundDevices();
|
||||||
emit captureDevicesChanged(getCaptureDevices());
|
emit captureDevicesChanged(getCaptureDevices());
|
||||||
emit playbackDevicesChanged(getPlaybackDevices());
|
emit playbackDevicesChanged(getPlaybackDevices());
|
||||||
|
|
@ -185,7 +186,6 @@ void SettingsModel::accessCallSettings() {
|
||||||
emit playbackGainChanged(getPlaybackGain());
|
emit playbackGainChanged(getPlaybackGain());
|
||||||
emit captureGainChanged(getCaptureGain());
|
emit captureGainChanged(getCaptureGain());
|
||||||
|
|
||||||
startCaptureGraph();
|
|
||||||
// Video
|
// Video
|
||||||
CoreModel::getInstance()->getCore()->reloadVideoDevices();
|
CoreModel::getInstance()->getCore()->reloadVideoDevices();
|
||||||
emit videoDevicesChanged(getVideoDevices());
|
emit videoDevicesChanged(getVideoDevices());
|
||||||
|
|
@ -205,13 +205,12 @@ bool SettingsModel::getCaptureGraphRunning() {
|
||||||
float SettingsModel::getMicVolume() {
|
float SettingsModel::getMicVolume() {
|
||||||
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
||||||
float v = 0.0;
|
float v = 0.0;
|
||||||
|
|
||||||
if (mSimpleCaptureGraph && mSimpleCaptureGraph->isRunning()) {
|
if (mSimpleCaptureGraph && mSimpleCaptureGraph->isRunning()) {
|
||||||
v = mSimpleCaptureGraph->getCaptureVolume();
|
v = mSimpleCaptureGraph->getCaptureVolume();
|
||||||
} else {
|
} else {
|
||||||
auto call = CoreModel::getInstance()->getCore()->getCurrentCall();
|
auto call = CoreModel::getInstance()->getCore()->getCurrentCall();
|
||||||
if (call) {
|
if (call) {
|
||||||
v = MediastreamerUtils::computeVu(call->getRecordVolume());
|
v = call->getRecordVolume();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -221,33 +220,49 @@ float SettingsModel::getMicVolume() {
|
||||||
|
|
||||||
float SettingsModel::getPlaybackGain() const {
|
float SettingsModel::getPlaybackGain() const {
|
||||||
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
||||||
float dbGain = CoreModel::getInstance()->getCore()->getPlaybackGainDb();
|
if (mSimpleCaptureGraph && mSimpleCaptureGraph->isRunning()) {
|
||||||
return MediastreamerUtils::dbToLinear(dbGain);
|
return mSimpleCaptureGraph->getPlaybackGain();
|
||||||
|
} else {
|
||||||
|
auto call = CoreModel::getInstance()->getCore()->getCurrentCall();
|
||||||
|
if (call) return call->getSpeakerVolumeGain();
|
||||||
|
else return 0.0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsModel::setPlaybackGain(float gain) {
|
void SettingsModel::setPlaybackGain(float gain) {
|
||||||
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
||||||
float oldGain = getPlaybackGain();
|
float oldGain = getPlaybackGain();
|
||||||
CoreModel::getInstance()->getCore()->setPlaybackGainDb(MediastreamerUtils::linearToDb(gain));
|
|
||||||
if (mSimpleCaptureGraph && mSimpleCaptureGraph->isRunning()) {
|
if (mSimpleCaptureGraph && mSimpleCaptureGraph->isRunning()) {
|
||||||
mSimpleCaptureGraph->setPlaybackGain(gain);
|
mSimpleCaptureGraph->setPlaybackGain(gain);
|
||||||
}
|
}
|
||||||
|
auto currentCall = CoreModel::getInstance()->getCore()->getCurrentCall();
|
||||||
|
if (currentCall) {
|
||||||
|
currentCall->setSpeakerVolumeGain(gain);
|
||||||
|
}
|
||||||
if ((int)(oldGain * 1000) != (int)(gain * 1000)) emit playbackGainChanged(gain);
|
if ((int)(oldGain * 1000) != (int)(gain * 1000)) emit playbackGainChanged(gain);
|
||||||
}
|
}
|
||||||
|
|
||||||
float SettingsModel::getCaptureGain() const {
|
float SettingsModel::getCaptureGain() const {
|
||||||
mustBeInLinphoneThread(getClassName());
|
mustBeInLinphoneThread(getClassName());
|
||||||
float dbGain = CoreModel::getInstance()->getCore()->getMicGainDb();
|
if (mSimpleCaptureGraph && mSimpleCaptureGraph->isRunning()) {
|
||||||
return MediastreamerUtils::dbToLinear(dbGain);
|
return mSimpleCaptureGraph->getCaptureGain();
|
||||||
|
} else {
|
||||||
|
auto call = CoreModel::getInstance()->getCore()->getCurrentCall();
|
||||||
|
if (call) return call->getMicrophoneVolumeGain();
|
||||||
|
else return 0.0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsModel::setCaptureGain(float gain) {
|
void SettingsModel::setCaptureGain(float gain) {
|
||||||
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
||||||
float oldGain = getCaptureGain();
|
float oldGain = getCaptureGain();
|
||||||
CoreModel::getInstance()->getCore()->setMicGainDb(MediastreamerUtils::linearToDb(gain));
|
|
||||||
if (mSimpleCaptureGraph && mSimpleCaptureGraph->isRunning()) {
|
if (mSimpleCaptureGraph && mSimpleCaptureGraph->isRunning()) {
|
||||||
mSimpleCaptureGraph->setCaptureGain(gain);
|
mSimpleCaptureGraph->setCaptureGain(gain);
|
||||||
}
|
}
|
||||||
|
auto currentCall = CoreModel::getInstance()->getCore()->getCurrentCall();
|
||||||
|
if (currentCall) {
|
||||||
|
currentCall->setMicrophoneVolumeGain(gain);
|
||||||
|
}
|
||||||
if ((int)(oldGain * 1000) != (int)(gain * 1000)) emit captureGainChanged(gain);
|
if ((int)(oldGain * 1000) != (int)(gain * 1000)) emit captureGainChanged(gain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue