traverso-commit
[Top][All Lists]
Advanced

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

[Traverso-commit] traverso/src core/AudioClip.cpp core/Song.cpp e...


From: Remon Sijrier
Subject: [Traverso-commit] traverso/src core/AudioClip.cpp core/Song.cpp e...
Date: Wed, 29 Aug 2007 18:00:37 +0000

CVSROOT:        /sources/traverso
Module name:    traverso
Changes by:     Remon Sijrier <r_sijrier>       07/08/29 18:00:37

Modified files:
        src/core       : AudioClip.cpp Song.cpp 
        src/engine     : defines.h 
        src/traverso/songcanvas: Cursors.cpp SongView.cpp SongView.h 

Log message:
        * Added timeref_scalefactor in SongView used to convert current 
scalefactor to timeref based scaling
        * Converted Cursors.cpp (playhead, workcursor) to use 
timeref_scalefactor based positioning.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/AudioClip.cpp?cvsroot=traverso&r1=1.128&r2=1.129
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Song.cpp?cvsroot=traverso&r1=1.132&r2=1.133
http://cvs.savannah.gnu.org/viewcvs/traverso/src/engine/defines.h?cvsroot=traverso&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/Cursors.cpp?cvsroot=traverso&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/SongView.cpp?cvsroot=traverso&r1=1.74&r2=1.75
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/SongView.h?cvsroot=traverso&r1=1.35&r2=1.36

Patches:
Index: core/AudioClip.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/AudioClip.cpp,v
retrieving revision 1.128
retrieving revision 1.129
diff -u -b -r1.128 -r1.129
--- core/AudioClip.cpp  28 Aug 2007 19:51:51 -0000      1.128
+++ core/AudioClip.cpp  29 Aug 2007 18:00:36 -0000      1.129
@@ -189,9 +189,9 @@
 QDomNode AudioClip::get_state( QDomDocument doc )
 {
        QDomElement node = doc.createElement("Clip");
-       node.setAttribute("trackstart", 
m_trackStartLocation.to_universal_frame());
-       node.setAttribute("sourcestart", 
m_sourceStartLocation.to_universal_frame());
-       node.setAttribute("length", m_length.to_universal_frame());
+       node.setAttribute("trackstart", m_trackStartLocation.universal_frame());
+       node.setAttribute("sourcestart", 
m_sourceStartLocation.universal_frame());
+       node.setAttribute("length", m_length.universal_frame());
        node.setAttribute("mute", m_isMuted);
        node.setAttribute("take", m_isTake);
        node.setAttribute("clipname", m_name );

Index: core/Song.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Song.cpp,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -b -r1.132 -r1.133
--- core/Song.cpp       28 Aug 2007 19:51:52 -0000      1.132
+++ core/Song.cpp       29 Aug 2007 18:00:36 -0000      1.133
@@ -238,7 +238,7 @@
        properties.setAttribute("artists", artists);
        properties.setAttribute("firstVisibleFrame", firstVisibleFrame);
        properties.setAttribute("workingFrame", (uint)workingFrame);
-       properties.setAttribute("transportlocation", 
m_transportLocation.to_universal_frame());
+       properties.setAttribute("transportlocation", 
m_transportLocation.universal_frame());
        properties.setAttribute("hzoom", m_hzoom);
        properties.setAttribute("sbx", m_sbx);
        properties.setAttribute("sby", m_sby);

Index: engine/defines.h
===================================================================
RCS file: /sources/traverso/traverso/src/engine/defines.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- engine/defines.h    28 Aug 2007 19:51:52 -0000      1.16
+++ engine/defines.h    29 Aug 2007 18:00:36 -0000      1.17
@@ -75,7 +75,7 @@
                return nframes_t(m_position / (UNIVERSAL_SAMPLE_RATE / rate));
        }
        
-       qint64 to_universal_frame() const {return m_position;}
+       qint64 universal_frame() const {return m_position;}
        
        friend int operator!=(const TimeRef& left, const TimeRef& right) {
                return left.m_position != right.m_position;
@@ -99,6 +99,10 @@
                return left;
        }
        
+       friend int operator/(const TimeRef& left, const qint64 right) {
+               return (int)(left.m_position / right);
+       }
+       
        friend int operator<(const TimeRef& left, const TimeRef& right) {
                return left.m_position < right.m_position;
        }

Index: traverso/songcanvas/Cursors.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/songcanvas/Cursors.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- traverso/songcanvas/Cursors.cpp     11 Aug 2007 22:54:58 -0000      1.26
+++ traverso/songcanvas/Cursors.cpp     29 Aug 2007 18:00:36 -0000      1.27
@@ -127,7 +127,7 @@
 
 void PlayHead::update_position()
 {
-       QPointF newPos(m_song->get_transport_frame() / m_sv->scalefactor, 1);
+       QPointF newPos(m_song->get_transport_location() / 
m_sv->timeref_scalefactor, 1);
        
        if (newPos != pos() && (m_animation.state() != QTimeLine::Running)) {
                setPos(newPos);
@@ -179,7 +179,7 @@
 
 void PlayHead::set_animation_value(int value)
 {
-       QPointF newPos(m_song->get_transport_frame() / m_sv->scalefactor, 0);
+       QPointF newPos(m_song->get_transport_location() / 
m_sv->timeref_scalefactor, 0);
        // calculate the motion distance of the playhead.
        qreal deltaX = newPos.x() - pos().x();
        
@@ -273,7 +273,7 @@
 
 void WorkCursor::update_position()
 {
-       setPos(m_song->get_working_frame() / m_sv->scalefactor, 1);
+       setPos(m_song->get_working_location() / m_sv->timeref_scalefactor, 1);
 }
 
 void WorkCursor::set_bounding_rect( QRectF rect )

Index: traverso/songcanvas/SongView.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/songcanvas/SongView.cpp,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -b -r1.74 -r1.75
--- traverso/songcanvas/SongView.cpp    14 Aug 2007 10:49:56 -0000      1.74
+++ traverso/songcanvas/SongView.cpp    29 Aug 2007 18:00:36 -0000      1.75
@@ -39,6 +39,8 @@
 #include <PlayHeadMove.h>
 #include <WorkCursorMove.h>
                
+#include "AudioDevice.h"
+               
 #include <Debugger.h>
 
 class Shuttle : public Command
@@ -103,6 +105,8 @@
        
        
        scalefactor = Peak::zoomStep[m_song->get_hzoom()];
+       timeref_scalefactor = scalefactor * 882;
+       
        song_mode_changed();
        
        foreach(Track* track, m_song->get_tracks()) {
@@ -161,6 +165,7 @@
 void SongView::scale_factor_changed( )
 {
        scalefactor = Peak::zoomStep[m_song->get_hzoom()];
+       timeref_scalefactor = scalefactor * 882;
        m_tlvp->scale_factor_changed();
        layout_tracks();
 }
@@ -607,10 +612,10 @@
 
 Command * SongView::playhead_to_workcursor( )
 {
-       nframes_t work = m_song->get_working_frame();
+       TimeRef worklocation = m_song->get_working_location();
 
-       m_song->set_transport_pos( work );
-       m_playCursor->setPos(work / scalefactor, 0);
+       m_song->set_transport_pos( worklocation );
+       m_playCursor->setPos(worklocation / timeref_scalefactor, 0);
        
        if (!m_song->is_transport_rolling()) {
                center();

Index: traverso/songcanvas/SongView.h
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/songcanvas/SongView.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- traverso/songcanvas/SongView.h      26 Jun 2007 23:43:21 -0000      1.35
+++ traverso/songcanvas/SongView.h      29 Aug 2007 18:00:36 -0000      1.36
@@ -89,6 +89,7 @@
        int vscrollbar_value() const;
 
        int             scalefactor;
+       qint64          timeref_scalefactor;
 
 private:
         Song*                  m_song;




reply via email to

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