traverso-commit
[Top][All Lists]
Advanced

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

[Traverso-commit] traverso/src commands/AudioClipExternalProcessi...


From: Remon Sijrier
Subject: [Traverso-commit] traverso/src commands/AudioClipExternalProcessi...
Date: Wed, 30 May 2007 13:14:49 +0000

CVSROOT:        /sources/traverso
Module name:    traverso
Changes by:     Remon Sijrier <r_sijrier>       07/05/30 13:14:49

Modified files:
        src/commands   : AudioClipExternalProcessing.cpp Import.cpp 
                         MoveClip.cpp 
        src/core       : AudioClip.cpp AudioClip.h core.pro Curve.cpp 
                         Curve.h FadeCurve.cpp FadeCurve.h ReadSource.h 
                         Song.cpp Song.h Track.cpp Track.h 
        src/plugins/LV2: LV2Plugin.cpp LV2Plugin.h 
        src/plugins    : PluginChain.cpp PluginChain.h Plugin.cpp 
                         Plugin.h PluginManager.cpp PluginManager.h 
                         PluginSlider.cpp PluginSlider.h plugins.pro 
        src/traverso   : PluginSelectorDialog.cpp 
        src/traverso/songcanvas: AudioClipView.cpp ClipsViewPort.cpp 
                                 CurveView.cpp FadeView.cpp 
                                 PluginChainView.cpp PluginView.cpp 
                                 PluginView.h songcanvas.pro 
                                 SongView.cpp 
Added files:
        src/plugins/native: GainEnvelope.cpp GainEnvelope.h 
        src/plugins    : PluginPropertiesDialog.cpp 
                         PluginPropertiesDialog.h 
Removed files:
        src/plugins/LV2: LV2PluginPropertiesDialog.cpp 
                         LV2PluginPropertiesDialog.h 

Log message:
        * Make Plugin (again) an Interface for plugins in traverso, as 
        a result, the PluginProperties Dialog no longer works on LV2Plugins only
        * Added GainEnvelope plugin, which is used as the Fader for 
        Song, Track and AudioClip, including the Gain Curve 'automation'
        * Get rid of the normalization factor in AudioClip, purely use the 
        fader gain variable!

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/commands/AudioClipExternalProcessing.cpp?cvsroot=traverso&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/traverso/src/commands/Import.cpp?cvsroot=traverso&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/traverso/src/commands/MoveClip.cpp?cvsroot=traverso&r1=1.42&r2=1.43
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/AudioClip.cpp?cvsroot=traverso&r1=1.101&r2=1.102
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/AudioClip.h?cvsroot=traverso&r1=1.51&r2=1.52
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/core.pro?cvsroot=traverso&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Curve.cpp?cvsroot=traverso&r1=1.39&r2=1.40
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Curve.h?cvsroot=traverso&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/FadeCurve.cpp?cvsroot=traverso&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/FadeCurve.h?cvsroot=traverso&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/ReadSource.h?cvsroot=traverso&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Song.cpp?cvsroot=traverso&r1=1.112&r2=1.113
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Song.h?cvsroot=traverso&r1=1.55&r2=1.56
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Track.cpp?cvsroot=traverso&r1=1.58&r2=1.59
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Track.h?cvsroot=traverso&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/traverso/src/plugins/LV2/LV2Plugin.cpp?cvsroot=traverso&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/traverso/src/plugins/LV2/LV2Plugin.h?cvsroot=traverso&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/traverso/src/plugins/LV2/LV2PluginPropertiesDialog.cpp?cvsroot=traverso&r1=1.10&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/plugins/LV2/LV2PluginPropertiesDialog.h?cvsroot=traverso&r1=1.6&r2=0
http://cvs.savannah.gnu.org/viewcvs/traverso/src/plugins/native/GainEnvelope.cpp?cvsroot=traverso&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/traverso/src/plugins/native/GainEnvelope.h?cvsroot=traverso&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/traverso/src/plugins/PluginChain.cpp?cvsroot=traverso&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/traverso/src/plugins/PluginChain.h?cvsroot=traverso&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/traverso/src/plugins/Plugin.cpp?cvsroot=traverso&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/traverso/src/plugins/Plugin.h?cvsroot=traverso&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/traverso/src/plugins/PluginManager.cpp?cvsroot=traverso&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/traverso/src/plugins/PluginManager.h?cvsroot=traverso&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/traverso/src/plugins/PluginSlider.cpp?cvsroot=traverso&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/traverso/src/plugins/PluginSlider.h?cvsroot=traverso&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/traverso/src/plugins/plugins.pro?cvsroot=traverso&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/traverso/src/plugins/PluginPropertiesDialog.cpp?cvsroot=traverso&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/traverso/src/plugins/PluginPropertiesDialog.h?cvsroot=traverso&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/PluginSelectorDialog.cpp?cvsroot=traverso&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/AudioClipView.cpp?cvsroot=traverso&r1=1.71&r2=1.72
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/ClipsViewPort.cpp?cvsroot=traverso&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/CurveView.cpp?cvsroot=traverso&r1=1.52&r2=1.53
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/FadeView.cpp?cvsroot=traverso&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/PluginChainView.cpp?cvsroot=traverso&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/PluginView.cpp?cvsroot=traverso&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/PluginView.h?cvsroot=traverso&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/songcanvas.pro?cvsroot=traverso&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/SongView.cpp?cvsroot=traverso&r1=1.63&r2=1.64

Patches:
Index: commands/AudioClipExternalProcessing.cpp
===================================================================
RCS file: 
/sources/traverso/traverso/src/commands/AudioClipExternalProcessing.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- commands/AudioClipExternalProcessing.cpp    17 May 2007 21:38:14 -0000      
1.5
+++ commands/AudioClipExternalProcessing.cpp    30 May 2007 13:14:45 -0000      
1.6
@@ -127,8 +127,6 @@
                m_resultingclip->set_track(m_clip->get_track());
                resources_manager()->set_source_for_clip(m_resultingclip, 
source);
                
m_resultingclip->set_track_start_frame(m_clip->get_track_start_frame());
-               // FIXME!!!!!!!!!!!!!!!!!!!!
-               m_resultingclip->init_gain_envelope();
        }
        
        

Index: commands/Import.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/commands/Import.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- commands/Import.cpp 17 May 2007 21:38:15 -0000      1.23
+++ commands/Import.cpp 30 May 2007 13:14:45 -0000      1.24
@@ -128,8 +128,6 @@
        resources_manager()->set_source_for_clip(m_clip, m_source);
        m_clip->set_song(m_track->get_song());
        m_clip->set_track(m_track);
-       // FIXME!!!!!!!!!!!!!!!!!!!!
-       m_clip->init_gain_envelope();
        
        nframes_t startFrame = 0;
        

Index: commands/MoveClip.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/commands/MoveClip.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -b -r1.42 -r1.43
--- commands/MoveClip.cpp       24 May 2007 18:28:59 -0000      1.42
+++ commands/MoveClip.cpp       30 May 2007 13:14:45 -0000      1.43
@@ -169,9 +169,6 @@
                d->newclip->set_track(d->view->get_clip()->get_track());
                
d->newclip->set_track_start_frame(d->view->get_clip()->get_track_start_frame() 
+ d->xoffset);
                
-               printf("Orig Clip has id %lld\n", 
d->view->get_clip()->get_id());
-               printf("Created new Clip with id %lld\n", d->newclip->get_id());
-       
                connect(d->view->get_clip()->get_track(), 
SIGNAL(audioClipAdded(AudioClip*)),
                        this, SLOT(audioclip_added(AudioClip*)));
        

Index: core/AudioClip.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/AudioClip.cpp,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -b -r1.101 -r1.102
--- core/AudioClip.cpp  28 May 2007 21:34:11 -0000      1.101
+++ core/AudioClip.cpp  30 May 2007 13:14:45 -0000      1.102
@@ -48,6 +48,8 @@
 #include "Utils.h"
 #include "Information.h"
 #include <Config.h>
+#include "PluginChain.h"
+#include "GainEnvelope.h"
 
 #include <commands.h>
 
@@ -62,7 +64,6 @@
        , m_name(name)
 {
        PENTERCONS;
-       m_gain = m_normfactor = 1.0;
        m_length = sourceStartFrame = sourceEndFrame = trackEndFrame = 0;
        isMuted=false;
        m_id = create_id();
@@ -114,19 +115,22 @@
        fadeIn = 0;
        fadeOut = 0;
        m_refcount = 0;
-       m_gainEnvelope = 0;
+       m_pluginChain = new PluginChain(this);
+       m_fader = m_pluginChain->get_fader();
+       m_fader->automate_port(0, true);
+       m_fader->set_gain(1.0);
 }
 
 int AudioClip::set_state(const QDomNode& node)
 {
        PENTER;
        
+       Q_ASSERT(m_song);
+       
        QDomElement e = node.toElement();
 
        isTake = e.attribute( "take", "").toInt();
        set_gain( e.attribute( "gain", "" ).toFloat() );
-       m_normfactor =  e.attribute( "normfactor", "1.0" ).toFloat();
-
        isLocked = e.attribute( "locked", "0" ).toInt();
 
        if (e.attribute("selected", "0").toInt() == 1) {
@@ -142,9 +146,7 @@
        sourceEndFrame = sourceStartFrame + m_length;
        set_track_start_frame( e.attribute( "trackstart", "" ).toUInt());
        
-       QDomElement curvesNode = node.firstChildElement("Curves");
-       if (!curvesNode.isNull()) {
-               QDomElement fadeInNode = curvesNode.firstChildElement("FadeIn");
+       QDomElement fadeInNode = node.firstChildElement("FadeIn");
                if (!fadeInNode.isNull()) {
                        fadeIn = new FadeCurve(this, m_song, "FadeIn");
                        fadeIn->set_state( fadeInNode );
@@ -152,7 +154,7 @@
                        private_add_fade(fadeIn);
                }
 
-               QDomElement fadeOutNode = 
curvesNode.firstChildElement("FadeOut");
+       QDomElement fadeOutNode = node.firstChildElement("FadeOut");
                if (!fadeOutNode.isNull()) {
                        fadeOut = new FadeCurve(this, m_song, "FadeOut");
                        fadeOut->set_state( fadeOutNode );
@@ -160,12 +162,9 @@
                        private_add_fade(fadeOut);
                }
                
-               QDomElement m_gainEnvelopeNode = 
curvesNode.firstChildElement("GainCurve");
-               if (!m_gainEnvelopeNode.isNull()) {
-                       m_gainEnvelope->set_state( m_gainEnvelopeNode );
-               } else {
-                       init_gain_envelope();
-               }
+       QDomNode pluginChainNode = node.firstChildElement("PluginChain");
+       if (!pluginChainNode.isNull()) {
+               m_pluginChain->set_state(pluginChainNode);
        }
 
        return 1;
@@ -177,8 +176,6 @@
        node.setAttribute("trackstart", trackStartFrame);
        node.setAttribute("sourcestart", sourceStartFrame);
        node.setAttribute("length", m_length);
-       node.setAttribute("gain", m_gain);
-       node.setAttribute("normfactor", m_normfactor);
        node.setAttribute("mute", isMuted);
        node.setAttribute("take", isTake);
        node.setAttribute("clipname", m_name );
@@ -189,17 +186,16 @@
 
        node.setAttribute("source", m_readSourceId);
 
-       QDomNode curves = doc.createElement("Curves");
-
        if (fadeIn) {
-               curves.appendChild(fadeIn->get_state(doc));
+               node.appendChild(fadeIn->get_state(doc));
        }
        if (fadeOut) {
-               curves.appendChild(fadeOut->get_state(doc));
+               node.appendChild(fadeOut->get_state(doc));
        }
-       curves.appendChild(m_gainEnvelope->get_state(doc, "GainCurve"));
 
-       node.appendChild(curves);
+       QDomNode pluginChainNode = doc.createElement("PluginChain");
+       pluginChainNode.appendChild(m_pluginChain->get_state(doc));
+       node.appendChild(pluginChainNode);
 
        return node;
 }
@@ -370,7 +366,8 @@
                gain = 0.0;
        if (gain > 32.0)
                gain = 32.0;
-       m_gain = gain;
+       
+       m_fader->set_gain(gain);
        emit gainChanged();
 }
 
@@ -396,7 +393,7 @@
                return -1;
        }
 
-       if (isMuted || ( (m_gain * m_normfactor) == 0.0f) ) {
+       if (isMuted || (get_gain() == 0.0f) ) {
                return 0;
        }
        
@@ -446,7 +443,7 @@
                m_fades.at(i)->process(mixdown, read_frames);
        }
        
-       m_gainEnvelope->process(mixdown, (m_song->get_transport_frame() - 
(trackStartFrame - sourceStartFrame)), read_frames);
+       m_fader->process_gain(mixdown, (m_song->get_transport_frame() - 
(trackStartFrame - sourceStartFrame)), read_frames);
        
        return 1;
 }
@@ -564,8 +561,6 @@
        isTake = 1;
        m_recordingStatus = RECORDING;
        
-       init_gain_envelope();
-       
        connect(m_song, SIGNAL(transferStopped()), this, 
SLOT(finish_recording()));
        connect(&audiodevice(), SIGNAL(driverParamsChanged()), this, 
SLOT(get_capture_bus()));
 
@@ -758,13 +753,7 @@
        m_songId = song->get_id();
        
        set_history_stack(m_song->get_history_stack());
-       
-       if (!m_gainEnvelope) {
-               m_gainEnvelope = new Curve(this, m_song);
-       }
-       
-       m_gainEnvelope->set_history_stack(get_history_stack());
-
+       m_pluginChain->set_song(m_song);
        set_snap_list(m_song->get_snap_list());
 }
 
@@ -788,12 +777,7 @@
 
 float AudioClip::get_gain( ) const
 {
-       return m_gain;
-}
-
-float AudioClip::get_norm_factor( ) const
-{
-       return m_normfactor;
+       return m_fader->get_gain();
 }
 
 bool AudioClip::is_selected( ) const
@@ -901,17 +885,12 @@
                calculate_normalization_factor(d);
        }
 
-       emit gainChanged();
-
        return (Command*) 0;
 }
 
 Command * AudioClip::denormalize( )
 {
-       m_normfactor = 1.0;
-       // Hmm, this is not entirely true, but "almost" ;-)
-       emit gainChanged();
-
+       set_gain(1.0);
        return (Command*) 0;
 }
 
@@ -945,7 +924,7 @@
        }
 
        /* compute scale factor */
-       m_normfactor = target/maxamp;
+       set_gain(target/maxamp);
 }
 
 FadeCurve * AudioClip::get_fade_in( )
@@ -980,11 +959,6 @@
        m_fades.removeAll(fade);
 }
 
-// int AudioClip::get_ref_count( ) const
-// {
-//     return m_refcount;
-// }
-
 void AudioClip::create_fade_in( )
 {
        fadeIn = new FadeCurve(this, m_song, "FadeIn");
@@ -1001,15 +975,6 @@
        THREAD_SAVE_CALL_EMIT_SIGNAL(this, fadeOut, 
private_add_fade(FadeCurve*), fadeAdded(FadeCurve*));
 }
 
-void AudioClip::init_gain_envelope()
-{
-       // FIXME Somehow Curves always should have 1 node, which is not allowed 
-       // to be removed, or moved horizontally, to avoid code like below..... 
!!!!!
-       // Add the default (first) node to the Gain Curve
-       CurveNode* node = new CurveNode(m_gainEnvelope, 0.0, 1.0);
-       Command::process_command(m_gainEnvelope->add_node(node, false));
-}
-
 QDomNode AudioClip::get_dom_node() const
 {
        return m_domNode;

Index: core/AudioClip.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/AudioClip.h,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -b -r1.51 -r1.52
--- core/AudioClip.h    28 May 2007 21:30:13 -0000      1.51
+++ core/AudioClip.h    30 May 2007 13:14:45 -0000      1.52
@@ -41,6 +41,8 @@
 class AudioBus;
 class FadeCurve;
 class Curve;
+class PluginChain;
+class GainEnvelope;
 struct ExportSpecification;
 
 class AudioClip : public ContextItem, public Snappable
@@ -84,7 +86,6 @@
 
        void set_selected(bool selected);
        int set_state( const QDomNode& node );
-//     int get_ref_count() const;
 
        AudioClip* prev_clip();
        AudioClip* next_clip();
@@ -95,9 +96,7 @@
        QDomNode get_state(QDomDocument doc);
        FadeCurve* get_fade_in();
        FadeCurve* get_fade_out();
-       Curve* get_gain_envelope() {return m_gainEnvelope;}
-       
-       float get_norm_factor() const;
+       PluginChain* get_plugin_chain() const {return m_pluginChain;}
        
        nframes_t get_length() const;
        nframes_t get_track_start_frame() const;
@@ -133,8 +132,6 @@
                return left->get_track_start_frame() > 
right->get_track_start_frame();
        }
 
-       void init_gain_envelope();
-
 private:
        Track*                  m_track;
        Song*                   m_song;
@@ -145,7 +142,8 @@
        AudioBus*               m_captureBus;
        FadeCurve*              fadeIn;
        FadeCurve*              fadeOut;
-       Curve*                  m_gainEnvelope;
+       GainEnvelope*           m_fader;
+       PluginChain*            m_pluginChain;
        QDomNode                m_domNode;
        
        QString                 m_name;
@@ -163,8 +161,6 @@
        bool            isLocked;
        bool            m_invalidReadSource;
        RecordingStatus m_recordingStatus;
-       float           m_gain;
-       float           m_normfactor;
        
        qint64          m_readSourceId;
        qint64          m_songId;

Index: core/core.pro
===================================================================
RCS file: /sources/traverso/traverso/src/core/core.pro,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- core/core.pro       17 Apr 2007 11:51:20 -0000      1.27
+++ core/core.pro       30 May 2007 13:14:46 -0000      1.28
@@ -8,6 +8,7 @@
 INCLUDEPATH += ../commands \
        ../engine \
        ../plugins \
+       ../plugins/native \
                . 
 QMAKE_LIBDIR = ../../lib 
 TARGET = traversocore 

Index: core/Curve.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Curve.cpp,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -b -r1.39 -r1.40
--- core/Curve.cpp      26 Apr 2007 16:53:42 -0000      1.39
+++ core/Curve.cpp      30 May 2007 13:14:46 -0000      1.40
@@ -97,18 +97,16 @@
 
 
 
-Curve::Curve(ContextItem* parent, Song* song)
+Curve::Curve(ContextItem* parent)
        : ContextItem(parent)
-       , m_song(song)
 {
        PENTERCONS;
        m_id = create_id();
        init();
 }
 
-Curve::Curve(ContextItem* parent, Song* song, const QDomNode node )
+Curve::Curve(ContextItem* parent, const QDomNode node )
        : ContextItem(parent)
-       , m_song(song)
 {
        init();
        set_state(node);
@@ -123,13 +121,15 @@
 
 void Curve::init( )
 {
-       Q_ASSERT(m_song);
        m_changed = true;
        m_lookup_cache.left = -1;
        m_lookup_cache.range.first = m_nodes.end();
 
        m_defaultValue = 1.0f;
        m_defaultInitialValue = 1.0f;   
+       
+       m_song = 0;
+       
        connect(this, SIGNAL(nodePositionChanged()), this, SLOT(set_changed()));
 }
 
@@ -175,7 +175,7 @@
                double when = whenValueList.at(0).toDouble();
                double value = whenValueList.at(1).toDouble();
                CurveNode* node = new CurveNode(this, when, value);
-               Command::process_command( add_node(node, false) );
+               private_add_node(node);
        }
        
        return 1;
@@ -632,6 +632,7 @@
                return cmd;
        }
 
+       
        AddRemove* cmd;
        
        cmd = new AddRemove(this, node, historable, m_song,

Index: core/Curve.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/Curve.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- core/Curve.h        26 Apr 2007 16:53:42 -0000      1.21
+++ core/Curve.h        30 May 2007 13:14:46 -0000      1.22
@@ -44,8 +44,8 @@
        Q_OBJECT
        
 public:
-       Curve(ContextItem* parent, Song* song);
-       Curve(ContextItem* parent, Song* song, const QDomNode node);
+       Curve(ContextItem* parent);
+       Curve(ContextItem* parent, const QDomNode node);
        ~Curve();
 
        QDomNode get_state(QDomDocument doc, const QString& name);
@@ -67,6 +67,7 @@
        
        // Set functions
        virtual void set_range(double when);
+       void set_song(Song* song) {m_song = song;}
        
        static bool smallerNode(const CurveNode* left, const CurveNode* right )
        {
@@ -85,6 +86,7 @@
                std::pair<QList<CurveNode* >::iterator, QList<CurveNode* 
>::iterator> range;
        };
        
+       Song* m_song;
        QList<CurveNode* > m_nodes;
        LookupCache m_lookup_cache;
        bool m_changed;
@@ -98,17 +100,14 @@
                }
        };
        
-       Song* m_song;
        
        double m_defaultValue;
-
        double m_defaultInitialValue;
        
        double multipoint_eval (double x);
        
        void x_scale(double factor);
        void solve ();
-       
        void init();
        
        friend class CurveNode;

Index: core/FadeCurve.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/FadeCurve.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- core/FadeCurve.cpp  27 Apr 2007 04:38:15 -0000      1.18
+++ core/FadeCurve.cpp  30 May 2007 13:14:46 -0000      1.19
@@ -17,7 +17,7 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
 
-$Id: FadeCurve.cpp,v 1.18 2007/04/27 04:38:15 r_sijrier Exp $
+$Id: FadeCurve.cpp,v 1.19 2007/05/30 13:14:46 r_sijrier Exp $
 */
  
 #include "FadeCurve.h"
@@ -37,7 +37,7 @@
 QStringList FadeCurve::defaultShapes = QStringList() << "Fastest" << "Fast" << 
"Linear"  << "Slow" << "Slowest";
 
 FadeCurve::FadeCurve(AudioClip* clip, Song* song, QString type )
-       : Curve(clip, song)
+       : Curve(clip)
        , m_clip(clip)
        , m_sType(type)
 {

Index: core/FadeCurve.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/FadeCurve.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- core/FadeCurve.h    23 Feb 2007 13:49:53 -0000      1.9
+++ core/FadeCurve.h    30 May 2007 13:14:46 -0000      1.10
@@ -17,7 +17,7 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
 
-$Id: FadeCurve.h,v 1.9 2007/02/23 13:49:53 r_sijrier Exp $
+$Id: FadeCurve.h,v 1.10 2007/05/30 13:14:46 r_sijrier Exp $
 */
 
 #ifndef FADE_CURVE_H
@@ -75,7 +75,6 @@
 
 private:
        AudioClip*      m_clip;
-       Song*           m_song;
        float           m_bendFactor;
        float           m_strenghtFactor;
        bool            m_bypass;

Index: core/ReadSource.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/ReadSource.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- core/ReadSource.h   17 May 2007 21:38:15 -0000      1.24
+++ core/ReadSource.h   30 May 2007 13:14:46 -0000      1.25
@@ -17,7 +17,7 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
 
-$Id: ReadSource.h,v 1.24 2007/05/17 21:38:15 r_sijrier Exp $
+$Id: ReadSource.h,v 1.25 2007/05/30 13:14:46 r_sijrier Exp $
 */
 
 #ifndef READSOURCE_H
@@ -52,7 +52,6 @@
        int file_read(int channel, audio_sample_t* dst, nframes_t start, 
nframes_t cnt) const;
 
        int init();
-       int get_ref_count() const {return m_refcount;}
        int get_error() const {return m_error;}
        int set_file(const QString& filename);
        void set_active(bool active);
@@ -68,7 +67,6 @@
        int     m_refcount;
        int     m_error;
        AudioClip* m_clip;
-       int     m_usedByClips;
        bool    m_silent;
        
        int ref() { return m_refcount++;}

Index: core/Song.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Song.cpp,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -b -r1.112 -r1.113
--- core/Song.cpp       30 May 2007 06:05:06 -0000      1.112
+++ core/Song.cpp       30 May 2007 13:14:46 -0000      1.113
@@ -70,7 +70,6 @@
        PENTERCONS;
        title = tr("Untitled");
        m_id = create_id();
-       m_gain = 1.0f;
        artists = tr("No artists name set");
        m_hzoom = config().get_property("Song", "hzoomLevel", 14).toInt();
 
@@ -84,7 +83,6 @@
        PENTERCONS;
        title = tr("Untitled");
        m_id = create_id();
-       m_gain = 1.0f;
        artists = tr("No artists name set");
        m_hzoom = config().get_property("Song", "hzoomLevel", 14).toInt();
 
@@ -166,6 +164,8 @@
        m_sbx = m_sby = 0;
        
        m_pluginChain = new PluginChain(this, this);
+       m_fader = m_pluginChain->get_fader();
+       m_fader->set_gain(0.5);
        m_timeline = new TimeLine(this);
        
        m_audiodeviceClient = new Client("song_" + 
QByteArray::number(get_id()));
@@ -234,7 +234,6 @@
        properties.setAttribute("hzoom", m_hzoom);
        properties.setAttribute("sbx", m_sbx);
        properties.setAttribute("sby", m_sby);
-       properties.setAttribute("mastergain", m_gain);
        properties.setAttribute("snapping", m_isSnapOn);
        properties.setAttribute("mode", m_mode);
        songNode.appendChild(properties);
@@ -251,9 +250,9 @@
 
        songNode.appendChild(tracksNode);
 
-       QDomNode m_pluginChainNode = doc.createElement("PluginChain");
-       m_pluginChainNode.appendChild(m_pluginChain->get_state(doc));
-       songNode.appendChild(m_pluginChainNode);
+       QDomNode pluginChainNode = doc.createElement("PluginChain");
+       pluginChainNode.appendChild(m_pluginChain->get_state(doc));
+       songNode.appendChild(pluginChainNode);
 
 
        return songNode;
@@ -541,7 +540,7 @@
        if (gain > 2.0)
                gain = 2.0;
 
-       m_gain = gain;
+       m_fader->set_gain(gain);
 
        emit masterGainChanged();
 }
@@ -869,11 +868,10 @@
 
        // Mix the result into the AudioDevice "physical" buffers
        if (m_playBackBus) {
-               // Process all the plugins for this Song
-               m_pluginChain->process(m_masterOut, nframes);
+               Mixer::mix_buffers_with_gain(m_playBackBus->get_buffer(0, 
nframes), m_masterOut->get_buffer(0, nframes), nframes, get_gain());
+               Mixer::mix_buffers_with_gain(m_playBackBus->get_buffer(1, 
nframes), m_masterOut->get_buffer(1, nframes), nframes, get_gain());
                
-               Mixer::mix_buffers_with_gain(m_playBackBus->get_buffer(0, 
nframes), m_masterOut->get_buffer(0, nframes), nframes, m_gain);
-               Mixer::mix_buffers_with_gain(m_playBackBus->get_buffer(1, 
nframes), m_masterOut->get_buffer(1, nframes), nframes, m_gain);
+               m_pluginChain->process_post_fader(m_masterOut, nframes);
        }
 
        
@@ -891,8 +889,8 @@
                m_tracks.at(i)->process(nframes);
        }
 
-       Mixer::apply_gain_to_buffer(m_masterOut->get_buffer(0, nframes), 
nframes, m_gain);
-       Mixer::apply_gain_to_buffer(m_masterOut->get_buffer(1, nframes), 
nframes, m_gain);
+       Mixer::apply_gain_to_buffer(m_masterOut->get_buffer(0, nframes), 
nframes, get_gain());
+       Mixer::apply_gain_to_buffer(m_masterOut->get_buffer(1, nframes), 
nframes, get_gain());
 
        // update the transportFrame
        transportFrame += nframes;
@@ -1056,7 +1054,7 @@
 
 float Song::get_gain() const
 {
-       return m_gain;
+       return m_fader->get_gain();
 }
 
 QList<Track* > Song::get_tracks( ) const

Index: core/Song.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/Song.h,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -b -r1.55 -r1.56
--- core/Song.h 24 May 2007 10:56:43 -0000      1.55
+++ core/Song.h 30 May 2007 13:14:46 -0000      1.56
@@ -41,6 +41,7 @@
 class Plugin;
 class TimeLine;
 class Snappable;
+class GainEnvelope;
 
 struct ExportSpecification;
 
@@ -168,7 +169,6 @@
 
        
        nframes_t       firstVisibleFrame;
-       float           m_gain;
        QString         artists;
        QString         title;
        int             m_mode;
@@ -185,6 +185,7 @@
        bool            m_recording;
        SnapList*       snaplist;
        Snappable*      workSnap;
+       GainEnvelope*   m_fader;
        
        void init();
 

Index: core/Track.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Track.cpp,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -b -r1.58 -r1.59
--- core/Track.cpp      28 May 2007 21:30:13 -0000      1.58
+++ core/Track.cpp      30 May 2007 13:14:46 -0000      1.59
@@ -49,7 +49,6 @@
 {
        PENTERCONS;
        m_pan = numtakes = 0;
-       m_gain = 0.5;
        m_sortIndex = -1;
        m_id = create_id();
        
@@ -77,7 +76,9 @@
 {
        isSolo = mutedBySolo = isMuted = isArmed = false;
        set_history_stack(m_song->get_history_stack());
-       pluginChain = new PluginChain(this, m_song);
+       m_pluginChain = new PluginChain(this, m_song);
+       m_fader = m_pluginChain->get_fader();
+       m_fader->set_gain(1.0);
        m_captureRightChannel = m_captureLeftChannel = true;
 }
 
@@ -88,7 +89,6 @@
                node.setAttribute("id", m_id);
        }
        node.setAttribute("name", m_name);
-       node.setAttribute("gain", m_gain);
        node.setAttribute("pan", m_pan);
        node.setAttribute("mute", isMuted);
        node.setAttribute("solo", isSolo);
@@ -118,9 +118,9 @@
                node.appendChild(clips);
        }
        
-       QDomNode pluginChainNode = doc.createElement("PluginChain");
-       pluginChainNode.appendChild(pluginChain->get_state(doc));
-       node.appendChild(pluginChainNode);
+       QDomNode m_pluginChainNode = doc.createElement("PluginChain");
+       m_pluginChainNode.appendChild(m_pluginChain->get_state(doc));
+       node.appendChild(m_pluginChainNode);
        
        return node;
 }
@@ -138,7 +138,6 @@
                solo();
        }
        set_muted_by_solo(e.attribute( "mutedbysolo", "0").toInt());
-       m_gain =  e.attribute( "gain", "" ).toFloat();
        set_pan( e.attribute( "pan", "" ).toFloat() );
        set_bus_in( e.attribute( "InBus", "" ).toAscii() );
        set_bus_out( e.attribute( "OutBus", "" ).toAscii() );
@@ -178,8 +177,10 @@
                }
        }
 
-       QDomNode pluginChainNode = node.firstChildElement("PluginChain");
-       pluginChain->set_state(pluginChainNode);
+       QDomNode m_pluginChainNode = node.firstChildElement("PluginChain");
+       if (!m_pluginChainNode.isNull()) {
+               m_pluginChain->set_state(m_pluginChainNode);
+       }
        
        return 1;
 }
@@ -332,7 +333,7 @@
                gain = 0.0;
        if (gain > 2.0)
                gain = 2.0;
-       m_gain = gain;
+       m_fader->set_gain(gain);
        emit gainChanged();
 }
 
@@ -365,7 +366,7 @@
 
 float Track::get_gain( ) const
 {
-       return m_gain;
+       return m_fader->get_gain();
 }
 
 void Track::set_muted_by_solo(bool muted)
@@ -405,8 +406,6 @@
 {
        int processResult = 0;
        
-       // FIXME if arm() is called while playback, it will _not_ start 
-       // a recording, but instead start playing this track!!!!
        if ( (isMuted || mutedBySolo) && ( ! isArmed) ) {
                return 0;
        }
@@ -421,6 +420,8 @@
        int result;
        float gainFactor, panFactor;
 
+       m_pluginChain->process_pre_fader(bus, nframes);
+       
        for (int i=0; i<audioClipList.size(); ++i) {
        
                memset (mixdown, 0, sizeof (audio_sample_t) * nframes);
@@ -436,15 +437,13 @@
                
                        result = clip->process(nframes, mixdown, chan);
                        
-                       if (result == 0) {
+                       if (result <= 0) {
                                continue;
                        }
 
-                       if (result != -1) { // No such channel !!
                                processResult |= result;
-                       }
                        
-                       gainFactor = m_gain * clip->get_gain() * 
clip->get_norm_factor();
+                       gainFactor = get_gain() * clip->get_gain();
                        
                        if ( (chan == 0) && (m_pan > 0)) {
                                panFactor = 1 - m_pan;
@@ -460,7 +459,7 @@
                }
        }
        
-       pluginChain->process(bus, nframes);
+       m_pluginChain->process_post_fader(bus, nframes);
                
        for (int i=0; i<bus->get_channel_count(); ++i) {
                
Mixer::mix_buffers_no_gain(m_song->get_master_out()->get_buffer(i, nframes), 
bus->get_buffer(i, nframes), nframes);
@@ -541,12 +540,12 @@
 
 Command* Track::add_plugin( Plugin * plugin )
 {
-       return pluginChain->add_plugin(plugin);
+       return m_pluginChain->add_plugin(plugin);
 }
 
 Command* Track::remove_plugin( Plugin * plugin )
 {
-       return pluginChain->remove_plugin(plugin);
+       return m_pluginChain->remove_plugin(plugin);
 }
 
 void Track::set_sort_index( int index )

Index: core/Track.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/Track.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- core/Track.h        17 May 2007 12:45:19 -0000      1.28
+++ core/Track.h        30 May 2007 13:14:46 -0000      1.29
@@ -37,6 +37,7 @@
 class Song;
 class PluginChain;
 class Plugin;
+class GainEnvelope;
 
 
 class Track : public ContextItem
@@ -78,7 +79,7 @@
        int get_total_clips();
        QDomNode get_state(QDomDocument doc, bool istemplate=false);
        AudioClipList get_cliplist() const {return audioClipList;}
-       PluginChain* get_plugin_chain() const {return pluginChain;}
+       PluginChain* get_plugin_chain() const {return m_pluginChain;}
        int get_sort_index() const;
        
 
@@ -118,9 +119,9 @@
 private :
        Song*           m_song;
        AudioClipList   audioClipList;
-       PluginChain*    pluginChain;
+       PluginChain*    m_pluginChain;
 
-       float   m_gain;
+       GainEnvelope* m_fader;
        float   m_pan;
        int numtakes;
        QByteArray busIn;

Index: plugins/LV2/LV2Plugin.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/plugins/LV2/LV2Plugin.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- plugins/LV2/LV2Plugin.cpp   24 May 2007 23:24:02 -0000      1.7
+++ plugins/LV2/LV2Plugin.cpp   30 May 2007 13:14:46 -0000      1.8
@@ -33,22 +33,20 @@
 
 
 
-LV2Plugin::LV2Plugin(bool slave)
-       : Plugin()
+LV2Plugin::LV2Plugin(Song* song, bool slave)
+       : Plugin(song)
        , m_instance(0)
        , m_slv2plugin(0)
-       , m_slave(0)
 {
        m_isSlave = slave;
 }
 
 
-LV2Plugin::LV2Plugin(char* pluginUri)
-       : Plugin()
+LV2Plugin::LV2Plugin(Song* song, char* pluginUri)
+       : Plugin(song)
        , m_pluginUri((char*) pluginUri)
        , m_instance(0)
        , m_slv2plugin(0)
-       , m_slave(0)
        , m_isSlave(false)
 {
 }
@@ -66,30 +64,10 @@
 
 QDomNode LV2Plugin::get_state( QDomDocument doc )
 {
-       QDomElement node = doc.createElement("Plugin");
+       QDomElement node = Plugin::get_state(doc).toElement();
+       
        node.setAttribute("type", "LV2Plugin");
        node.setAttribute("uri", m_pluginUri);
-       node.setAttribute("bypassed", is_bypassed());
-       
-       QDomNode controlPortsNode = doc.createElement("ControlPorts");
-       
-       foreach(LV2ControlPort* port, m_controlPorts) {
-               controlPortsNode.appendChild(port->get_state(doc));
-       }
-       
-       QDomNode audioInputPortsNode = doc.createElement("AudioInputPorts");
-       foreach(AudioInputPort* port, m_audioInputPorts) {
-               audioInputPortsNode.appendChild(port->get_state(doc));
-       }
-       
-       QDomNode audioOutputPortsNode = doc.createElement("AudioOutputPorts");
-       foreach(AudioOutputPort* port, m_audioOutputPorts) {
-               audioOutputPortsNode.appendChild(port->get_state(doc));
-       }
-       
-       node.appendChild(controlPortsNode);
-       node.appendChild(audioInputPortsNode);
-       node.appendChild(audioOutputPortsNode);
        
        return node;
 }
@@ -97,10 +75,11 @@
 
 int LV2Plugin::set_state(const QDomNode & node )
 {
+       Plugin::set_state(node);
+       
        QDomElement e = node.toElement();
        
        m_pluginUri = e.attribute( "uri", "");
-       m_bypass = e.attribute( "bypassed", "0").toInt();
        
        if (create_instance() < 0) {
                return -1;
@@ -168,10 +147,10 @@
        }
 
        /* Create ports */
-       m_portcount  = slv2_plugin_get_num_ports(m_slv2plugin);
-       PMESG("numports is %d", (int) m_portcount);
+       int portcount  = slv2_plugin_get_num_ports(m_slv2plugin);
+       PMESG("numports is %d", portcount);
 
-       for (int i=0; i < m_portcount; ++i) {
+       for (int i=0; i < portcount; ++i) {
                LV2ControlPort* port = create_port(i);
                if (port) {
                        m_controlPorts.append(port);
@@ -318,19 +297,18 @@
 
 
 LV2ControlPort::LV2ControlPort(LV2Plugin* plugin, int index, float value)
-       : PluginPort(plugin, index)
+       : PluginControlPort(plugin, index, value)
        , m_lv2plugin(plugin)
-       , m_controlValue(value)
 {
-       slv2_instance_connect_port(m_lv2plugin->get_instance(), m_index, 
&m_controlValue);
+       slv2_instance_connect_port(m_lv2plugin->get_instance(), m_index, 
&m_value);
        init();
 }
 
 LV2ControlPort::LV2ControlPort( LV2Plugin * plugin, const QDomNode node )
-       : PluginPort(plugin), m_lv2plugin(plugin)
+       : PluginControlPort(plugin, node)
+       , m_lv2plugin(plugin)
 {
-       set_state(node);
-       slv2_instance_connect_port(m_lv2plugin->get_instance(), m_index, 
&m_controlValue);
+       slv2_instance_connect_port(m_lv2plugin->get_instance(), m_index, 
&m_value);
        init();
 }
 
@@ -347,21 +325,7 @@
 
 QDomNode LV2ControlPort::get_state( QDomDocument doc )
 {
-       
-       QDomElement node = PluginPort::get_state(doc).toElement();
-       node.setAttribute("value", m_controlValue);
-       
-       return node;
-}
-
-
-int LV2ControlPort::set_state( const QDomNode & node )
-{
-       QDomElement e = node.toElement();
-       m_index = e.attribute( "index", "").toInt();
-       m_controlValue = e.attribute( "value", "").toFloat();
-       
-       return 1;
+       return PluginControlPort::get_state(doc);
 }
 
 
@@ -408,27 +372,11 @@
        return qslist;
 }
 
-void LV2ControlPort::set_control_value(float value)
-{
-       m_controlValue = value;
-}
-
-
-LV2ControlPort * LV2Plugin::get_control_port_by_index(int index) const
-{
-       foreach(LV2ControlPort* port, m_controlPorts) {
-               if (port->get_index() == index) {
-                       return port;
-               }
-       }
-       return 0;
-}
-
 LV2Plugin * LV2Plugin::create_copy()
 {
        QDomDocument doc("LV2Plugin");
        QDomNode pluginState = get_state(doc);
-       LV2Plugin* plug = new LV2Plugin(true);
+       LV2Plugin* plug = new LV2Plugin(m_song, true);
        plug->set_state(pluginState);
        return plug;
 }

Index: plugins/LV2/LV2Plugin.h
===================================================================
RCS file: /sources/traverso/traverso/src/plugins/LV2/LV2Plugin.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- plugins/LV2/LV2Plugin.h     24 May 2007 23:24:03 -0000      1.7
+++ plugins/LV2/LV2Plugin.h     30 May 2007 13:14:46 -0000      1.8
@@ -34,6 +34,7 @@
 class LV2ControlPort;
 class AudioInputPort;
 class AudioOutputPort;
+class Song;
 
 class LV2Plugin : public Plugin
 {
@@ -41,19 +42,15 @@
        Q_CLASSINFO("toggle_bypass", tr("Bypass: On/Off"))
 
 public:
-       LV2Plugin(bool slave=false);
-       LV2Plugin(char* pluginUri);
+       LV2Plugin(Song* song, bool slave=false);
+       LV2Plugin(Song* song, char* pluginUri);
        ~LV2Plugin();
 
        void process(AudioBus* bus, unsigned long nframes);
 
        SLV2Instance  get_instance() const {return m_instance; }
        SLV2Plugin get_slv2_plugin() const {return m_slv2plugin; }
-       LV2ControlPort* get_control_port_by_index(int index) const;
        LV2Plugin* create_copy();
-       LV2Plugin* get_slave() const {return m_slave;}
-
-       QList<LV2ControlPort* > get_control_ports() const { return 
m_controlPorts; }
 
        QDomNode get_state(QDomDocument doc);
        QString get_name();
@@ -65,14 +62,8 @@
        QString         m_pluginUri;
        SLV2Instance    m_instance;
        SLV2Plugin      m_slv2plugin;
-       int             m_portcount;
-       LV2Plugin*      m_slave;
        bool            m_isSlave;
        
-       QList<LV2ControlPort* >         m_controlPorts;
-       QList<AudioInputPort* >         m_audioInputPorts;
-       QList<AudioOutputPort* >        m_audioOutputPorts;
-
        LV2ControlPort* create_port(int portIndex);
 
        int create_instance();
@@ -82,16 +73,14 @@
 };
 
 
-class LV2ControlPort : public PluginPort
+class LV2ControlPort : public PluginControlPort
 {
-       Q_OBJECT
 
 public:
        LV2ControlPort(LV2Plugin* plugin, int index, float value);
        LV2ControlPort(LV2Plugin* plugin, const QDomNode node);
        ~LV2ControlPort(){};
 
-       float get_control_value() {return m_controlValue; }
        float get_min_control_value();
        float get_max_control_value();
        float get_default_value();
@@ -103,15 +92,9 @@
 
 private:
        LV2Plugin*      m_lv2plugin;
-       float           m_controlValue;
        
-       int set_state( const QDomNode & node );
        void init();
        QStringList get_hints();
-
-public slots:
-       void set_control_value(float value);
-
 }; 
 
 

Index: plugins/PluginChain.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/plugins/PluginChain.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- plugins/PluginChain.cpp     24 May 2007 10:56:43 -0000      1.10
+++ plugins/PluginChain.cpp     30 May 2007 13:14:47 -0000      1.11
@@ -33,18 +33,27 @@
 // in case we run with memory leak detection enabled!
 #include "Debugger.h"
 
+PluginChain::PluginChain(ContextItem * parent)
+       : ContextItem(parent)
+{
+       m_fader = new GainEnvelope(0);
+}
+
 PluginChain::PluginChain(ContextItem* parent, Song* song)
-       : ContextItem(parent), m_song(song)
+       : ContextItem(parent)
 {
-       m_hs = parent->get_history_stack();
+       m_fader = new GainEnvelope(song);
+       set_song(song);
 }
 
-PluginChain::~ PluginChain( )
+PluginChain::~ PluginChain()
 {
        PENTERDES;
        foreach(Plugin* plugin, m_pluginList) {
                delete plugin;
        }
+       
+       delete m_fader;
 }
 
 
@@ -56,6 +65,8 @@
                pluginsNode.appendChild(plugin->get_state(doc));
        }
        
+       pluginsNode.appendChild(m_fader->get_state(doc));
+       
        return pluginsNode;
 }
 
@@ -65,14 +76,18 @@
        QDomNode pluginNode = pluginsNode.firstChild();
        
        while(!pluginNode.isNull()) {
+               if (pluginNode.toElement().attribute( "type", "") == 
"GainEnvelope") {
+                       m_fader->set_state(pluginNode);
+               } else {
                Plugin* plugin = 
PluginManager::instance()->get_plugin(pluginNode);
                if (!plugin) {
-                       PERROR("PluginManager couldn't create Plugin ????");
                        pluginNode = pluginNode.nextSibling();
                        continue;
                }
                plugin->set_history_stack(get_history_stack());
                private_add_plugin(plugin);
+               }
+               
                pluginNode = pluginNode.nextSibling();
        }
        
@@ -113,9 +128,15 @@
        if (index >=0 ) {
                m_pluginList.removeAt(index);
        } else {
-//             QCritical("Plugin not found in list, this is invalid plugin 
remove!!!!!");
+               PERROR("Plugin not found in list, this is invalid plugin 
remove!!!!!");
        }
 }
 
-//eof
+void PluginChain::set_song(Song * song)
+{
+       m_song = song;
+       set_history_stack(m_song->get_history_stack());
+       m_fader->set_song(song);
+}
+
 

Index: plugins/PluginChain.h
===================================================================
RCS file: /sources/traverso/traverso/src/plugins/PluginChain.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- plugins/PluginChain.h       24 May 2007 10:56:43 -0000      1.8
+++ plugins/PluginChain.h       30 May 2007 13:14:47 -0000      1.9
@@ -27,6 +27,7 @@
 #include <QList>
 #include <QDomNode>
 #include "Plugin.h"
+#include "GainEnvelope.h"
 
 class Song;
 class AudioBus;
@@ -36,6 +37,7 @@
        Q_OBJECT
        
 public:
+       PluginChain(ContextItem* parent);
        PluginChain(ContextItem* parent, Song* song);
        ~PluginChain();
        
@@ -44,12 +46,18 @@
        
        Command* add_plugin(Plugin* plugin, bool historable=true);
        Command* remove_plugin(Plugin* plugin, bool historable=true);
-       void process(AudioBus* bus, unsigned long nframes);
+       void process_pre_fader(AudioBus* bus, unsigned long nframes);
+       void process_post_fader(AudioBus* bus, unsigned long nframes);
+       void process_fader(audio_sample_t* buffer, nframes_t pos, nframes_t 
nframes) {m_fader->process_gain(buffer, pos, nframes);}
+       
+       void set_song(Song* song);
        
        QList<Plugin* > get_plugin_list() {return m_pluginList;}
+       GainEnvelope* get_fader() const {return m_fader;}
        
 private:
        QList<Plugin* > m_pluginList;
+       GainEnvelope*   m_fader;
        Song*           m_song;
        
 signals:
@@ -63,10 +71,22 @@
 
 };
 
-inline void PluginChain::process(AudioBus * bus, unsigned long nframes)
+inline void PluginChain::process_pre_fader(AudioBus * bus, unsigned long 
nframes)
+{
+       return;
+       for (int i=0; i<m_pluginList.size(); ++i) {
+               Plugin* plugin = m_pluginList.at(i);
+               if (plugin == m_fader) return;
+               plugin->process(bus, nframes);
+       }
+}
+
+inline void PluginChain::process_post_fader(AudioBus * bus, unsigned long 
nframes)
 {
        for (int i=0; i<m_pluginList.size(); ++i) {
-               m_pluginList.at(i)->process(bus, nframes);
+               Plugin* plugin = m_pluginList.at(i);
+//             if (plugin == m_fader) continue;
+               plugin->process(bus, nframes);
        }
 }
 

Index: plugins/Plugin.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/plugins/Plugin.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- plugins/Plugin.cpp  19 Jan 2007 12:15:10 -0000      1.3
+++ plugins/Plugin.cpp  30 May 2007 13:14:47 -0000      1.4
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 2006 Remon Sijrier
+Copyright (C) 2006-2007 Remon Sijrier
 
 This file is part of Traverso
 
@@ -17,16 +17,62 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
 
-$Id: Plugin.cpp,v 1.3 2007/01/19 12:15:10 r_sijrier Exp $
 */
 
 #include "Plugin.h"
 
-Plugin::Plugin( )
+#include "Curve.h"
+#include "AddRemove.h"
+
+#include "Debugger.h"
+
+Plugin::Plugin(Song* song)
+       : m_slave(0)
+       , m_song(song)
 {
        m_bypass = false;
 }
 
+QDomNode Plugin::get_state(QDomDocument doc)
+{
+       QDomElement node = doc.createElement("Plugin");
+       
+       node.setAttribute("bypassed", is_bypassed());
+       
+       QDomNode controlPortsNode = doc.createElement("ControlPorts");
+       foreach(PluginControlPort* port, m_controlPorts) {
+               controlPortsNode.appendChild(port->get_state(doc));
+       }
+       
+       if (m_audioInputPorts.size() > 0) {
+               QDomNode audioInputPortsNode = 
doc.createElement("AudioInputPorts");
+               foreach(AudioInputPort* port, m_audioInputPorts) {
+                       audioInputPortsNode.appendChild(port->get_state(doc));
+               }
+               node.appendChild(audioInputPortsNode);
+       }
+       
+       if (m_audioOutputPorts.size() > 0) {
+               QDomNode audioOutputPortsNode = 
doc.createElement("AudioOutputPorts");
+               foreach(AudioOutputPort* port, m_audioOutputPorts) {
+                       audioOutputPortsNode.appendChild(port->get_state(doc));
+               }
+               node.appendChild(audioOutputPortsNode);
+       }
+       
+       node.appendChild(controlPortsNode);
+       
+       return node;
+}
+
+int Plugin::set_state(const QDomNode & node)
+{
+       QDomElement e = node.toElement();
+       
+       m_bypass = e.attribute( "bypassed", "0").toInt();
+
+       return 1;
+}
 
 Command* Plugin::toggle_bypass( )
 {
@@ -37,6 +83,25 @@
        return (Command*) 0;
 }
 
+PluginControlPort* Plugin::get_control_port_by_index(int index) const
+{
+       foreach(PluginControlPort* port, m_controlPorts) {
+               if (port->get_index() == index) {
+                       return port;
+               }
+       }
+       return 0;
+}
+
+void Plugin::automate_port(int index, bool automate)
+{
+       PluginControlPort* port = get_control_port_by_index(index);
+       if (!port) {
+               PERROR("ControlPort with index %d does not exist", index);
+               return;
+       }
+       port->set_use_automation(automate);
+}
 
 
 QDomNode PluginPort::get_state( QDomDocument doc )
@@ -52,7 +117,6 @@
        return 1;
 }
 
-
 AudioInputPort::AudioInputPort(QObject* parent, int index)
        : PluginPort(parent, index)
 {
@@ -66,7 +130,6 @@
        return node;
 }
 
-
 int AudioInputPort::set_state( const QDomNode & node )
 {
        QDomElement e = node.toElement();
@@ -81,7 +144,6 @@
 {
 }
 
-
 QDomNode AudioOutputPort::get_state( QDomDocument doc )
 {
        QDomElement node = doc.createElement("AudioOutputPort");
@@ -90,7 +152,6 @@
        return node;
 }
 
-
 int AudioOutputPort::set_state( const QDomNode & node )
 {
        QDomElement e = node.toElement();
@@ -100,4 +161,81 @@
        return 1;
 }
 
-//eof
+PluginControlPort::PluginControlPort(Plugin* parent, int index, float value)
+       : PluginPort(parent, index)
+       , m_curve(0)
+       , m_plugin(parent)
+       , m_value(value)
+       , m_automation(false)
+{
+}
+
+PluginControlPort::PluginControlPort(Plugin* parent, const QDomNode node)
+       : PluginPort(parent)
+       , m_curve(0)
+       , m_plugin(parent)
+       , m_automation(false)
+{
+       set_state(node);
+}
+
+QDomNode PluginControlPort::get_state(QDomDocument doc)
+{
+       QDomElement node = PluginPort::get_state(doc).toElement();
+       node.setAttribute("value", m_value);
+       node.setAttribute("automation", m_automation);
+       if (m_curve) {
+               node.appendChild(m_curve->get_state(doc, "PortAutomation"));
+       }
+       return node;
+}
+
+int PluginControlPort::set_state(const QDomNode & node)
+{
+       QDomElement e = node.toElement();
+       m_index = e.attribute("index", "-1").toInt();
+       m_value = e.attribute("value", "nan").toFloat();
+       m_automation = e.attribute("automation", "0").toInt();
+       
+       QDomElement curveNode = node.firstChildElement("PortAutomation");
+       if (!curveNode.isNull()) {
+               m_curve = new Curve(m_plugin, curveNode);
+               m_curve->set_song(m_plugin->get_song());
+       }
+               
+       return 1;
+}
+
+QString PluginControlPort::get_description()
+{
+       return m_description;
+}
+
+QString PluginControlPort::get_symbol()
+{
+       return "";
+}
+
+void PluginControlPort::set_control_value(float value)
+{
+       m_value = value;
+}
+
+void PluginControlPort::set_use_automation(bool automation)
+{
+       m_automation = automation;
+       if (!m_curve) {
+               m_curve = new Curve(m_plugin);
+               // Add the first default node:
+               CurveNode* node = new CurveNode(m_curve, 0.0, 1.0);
+               AddRemove* cmd = (AddRemove*)m_curve->add_node(node, false);
+               cmd->set_instantanious(true);
+               Command::process_command(cmd);
+               m_curve->set_song(m_plugin->get_song());
+       }
+}
+
+bool PluginControlPort::use_automation()
+{
+       return m_automation;
+}

Index: plugins/Plugin.h
===================================================================
RCS file: /sources/traverso/traverso/src/plugins/Plugin.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- plugins/Plugin.h    24 May 2007 23:24:03 -0000      1.6
+++ plugins/Plugin.h    30 May 2007 13:14:47 -0000      1.7
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 2006 Remon Sijrier
+Copyright (C) 2006-2007 Remon Sijrier
 
 This file is part of Traverso
 
@@ -17,7 +17,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: Plugin.h,v 1.6 2007/05/24 23:24:03 r_sijrier Exp $
 */
 
 
@@ -32,6 +31,11 @@
 
 class AudioBus;
 class PluginChain;
+class PluginControlPort;
+class AudioInputPort;
+class AudioOutputPort;
+class Curve;
+class Song;
 
 class Plugin : public ContextItem
 {
@@ -39,21 +43,35 @@
        Q_CLASSINFO("toggle_bypass", tr("Bypass: On/Off"))
        
 public:
-       Plugin();
-       ~Plugin(){};
+       Plugin(Song* song = 0);
+       virtual ~Plugin(){};
 
-       virtual int init() = 0;
-       virtual QDomNode get_state(QDomDocument doc) = 0;
-       virtual int set_state(const QDomNode & node ) = 0;
+       virtual int init() {return 1;}
+       virtual QDomNode get_state(QDomDocument doc);
+       virtual int set_state(const QDomNode & node );
        virtual void process(AudioBus* bus, unsigned long nframes) = 0;
        virtual QString get_name() = 0;
        
+       PluginControlPort* get_control_port_by_index(int index) const;
+       QList<PluginControlPort* > get_control_ports() const { return 
m_controlPorts; }
+       
+       Plugin* get_slave() const {return m_slave;}
+       Song* get_song() const {return m_song;}
        bool is_bypassed() const {return m_bypass;}
        
+       void automate_port(int index, bool automate);
+       
 
 protected:
+       Plugin* m_slave;
+       Song* m_song;
+       QList<PluginControlPort* >      m_controlPorts;
+       QList<AudioInputPort* >         m_audioInputPorts;
+       QList<AudioOutputPort* >        m_audioOutputPorts;
+       
        bool    m_bypass;
        
+       
 signals:
        void bypassChanged();
        
@@ -68,7 +86,7 @@
 public:
        PluginPort(QObject* parent, int index) : QObject(parent), 
m_index(index), m_hint(FLOAT_CONTROL) {};
        PluginPort(QObject* parent) : QObject(parent), m_hint(FLOAT_CONTROL) {};
-       ~PluginPort(){};
+       virtual ~PluginPort(){};
 
        virtual QDomNode get_state(QDomDocument doc);
        virtual int set_state( const QDomNode & node ) = 0;
@@ -82,19 +100,65 @@
        int get_index() const {return m_index;}
        int get_hint() const {return m_hint;}
 
+       void set_index(int index) {m_index = index;}
+
 protected:
        int     m_index;
        int     m_hint;
 }; 
 
 
+class PluginControlPort : public PluginPort
+{
+       Q_OBJECT
+
+public:
+       PluginControlPort(Plugin* parent, int index, float value);
+       PluginControlPort(Plugin* parent, const QDomNode node);
+       virtual ~PluginControlPort(){}
+
+       virtual float get_control_value() {return m_value; }
+       virtual float get_min_control_value() {return m_min;}
+       virtual float get_max_control_value() {return m_max;}
+       virtual float get_default_value() {return m_default;}
+       
+       void set_min(float min) {m_min = min;}
+       void set_max(float max) {m_max = max;}
+       void set_default(float def) {m_default = def;}
+       void set_use_automation(bool automation);
+       
+       bool use_automation();
+       Curve* get_curve() const {return m_curve;}
+
+       virtual QDomNode get_state(QDomDocument doc);
+
+       virtual QString get_description();
+       virtual QString get_symbol();
+
+protected:
+       Curve*  m_curve;
+       Plugin* m_plugin;
+       float   m_value;
+       float   m_default;
+       float   m_min;
+       float   m_max;
+       bool    m_automation;
+       QString m_description;
+       
+       virtual int set_state( const QDomNode & node );
+       
+public slots:
+       void set_control_value(float value);
+};
+
+
 class AudioInputPort : public PluginPort
 {
 
 public:
        AudioInputPort(QObject* parent, int index);
        AudioInputPort(QObject* parent) : PluginPort(parent) {};
-       ~AudioInputPort(){};
+       virtual ~AudioInputPort(){};
 
        QDomNode get_state(QDomDocument doc);
        int set_state( const QDomNode & node );
@@ -108,7 +172,7 @@
 public:
        AudioOutputPort(QObject* parent, int index);
        AudioOutputPort(QObject* parent) : PluginPort(parent) {};
-       ~AudioOutputPort(){};
+       virtual ~AudioOutputPort(){};
 
        QDomNode get_state(QDomDocument doc);
        int set_state( const QDomNode & node );

Index: plugins/PluginManager.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/plugins/PluginManager.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- plugins/PluginManager.cpp   20 Apr 2007 13:22:21 -0000      1.8
+++ plugins/PluginManager.cpp   30 May 2007 13:14:47 -0000      1.9
@@ -19,15 +19,22 @@
 */
 
 
+#include "ProjectManager.h"
+#include "Project.h"
+#include "Song.h"
 #include "PluginManager.h"
 #include "Plugin.h"
 #include "CorrelationMeter.h"
 #include "SpectralMeter.h"
+#include "Utils.h"
+#include "Information.h"
 
 #if defined (LV2_SUPPORT)
 #include <LV2Plugin.h>
 #endif
 
+#include "Debugger.h"
+
 PluginManager* PluginManager::m_instance = 0;
 
 
@@ -72,10 +79,11 @@
        QString type = e.attribute( "type", "");
 
        Plugin* plugin = 0;
+       Song* song = pm().get_project()->get_current_song();
 
 #if defined (LV2_SUPPORT)
        if (type == "LV2Plugin") {
-               plugin = new LV2Plugin();
+               plugin = new LV2Plugin(song);
        }
 #endif
        
@@ -99,6 +107,8 @@
                        delete plugin;
                        plugin = 0;
                }
+       } else {
+               PERROR("PluginManager couldn't create Plugin ???? (%s)", 
QS_C(type));
        }
 
        return plugin;
@@ -110,6 +120,20 @@
 {
        return m_slv2Plugins;
 }
+
+Plugin* PluginManager::create_lv2_plugin(const QString& uri)
+{
+       Song* song = pm().get_project()->get_current_song();
+       LV2Plugin* plugin = new LV2Plugin(song, QS_C(uri));
+       
+       if (plugin->init() < 0) {
+               info().warning(QObject::tr("Plugin %1 initialization 
failed!").arg(uri));
+               delete plugin;
+               plugin = 0;
+       }
+       
+       return plugin;
+}
 #endif
 
 //eof

Index: plugins/PluginManager.h
===================================================================
RCS file: /sources/traverso/traverso/src/plugins/PluginManager.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- plugins/PluginManager.h     20 Apr 2007 13:22:21 -0000      1.5
+++ plugins/PluginManager.h     30 May 2007 13:14:47 -0000      1.6
@@ -43,6 +43,7 @@
 
 #if defined (LV2_SUPPORT)
        SLV2Plugins get_slv2_plugin_list();
+       Plugin* create_lv2_plugin(const QString& uri);
 #endif
 
 private:

Index: plugins/PluginSlider.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/plugins/PluginSlider.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- plugins/PluginSlider.cpp    25 May 2007 12:42:46 -0000      1.8
+++ plugins/PluginSlider.cpp    30 May 2007 13:14:48 -0000      1.9
@@ -21,10 +21,9 @@
 
 #include "PluginSlider.h"
 #include <Themer.h>
-#include "LV2Plugin.h"
 #include "Plugin.h"
 
-PluginSlider::PluginSlider(LV2ControlPort* port)
+PluginSlider::PluginSlider(PluginControlPort* port)
        : QWidget()
        , m_port(port)
 {

Index: plugins/PluginSlider.h
===================================================================
RCS file: /sources/traverso/traverso/src/plugins/PluginSlider.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- plugins/PluginSlider.h      25 May 2007 12:42:46 -0000      1.6
+++ plugins/PluginSlider.h      30 May 2007 13:14:48 -0000      1.7
@@ -27,14 +27,14 @@
 #include <QPainter>
 #include <QMouseEvent>
 
-class LV2ControlPort;
+class PluginControlPort;
 
 class PluginSlider : public QWidget
 {
        Q_OBJECT
        
 public:
-       PluginSlider(LV2ControlPort* port);
+       PluginSlider(PluginControlPort* port);
        ~PluginSlider(){};
        
        void paint(QPainter *);
@@ -51,7 +51,7 @@
         void wheelEvent(QWheelEvent* e );
        
 private:
-       LV2ControlPort* m_port;
+       PluginControlPort* m_port;
        float   m_max;
        float   m_min;
        float   m_value;

Index: plugins/plugins.pro
===================================================================
RCS file: /sources/traverso/traverso/src/plugins/plugins.pro,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- plugins/plugins.pro 25 May 2007 18:38:50 -0000      1.12
+++ plugins/plugins.pro 30 May 2007 13:14:48 -0000      1.13
@@ -20,7 +20,8 @@
 native/CorrelationMeter.cpp \
 native/SpectralMeter.cpp \
 LV2/LV2Plugin.cpp \
-LV2/LV2PluginPropertiesDialog.cpp
+native/GainEnvelope.cpp \
+PluginPropertiesDialog.cpp
 HEADERS += PluginChain.h \
 Plugin.h \
 PluginManager.h \
@@ -28,17 +29,13 @@
 native/CorrelationMeter.h \
 native/SpectralMeter.h \
 LV2/LV2Plugin.h \
-LV2/LV2PluginPropertiesDialog.h
-
-!contains(DEFINES, LV2_SUPPORT) {
+native/GainEnvelope.h \
+PluginPropertiesDialog.h
+!contains(DEFINES, LV2_SUPPORT){
        HEADERS -=      LV2/LV2Plugin.h \
                        LV2/LV2ControlPort.h \
-                       LV2/LV2PluginPropertiesDialog.h \
-                       PluginSlider.h
        SOURCES -=      LV2/LV2Plugin.cpp \
                        LV2/LV2ControlPort.cpp \
-                       LV2/LV2PluginPropertiesDialog.cpp \
-                       PluginSlider.cpp
        INCLUDEPATH -= LV2
 }
 

Index: traverso/PluginSelectorDialog.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/PluginSelectorDialog.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- traverso/PluginSelectorDialog.cpp   26 Apr 2007 18:57:57 -0000      1.9
+++ traverso/PluginSelectorDialog.cpp   30 May 2007 13:14:48 -0000      1.10
@@ -73,9 +73,6 @@
 void PluginSelectorDialog::on_okButton_clicked( )
 {
 #if defined (LV2_SUPPORT)
-       LV2Plugin* plugin = 0;
-
-
        QList<QTreeWidgetItem *> list = pluginTreeWidget->selectedItems();
        
        if ( ! list.size()) {
@@ -88,15 +85,9 @@
        
        QString uri = item->data(0, Qt::UserRole).toString();
 
-       plugin = new LV2Plugin(QS_C(uri));
+       Plugin* plugin = PluginManager::instance()->create_lv2_plugin(uri);
        
-       if (plugin->init() > 0) {
-               m_plugin = plugin;
-       } else {
-               printf("Plugin init failed!");
-               info().warning(tr("Plugin initialization failed!"));
-               delete plugin;
-               plugin = 0;
+       if (!plugin) {
                reject();
        }
 

Index: traverso/songcanvas/AudioClipView.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/songcanvas/AudioClipView.cpp,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -b -r1.71 -r1.72
--- traverso/songcanvas/AudioClipView.cpp       30 May 2007 06:31:56 -0000      
1.71
+++ traverso/songcanvas/AudioClipView.cpp       30 May 2007 13:14:48 -0000      
1.72
@@ -37,6 +37,7 @@
 #include <FadeCurve.h>
 #include <Curve.h>
 #include <Interface.h>
+#include "PluginChain.h"
 
 #include <QFileDialog>
 
@@ -76,7 +77,7 @@
                add_new_fadeview(curve);
        }
        
-       curveView = new CurveView(m_sv, this, m_clip->get_gain_envelope());
+       curveView = new CurveView(m_sv, this, 
m_clip->get_plugin_chain()->get_fader()->get_curve());
        // CurveViews don't 'get' their start offset, it's only a property for 
AudioClips..
        // So to be sure the CurveNodeViews start offset get updated as well,
        // we call curveviews calculate_bounding_rect() function!
@@ -378,7 +379,7 @@
                }
        
                
-               float scaleFactor = ( (float) height * 0.90 / 
(Peak::MAX_DB_VALUE * 2)) * m_clip->get_gain() * m_clip->get_norm_factor();
+               float scaleFactor = ( (float) height * 0.90 / 
(Peak::MAX_DB_VALUE * 2)) * m_clip->get_gain();
                float ytrans;
                
                if (m_mergedView) {
@@ -480,7 +481,7 @@
                                }
                        
                        } else {
-                               scaleFactor =  (float) height * 0.95 * 
m_clip->get_gain() * m_clip->get_norm_factor() / Peak::MAX_DB_VALUE;
+                               scaleFactor =  (float) height * 0.95 * 
m_clip->get_gain() / Peak::MAX_DB_VALUE;
                                ytrans = height + (chan * height);
                
                                if (m_mergedView) {
@@ -525,7 +526,7 @@
 void AudioClipView::create_clipinfo_string()
 {
        PENTER;
-       QString sclipGain = "Gain: "+ 
coefficient_to_dbstring(m_clip->get_gain() * m_clip->get_norm_factor());
+       QString sclipGain = "Gain: "+ 
coefficient_to_dbstring(m_clip->get_gain());
        m_clipinfoString = m_clip->get_name()  + "    " + sclipGain + "   " + 
QString::number(m_clip->get_rate()) +  " Hz";
 }
 

Index: traverso/songcanvas/ClipsViewPort.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/songcanvas/ClipsViewPort.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- traverso/songcanvas/ClipsViewPort.cpp       17 May 2007 21:38:16 -0000      
1.19
+++ traverso/songcanvas/ClipsViewPort.cpp       30 May 2007 13:14:48 -0000      
1.20
@@ -164,8 +164,6 @@
                        clip->set_track(importTrack);
                        clip->set_track_start_frame(startpos);
                        startpos = clip->get_track_end_frame();
-                       // FIXME!!!!!!!!!!!!!!!!!!!!
-                       clip->init_gain_envelope();
                        AddRemoveClip* arc = new AddRemoveClip(clip, 
AddRemoveClip::ADD);
                        group->add_command(arc);
                }

Index: traverso/songcanvas/CurveView.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/songcanvas/CurveView.cpp,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -b -r1.52 -r1.53
--- traverso/songcanvas/CurveView.cpp   30 May 2007 06:31:57 -0000      1.52
+++ traverso/songcanvas/CurveView.cpp   30 May 2007 13:14:48 -0000      1.53
@@ -190,7 +190,8 @@
        m_blinkColorDirection = 1;
        m_blinkingNode = 0;
        m_startoffset = 0;
-       m_guicurve = new Curve(0, m_sv->get_song());
+       m_guicurve = new Curve(0);
+       m_guicurve->set_song(sv->get_song());
        
        QList<CurveNode* >* nodes = m_curve->get_nodes();
        for (int i=0; i < nodes->size(); i++) {

Index: traverso/songcanvas/FadeView.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/songcanvas/FadeView.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- traverso/songcanvas/FadeView.cpp    22 May 2007 19:52:43 -0000      1.16
+++ traverso/songcanvas/FadeView.cpp    30 May 2007 13:14:48 -0000      1.17
@@ -17,7 +17,7 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
 
-$Id: FadeView.cpp,v 1.16 2007/05/22 19:52:43 r_sijrier Exp $
+$Id: FadeView.cpp,v 1.17 2007/05/30 13:14:48 r_sijrier Exp $
 */
 
 #include "FadeView.h"
@@ -48,7 +48,8 @@
        PENTERCONS;
        m_sv = sv;
        m_holdactive = false;
-       m_guicurve = new Curve(0, m_sv->get_song());
+       m_guicurve = new Curve(0);
+       m_guicurve->set_song(m_sv->get_song());
        
        foreach(CurveNode* node, *m_fadeCurve->get_nodes()) {
                CurveNode* guinode = new CurveNode(m_guicurve, 

Index: traverso/songcanvas/PluginChainView.cpp
===================================================================
RCS file: 
/sources/traverso/traverso/src/traverso/songcanvas/PluginChainView.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- traverso/songcanvas/PluginChainView.cpp     24 May 2007 13:11:38 -0000      
1.14
+++ traverso/songcanvas/PluginChainView.cpp     30 May 2007 13:14:48 -0000      
1.15
@@ -91,6 +91,8 @@
        view->setPos(x, m_boundingRect.height() - 
view->boundingRect().height());
        
        m_pluginViews.append(view);
+       
+       show();
 }
 
 void PluginChainView::remove_pluginview( Plugin * plugin )
@@ -115,6 +117,7 @@
        if (!m_pluginViews.size()) {
                hide();
        }
+       
        m_parentViewItem->update();
 }
 

Index: traverso/songcanvas/PluginView.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/songcanvas/PluginView.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- traverso/songcanvas/PluginView.cpp  24 May 2007 23:24:03 -0000      1.19
+++ traverso/songcanvas/PluginView.cpp  30 May 2007 13:14:48 -0000      1.20
@@ -33,9 +33,7 @@
 #include <Track.h>
 #include <Utils.h>
 
-#if defined (LV2_SUPPORT)
-#include <LV2PluginPropertiesDialog.h>
-#endif
+#include <PluginPropertiesDialog.h>
 
 // Always put me below _all_ includes, this is needed
 // in case we run with memory leak detection enabled!
@@ -49,9 +47,7 @@
 {
        PENTERCONS;
        
-#if defined (LV2_SUPPORT)
-       propertiesDialog = 0;
-#endif
+       m_propertiesDialog = 0;
 
        setZValue(parent->zValue() + 2);
        
@@ -71,11 +67,9 @@
 PluginView::~PluginView( )
 {
        PENTERDES2;
-#if defined (LV2_SUPPORT)
-       if (propertiesDialog) {
-               delete propertiesDialog;
+       if (m_propertiesDialog) {
+               delete m_propertiesDialog;
        }
-#endif
 }
 
 void PluginView::paint(QPainter* painter, const QStyleOptionGraphicsItem 
*option, QWidget *widget)
@@ -111,13 +105,11 @@
 
 Command * PluginView::edit_properties( )
 {
-#if defined (LV2_SUPPORT)
-       if (! propertiesDialog) {
-               propertiesDialog = new 
LV2PluginPropertiesDialog(Interface::instance(), (LV2Plugin*) m_plugin);
-               propertiesDialog->setWindowTitle(m_name);
+       if (! m_propertiesDialog) {
+               m_propertiesDialog = new 
PluginPropertiesDialog(Interface::instance(), m_plugin);
+               m_propertiesDialog->setWindowTitle(m_name);
        } 
-       propertiesDialog->show();
-#endif
+       m_propertiesDialog->show();
        return (Command*) 0;
 }
 

Index: traverso/songcanvas/PluginView.h
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/songcanvas/PluginView.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- traverso/songcanvas/PluginView.h    24 May 2007 13:11:38 -0000      1.10
+++ traverso/songcanvas/PluginView.h    30 May 2007 13:14:48 -0000      1.11
@@ -26,9 +26,7 @@
 #include "ViewItem.h"
 #include <QString>
 
-#if defined (LV2_SUPPORT)
-class LV2PluginPropertiesDialog;
-#endif
+class PluginPropertiesDialog;
 
 class TrackView;
 class PluginChainView;
@@ -59,9 +57,7 @@
        int             m_textwidth;
         QString                m_name;
        
-#if defined (LV2_SUPPORT)
-        LV2PluginPropertiesDialog*     propertiesDialog;
-#endif
+        PluginPropertiesDialog* m_propertiesDialog;
 
 public slots:
        Command* edit_properties();

Index: traverso/songcanvas/songcanvas.pro
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/songcanvas/songcanvas.pro,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- traverso/songcanvas/songcanvas.pro  19 May 2007 19:30:11 -0000      1.4
+++ traverso/songcanvas/songcanvas.pro  30 May 2007 13:14:48 -0000      1.5
@@ -11,6 +11,7 @@
                ../../engine \
                ../../commands \
                ../../plugins \
+               ../../plugins/native \
                ./
 
 SOURCES += AudioClipView.cpp \

Index: traverso/songcanvas/SongView.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/songcanvas/SongView.cpp,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -b -r1.63 -r1.64
--- traverso/songcanvas/SongView.cpp    30 May 2007 06:05:06 -0000      1.63
+++ traverso/songcanvas/SongView.cpp    30 May 2007 13:14:49 -0000      1.64
@@ -125,8 +125,10 @@
        set_hscrollbar_value(x);
        set_vscrollbar_value(y);
        
-       m_shuttleCurve = new Curve(0, m_song);
-       m_dragShuttleCurve = new Curve(0, m_song);
+       m_shuttleCurve = new Curve(0);
+       m_shuttleCurve->set_song(m_song);
+       m_dragShuttleCurve = new Curve(0);
+       m_dragShuttleCurve->set_song(m_song);
        
        // Use these variables to fine tune the scroll behavior
        float whens[7] = {0.0, 0.2, 0.5, 0.7, 0.8, 0.9, 1.3};

Index: plugins/native/GainEnvelope.cpp
===================================================================
RCS file: plugins/native/GainEnvelope.cpp
diff -N plugins/native/GainEnvelope.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ plugins/native/GainEnvelope.cpp     30 May 2007 13:14:47 -0000      1.1
@@ -0,0 +1,108 @@
+/*Copyright (C) 2007 Remon Sijrier
+
+This file is part of Traverso
+
+Traverso is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
+
+*/
+
+#include "GainEnvelope.h"
+
+#include "Song.h"
+#include "Curve.h"
+#include "Mixer.h"
+#include "AudioBus.h"
+
+GainEnvelope::GainEnvelope(Song* song)
+       : Plugin(song)
+{
+       PluginControlPort* port = new PluginControlPort(this, 0, 1.0);
+       port->set_index(0);
+       m_controlPorts.append(port);
+       if (song) {
+               set_song(song);
+       }
+}
+
+QDomNode GainEnvelope::get_state(QDomDocument doc)
+{
+       QDomElement node = Plugin::get_state(doc).toElement();
+       node.setAttribute("type", "GainEnvelope");
+       node.setAttribute("gain", m_gain);
+       
+       return node;
+}
+
+int GainEnvelope::set_state(const QDomNode & node)
+{
+       foreach(PluginControlPort* port, m_controlPorts) {
+               delete port;
+       }
+       m_controlPorts.clear();
+       
+       Plugin::set_state(node);
+       
+       QDomElement controlPortsNode = node.firstChildElement("ControlPorts");
+       if (!controlPortsNode.isNull()) {
+               QDomNode portNode = controlPortsNode.firstChild();
+               
+               while (!portNode.isNull()) {
+                       
+                       PluginControlPort* port = new PluginControlPort(this, 
portNode);
+                       m_controlPorts.append(port);
+                       
+                       portNode = portNode.nextSibling();
+               }
+       }
+       
+       QDomElement e = node.toElement();
+       m_gain = e.attribute("gain", "1.0").toFloat();
+       
+       return 1;
+}
+
+void GainEnvelope::process_gain(audio_sample_t* buffer, nframes_t pos, 
nframes_t nframes)
+{
+       PluginControlPort* port = m_controlPorts.at(0);
+       
+       Mixer::apply_gain_to_buffer(buffer, nframes, port->get_control_value());
+       
+       if (port->use_automation()) {
+               port->get_curve()->process(buffer, pos, nframes);
+       }
+}
+
+QString GainEnvelope::get_name()
+{
+       return "Gain Envelope";
+}
+
+void GainEnvelope::set_song(Song * song)
+{
+       m_song = song;
+       set_history_stack(m_song->get_history_stack());
+}
+
+void GainEnvelope::process(AudioBus * bus, unsigned long nframes)
+{
+       Q_UNUSED(bus)
+       Q_UNUSED(nframes)
+}
+
+Curve * GainEnvelope::get_curve() const
+{
+       return m_controlPorts.at(0)->get_curve();
+}
+

Index: plugins/native/GainEnvelope.h
===================================================================
RCS file: plugins/native/GainEnvelope.h
diff -N plugins/native/GainEnvelope.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ plugins/native/GainEnvelope.h       30 May 2007 13:14:47 -0000      1.1
@@ -0,0 +1,57 @@
+/*
+Copyright (C) 2007 Remon Sijrier
+
+This file is part of Traverso
+
+Traverso is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
+
+*/
+
+
+#ifndef GAIN_ENVELOPE_H
+#define GAIN_ENVELOPE_H
+
+#include "Plugin.h"
+
+class Song;
+class Curve;
+
+class GainEnvelope : public Plugin
+{
+       Q_OBJECT
+       
+public:
+       GainEnvelope(Song* song);
+       ~GainEnvelope(){};
+
+       QDomNode get_state(QDomDocument doc);
+       int set_state(const QDomNode & node );
+       void process(AudioBus* bus, unsigned long nframes);
+       void process_gain(audio_sample_t* buffer, nframes_t pos, nframes_t 
nframes);
+       
+       void set_song(Song* song);
+       void set_gain(float gain) {m_gain = gain;}
+       
+       float get_gain() const {return m_gain;}
+       Curve* get_curve() const;
+       QString get_name();
+       
+private:
+       float m_gain;
+};
+
+
+#endif
+

Index: plugins/PluginPropertiesDialog.cpp
===================================================================
RCS file: plugins/PluginPropertiesDialog.cpp
diff -N plugins/PluginPropertiesDialog.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ plugins/PluginPropertiesDialog.cpp  30 May 2007 13:14:48 -0000      1.1
@@ -0,0 +1,128 @@
+/*
+Copyright (C) 2006-2007 Remon Sijrier
+
+This file is part of Traverso
+
+Traverso is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
+
+*/
+
+
+#include "PluginPropertiesDialog.h"
+#include "Plugin.h"
+
+#include <QSlider>
+#include <QLabel>
+#include <QVBoxLayout>
+#include <QHBoxLayout>
+#include <QWidget>
+#include <QPushButton>
+
+#include <PluginSlider.h>
+#include "Command.h"
+
+PluginPropertiesDialog::PluginPropertiesDialog(QWidget* parent, Plugin* plugin)
+       : QDialog(parent)
+       , m_plugin(plugin)
+{
+       QWidget* sliderWidget = new QWidget(this);
+       QVBoxLayout* sliderWidgetLayout = new QVBoxLayout;
+       sliderWidget->setLayout(sliderWidgetLayout);
+
+       QWidget* optionsWidget = new QWidget(this);
+       QHBoxLayout* optionsLayout = new QHBoxLayout;
+       optionsWidget->setLayout(optionsLayout);
+       m_bypassButton = new QPushButton(tr("Bypass"), optionsWidget);
+       m_bypassButton->setCheckable(true);
+       m_bypassButton->setChecked(plugin->is_bypassed());
+       QPushButton* closeButton = new QPushButton(tr("Close"), optionsWidget);
+       QPushButton* resetButton = new QPushButton(tr("Reset"), optionsWidget);
+       optionsLayout->addWidget(m_bypassButton);
+       optionsLayout->addWidget(resetButton);
+       optionsLayout->addStretch(10);
+       optionsLayout->addWidget(closeButton);
+       
+       QVBoxLayout* dialogLayout = new QVBoxLayout;
+       dialogLayout->addWidget(sliderWidget);
+       dialogLayout->addWidget(optionsWidget);
+       dialogLayout->setMargin(0);
+       setLayout(dialogLayout);
+
+
+       foreach(PluginControlPort* port, m_plugin->get_control_ports()) {
+
+               if (port->get_symbol() == "latency") {
+                       continue;
+               }
+               
+               QWidget* widget = new QWidget(sliderWidget);
+               widget->setMaximumHeight(22);
+               QHBoxLayout* lay = new QHBoxLayout();
+               lay->setSpacing(12);
+               lay->setMargin(3);
+
+               PluginSlider* slider = new PluginSlider(port);
+               slider->update_slider_position();
+               m_sliders.append(slider);
+
+               connect(slider, SIGNAL(sliderValueChanged(float)), port, 
SLOT(set_control_value(float)));
+               // in case the plugin has a slave 'map' the signal to the slave 
port control slot too!
+               if (m_plugin->get_slave()) {
+                       connect(slider, SIGNAL(sliderValueChanged(float)), 
m_plugin->get_slave()->get_control_port_by_index(port->get_index()), 
SLOT(set_control_value(float)));
+               }
+               
+               QLabel* minvalue = new QLabel();
+               minvalue->setNum(port->get_min_control_value());
+               minvalue->setFixedWidth(35);
+               minvalue->setAlignment(Qt::AlignRight);
+
+               QLabel* maxvalue = new QLabel();
+               maxvalue->setNum(port->get_max_control_value());
+               maxvalue->setFixedWidth(35);
+               maxvalue->setAlignment(Qt::AlignRight);
+
+               QLabel* controlname = new QLabel(port->get_description());
+
+               lay->addWidget(controlname);
+               lay->addStretch(1);
+               lay->addWidget(minvalue);
+               lay->addWidget(slider);
+               lay->addWidget(maxvalue);
+
+               widget->setLayout(lay);
+
+               sliderWidgetLayout->addWidget(widget);
+       }
+       
+       connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
+       connect(resetButton, SIGNAL(clicked()), this, 
SLOT(reset_button_clicked()));
+       connect(m_bypassButton, SIGNAL(clicked()), this, 
SLOT(bypass_button_clicked()));
+}
+
+void PluginPropertiesDialog::bypass_button_clicked()
+{
+       m_plugin->toggle_bypass();
+       m_bypassButton->setChecked(m_plugin->is_bypassed());
+}
+
+void PluginPropertiesDialog::reset_button_clicked()
+{
+       foreach(PluginSlider* slider, m_sliders) {
+               slider->reset_default_value();
+       }
+}
+
+//eof
+

Index: plugins/PluginPropertiesDialog.h
===================================================================
RCS file: plugins/PluginPropertiesDialog.h
diff -N plugins/PluginPropertiesDialog.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ plugins/PluginPropertiesDialog.h    30 May 2007 13:14:48 -0000      1.1
@@ -0,0 +1,53 @@
+/*
+Copyright (C) 2006-2007 Remon Sijrier
+
+This file is part of Traverso
+
+Traverso is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
+
+*/
+
+
+#ifndef LV2_PLUGIN_PROPERTIES_DIALOG_H
+#define LV2_PLUGIN_PROPERTIES_DIALOG_H
+
+#include <QDialog>
+
+class Plugin;
+class PluginSlider;
+class QPushButton;
+
+class PluginPropertiesDialog : public QDialog
+{
+       Q_OBJECT
+
+public:
+       PluginPropertiesDialog(QWidget* parent, Plugin* plugin);
+       ~PluginPropertiesDialog(){};
+
+
+private:
+       Plugin* m_plugin;
+       QList<PluginSlider*> m_sliders;
+       QPushButton* m_bypassButton;
+       
+private slots:
+       void bypass_button_clicked();
+       void reset_button_clicked();
+};
+
+#endif
+
+//eof

Index: plugins/LV2/LV2PluginPropertiesDialog.cpp
===================================================================
RCS file: plugins/LV2/LV2PluginPropertiesDialog.cpp
diff -N plugins/LV2/LV2PluginPropertiesDialog.cpp
--- plugins/LV2/LV2PluginPropertiesDialog.cpp   25 May 2007 12:42:46 -0000      
1.10
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,128 +0,0 @@
-/*
-Copyright (C) 2006-2007 Remon Sijrier
-
-This file is part of Traverso
-
-Traverso is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
-
-*/
-
-
-#include "LV2PluginPropertiesDialog.h"
-#include "LV2Plugin.h"
-
-#include <QSlider>
-#include <QLabel>
-#include <QVBoxLayout>
-#include <QHBoxLayout>
-#include <QWidget>
-#include <QPushButton>
-
-#include <PluginSlider.h>
-#include "Command.h"
-
-LV2PluginPropertiesDialog::LV2PluginPropertiesDialog(QWidget* parent, 
LV2Plugin* plugin)
-       : QDialog(parent)
-       , m_plugin(plugin)
-{
-       QWidget* sliderWidget = new QWidget(this);
-       QVBoxLayout* sliderWidgetLayout = new QVBoxLayout;
-       sliderWidget->setLayout(sliderWidgetLayout);
-
-       QWidget* optionsWidget = new QWidget(this);
-       QHBoxLayout* optionsLayout = new QHBoxLayout;
-       optionsWidget->setLayout(optionsLayout);
-       m_bypassButton = new QPushButton(tr("Bypass"), optionsWidget);
-       m_bypassButton->setCheckable(true);
-       m_bypassButton->setChecked(plugin->is_bypassed());
-       QPushButton* closeButton = new QPushButton(tr("Close"), optionsWidget);
-       QPushButton* resetButton = new QPushButton(tr("Reset"), optionsWidget);
-       optionsLayout->addWidget(m_bypassButton);
-       optionsLayout->addWidget(resetButton);
-       optionsLayout->addStretch(10);
-       optionsLayout->addWidget(closeButton);
-       
-       QVBoxLayout* dialogLayout = new QVBoxLayout;
-       dialogLayout->addWidget(sliderWidget);
-       dialogLayout->addWidget(optionsWidget);
-       dialogLayout->setMargin(0);
-       setLayout(dialogLayout);
-
-
-       foreach(LV2ControlPort* port, m_plugin->get_control_ports()) {
-
-               if (port->get_symbol() == "latency") {
-                       continue;
-               }
-               
-               QWidget* widget = new QWidget(sliderWidget);
-               widget->setMaximumHeight(22);
-               QHBoxLayout* lay = new QHBoxLayout();
-               lay->setSpacing(12);
-               lay->setMargin(3);
-
-               PluginSlider* slider = new PluginSlider(port);
-               slider->update_slider_position();
-               m_sliders.append(slider);
-
-               connect(slider, SIGNAL(sliderValueChanged(float)), port, 
SLOT(set_control_value(float)));
-               // in case the plugin has a slave 'map' the signal to the slave 
port control slot too!
-               if (m_plugin->get_slave()) {
-                       connect(slider, SIGNAL(sliderValueChanged(float)), 
m_plugin->get_slave()->get_control_port_by_index(port->get_index()), 
SLOT(set_control_value(float)));
-               }
-               
-               QLabel* minvalue = new QLabel();
-               minvalue->setNum(port->get_min_control_value());
-               minvalue->setFixedWidth(35);
-               minvalue->setAlignment(Qt::AlignRight);
-
-               QLabel* maxvalue = new QLabel();
-               maxvalue->setNum(port->get_max_control_value());
-               maxvalue->setFixedWidth(35);
-               maxvalue->setAlignment(Qt::AlignRight);
-
-               QLabel* controlname = new QLabel(port->get_description());
-
-               lay->addWidget(controlname);
-               lay->addStretch(1);
-               lay->addWidget(minvalue);
-               lay->addWidget(slider);
-               lay->addWidget(maxvalue);
-
-               widget->setLayout(lay);
-
-               sliderWidgetLayout->addWidget(widget);
-       }
-       
-       connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
-       connect(resetButton, SIGNAL(clicked()), this, 
SLOT(reset_button_clicked()));
-       connect(m_bypassButton, SIGNAL(clicked()), this, 
SLOT(bypass_button_clicked()));
-}
-
-void LV2PluginPropertiesDialog::bypass_button_clicked()
-{
-       m_plugin->toggle_bypass();
-       m_bypassButton->setChecked(m_plugin->is_bypassed());
-}
-
-void LV2PluginPropertiesDialog::reset_button_clicked()
-{
-       foreach(PluginSlider* slider, m_sliders) {
-               slider->reset_default_value();
-       }
-}
-
-//eof
-

Index: plugins/LV2/LV2PluginPropertiesDialog.h
===================================================================
RCS file: plugins/LV2/LV2PluginPropertiesDialog.h
diff -N plugins/LV2/LV2PluginPropertiesDialog.h
--- plugins/LV2/LV2PluginPropertiesDialog.h     25 May 2007 00:07:55 -0000      
1.6
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,53 +0,0 @@
-/*
-Copyright (C) 2006-2007 Remon Sijrier
-
-This file is part of Traverso
-
-Traverso is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
-
-*/
-
-
-#ifndef LV2_PLUGIN_PROPERTIES_DIALOG_H
-#define LV2_PLUGIN_PROPERTIES_DIALOG_H
-
-#include <QDialog>
-
-class LV2Plugin;
-class PluginSlider;
-class QPushButton;
-
-class LV2PluginPropertiesDialog : public QDialog
-{
-       Q_OBJECT
-
-public:
-       LV2PluginPropertiesDialog(QWidget* parent, LV2Plugin* plugin);
-       ~LV2PluginPropertiesDialog(){};
-
-
-private:
-       LV2Plugin*      m_plugin;
-       QList<PluginSlider*> m_sliders;
-       QPushButton* m_bypassButton;
-       
-private slots:
-       void bypass_button_clicked();
-       void reset_button_clicked();
-};
-
-#endif
-
-//eof




reply via email to

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