mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-26 00:08:13 +00:00
feat(src/utils/LinphoneUtils): provide a computeVu function
This commit is contained in:
parent
8a888707d5
commit
c006d526fc
3 changed files with 23 additions and 36 deletions
|
|
@ -25,6 +25,7 @@
|
|||
#include <QTimer>
|
||||
|
||||
#include "../../app/App.hpp"
|
||||
#include "../../utils/LinphoneUtils.hpp"
|
||||
#include "../../utils/Utils.hpp"
|
||||
#include "../core/CoreManager.hpp"
|
||||
|
||||
|
|
@ -376,27 +377,12 @@ float CallModel::getQuality () const {
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#define VU_MIN (-20.f)
|
||||
#define VU_MAX (4.f)
|
||||
|
||||
inline float computeVu (float volume) {
|
||||
if (volume < VU_MIN)
|
||||
return 0.f;
|
||||
if (volume > VU_MAX)
|
||||
return 1.f;
|
||||
|
||||
return (volume - VU_MIN) / (VU_MAX - VU_MIN);
|
||||
}
|
||||
|
||||
#undef VU_MIN
|
||||
#undef VU_MAX
|
||||
|
||||
float CallModel::getMicroVu () const {
|
||||
return computeVu(mCall->getRecordVolume());
|
||||
return LinphoneUtils::computeVu(mCall->getRecordVolume());
|
||||
}
|
||||
|
||||
float CallModel::getSpeakerVu () const {
|
||||
return computeVu(mCall->getPlayVolume());
|
||||
return LinphoneUtils::computeVu(mCall->getPlayVolume());
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include <QDateTime>
|
||||
|
||||
#include "../../utils/LinphoneUtils.hpp"
|
||||
#include "../../utils/Utils.hpp"
|
||||
#include "../core/CoreManager.hpp"
|
||||
|
||||
|
|
@ -123,35 +124,20 @@ bool ConferenceModel::getRecording () const {
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#define VU_MIN (-20.f)
|
||||
#define VU_MAX (4.f)
|
||||
|
||||
inline float computeVu (float volume) {
|
||||
if (volume < VU_MIN)
|
||||
return 0.f;
|
||||
if (volume > VU_MAX)
|
||||
return 1.f;
|
||||
|
||||
return (volume - VU_MIN) / (VU_MAX - VU_MIN);
|
||||
}
|
||||
|
||||
#undef VU_MIN
|
||||
#undef VU_MAX
|
||||
|
||||
float ConferenceModel::getMicroVu () const {
|
||||
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
|
||||
return computeVu(core->getConferenceLocalInputVolume());
|
||||
return LinphoneUtils::computeVu(core->getConferenceLocalInputVolume());
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void ConferenceModel::leave() {
|
||||
void ConferenceModel::leave () {
|
||||
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
|
||||
core->leaveConference();
|
||||
emit conferenceChanged();
|
||||
}
|
||||
|
||||
void ConferenceModel::join() {
|
||||
void ConferenceModel::join () {
|
||||
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
|
||||
core->enterConference();
|
||||
emit conferenceChanged();
|
||||
|
|
@ -167,4 +153,4 @@ bool ConferenceModel::isInConference () const {
|
|||
|
||||
void ConferenceModel::handleCallStateChanged (const shared_ptr<linphone::Call> &call, linphone::CallState state) {
|
||||
emit conferenceChanged();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,8 +28,23 @@
|
|||
|
||||
// =============================================================================
|
||||
|
||||
#define VU_MIN (-20.f)
|
||||
#define VU_MAX (4.f)
|
||||
|
||||
namespace LinphoneUtils {
|
||||
inline float computeVu (float volume) {
|
||||
if (volume < VU_MIN)
|
||||
return 0.f;
|
||||
if (volume > VU_MAX)
|
||||
return 1.f;
|
||||
|
||||
return (volume - VU_MIN) / (VU_MAX - VU_MIN);
|
||||
}
|
||||
|
||||
linphone::TransportType stringToTransportType (const QString &transport);
|
||||
}
|
||||
|
||||
#undef VU_MIN
|
||||
#undef VU_MAX
|
||||
|
||||
#endif // ifndef LINPHONE_UTILS_H_
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue