traverso-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Traverso-commit] traverso/src/core AudioClipGroup.cpp AudioClipG...


From: Remon Sijrier
Subject: [Traverso-commit] traverso/src/core AudioClipGroup.cpp AudioClipG...
Date: Wed, 13 Feb 2008 15:29:15 +0000

CVSROOT:        /sources/traverso
Module name:    traverso
Changes by:     Remon Sijrier <r_sijrier>       08/02/13 15:29:15

Modified files:
        src/core       : AudioClipGroup.cpp AudioClipGroup.h 

Log message:
        * implemented basic functionality

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/AudioClipGroup.cpp?cvsroot=traverso&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/AudioClipGroup.h?cvsroot=traverso&r1=1.1&r2=1.2

Patches:
Index: AudioClipGroup.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/AudioClipGroup.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- AudioClipGroup.cpp  13 Feb 2008 13:36:09 -0000      1.1
+++ AudioClipGroup.cpp  13 Feb 2008 15:29:14 -0000      1.2
@@ -25,6 +25,11 @@
 
 #include "Debugger.h"
 
+static bool smallerClip(const AudioClip* left, const AudioClip* right )
+{
+       return left->get_track_start_location() < 
right->get_track_start_location();
+}
+
 AudioClipGroup::AudioClipGroup()
 {
 }
@@ -32,4 +37,48 @@
 AudioClipGroup::AudioClipGroup(QList< AudioClip * > clips)
 {
        m_clips = clips;
+       update_track_start_and_end_locations();
+}
+
+void AudioClipGroup::add_clip(AudioClip * clip)
+{
+       m_clips.append(clip);
+       update_track_start_and_end_locations();
+}
+
+void AudioClipGroup::move_to(TimeRef location)
+{
+       foreach(AudioClip* clip, m_clips) {
+               TimeRef offset = clip->get_track_start_location() - 
m_trackStartLocation;
+               clip->set_track_start_location(location + offset);
+       }
+       
+       if (m_clips.size()) {
+               m_trackStartLocation = 
m_clips.first()->get_track_start_location();
+               m_trackEndLocation = m_clips.last()->get_track_end_location();
+       }
+}
+
+void AudioClipGroup::update_track_start_and_end_locations()
+{
+       qSort(m_clips.begin(), m_clips.end(), smallerClip);
+
+       if (m_clips.size()) {
+               m_trackStartLocation = 
m_clips.first()->get_track_start_location();
+               m_trackEndLocation = m_clips.last()->get_track_end_location();
+       }
+}
+
+void AudioClipGroup::set_snappable(bool snap)
+{
+       foreach(AudioClip* clip, m_clips) {
+               clip->set_snappable(snap);
+       }
+}
+
+void AudioClipGroup::set_as_moving(bool move)
+{
+       foreach(AudioClip* clip, m_clips) {
+               clip->set_as_moving(move);
+       }
 }

Index: AudioClipGroup.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/AudioClipGroup.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- AudioClipGroup.h    13 Feb 2008 13:36:09 -0000      1.1
+++ AudioClipGroup.h    13 Feb 2008 15:29:14 -0000      1.2
@@ -32,8 +32,22 @@
        AudioClipGroup();
        AudioClipGroup(QList<AudioClip*> clips);
        
+       void add_clip(AudioClip* clip);
+       void move_to(TimeRef location);
+       
+       void set_snappable(bool snap);
+       void set_as_moving(bool move);
+       
+       TimeRef get_track_start_location() const {return m_trackStartLocation;}
+       TimeRef get_track_end_location() const {return m_trackEndLocation;}
+       TimeRef get_length() const {return m_trackEndLocation - 
m_trackStartLocation;}
+       
 private:
        QList<AudioClip*> m_clips;
+       TimeRef m_trackEndLocation;
+       TimeRef m_trackStartLocation;
+       
+       void update_track_start_and_end_locations();
 };
 
 #endif




reply via email to

[Prev in Thread] Current Thread [Next in Thread]