Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linphone-desktop
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
linphone-desktop
Commits
c006d526
Commit
c006d526
authored
Jun 08, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(src/utils/LinphoneUtils): provide a `computeVu` function
parent
8a888707
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
36 deletions
+23
-36
CallModel.cpp
linphone-desktop/src/components/call/CallModel.cpp
+3
-17
ConferenceModel.cpp
...one-desktop/src/components/conference/ConferenceModel.cpp
+5
-19
LinphoneUtils.hpp
linphone-desktop/src/utils/LinphoneUtils.hpp
+15
-0
No files found.
linphone-desktop/src/components/call/CallModel.cpp
View file @
c006d526
...
...
@@ -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
());
}
// -----------------------------------------------------------------------------
...
...
linphone-desktop/src/components/conference/ConferenceModel.cpp
View file @
c006d526
...
...
@@ -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
();
}
\ No newline at end of file
}
linphone-desktop/src/utils/LinphoneUtils.hpp
View file @
c006d526
...
...
@@ -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_
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment