along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id$
*/
#ifndef __ardour_overlap_h__
#include <vector>
#include <algorithm>
#include <boost/shared_ptr.hpp>
+#include <boost/enable_shared_from_this.hpp>
#include <sigc++/signal.h>
#include <ardour/ardour.h>
#include <ardour/curve.h>
#include <ardour/audioregion.h>
-#include <ardour/state_manager.h>
#include <ardour/crossfade_compare.h>
namespace ARDOUR {
class AudioRegion;
class Playlist;
-struct CrossfadeState : public StateManager::State {
- CrossfadeState (std::string reason) : StateManager::State (reason) {}
-
- UndoAction fade_in_memento;
- UndoAction fade_out_memento;
- nframes_t position;
- nframes_t length;
- AnchorPoint anchor_point;
- bool follow_overlap;
- bool active;
-};
-
-class Crossfade : public PBD::StatefulDestructible, public StateManager
+class Crossfade : public PBD::StatefulDestructible, public boost::enable_shared_from_this<ARDOUR::Crossfade>
{
public:
/* copy constructor to copy a crossfade with new regions. used (for example)
- when a playlist copy is made */
+ when a playlist copy is made
+ */
Crossfade (const Crossfade &, boost::shared_ptr<ARDOUR::AudioRegion>, boost::shared_ptr<ARDOUR::AudioRegion>);
/* the usual XML constructor */
- Crossfade (const ARDOUR::Playlist&, XMLNode&);
+ Crossfade (const Playlist&, XMLNode&);
virtual ~Crossfade();
bool operator== (const ARDOUR::Crossfade&);
nframes_t overlap_length() const;
nframes_t position() const { return _position; }
- sigc::signal<void,Crossfade*> Invalidated;
+ void invalidate();
+
+ sigc::signal<void,boost::shared_ptr<Crossfade> > Invalidated;
+ sigc::signal<void,Change> StateChanged;
bool covers (nframes_t frame) const {
return _position <= frame && frame < _position + _length;
OverlapType coverage (nframes_t start, nframes_t end) const;
- UndoAction get_memento() const;
-
static void set_buffer_size (nframes_t);
bool active () const { return _active; }
static void set_short_xfade_length (nframes_t n);
static Change ActiveChanged;
+ static Change FollowOverlapChanged;
private:
friend struct CrossfadeComparePtr;
AnchorPoint _anchor_point;
bool _follow_overlap;
bool _fixed;
+ int32_t layer_relation;
Curve _fade_in;
Curve _fade_out;
static Sample* crossfade_buffer_out;
static Sample* crossfade_buffer_in;
- void initialize (bool savestate=true);
+ void initialize ();
int compute (boost::shared_ptr<ARDOUR::AudioRegion>, boost::shared_ptr<ARDOUR::AudioRegion>, CrossfadeModel);
- bool update (bool force);
-
- StateManager::State* state_factory (std::string why) const;
- Change restore_state (StateManager::State&);
-
- void member_changed (ARDOUR::Change);
-
+ bool update ();
};