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 Curve.cpp Curve.h


From: Remon Sijrier
Subject: [Traverso-commit] traverso/src/core AudioClip.cpp Curve.cpp Curve.h
Date: Tue, 10 Apr 2007 18:32:32 +0000

CVSROOT:        /sources/traverso
Module name:    traverso
Changes by:     Remon Sijrier <r_sijrier>       07/04/10 18:32:32

Modified files:
        src/core       : AudioClip.cpp Curve.cpp Curve.h 

Log message:
        * added Curve::process()

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/AudioClip.cpp?cvsroot=traverso&r1=1.73&r2=1.74
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Curve.cpp?cvsroot=traverso&r1=1.34&r2=1.35
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Curve.h?cvsroot=traverso&r1=1.17&r2=1.18

Patches:
Index: AudioClip.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/AudioClip.cpp,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -b -r1.73 -r1.74
--- AudioClip.cpp       10 Apr 2007 17:13:01 -0000      1.73
+++ AudioClip.cpp       10 Apr 2007 18:32:32 -0000      1.74
@@ -442,15 +442,7 @@
                m_fades.at(i)->process(mixdown, read_frames);
        }
        
-       nframes_t gainEnvelopeMixPos = m_song->get_transport_frame() - 
trackStartFrame;
-       gainEnvelope->get_vector(gainEnvelopeMixPos, gainEnvelopeMixPos + 
read_frames, m_song->gainbuffer, read_frames);
-       
-       for (nframes_t n = 0; n < read_frames; ++n) {
-               mixdown[n] *= m_song->gainbuffer[n];
-       }
-       
-       
-
+       gainEnvelope->process(mixdown, (m_song->get_transport_frame() - 
trackStartFrame), read_frames);
 
        return 1;
 }

Index: Curve.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Curve.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -b -r1.34 -r1.35
--- Curve.cpp   2 Apr 2007 21:05:43 -0000       1.34
+++ Curve.cpp   10 Apr 2007 18:32:32 -0000      1.35
@@ -25,7 +25,6 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
 
-$Id: Curve.cpp,v 1.34 2007/04/02 21:05:43 r_sijrier Exp $
 */
 
 #include "Curve.h"
@@ -40,6 +39,7 @@
 #include <QThread>
 #include <AddRemove.h>
 #include <CommandGroup.h>
+#include "Mixer.h"
 
 // Always put me below _all_ includes, this is needed
 // in case we run with memory leak detection enabled!
@@ -53,7 +53,6 @@
        , m_song(song)
 {
        PENTERCONS;
-       Q_ASSERT(m_song);
        m_id = create_id();
        init();
 }
@@ -62,7 +61,6 @@
        : ContextItem(parent)
        , m_song(song)
 {
-       Q_ASSERT(m_song);
        init();
        set_state(node);
 }
@@ -76,6 +74,7 @@
 
 void Curve::init( )
 {
+       Q_ASSERT(m_song);
        m_changed = true;
        m_lookup_cache.left = -1;
        m_lookup_cache.range.first = m_nodes.end();
@@ -117,6 +116,9 @@
        QStringList nodesList = e.attribute( "nodes", "" ).split(";");
        m_defaultValue = e.attribute( "defaulvalue", "1.0" ).toDouble();
        m_id = e.attribute("id", "0" ).toLongLong();
+       if (m_id == 0) {
+               m_id = create_id();
+       }
        
        for (int i=0; i<nodesList.size(); ++i) {
                QStringList whenValueList = nodesList.at(i).split(",");
@@ -129,6 +131,27 @@
        return 1;
 }
 
+
+int Curve::process(audio_sample_t* buffer, nframes_t pos, nframes_t nframes)
+{
+       if ((pos + nframes) > get_range()) {
+               if (m_nodes.last()->value == 1.0) {
+                       return 0;
+               }
+               Mixer::apply_gain_to_buffer(buffer, nframes, 
m_nodes.last()->value);
+               return 1;
+       }
+       
+       audio_sample_t mixdown[nframes];
+       
+       get_vector(pos, pos + nframes, mixdown, nframes);
+       
+       for (nframes_t n = 0; n < nframes; ++n) {
+               buffer[n] *= mixdown[n];
+       }
+}
+
+
 void Curve::solve ()
 {
        uint32_t npoints;
@@ -571,6 +594,5 @@
        set_changed();
 }
 
-
 //eof
 

Index: Curve.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/Curve.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- Curve.h     23 Feb 2007 15:35:49 -0000      1.17
+++ Curve.h     10 Apr 2007 18:32:32 -0000      1.18
@@ -25,7 +25,6 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
 
-$Id: Curve.h,v 1.17 2007/02/23 15:35:49 r_sijrier Exp $
 */
 
 #ifndef CURVE_H
@@ -51,6 +50,7 @@
 
        virtual QDomNode get_state(QDomDocument doc);
        virtual int set_state( const QDomNode& node );
+       virtual int process(audio_sample_t* buffer, nframes_t pos, nframes_t 
nframes);
        
        Command* add_node(CurveNode* node, bool historable=true);
        Command* remove_node(CurveNode* node, bool historable=true);




reply via email to

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