Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Kdenlive
Commits
997a9abd
Commit
997a9abd
authored
Aug 03, 2020
by
Jean-Baptiste Mardelle
Browse files
Reduce range of volume effect (limit to -50 - +50 dB), and use logarithmic scale in timeline.
Related to
#770
parent
68914726
Pipeline
#29549
passed with stage
in 29 minutes and 24 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
data/effects/volume.xml
View file @
997a9abd
...
...
@@ -3,7 +3,7 @@
<name>
Volume (keyframable)
</name>
<description>
Adjust audio volume with keyframes
</description>
<author>
Dan Dennedy
</author>
<parameter
type=
"animated"
name=
"level"
default=
"0"
max=
"
6
0"
min=
"-
10
0"
suffix=
"dB"
scale=
"-1"
>
<parameter
type=
"animated"
name=
"level"
default=
"0"
max=
"
5
0"
min=
"-
5
0"
suffix=
"dB"
scale=
"-1"
>
<name>
Gain
</name>
</parameter>
</effect>
src/assets/keyframes/model/keyframemodel.cpp
View file @
997a9abd
...
...
@@ -305,9 +305,9 @@ bool KeyframeModel::updateKeyframe(int pos, double newVal)
int
logRole
=
ptr
->
data
(
m_index
,
AssetParameterModel
::
ScaleRole
).
toInt
();
double
realValue
;
if
(
logRole
==
-
1
)
{
// Logarythmic scale
for lower than norm values
// Logarythmic scale
if
(
newVal
>=
0.5
)
{
realValue
=
norm
+
(
2
*
(
newVal
-
0.5
)
*
(
max
/
factor
-
norm
)
)
;
realValue
=
norm
+
pow
(
2
*
(
newVal
-
0.5
)
,
10.0
/
6
)
*
(
max
/
factor
-
norm
);
}
else
{
realValue
=
norm
-
pow
(
2
*
(
0.5
-
newVal
),
10.0
/
6
)
*
(
norm
-
min
/
factor
);
}
...
...
@@ -461,11 +461,12 @@ QVariant KeyframeModel::data(const QModelIndex &index, int role) const
int
logRole
=
ptr
->
data
(
m_index
,
AssetParameterModel
::
ScaleRole
).
toInt
();
double
linear
=
val
*
factor
;
if
(
logRole
==
-
1
)
{
// Logarythmic scale for lower than norm values
// Logarythmic scale
// transform current value to 0..1 scale
if
(
linear
>=
norm
)
{
return
0.5
+
(
linear
-
norm
)
/
(
max
*
factor
-
norm
)
*
0.5
;
double
scaled
=
(
linear
-
norm
)
/
(
max
*
factor
-
norm
);
return
0.5
+
pow
(
scaled
,
0.6
)
*
0.5
;
}
// transform current value to 0..1 scale
double
scaled
=
(
linear
-
norm
)
/
(
min
*
factor
-
norm
);
// Log scale
return
0.5
-
pow
(
scaled
,
0.6
)
*
0.5
;
...
...
@@ -896,9 +897,9 @@ QVariant KeyframeModel::getNormalizedValue(double newVal) const
int
logRole
=
ptr
->
data
(
m_index
,
AssetParameterModel
::
ScaleRole
).
toInt
();
double
realValue
;
if
(
logRole
==
-
1
)
{
// Logarythmic scale
for lower than norm values
// Logarythmic scale
if
(
newVal
>=
0.5
)
{
realValue
=
norm
+
(
2
*
(
newVal
-
0.5
)
*
(
max
/
factor
-
norm
)
)
;
realValue
=
norm
+
pow
(
2
*
(
newVal
-
0.5
)
,
10.0
/
6
)
*
(
max
/
factor
-
norm
);
}
else
{
realValue
=
norm
-
pow
(
2
*
(
0.5
-
newVal
),
10.0
/
6
)
*
(
norm
-
min
/
factor
);
}
...
...
Write
Preview
Supports
Markdown
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