Increase monitor audio thumb resolution, add monitor seek bar in clip monitor

parent 6fa7f38a
Pipeline #26589 passed with stage
in 9 minutes and 41 seconds
......@@ -330,16 +330,16 @@ bool AudioThumbJob::startJob()
return false;
}
m_lengthInFrames = m_prod->get_length(); // Multiply this if we want more than 1 sample per frame
int thumbResolution = 1000;
int thumbResolution = 3000;
// Increase audio thumb resolution for longer clips to get a better resolution
if (m_lengthInFrames > 30000) {
// More than 20 minutes at 25fps
if (m_lengthInFrames > 10000) {
// More than 10 minutes at 25fps
if (m_lengthInFrames > 90000) {
// More than 1 hour at 25fps
thumbResolution = 3000;
thumbResolution = 10000;
} else {
thumbResolution = 2000;
thumbResolution = 6000;
}
}
m_thumbSize = QSize(thumbResolution, 1000 / pCore->getCurrentDar());
......@@ -441,14 +441,14 @@ bool AudioThumbJob::commitResult(Fun &undo, Fun &redo)
auto operation = [clip = m_binClip, image = std::move(result)]() {
clip->updateAudioThumbnail();
if (!image.isNull() && clip->clipType() == ClipType::Audio) {
clip->setThumbnail(image);
clip->setThumbnail(image.scaled(200, 200 / pCore->getCurrentDar()));
}
return true;
};
auto reverse = [clip = m_binClip, image = std::move(oldImage)]() {
clip->updateAudioThumbnail();
if (!image.isNull() && clip->clipType() == ClipType::Audio) {
clip->setThumbnail(image);
clip->setThumbnail(image.scaled(200, 200 / pCore->getCurrentDar()));
}
return true;
};
......
......@@ -265,6 +265,7 @@ Item {
]
asynchronous: true
cache: false
smooth: false
}
Rectangle {
width: parent.width
......@@ -284,16 +285,24 @@ Item {
MouseArea {
id: thumbMouseArea
anchors.fill: parent
acceptedButtons: audioThumb.isAudioClip ? Qt.NoButton : Qt.LeftButton
acceptedButtons: Qt.LeftButton
hoverEnabled: true
propagateComposedEvents: true
onPressed: {
if (audioThumb.isAudioClip && mouseY < audioSeekZone.y) {
mouse.accepted = false
return
}
var pos = Math.max(mouseX, 0)
pos += audioThumb.width/root.zoomFactor * root.zoomStart
controller.setPosition(Math.min(pos / root.timeScale, root.duration));
}
onPositionChanged: {
if (mouse.modifiers & Qt.ShiftModifier || (pressed && !audioThumb.isAudioClip)) {
if (audioThumb.isAudioClip && mouseY < audioSeekZone.y) {
mouse.accepted = false
return
}
if (mouse.modifiers & Qt.ShiftModifier || pressed) {
var pos = Math.max(mouseX, 0)
pos += audioThumb.width/root.zoomFactor * root.zoomStart
controller.setPosition(Math.min(pos / root.timeScale, root.duration));
......@@ -313,6 +322,35 @@ Item {
}
}
Rectangle {
id: audioSeekZone
width: parent.width
height: parent.height / 6
anchors.centerIn: parent
anchors.verticalCenterOffset: audioThumb.isAudioClip ? parent.height * 5 / 12 : 0
visible: audioThumb.isAudioClip && thumbMouseArea.containsMouse && thumbMouseArea.mouseY > y
color: 'yellow'
opacity: 0.5
Rectangle {
width: parent.width
height: 1
color: '#000'
anchors.top: parent.top
}
// frame ticks
Repeater {
id: rulerAudioTicks
model: parent.width / root.frameSize + 2
Rectangle {
x: index * root.frameSize - (clipMonitorRuler.rulerZoomOffset % root.frameSize)
anchors.top: audioSeekZone.top
height: (index % 5) ? audioSeekZone.height / 6 : audioSeekZone.height / 3
width: 1
color: '#000'
opacity: 0.8
}
}
}
}
}
Label {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment