]> git.sesse.net Git - kdenlive/blobdiff - src/customtrackview.h
Load & save markers (audacity compatible):
[kdenlive] / src / customtrackview.h
index d3f04980a8c24f292d8876410f3aa07863230c98..1f322854a481ad9acea0e726faea4152b31571bf 100644 (file)
@@ -42,6 +42,7 @@ class ClipItem;
 class AbstractClipItem;
 class AbstractGroupItem;
 class Transition;
+class AudioCorrelation;
 
 class CustomTrackView : public QGraphicsView
 {
@@ -60,7 +61,13 @@ public:
     void configTracks(QList <TrackInfo> trackInfos);
     int cursorPos();
     void checkAutoScroll();
-    void moveClip(const ItemInfo &start, const ItemInfo &end, bool refresh);
+    /**
+      Move the clip at \c start to \c end.
+
+      If \c out_actualEnd is not NULL, it will be set to the position the clip really ended up at.
+      For example, attempting to move a clip to t = -1 s will actually move it to t = 0 s.
+      */
+    bool moveClip(const ItemInfo &start, const ItemInfo &end, bool refresh, ItemInfo *out_actualEnd = NULL);
     void moveGroup(QList <ItemInfo> startClip, QList <ItemInfo> startTransition, const GenTime &offset, const int trackOffset, bool reverseMove = false);
     /** move transition, startPos = (old start, old end), endPos = (new start, new end) */
     void moveTransition(const ItemInfo &start, const ItemInfo &end, bool refresh);
@@ -72,6 +79,7 @@ public:
     void addMarker(const QString &id, const GenTime &pos, const QString &comment);
     void setScale(double scaleFactor, double verticalScale);
     void deleteClip(const QString &clipId);
+    /** @brief Add effect to current clip */
     void slotAddEffect(QDomElement effect, GenTime pos, int track);
     void slotAddGroupEffect(QDomElement effect, AbstractGroupItem *group);
     void addEffect(int track, GenTime pos, QDomElement effect);
@@ -140,6 +148,12 @@ public:
     /** @brief Creates SplitAudioCommands for selected clips. */
     void splitAudio();
 
+    /// Define which clip to take as reference for automatic audio alignment
+    void setAudioAlignReference();
+
+    /// Automatically align the currently selected clips to synchronize their audio with the reference's audio
+    void alignAudio();
+
     /** @brief Seperates the audio of a clip to a audio track.
     * @param pos Position of the clip to split
     * @param track Track of the clip
@@ -188,9 +202,14 @@ public:
     bool hasAudio(int track) const;
 
     int getFrameWidth();
+    /** @brief Returns last requested seeking pos (or SEEK_INACTIVE if no seek). */
+    int seekPosition() const;
     
 public slots:
-    void setCursorPos(int pos, bool seek = true);
+    /** @brief Send seek request to MLT. */
+    void seekCursorPos(int pos);
+    /** @brief Move timeline cursor to new position. */
+    void setCursorPos(int pos);
     void moveCursorPos(int delta);
     void updateCursorPos();
     void slotDeleteEffect(ClipItem *clip, int track, QDomElement effect, bool affectGroup = true);
@@ -212,7 +231,9 @@ public slots:
      * @param id Id of the marker's clip
      * @param t Position of the marker
      * @param c Comment of the marker */
-    void slotAddClipMarker(const QString &id, GenTime t, QString c);
+    void slotAddClipMarker(const QString &id, GenTime t, QString c, QUndoCommand *groupCommand = 0);
+    void slotLoadClipMarkers(const QString &id);
+    void slotSaveClipMarkers(const QString &id);
     bool addGuide(const GenTime &pos, const QString &comment);
 
     /** @brief Shows a dialog for adding a guide.
@@ -361,6 +382,9 @@ private:
     QWaitCondition m_producerNotReady;
     KStatefulBrush m_activeTrackBrush;
 
+    AudioCorrelation *m_audioCorrelator;
+    ClipItem *m_audioAlignmentReference;
+
     /** stores the state of the control modifier during mouse press.
      * Will then be used to identify whether we resize a group or only one item of it. */
     bool m_controlModifier;
@@ -446,7 +470,7 @@ private:
     void adjustEffects(ClipItem *item, ItemInfo oldInfo, QUndoCommand *command);
     
     /** @brief Prepare an add clip command for an effect */
-    void processEffect(ClipItem *item, QDomElement effect, QUndoCommand *effectCommand);
+    void processEffect(ClipItem *item, QDomElement effect, int offset, QUndoCommand *effectCommand);
     
     /** @brief Get effect parameters ready for MLT*/
     void adjustEffectParameters(EffectsParameterList &parameters, QDomNodeList params, const QString &prefix = QString());
@@ -495,6 +519,8 @@ signals:
     void showTrackEffects(int, TrackInfo);
     /** @brief Update the track effect button that shows if a track has effects or not.*/
     void updateTrackEffectState(int);
+    /** @brief Cursor position changed, repaint ruler.*/
+    void updateRuler();
 };
 
 #endif