#include <pbd/memento_command.h>
#include <pbd/stacktrace.h>
+#include <evoral/Curve.hpp>
+
#include "streamview.h"
#include "audio_region_view.h"
#include "audio_time_axis.h"
CrossfadeEditor::Presets* CrossfadeEditor::fade_out_presets = 0;
CrossfadeEditor::Half::Half ()
- : line (0),
- //normative_curve (Evoral::Parameter(GainAutomation, 0.0, 1.0, 1.0)), // FIXME: GainAutomation?
- normative_curve (Evoral::Parameter(GainAutomation)),
- gain_curve (Evoral::Parameter(GainAutomation))
+ : line (0)
+ , normative_curve (Evoral::Parameter(GainAutomation))
+ , gain_curve (Evoral::Parameter(GainAutomation))
{
}
fade[current].shading->property_points() = spts;
for (vector<ArdourCanvas::WaveView*>::iterator i = fade[current].waves.begin(); i != fade[current].waves.end(); ++i) {
- (*i)->property_gain_src() = &fade[current].gain_curve;
+ (*i)->property_gain_src() = static_cast<Evoral::Curve*>(&fade[current].gain_curve.curve());
}
}
waveview->property_sourcefile_length_function() = (void*) sourcefile_length_from_c;
waveview->property_peak_function() = (void*) region_read_peaks_from_c;
waveview->property_gain_function() = (void*) curve_get_vector_from_c;
- waveview->property_gain_src() = &fade[which].gain_curve;
+ waveview->property_gain_src() = static_cast<Evoral::Curve*>(&fade[which].gain_curve.curve());
waveview->property_x() = canvas_border;
waveview->property_y() = yoff;
waveview->property_height() = ht;
void move_to (double x, double y, double xfract, double yfract);
};
- struct PointSorter
- {
+ struct PointSorter {
bool operator() (const CrossfadeEditor::Point* a, const CrossfadeEditor::Point *b) {
return a->x < b->x;
}
XMLNode& serialize_events ();
private:
+ void create_curve_if_necessary ();
int deserialize_events (const XMLNode&);
void maybe_signal_changed ();
sigc::signal<void> NamedSelectionRemoved;
/* Curves and AutomationLists (TODO when they go away) */
- void add_curve(Evoral::Curve*);
void add_automation_list(AutomationList*);
/* fade curves */
#include <pbd/error.h>
#include <pbd/enumwriter.h>
+#include <evoral/Curve.hpp>
+
#include <ardour/audio_track.h>
#include <ardour/audio_diskstream.h>
#include <ardour/session.h>
#include <pbd/enumwriter.h>
#include <pbd/convert.h>
+#include <evoral/Curve.hpp>
+
#include <ardour/audioregion.h>
#include <ardour/session.h>
#include <ardour/gain.h>
}
#endif
-/* XXX: min_val max_val redundant? (param.min() param.max()) */
AutomationList::AutomationList (Evoral::Parameter id)
: ControlList(id)
{
_style = Absolute;
_touching = false;
+ create_curve_if_necessary();
+
assert(_parameter.type() != NullAutomation);
AutomationListCreated(this);
}
_state = other._state;
_touching = other._touching;
+ create_curve_if_necessary();
+
assert(_parameter.type() != NullAutomation);
AutomationListCreated(this);
}
_style = other._style;
_state = other._state;
_touching = other._touching;
+
+ create_curve_if_necessary();
assert(_parameter.type() != NullAutomation);
AutomationListCreated(this);
set_state (node);
- if (id)
+ if (id) {
_parameter = id;
+ }
+
+ create_curve_if_necessary();
assert(_parameter.type() != NullAutomation);
AutomationListCreated(this);
return boost::shared_ptr<Evoral::ControlList>(new AutomationList(id));
}
+void
+AutomationList::create_curve_if_necessary()
+{
+ switch (_parameter.type()) {
+ case GainAutomation:
+ case PanAutomation:
+ case FadeInAutomation:
+ case FadeOutAutomation:
+ case EnvelopeAutomation:
+ create_curve();
+ break;
+ default:
+ break;
+ }
+}
+
bool
AutomationList::operator== (const AutomationList& other)
{
#include <pbd/xml++.h>
#include <pbd/enumwriter.h>
+#include <evoral/Curve.hpp>
+
#include <ardour/session.h>
#include <ardour/panner.h>
#include <ardour/utils.h>
#include <pbd/stacktrace.h>
#include <pbd/memento_command.h>
+#include <evoral/Curve.hpp>
+
#include <ardour/timestamps.h>
#include <ardour/audioengine.h>
#include <ardour/route.h>
#include <pbd/id.h>
#include <pbd/statefuldestructible.h>
#include <pbd/failed_constructor.h>
+#include <evoral/Curve.hpp>
using namespace PBD;
using namespace ARDOUR;
#include <glibmm/thread.h>
#include "evoral/types.hpp"
#include "evoral/Parameter.hpp"
-#include "evoral/Curve.hpp"
namespace Evoral {
+class Curve;
/** A single event (time-stamped value) for a control
*/
bool rt_safe_earliest_event (double start, double end, double& x, double& y, bool start_inclusive=false) const;
bool rt_safe_earliest_event_unlocked (double start, double end, double& x, double& y, bool start_inclusive=false) const;
- Curve& curve() { return *_curve; }
- const Curve& curve() const { return *_curve; }
+ void create_curve();
+ void destroy_curve();
+
+ Curve& curve() { assert(_curve); return *_curve; }
+ const Curve& curve() const { assert(_curve); return *_curve; }
virtual void mark_dirty () const;
#include <utility>
#include <iostream>
#include "evoral/ControlList.hpp"
+#include "evoral/Curve.hpp"
using namespace std;
ControlList::ControlList (const Parameter& id)
: _parameter(id)
, _interpolation(Linear)
- , _curve(new Curve(*this))
+ , _curve(0)
{
_frozen = 0;
_changed_when_thawed = false;
ControlList::ControlList (const ControlList& other)
: _parameter(other._parameter)
, _interpolation(Linear)
- , _curve(new Curve(*this))
+ , _curve(0)
{
_frozen = 0;
_changed_when_thawed = false;
for (const_iterator i = other._events.begin(); i != other._events.end(); ++i) {
_events.push_back (new ControlEvent (**i));
}
-
+
mark_dirty ();
}
ControlList::ControlList (const ControlList& other, double start, double end)
: _parameter(other._parameter)
, _interpolation(Linear)
- , _curve(new Curve(*this))
+ , _curve(0)
{
_frozen = 0;
_changed_when_thawed = false;
_events.push_back (new ControlEvent ((*i)->when, (*i)->value));
}
}
-
+
mark_dirty ();
}
return *this;
}
+void
+ControlList::create_curve()
+{
+ _curve = new Curve(*this);
+}
+
+void
+ControlList::destroy_curve()
+{
+ delete _curve;
+ _curve = NULL;
+}
+
void
ControlList::maybe_signal_changed ()
{