diff options
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/ardour/automation_event.h | 8 | ||||
-rw-r--r-- | libs/ardour/ardour/curve.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/io.h | 7 | ||||
-rw-r--r-- | libs/ardour/ardour/location.h | 11 | ||||
-rw-r--r-- | libs/ardour/ardour/session.h | 4 | ||||
-rw-r--r-- | libs/ardour/ardour/tempo.h | 11 | ||||
-rw-r--r-- | libs/ardour/audio_playlist.cc | 12 | ||||
-rw-r--r-- | libs/ardour/audio_track.cc | 3 | ||||
-rw-r--r-- | libs/ardour/audioregion.cc | 1 | ||||
-rw-r--r-- | libs/ardour/automation_event.cc | 42 | ||||
-rw-r--r-- | libs/ardour/crossfade.cc | 4 | ||||
-rw-r--r-- | libs/ardour/curve.cc | 3 | ||||
-rw-r--r-- | libs/ardour/insert.cc | 12 | ||||
-rw-r--r-- | libs/ardour/io.cc | 6 | ||||
-rw-r--r-- | libs/ardour/location.cc | 27 | ||||
-rw-r--r-- | libs/ardour/panner.cc | 4 | ||||
-rw-r--r-- | libs/ardour/redirect.cc | 4 | ||||
-rw-r--r-- | libs/ardour/send.cc | 8 | ||||
-rw-r--r-- | libs/ardour/session.cc | 16 | ||||
-rw-r--r-- | libs/ardour/session_click.cc | 35 | ||||
-rw-r--r-- | libs/ardour/session_command.cc | 8 | ||||
-rw-r--r-- | libs/ardour/session_state.cc | 4 | ||||
-rw-r--r-- | libs/ardour/tempo.cc | 43 |
23 files changed, 210 insertions, 65 deletions
diff --git a/libs/ardour/ardour/automation_event.h b/libs/ardour/ardour/automation_event.h index 22ab706f82..e2940bc2e1 100644 --- a/libs/ardour/ardour/automation_event.h +++ b/libs/ardour/ardour/automation_event.h @@ -54,7 +54,7 @@ struct ControlEvent { }; - class AutomationList : public StateManager, public PBD::StatefulDestructible +class AutomationList : public PBD::StatefulDestructible { public: typedef std::list<ControlEvent*> AutomationEventList; @@ -151,7 +151,11 @@ struct ControlEvent { (obj.*method)(*this); } + sigc::signal<void,Change> StateChanged; + +#ifdef STATE_MANAGER UndoAction get_memento () const; +#endif virtual void store_state (XMLNode& node) const; virtual void load_state (const XMLNode&); @@ -242,8 +246,10 @@ struct ControlEvent { virtual double unlocked_eval (double where); +#ifdef STATE_MANAGER Change restore_state (StateManager::State&); StateManager::State* state_factory (std::string why) const; +#endif virtual ControlEvent* point_factory (double,double) const; virtual ControlEvent* point_factory (const ControlEvent&) const; diff --git a/libs/ardour/ardour/curve.h b/libs/ardour/ardour/curve.h index 7ba6b5fa6c..9de7d0ef48 100644 --- a/libs/ardour/ardour/curve.h +++ b/libs/ardour/ardour/curve.h @@ -66,7 +66,9 @@ class Curve : public AutomationList ControlEvent* point_factory (double,double) const; ControlEvent* point_factory (const ControlEvent&) const; +#ifdef STATE_MANAGER Change restore_state (StateManager::State&); +#endif private: AutomationList::iterator last_bound; diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h index 96ae75f298..cbac629593 100644 --- a/libs/ardour/ardour/io.h +++ b/libs/ardour/ardour/io.h @@ -59,7 +59,7 @@ class Panner; * An IO can contain ports of varying types, making routes/inserts/etc with * varied combinations of types (eg MIDI and audio) possible. */ -class IO : public PBD::StatefulDestructible, public ARDOUR::StateManager +class IO : public PBD::StatefulDestructible { public: @@ -167,8 +167,9 @@ virtual ~IO(); XMLNode& get_state (void); int set_state (const XMLNode&); +#ifdef STATE_MANAGER virtual UndoAction get_memento() const; - +#endif static int disable_connecting (void); @@ -300,8 +301,10 @@ public: /* state management */ +#ifdef STATE_MANAGER Change restore_state (State&); StateManager::State* state_factory (std::string why) const; +#endif AutoState _gain_automation_state; AutoStyle _gain_automation_style; diff --git a/libs/ardour/ardour/location.h b/libs/ardour/ardour/location.h index 1f1c02d67c..e618f46dfe 100644 --- a/libs/ardour/ardour/location.h +++ b/libs/ardour/ardour/location.h @@ -131,7 +131,7 @@ class Location : public PBD::StatefulDestructible bool set_flag_internal (bool yn, Flags flag); }; -class Locations : public StateManager, public PBD::StatefulDestructible +class Locations : public PBD::StatefulDestructible { public: typedef std::list<Location *> LocationList; @@ -169,6 +169,7 @@ class Locations : public StateManager, public PBD::StatefulDestructible sigc::signal<void> changed; sigc::signal<void,Location*> added; sigc::signal<void,Location*> removed; + sigc::signal<void,Change> StateChanged; template<class T> void apply (T& obj, void (T::*method)(LocationList&)) { Glib::Mutex::Lock lm (lock); @@ -180,26 +181,30 @@ class Locations : public StateManager, public PBD::StatefulDestructible (obj.*method)(locations, arg); } +#ifdef STATE_MANAGER UndoAction get_memento () const; +#endif private: +#ifdef STATE_MANAGER struct State : public ARDOUR::StateManager::State { LocationList locations; LocationList states; State (std::string why) : ARDOUR::StateManager::State (why) {} }; - +#endif LocationList locations; Location *current_location; mutable Glib::Mutex lock; int set_current_unlocked (Location *); void location_changed (Location*); - +#ifdef STATE_MANAGER Change restore_state (StateManager::State&); StateManager::State* state_factory (std::string why) const; +#endif }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 0cbc168329..da5a098aa0 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -757,11 +757,11 @@ class Session : public PBD::StatefulDestructible current_trans->add_command (cmd); } - std::map<PBD::ID, PBD::StatefulDestructible*> registry; + std::map<PBD::ID, PBD::StatefulThingWithGoingAway*> registry; // these commands are implemented in libs/ardour/session_command.cc Command *memento_command_factory(XMLNode *n); - void register_with_memento_command_factory(PBD::ID, PBD::StatefulDestructible *); + void register_with_memento_command_factory(PBD::ID, PBD::StatefulThingWithGoingAway *); class GlobalSoloStateCommand : public Command { diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h index 7cdbe56cf2..eaadcb1c99 100644 --- a/libs/ardour/ardour/tempo.h +++ b/libs/ardour/ardour/tempo.h @@ -162,6 +162,7 @@ class TempoSection : public MetricSection, public Tempo { typedef list<MetricSection*> Metrics; +#ifdef STATE_MANAGER class TempoMapState : public StateManager::State { public: TempoMapState (std::string why) @@ -171,8 +172,9 @@ class TempoMapState : public StateManager::State { Metrics *metrics; }; +#endif -class TempoMap : public StateManager, public PBD::StatefulDestructible +class TempoMap : public PBD::StatefulDestructible { public: @@ -246,7 +248,9 @@ class TempoMap : public StateManager, public PBD::StatefulDestructible void dump (std::ostream&) const; void clear (); +#ifdef STATE_MANAGER UndoAction get_memento() const; +#endif /* this is a helper class that we use to be able to keep track of which meter *AND* tempo are in effect at @@ -279,6 +283,8 @@ class TempoMap : public StateManager, public PBD::StatefulDestructible Metric metric_at (nframes_t) const; void bbt_time_with_metric (nframes_t, BBT_Time&, const Metric&) const; + sigc::signal<void,ARDOUR::Change> StateChanged; + private: static Tempo _default_tempo; static Meter _default_meter; @@ -310,6 +316,7 @@ class TempoMap : public StateManager, public PBD::StatefulDestructible int move_metric_section (MetricSection&, const BBT_Time& to); void do_insert (MetricSection* section); +#ifdef STATE_MANAGER Change restore_state (StateManager::State&); StateManager::State* state_factory (std::string why) const; @@ -318,7 +325,7 @@ class TempoMap : public StateManager, public PBD::StatefulDestructible /* override state_manager::save_state so we can check in_set_state */ void save_state (std::string why); - +#endif }; }; /* namespace ARDOUR */ diff --git a/libs/ardour/audio_playlist.cc b/libs/ardour/audio_playlist.cc index cce6e188f8..19609da2a4 100644 --- a/libs/ardour/audio_playlist.cc +++ b/libs/ardour/audio_playlist.cc @@ -120,9 +120,6 @@ AudioPlaylist::~AudioPlaylist () /* drop connections to signals */ notify_callbacks (); - - - cerr << "deleting crossfades " << _crossfades.size() << endl; for (Crossfades::iterator x = _crossfades.begin(); x != _crossfades.end(); ) { Crossfades::iterator tmp; @@ -132,12 +129,8 @@ AudioPlaylist::~AudioPlaylist () delete *x; - cerr << _crossfades.size() << " to go\n"; - x = tmp; } - - cerr << "done\n"; } struct RegionSortByLayer { @@ -372,8 +365,6 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh) return; } - cerr << "Check dependents of " << r->name() << endl; - if ((region = boost::dynamic_pointer_cast<AudioRegion> (r)) == 0) { fatal << _("programming error: non-audio Region tested for overlap in audio playlist") << endmsg; @@ -461,10 +452,7 @@ AudioPlaylist::add_crossfade (Crossfade& xfade) { Crossfades::iterator ci; - cerr << "adding xfade involving " << xfade.in()->name() << " and " << xfade.out()->name() << endl; - for (ci = _crossfades.begin(); ci != _crossfades.end(); ++ci) { - cerr << "\tcompare to " << (*ci)->in()->name() << " and " << (*ci)->out()->name() << endl; if (*(*ci) == xfade) { // Crossfade::operator==() break; } diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc index 677c9a0497..d61ec7b003 100644 --- a/libs/ardour/audio_track.cc +++ b/libs/ardour/audio_track.cc @@ -794,8 +794,9 @@ AudioTrack::freeze (InterThreadInfo& itt) FreezeRecordInsertInfo* frii = new FreezeRecordInsertInfo ((*r)->get_state(), insert); frii->id = insert->id(); +#ifdef STATE_MANAGER frii->memento = (*r)->get_memento(); - +#endif _freeze_record.insert_info.push_back (frii); /* now deactivate the insert */ diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc index 2f2c67ec50..d2cf279d3e 100644 --- a/libs/ardour/audioregion.cc +++ b/libs/ardour/audioregion.cc @@ -306,7 +306,6 @@ AudioRegion::AudioRegion (SourceList& srcs, const XMLNode& node) AudioRegion::~AudioRegion () { - cerr << "====== " << _name << " DESTRUCTOR @ " << this << endl; notify_callbacks (); GoingAway (); /* EMIT SIGNAL */ } diff --git a/libs/ardour/automation_event.cc b/libs/ardour/automation_event.cc index f286b11607..6b7f0ff016 100644 --- a/libs/ardour/automation_event.cc +++ b/libs/ardour/automation_event.cc @@ -64,7 +64,9 @@ AutomationList::AutomationList (double defval, bool with_state) lookup_cache.range.first = events.end(); if (!no_state) { +#ifdef STATE_MANAGER save_state (_("initial")); +#endif } AutomationListCreated(this); @@ -133,15 +135,16 @@ AutomationList::AutomationList (const AutomationList& other, double start, doubl AutomationList::~AutomationList() { - std::set<ControlEvent*> all_events; - AutomationList::State* asp; - GoingAway (); for (AutomationEventList::iterator x = events.begin(); x != events.end(); ++x) { - all_events.insert (*x); + delete (*x); } +#ifdef STATE_MANAGER + std::set<ControlEvent*> all_events; + AutomationList::State* asp; + for (StateMap::iterator i = states.begin(); i != states.end(); ++i) { if ((asp = dynamic_cast<AutomationList::State*> (*i)) != 0) { @@ -155,6 +158,7 @@ AutomationList::~AutomationList() for (std::set<ControlEvent*>::iterator i = all_events.begin(); i != all_events.end(); ++i) { delete (*i); } +#endif } bool @@ -237,7 +241,9 @@ AutomationList::clear () Glib::Mutex::Lock lm (lock); events.clear (); if (!no_state) { +#ifdef STATE_MANAGER save_state (_("cleared")); +#endif } mark_dirty (); } @@ -270,7 +276,9 @@ void AutomationList::_x_scale (double factor) (*i)->when = floor ((*i)->when * factor); } +#ifdef STATE_MANAGER save_state ("x-scaled"); +#endif mark_dirty (); } @@ -409,7 +417,9 @@ AutomationList::add (double when, double value, bool for_loading) mark_dirty (); if (!no_state && !for_loading) { +#ifdef STATE_MANAGER save_state (_("added event")); +#endif } } @@ -426,7 +436,9 @@ AutomationList::erase (AutomationList::iterator i) events.erase (i); reposition_for_rt_add (0); if (!no_state) { +#ifdef STATE_MANAGER save_state (_("removed event")); +#endif } mark_dirty (); } @@ -441,7 +453,9 @@ AutomationList::erase (AutomationList::iterator start, AutomationList::iterator events.erase (start, end); reposition_for_rt_add (0); if (!no_state) { +#ifdef STATE_MANAGER save_state (_("removed multiple events")); +#endif } mark_dirty (); } @@ -472,7 +486,9 @@ AutomationList::reset_range (double start, double endt) reset = true; if (!no_state) { +#ifdef STATE_MANAGER save_state (_("removed range")); +#endif } mark_dirty (); @@ -503,7 +519,9 @@ AutomationList::erase_range (double start, double endt) reposition_for_rt_add (0); erased = true; if (!no_state) { +#ifdef STATE_MANAGER save_state (_("removed range")); +#endif } mark_dirty (); } @@ -533,7 +551,9 @@ AutomationList::move_range (iterator start, iterator end, double xdelta, double } if (!no_state) { +#ifdef STATE_MANAGER save_state (_("event range adjusted")); +#endif } mark_dirty (); @@ -555,7 +575,9 @@ AutomationList::modify (iterator iter, double when, double val) (*iter)->when = when; (*iter)->value = val; if (!no_state) { +#ifdef STATE_MANAGER save_state (_("event adjusted")); +#endif } mark_dirty (); @@ -613,6 +635,7 @@ AutomationList::thaw () } } +#ifdef STATE_MANAGER StateManager::State* AutomationList::state_factory (std::string why) const { @@ -646,6 +669,7 @@ AutomationList::get_memento () const { return sigc::bind (mem_fun (*(const_cast<AutomationList*> (this)), &StateManager::use_state), _current_state_id); } +#endif void AutomationList::set_max_xval (double x) @@ -1084,7 +1108,9 @@ AutomationList::cut_copy_clear (double start, double end, int op) if (changed) { reposition_for_rt_add (0); if (!no_state) { +#ifdef STATE_MANAGER save_state (_("cut/copy/clear")); +#endif } } @@ -1117,7 +1143,9 @@ AutomationList::copy (iterator start, iterator end) } if (!no_state) { +#ifdef STATE_MANAGER save_state (_("copy")); +#endif } } @@ -1185,7 +1213,9 @@ AutomationList::paste (AutomationList& alist, double pos, float times) reposition_for_rt_add (0); if (!no_state) { +#ifdef STATE_MANAGER save_state (_("paste")); +#endif } mark_dirty (); @@ -1235,6 +1265,8 @@ AutomationList::load_state (const XMLNode& node) nframes_t x; double y; + freeze (); + clear (); for (i = elist.begin(); i != elist.end(); ++i) { @@ -1253,6 +1285,8 @@ AutomationList::load_state (const XMLNode& node) add (x, y); } + + thaw (); } XMLNode &AutomationList::get_state () diff --git a/libs/ardour/crossfade.cc b/libs/ardour/crossfade.cc index 739ea1cc0e..46a8e6e400 100644 --- a/libs/ardour/crossfade.cc +++ b/libs/ardour/crossfade.cc @@ -160,6 +160,8 @@ Crossfade::Crossfade (const Playlist& playlist, XMLNode& node) } _length = 0; + _active = Config->get_xfades_active(); + initialize(); if (set_state (node)) { @@ -197,9 +199,7 @@ Crossfade::Crossfade (const Crossfade &orig, boost::shared_ptr<AudioRegion> newi Crossfade::~Crossfade () { - cerr << "Deleting xfade @ " << this << endl; Invalidated (this); - cerr << "invalidation signal sent\n"; } void diff --git a/libs/ardour/curve.cc b/libs/ardour/curve.cc index 20f7053f2e..5f7d692471 100644 --- a/libs/ardour/curve.cc +++ b/libs/ardour/curve.cc @@ -435,13 +435,14 @@ Curve::point_factory (const ControlEvent& other) const return new CurvePoint (other.when, other.value); } +#ifdef STATE_MANAGER Change Curve::restore_state (StateManager::State& state) { mark_dirty (); return AutomationList::restore_state (state); } - +#endif extern "C" { diff --git a/libs/ardour/insert.cc b/libs/ardour/insert.cc index d64cce36f9..5531e4136b 100644 --- a/libs/ardour/insert.cc +++ b/libs/ardour/insert.cc @@ -81,7 +81,9 @@ PluginInsert::PluginInsert (Session& s, boost::shared_ptr<Plugin> plug, Placemen init (); +#ifdef STATE_MANAGER save_state (_("initial state")); +#endif { Glib::Mutex::Lock em (_session.engine().process_lock()); @@ -100,7 +102,9 @@ PluginInsert::PluginInsert (Session& s, const XMLNode& node) set_automatable (); +#ifdef STATE_MANAGER save_state (_("initial state")); +#endif _plugins[0]->ParameterChanged.connect (mem_fun (*this, &PluginInsert::parameter_changed)); @@ -125,7 +129,9 @@ PluginInsert::PluginInsert (const PluginInsert& other) init (); +#ifdef STATE_MANAGER save_state (_("initial state")); +#endif RedirectCreated (this); /* EMIT SIGNAL */ } @@ -841,16 +847,22 @@ PortInsert::PortInsert (Session& s, Placement p) : Insert (s, p, 1, -1, 1, -1) { init (); +#ifdef STATE_MANAGER save_state (_("initial state")); RedirectCreated (this); /* EMIT SIGNAL */ +#endif + } PortInsert::PortInsert (const PortInsert& other) : Insert (other._session, other.placement(), 1, -1, 1, -1) { init (); +#ifdef STATE_MANAGER save_state (_("initial state")); RedirectCreated (this); /* EMIT SIGNAL */ +#endif + } void diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc index bcd3ee7940..a9751268ff 100644 --- a/libs/ardour/io.cc +++ b/libs/ardour/io.cc @@ -2313,6 +2313,7 @@ IO::setup_peak_meters () } } +#ifdef STATE_MANAGER UndoAction IO::get_memento() const { @@ -2331,6 +2332,7 @@ IO::state_factory (std::string why) const StateManager::State* state = new StateManager::State (why); return state; } +#endif /** Update the peak meters. @@ -2488,7 +2490,9 @@ IO::load_automation (const string& path) } } +#ifdef STATE_MANAGER _gain_automation_curve.save_state (_("loaded from disk")); +#endif return 0; } @@ -2615,9 +2619,11 @@ IO::transport_stopped (nframes_t frame) if (_gain_automation_curve.automation_state() != Off) { +#ifdef STATE_MANAGER if (gain_automation_recording()) { _gain_automation_curve.save_state (_("automation write/touch")); } +#endif /* the src=0 condition is a special signal to not propagate automation gain changes into the mix group when locating. diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc index 39331cfda6..f9bcd76a0b 100644 --- a/libs/ardour/location.cc +++ b/libs/ardour/location.cc @@ -372,13 +372,25 @@ Locations::Locations () { current_location = 0; +#ifdef STATE_MANAGER save_state (_("initial")); +#endif } Locations::~Locations () { + for (LocationList::iterator i = locations.begin(); i != locations.end(); ) { + LocationList::iterator tmp = i; + ++tmp; + delete *i; + i = tmp; + } + +#ifdef STATE_MANAGER + std::set<Location*> all_locations; + for (StateMap::iterator siter = states.begin(); siter != states.end(); ++siter) { State* lstate = dynamic_cast<State*> (*siter); @@ -393,6 +405,7 @@ Locations::~Locations () } set_delete (&all_locations); +#endif } int @@ -445,7 +458,9 @@ Locations::clear () current_location = 0; } +#ifdef STATE_MANAGER save_state (_("clear")); +#endif changed (); /* EMIT SIGNAL */ current_changed (0); /* EMIT SIGNAL */ @@ -470,7 +485,9 @@ Locations::clear_markers () } } +#ifdef STATE_MANAGER save_state (_("clear markers")); +#endif changed (); /* EMIT SIGNAL */ } @@ -498,7 +515,9 @@ Locations::clear_ranges () current_location = 0; } +#ifdef STATE_MANAGER save_state (_("clear ranges")); +#endif changed (); /* EMIT SIGNAL */ current_changed (0); /* EMIT SIGNAL */ @@ -516,7 +535,9 @@ Locations::add (Location *loc, bool make_current) } } +#ifdef STATE_MANAGER save_state (_("add")); +#endif added (loc); /* EMIT SIGNAL */ @@ -554,7 +575,9 @@ Locations::remove (Location *loc) } if (was_removed) { +#ifdef STATE_MANAGER save_state (_("remove")); +#endif removed (loc); /* EMIT SIGNAL */ @@ -569,7 +592,9 @@ Locations::remove (Location *loc) void Locations::location_changed (Location* loc) { +#ifdef STATE_MANAGER save_state (X_("location changed")); +#endif changed (); /* EMIT SIGNAL */ } @@ -809,6 +834,7 @@ Locations::auto_punch_location () const return 0; } +#ifdef STATE_MANAGER StateManager::State* Locations::state_factory (std::string why) const { @@ -847,6 +873,7 @@ Locations::get_memento () const { return sigc::bind (mem_fun (*(const_cast<Locations*> (this)), &StateManager::use_state), _current_state_id); } +#endif uint32_t Locations::num_range_markers () const diff --git a/libs/ardour/panner.cc b/libs/ardour/panner.cc index 22053ce56b..229c4c5e1c 100644 --- a/libs/ardour/panner.cc +++ b/libs/ardour/panner.cc @@ -208,7 +208,9 @@ BaseStereoPanner::transport_stopped (nframes_t frame) if (_automation.automation_state() != Off) { if (_automation.automation_write()) { +#ifdef STATE_MANAGER _automation.save_state (_("automation write pass")); +#endif } set_position (_automation.eval (frame)); @@ -285,7 +287,9 @@ BaseStereoPanner::load (istream& in, string path, uint32_t& linecnt) /* now that we are done loading */ +#ifdef STATE_MANAGER _automation.save_state (_("loaded from disk")); +#endif _automation.StateChanged (Change (0)); return 0; diff --git a/libs/ardour/redirect.cc b/libs/ardour/redirect.cc index 9323966f96..18b16eaa73 100644 --- a/libs/ardour/redirect.cc +++ b/libs/ardour/redirect.cc @@ -144,9 +144,11 @@ Redirect::load_automation (string path) tosave.insert (port); } +#ifdef STATE_MANAGER for (set<uint32_t>::iterator i = tosave.begin(); i != tosave.end(); ++i) { automation_list (*i).save_state (_("loaded from disk")); } +#endif return 0; @@ -464,7 +466,9 @@ void Redirect::set_active (bool yn, void* src) { _active = yn; +#ifdef STATE_MANAGER save_state (_("active_changed")); +#endif active_changed (this, src); _session.set_dirty (); } diff --git a/libs/ardour/send.cc b/libs/ardour/send.cc index b37168807e..1479eab420 100644 --- a/libs/ardour/send.cc +++ b/libs/ardour/send.cc @@ -36,7 +36,9 @@ Send::Send (Session& s, Placement p) { _metering = false; expected_inputs = 0; +#ifdef STATE_MANAGER save_state (_("initial state")); +#endif RedirectCreated (this); /* EMIT SIGNAL */ } @@ -50,7 +52,10 @@ Send::Send (Session& s, const XMLNode& node) throw failed_constructor(); } +#ifdef STATE_MANAGER save_state (_("initial state")); +#endif + RedirectCreated (this); /* EMIT SIGNAL */ } @@ -59,7 +64,10 @@ Send::Send (const Send& other) { _metering = false; expected_inputs = 0; +#ifdef STATE_MANAGER save_state (_("initial state")); +#endif + RedirectCreated (this); /* EMIT SIGNAL */ } diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 66cb1f89fa..fddd289882 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -430,6 +430,10 @@ Session::~Session () } AudioDiskstream::free_working_buffers(); + + /* this should cause deletion of the auditioner */ + + // auditioner.reset (); #undef TRACK_DESTRUCTION #ifdef TRACK_DESTRUCTION @@ -469,9 +473,7 @@ Session::~Session () tmp = i; ++tmp; - cerr << "dropping refs on an audio region (" << i->second->name() << " @ " << i->second << ") with UC = " << i->second.use_count() << endl; i->second->drop_references (); - cerr << "AFTER: UC = " << i->second.use_count() << endl; i = tmp; } @@ -1548,11 +1550,17 @@ Session::resort_routes_using (shared_ptr<RouteList> r) for (i = r->begin(); i != r->end(); ++i) { trace_terminal (*i, *i); - } - + } + RouteSorter cmp; r->sort (cmp); + /* don't leave dangling references to routes in Route::fed_by */ + + for (i = r->begin(); i != r->end(); ++i) { + (*i)->fed_by.clear (); + } + #if 0 cerr << "finished route resort\n"; diff --git a/libs/ardour/session_click.cc b/libs/ardour/session_click.cc index 7f9b142679..ba7f7ae811 100644 --- a/libs/ardour/session_click.cc +++ b/libs/ardour/session_click.cc @@ -64,30 +64,31 @@ Session::click (nframes_t start, nframes_t nframes, nframes_t offset) goto run_clicks; } - if (points->empty()) { - delete points; - goto run_clicks; - } - - for (TempoMap::BBTPointList::iterator i = points->begin(); i != points->end(); ++i) { - switch ((*i).type) { - case TempoMap::Beat: - if (click_emphasis_data == 0 || (click_emphasis_data && (*i).beat != 1)) { - clicks.push_back (new Click ((*i).frame, click_length, click_data)); + if (!points->empty()) { + + for (TempoMap::BBTPointList::iterator i = points->begin(); i != points->end(); ++i) { + switch ((*i).type) { + case TempoMap::Beat: + if (click_emphasis_data == 0 || (click_emphasis_data && (*i).beat != 1)) { + clicks.push_back (new Click ((*i).frame, click_length, click_data)); + } + break; + + case TempoMap::Bar: + if (click_emphasis_data) { + clicks.push_back (new Click ((*i).frame, click_emphasis_length, click_emphasis_data)); + } + break; } - break; - - case TempoMap::Bar: - if (click_emphasis_data) { - clicks.push_back (new Click ((*i).frame, click_emphasis_length, click_emphasis_data)); - } - break; } } + + delete points; delete points; run_clicks: + memset (buf, 0, sizeof (Sample) * nframes); for (list<Click*>::iterator i = clicks.begin(); i != clicks.end(); ) { diff --git a/libs/ardour/session_command.cc b/libs/ardour/session_command.cc index c5c31b7c17..1492136b88 100644 --- a/libs/ardour/session_command.cc +++ b/libs/ardour/session_command.cc @@ -7,13 +7,15 @@ #include <ardour/audiosource.h> #include <ardour/audioregion.h> #include <pbd/error.h> +#include <pbd/statefuldestructible.h> + using namespace PBD; -#include "i18n.h" +#include "i18n.h" namespace ARDOUR { -void Session::register_with_memento_command_factory(PBD::ID id, StatefulDestructible *ptr) +void Session::register_with_memento_command_factory(PBD::ID id, PBD::StatefulThingWithGoingAway *ptr) { registry[id] = ptr; } @@ -78,7 +80,7 @@ Command *Session::memento_command_factory(XMLNode *n) if (automation_lists.count(id)) return new MementoCommand<AutomationList>(*automation_lists[id], before, after); } else if (registry.count(id)) { // For Editor and AutomationLine which are off-limits here - return new MementoCommand<StatefulDestructible>(*registry[id], before, after); + return new MementoCommand<PBD::StatefulThingWithGoingAway>(*registry[id], before, after); } /* we failed */ diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index c3e0fe9388..d742186d6b 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -243,7 +243,7 @@ Session::first_stage_init (string fullpath, string snapshot_name) Curve::CurveCreated.connect (mem_fun (*this, &Session::add_curve)); AutomationList::AutomationListCreated.connect (mem_fun (*this, &Session::add_automation_list)); - Controllable::GoingAway.connect (mem_fun (*this, &Session::remove_controllable)); + Controllable::Destroyed.connect (mem_fun (*this, &Session::remove_controllable)); IO::MoreOutputs.connect (mem_fun (*this, &Session::ensure_passthru_buffers)); @@ -1147,7 +1147,9 @@ Session::set_state (const XMLNode& node) start_location = location; } +#ifdef STATE_MANAGER _locations.save_state (_("initial state")); +#endif if ((child = find_named_node (node, "EditGroups")) == 0) { error << _("Session: XML state has no edit groups section") << endmsg; diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc index 913218c91c..e9d46f83e3 100644 --- a/libs/ardour/tempo.cc +++ b/libs/ardour/tempo.cc @@ -206,7 +206,9 @@ TempoMap::TempoMap (nframes_t fr) _frame_rate = fr; last_bbt_valid = false; BBT_Time start; +#ifdef STATE_MANAGER in_set_state = false; +#endif start.bars = 1; start.beats = 1; @@ -223,7 +225,9 @@ TempoMap::TempoMap (nframes_t fr) metrics->push_back (t); metrics->push_back (m); +#ifdef STATE_MANAGER save_state (_("initial")); +#endif } TempoMap::~TempoMap () @@ -256,7 +260,9 @@ TempoMap::move_metric_section (MetricSection& section, const BBT_Time& when) section.set_start (corrected); metrics->sort (cmp); timestamp_metrics (); +#ifdef STATE_MANAGER save_state (_("move metric")); +#endif return 0; } @@ -265,7 +271,7 @@ void TempoMap::move_tempo (TempoSection& tempo, const BBT_Time& when) { if (move_metric_section (tempo, when) == 0) { - send_state_changed (Change (0)); + StateChanged (Change (0)); } } @@ -273,7 +279,7 @@ void TempoMap::move_meter (MeterSection& meter, const BBT_Time& when) { if (move_metric_section (meter, when) == 0) { - send_state_changed (Change (0)); + StateChanged (Change (0)); } } @@ -301,7 +307,7 @@ TempoMap::remove_tempo (const TempoSection& tempo) } if (removed) { - send_state_changed (Change (0)); + StateChanged (Change (0)); } } @@ -327,12 +333,14 @@ TempoMap::remove_meter (const MeterSection& tempo) } if (removed) { +#ifdef STATE_MANAGER save_state (_("metric removed")); +#endif } } if (removed) { - send_state_changed (Change (0)); + StateChanged (Change (0)); } } @@ -370,10 +378,12 @@ TempoMap::add_tempo (const Tempo& tempo, BBT_Time where) do_insert (new TempoSection (where, tempo.beats_per_minute())); +#ifdef STATE_MANAGER save_state (_("add tempo")); +#endif } - send_state_changed (Change (0)); + StateChanged (Change (0)); } void @@ -399,12 +409,14 @@ TempoMap::replace_tempo (TempoSection& existing, const Tempo& replacement) } if (replaced) { +#ifdef STATE_MANAGER save_state (_("replace tempo")); +#endif } } if (replaced) { - send_state_changed (Change (0)); + StateChanged (Change (0)); } } @@ -432,10 +444,12 @@ TempoMap::add_meter (const Meter& meter, BBT_Time where) do_insert (new MeterSection (where, meter.beats_per_bar(), meter.note_divisor())); +#ifdef STATE_MANAGER save_state (_("add meter")); +#endif } - send_state_changed (Change (0)); + StateChanged (Change (0)); } void @@ -460,12 +474,14 @@ TempoMap::replace_meter (MeterSection& existing, const Meter& replacement) } if (replaced) { +#ifdef STATE_MANAGER save_state (_("replaced meter")); +#endif } } if (replaced) { - send_state_changed (Change (0)); + StateChanged (Change (0)); } } @@ -1266,7 +1282,9 @@ TempoMap::set_state (const XMLNode& node) XMLNodeConstIterator niter; Metrics old_metrics (*metrics); +#ifdef STATE_MANAGER in_set_state = true; +#endif metrics->clear(); @@ -1308,7 +1326,9 @@ TempoMap::set_state (const XMLNode& node) timestamp_metrics (); } +#ifdef STATE_MANAGER in_set_state = false; +#endif } /* This state needs to be saved. This string will never be a part of the @@ -1318,9 +1338,12 @@ TempoMap::set_state (const XMLNode& node) If this state is not saved, there is no way to reach it through undo actions. */ + +#ifdef STATE_MANAGER save_state(_("load XML data")); +#endif - send_state_changed (Change (0)); + StateChanged (Change (0)); return 0; } @@ -1343,6 +1366,7 @@ TempoMap::dump (std::ostream& o) const } } +#ifdef STATE_MANAGER UndoAction TempoMap::get_memento () const { @@ -1405,3 +1429,4 @@ TempoMap::save_state (std::string why) StateManager::save_state (why); } } +#endif |