]> git.sesse.net Git - kdenlive/commitdiff
Fix remaining issues with audio fades:
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Wed, 19 Nov 2008 11:07:48 +0000 (11:07 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Wed, 19 Nov 2008 11:07:48 +0000 (11:07 +0000)
http://www.kdenlive.org/mantis/view.php?id=258

svn path=/branches/KDE4/; revision=2715

src/clipitem.cpp
src/customtrackview.cpp
src/effectstackedit.cpp

index 40ee65a30b783712766bfd41b9c7ab8302af6cac..17e0c146c749d9f05d5ca5b29db4f474d90ab74f 100644 (file)
@@ -881,7 +881,7 @@ void ClipItem::setFadeIn(int pos) {
     if (pos == m_startFade) return;
     int oldIn = m_startFade;
     if (pos < 0) pos = 0;
-    if (pos > m_cropDuration.frames(m_fps)) pos = (int)(m_cropDuration.frames(m_fps) / 2);
+    if (pos > m_cropDuration.frames(m_fps)) pos = (int)(m_cropDuration.frames(m_fps));
     m_startFade = pos;
     QRectF rect = boundingRect();
     update(rect.x(), rect.y(), qMax(oldIn, pos), rect.height());
@@ -891,7 +891,7 @@ void ClipItem::setFadeOut(int pos) {
     if (pos == m_endFade) return;
     int oldOut = m_endFade;
     if (pos < 0) pos = 0;
-    if (pos > m_cropDuration.frames(m_fps)) pos = (int)(m_cropDuration.frames(m_fps) / 2);
+    if (pos > m_cropDuration.frames(m_fps)) pos = (int)(m_cropDuration.frames(m_fps));
     m_endFade = pos;
     QRectF rect = boundingRect();
     update(rect.x() + rect.width() - qMax(oldOut, pos), rect.y(), qMax(oldOut, pos), rect.height());
index 019e0df880d627128b4423ddb72dc3f6b86f05f8..a36bada38658ba7fd1a2a9fad7ad80915a894790 100644 (file)
@@ -1802,6 +1802,11 @@ void CustomTrackView::updateClipFade(ClipItem * item, bool updateFadeOut) {
             if (effectPos == -1) return;
             QDomElement oldeffect = item->effectAt(effectPos);
             int start = item->cropStart().frames(m_document->fps());
+           int max = item->cropDuration().frames(m_document->fps());
+           if (end > max) {
+               item->setFadeIn(max);
+               end = item->fadeIn();
+           }
             end += start;
             EffectsList::setParameter(oldeffect, "in", QString::number(start));
             EffectsList::setParameter(oldeffect, "out", QString::number(end));
@@ -1819,6 +1824,11 @@ void CustomTrackView::updateClipFade(ClipItem * item, bool updateFadeOut) {
             if (effectPos == -1) return;
             QDomElement oldeffect = item->effectAt(effectPos);
             int end = (item->duration() - item->cropStart()).frames(m_document->fps());
+           int max = item->cropDuration().frames(m_document->fps());
+           if (end > max) {
+               item->setFadeOut(max);
+               start = item->fadeOut();
+           }
             start = end - start;
             EffectsList::setParameter(oldeffect, "in", QString::number(start));
             EffectsList::setParameter(oldeffect, "out", QString::number(end));
index 82d45e782786317b97dbfde5d5c53c686ea2aa53..a3421aaeea6e76184cff5ce5c3a5d4cbb8894f61 100644 (file)
@@ -376,8 +376,16 @@ void EffectStackEdit::collectAllParameters() {
             int pos = m_timecode.getFrameCount(line->text(), KdenliveSettings::project_fps());
             if (params.attribute("id") == "fadein") {
                 pos += m_in;
+               if (pos > m_out) {
+                   pos = m_out;
+                   line->setText(m_timecode.getTimecodeFromFrames(pos));
+               }
             } else if (params.attribute("id") == "fadeout") {
                 pos = m_out - (pos - m_in);
+               if (pos > m_out - m_in) {
+                   pos = m_out - m_in;
+                   line->setText(m_timecode.getTimecodeFromFrames(pos));
+               }
             }
             setValue = QString::number(pos);
         } else if (type == "wipe") {