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
0f53fb82
Commit
0f53fb82
authored
Mar 04, 2022
by
Jean-Baptiste Mardelle
Browse files
Fix audio thumbs of reversed clips.
Related to
#1354
parent
06f62538
Pipeline
#145050
passed with stage
in 8 minutes and 44 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/timeline2/view/qml/ClipAudioThumbs.qml
View file @
0f53fb82
...
...
@@ -97,8 +97,8 @@ Row {
format
:
timeline
.
audioThumbFormat
normalize
:
timeline
.
audioThumbNormalize
speed
:
clipRoot
.
speed
waveInPoint
:
clipRoot
.
speed
<
0
?
(
Math
.
round
((
clipRoot
.
maxDuration
-
1
-
clipRoot
.
inPoint
)
*
Math
.
abs
(
clipRoot
.
speed
)
-
((
index
+
waveform
.
offset
)
*
waveform
.
maxWidth
/
waveform
.
timeScale
)
*
Math
.
abs
(
clipRoot
.
speed
))
*
clipRoot
.
audioChannels
)
:
(
Math
.
round
((
clipRoot
.
inPoint
+
((
index
+
waveform
.
offset
)
*
waveform
.
maxWidth
/
waveform
.
timeScale
))
*
clipRoot
.
speed
)
*
clipRoot
.
audioChannels
)
waveOutPoint
:
clipRoot
.
speed
<
0
?
(
waveInPoint
-
Math
.
ceil
(
width
/
waveform
.
timeScale
*
Math
.
abs
(
clipRoot
.
speed
))
*
clipRoot
.
audioChannels
)
:
(
waveInPoint
+
Math
.
round
(
width
/
waveform
.
timeScale
*
clipRoot
.
speed
)
*
clipRoot
.
audioChannels
)
waveInPoint
:
clipRoot
.
speed
<
0
?
(
Math
.
ceil
((
clipRoot
.
maxDuration
-
1
-
clipRoot
.
inPoint
)
*
Math
.
abs
(
clipRoot
.
speed
)
-
((
index
+
waveform
.
offset
)
*
waveform
.
maxWidth
/
waveform
.
timeScale
)
*
Math
.
abs
(
clipRoot
.
speed
))
*
clipRoot
.
audioChannels
)
:
(
Math
.
round
((
clipRoot
.
inPoint
+
((
index
+
waveform
.
offset
)
*
waveform
.
maxWidth
/
waveform
.
timeScale
))
*
clipRoot
.
speed
)
*
clipRoot
.
audioChannels
)
waveOutPoint
:
clipRoot
.
speed
<
0
?
Math
.
max
(
0
,
(
waveInPoint
-
Math
.
round
(
width
/
waveform
.
timeScale
*
Math
.
abs
(
clipRoot
.
speed
))
*
clipRoot
.
audioChannels
)
)
:
(
waveInPoint
+
Math
.
round
(
width
/
waveform
.
timeScale
*
clipRoot
.
speed
)
*
clipRoot
.
audioChannels
)
fillColor0
:
clipRoot
.
color
fillColor1
:
root
.
thumbColor1
fillColor2
:
root
.
thumbColor2
...
...
src/timeline2/view/qml/timelineitems.cpp
View file @
0f53fb82
...
...
@@ -163,11 +163,17 @@ public:
if
(
m_audioMax
>
1
)
{
scaleFactor
=
m_audioMax
;
}
bool
reverse
=
m_speed
<
0
;
int
maxLength
=
m_audioLevels
.
length
();
if
(
reverse
)
{
m_inPoint
=
qMin
(
m_inPoint
,
maxLength
-
m_channels
);
}
int
startPos
=
int
(
m_inPoint
/
indicesPrPixel
);
if
(
!
KdenliveSettings
::
displayallchannels
())
{
// Draw merged channels
double
i
=
0
;
int
j
=
0
;
int
idx
=
0
;
QPainterPath
path
;
if
(
pathDraw
)
{
path
.
moveTo
(
j
-
1
,
height
());
...
...
@@ -175,10 +181,15 @@ public:
for
(;
i
<=
width
();
j
++
)
{
double
level
;
i
=
j
*
increment
;
int
idx
=
qCeil
((
startPos
+
i
)
*
indicesPrPixel
);
idx
+=
idx
%
m_channels
;
if
(
reverse
)
{
idx
=
qCeil
((
startPos
-
i
)
*
indicesPrPixel
);
idx
-=
idx
%
m_channels
;
}
else
{
idx
=
qCeil
((
startPos
+
i
)
*
indicesPrPixel
);
idx
+=
idx
%
m_channels
;
}
i
-=
offset
;
if
(
idx
+
m_channels
>=
m
_audioLevels
.
l
ength
()
||
idx
<
0
)
{
if
(
idx
+
m_channels
>=
m
axL
ength
||
idx
<
0
)
{
break
;
}
level
=
m_audioLevels
.
at
(
idx
)
/
scaleFactor
;
...
...
@@ -228,13 +239,19 @@ public:
painter
->
setOpacity
(
1
);
double
i
=
0
;
int
j
=
0
;
int
idx
=
0
;
for
(;
i
<=
width
();
j
++
)
{
i
=
j
*
increment
;
int
idx
=
int
(
ceil
((
startPos
+
i
)
*
indicesPrPixel
));
idx
+=
idx
%
m_channels
;
if
(
reverse
)
{
idx
=
qCeil
((
startPos
-
i
)
*
indicesPrPixel
);
idx
-=
idx
%
m_channels
;
}
else
{
idx
=
qCeil
((
startPos
+
i
)
*
indicesPrPixel
);
idx
+=
idx
%
m_channels
;
}
i
-=
offset
;
idx
+=
channel
;
if
(
idx
>=
m
_audioLevels
.
l
ength
()
||
idx
<
0
)
break
;
if
(
idx
>=
m
axL
ength
||
idx
<
0
)
break
;
if
(
pathDraw
)
{
level
=
m_audioLevels
.
at
(
idx
)
*
scaleFactor
;
path
.
lineTo
(
i
,
y
-
level
);
...
...
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