Only create a Curve for an AutomationList if we need it.
Fix crash on crossfade editor show (ticket 2442). git-svn-id: svn://localhost/ardour2/branches/3.0@4641 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
c006ff1762
commit
75c15679bf
|
@ -33,6 +33,8 @@
|
|||
#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"
|
||||
|
|
|
@ -66,10 +66,9 @@ CrossfadeEditor::Presets* CrossfadeEditor::fade_in_presets = 0;
|
|||
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))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -726,7 +725,7 @@ CrossfadeEditor::redraw ()
|
|||
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());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1124,7 +1123,7 @@ CrossfadeEditor::make_waves (boost::shared_ptr<AudioRegion> region, WhichFade wh
|
|||
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;
|
||||
|
|
|
@ -96,8 +96,7 @@ class CrossfadeEditor : public ArdourDialog
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -85,6 +85,7 @@ class AutomationList : public PBD::StatefulDestructible, public Evoral::ControlL
|
|||
XMLNode& serialize_events ();
|
||||
|
||||
private:
|
||||
void create_curve_if_necessary ();
|
||||
int deserialize_events (const XMLNode&);
|
||||
|
||||
void maybe_signal_changed ();
|
||||
|
|
|
@ -703,7 +703,6 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
|
|||
sigc::signal<void> NamedSelectionRemoved;
|
||||
|
||||
/* Curves and AutomationLists (TODO when they go away) */
|
||||
void add_curve(Evoral::Curve*);
|
||||
void add_automation_list(AutomationList*);
|
||||
|
||||
/* fade curves */
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#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>
|
||||
|
|
|
@ -35,6 +35,8 @@
|
|||
#include <pbd/enumwriter.h>
|
||||
#include <pbd/convert.h>
|
||||
|
||||
#include <evoral/Curve.hpp>
|
||||
|
||||
#include <ardour/audioregion.h>
|
||||
#include <ardour/session.h>
|
||||
#include <ardour/gain.h>
|
||||
|
|
|
@ -50,7 +50,6 @@ static void dumpit (const AutomationList& al, string prefix = "")
|
|||
}
|
||||
#endif
|
||||
|
||||
/* XXX: min_val max_val redundant? (param.min() param.max()) */
|
||||
AutomationList::AutomationList (Evoral::Parameter id)
|
||||
: ControlList(id)
|
||||
{
|
||||
|
@ -58,6 +57,8 @@ AutomationList::AutomationList (Evoral::Parameter id)
|
|||
_style = Absolute;
|
||||
_touching = false;
|
||||
|
||||
create_curve_if_necessary();
|
||||
|
||||
assert(_parameter.type() != NullAutomation);
|
||||
AutomationListCreated(this);
|
||||
}
|
||||
|
@ -69,6 +70,8 @@ AutomationList::AutomationList (const AutomationList& other)
|
|||
_state = other._state;
|
||||
_touching = other._touching;
|
||||
|
||||
create_curve_if_necessary();
|
||||
|
||||
assert(_parameter.type() != NullAutomation);
|
||||
AutomationListCreated(this);
|
||||
}
|
||||
|
@ -79,6 +82,8 @@ AutomationList::AutomationList (const AutomationList& other, double start, doubl
|
|||
_style = other._style;
|
||||
_state = other._state;
|
||||
_touching = other._touching;
|
||||
|
||||
create_curve_if_necessary();
|
||||
|
||||
assert(_parameter.type() != NullAutomation);
|
||||
AutomationListCreated(this);
|
||||
|
@ -96,8 +101,11 @@ AutomationList::AutomationList (const XMLNode& node, Evoral::Parameter id)
|
|||
|
||||
set_state (node);
|
||||
|
||||
if (id)
|
||||
if (id) {
|
||||
_parameter = id;
|
||||
}
|
||||
|
||||
create_curve_if_necessary();
|
||||
|
||||
assert(_parameter.type() != NullAutomation);
|
||||
AutomationListCreated(this);
|
||||
|
@ -114,6 +122,22 @@ AutomationList::create(Evoral::Parameter id)
|
|||
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)
|
||||
{
|
||||
|
|
|
@ -37,6 +37,8 @@
|
|||
#include <pbd/xml++.h>
|
||||
#include <pbd/enumwriter.h>
|
||||
|
||||
#include <evoral/Curve.hpp>
|
||||
|
||||
#include <ardour/session.h>
|
||||
#include <ardour/panner.h>
|
||||
#include <ardour/utils.h>
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#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>
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <pbd/id.h>
|
||||
#include <pbd/statefuldestructible.h>
|
||||
#include <pbd/failed_constructor.h>
|
||||
#include <evoral/Curve.hpp>
|
||||
|
||||
using namespace PBD;
|
||||
using namespace ARDOUR;
|
||||
|
|
|
@ -25,10 +25,10 @@
|
|||
#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
|
||||
*/
|
||||
|
@ -216,8 +216,11 @@ public:
|
|||
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;
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <utility>
|
||||
#include <iostream>
|
||||
#include "evoral/ControlList.hpp"
|
||||
#include "evoral/Curve.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -36,7 +37,7 @@ inline bool event_time_less_than (ControlEvent* a, ControlEvent* b)
|
|||
ControlList::ControlList (const Parameter& id)
|
||||
: _parameter(id)
|
||||
, _interpolation(Linear)
|
||||
, _curve(new Curve(*this))
|
||||
, _curve(0)
|
||||
{
|
||||
_frozen = 0;
|
||||
_changed_when_thawed = false;
|
||||
|
@ -54,7 +55,7 @@ ControlList::ControlList (const Parameter& id)
|
|||
ControlList::ControlList (const ControlList& other)
|
||||
: _parameter(other._parameter)
|
||||
, _interpolation(Linear)
|
||||
, _curve(new Curve(*this))
|
||||
, _curve(0)
|
||||
{
|
||||
_frozen = 0;
|
||||
_changed_when_thawed = false;
|
||||
|
@ -70,14 +71,14 @@ ControlList::ControlList (const ControlList& other)
|
|||
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;
|
||||
|
@ -99,7 +100,7 @@ ControlList::ControlList (const ControlList& other, double start, double end)
|
|||
_events.push_back (new ControlEvent ((*i)->when, (*i)->value));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mark_dirty ();
|
||||
}
|
||||
|
||||
|
@ -147,6 +148,19 @@ ControlList::operator= (const ControlList& other)
|
|||
return *this;
|
||||
}
|
||||
|
||||
void
|
||||
ControlList::create_curve()
|
||||
{
|
||||
_curve = new Curve(*this);
|
||||
}
|
||||
|
||||
void
|
||||
ControlList::destroy_curve()
|
||||
{
|
||||
delete _curve;
|
||||
_curve = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
ControlList::maybe_signal_changed ()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue