diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2009-12-10 03:25:32 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2009-12-10 03:25:32 +0000 |
commit | 61cade6d59118288e90a405e0f4fbc24d0108814 (patch) | |
tree | fe9083a4c005ac239bf5995c16252609dc547869 /libs/ardour/ardour | |
parent | f18bcf0cc835ab401d8e28dcc18c72795977752a (diff) |
drastic, deep and wide changes to make RouteGroup use boost::shared_ptr<Route> and boost::shared_ptr<RouteList> to better fit into emerging framework for "RT operations" ; torben's changes to MTC slaving code (sorry for bundling)
git-svn-id: svn://localhost/ardour2/branches/3.0@6334 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/ardour')
-rw-r--r-- | libs/ardour/ardour/pi_controller.h | 31 | ||||
-rw-r--r-- | libs/ardour/ardour/route.h | 9 | ||||
-rw-r--r-- | libs/ardour/ardour/route_group.h | 33 | ||||
-rw-r--r-- | libs/ardour/ardour/route_group_member.h | 51 | ||||
-rw-r--r-- | libs/ardour/ardour/route_group_specialized.h | 12 | ||||
-rw-r--r-- | libs/ardour/ardour/slave.h | 4 |
6 files changed, 110 insertions, 30 deletions
diff --git a/libs/ardour/ardour/pi_controller.h b/libs/ardour/ardour/pi_controller.h index f992e6a18c..d3cd0eb6bf 100644 --- a/libs/ardour/ardour/pi_controller.h +++ b/libs/ardour/ardour/pi_controller.h @@ -19,6 +19,8 @@ #ifndef __libardour_pi_controller__ #define __libardour_pi_controller__ +#include "ardour/types.h" + class PIController { public: @@ -48,6 +50,35 @@ class PIController { int smooth_size; double smooth_offset; double current_resample_factor; + bool fir_empty; }; +#define ESTIMATOR_SIZE 16 + +class PIChaser { + public: + PIChaser(); + ~PIChaser(); + + double get_ratio( nframes64_t realtime, nframes64_t chasetime, nframes64_t slavetime, bool in_control ); + void reset(); + nframes64_t want_locate() { return want_locate_val; } + + private: + PIController *pic; + nframes64_t realtime_stamps[ESTIMATOR_SIZE]; + nframes64_t chasetime_stamps[ESTIMATOR_SIZE]; + int array_index; + nframes64_t want_locate_val; + + void feed_estimator( nframes64_t realtime, nframes64_t chasetime ); + double get_estimate(); + + double speed; + + double speed_threshold; + nframes64_t pos_threshold; +}; + + #endif /* __libardour_pi_controller__ */ diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index 8b08dded99..8e63a2d523 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -42,6 +42,7 @@ #include "ardour/io.h" #include "ardour/types.h" #include "ardour/mute_master.h" +#include "ardour/route_group_member.h" namespace ARDOUR { @@ -54,7 +55,7 @@ class RouteGroup; class Send; class InternalReturn; -class Route : public SessionObject, public AutomatableControls +class Route : public SessionObject, public AutomatableControls, public RouteGroupMember { public: @@ -149,10 +150,6 @@ class Route : public SessionObject, public AutomatableControls void set_denormal_protection (bool yn); bool denormal_protection() const; - void set_route_group (RouteGroup *, void *); - void drop_route_group (void *); - RouteGroup *route_group () const { return _route_group; } - void set_meter_point (MeterPoint, void *src); MeterPoint meter_point() const { return _meter_point; } void meter (); @@ -244,7 +241,6 @@ class Route : public SessionObject, public AutomatableControls /** the processors have changed; the parameter indicates what changed */ sigc::signal<void, RouteProcessorChange> processors_changed; sigc::signal<void,void*> record_enable_changed; - sigc::signal<void,void*> route_group_changed; /** the metering point has changed */ sigc::signal<void,void*> meter_change; sigc::signal<void> signal_latency_changed; @@ -369,7 +365,6 @@ class Route : public SessionObject, public AutomatableControls boost::shared_ptr<MuteMaster> _mute_master; MuteMaster::MutePoint _mute_points; - RouteGroup* _route_group; std::string _comment; bool _have_internal_generator; bool _solo_safe; diff --git a/libs/ardour/ardour/route_group.h b/libs/ardour/ardour/route_group.h index 0f71093377..996e8fee2f 100644 --- a/libs/ardour/ardour/route_group.h +++ b/libs/ardour/ardour/route_group.h @@ -25,6 +25,7 @@ #include <string> #include <stdint.h> #include <sigc++/signal.h> + #include "pbd/stateful.h" #include "ardour/types.h" @@ -53,6 +54,7 @@ public: }; RouteGroup (Session& s, const std::string &n, Flag f = Flag(0), Property p = Property(0)); + ~RouteGroup (); const std::string& name() { return _name; } void set_name (std::string str); @@ -60,13 +62,12 @@ public: bool is_active () const { return _flags & Active; } bool is_relative () const { return _flags & Relative; } bool is_hidden () const { return _flags & Hidden; } - bool empty() const {return routes.empty();} + bool empty() const {return routes->empty();} + size_t size() const { return routes->size();} gain_t get_max_factor(gain_t factor); gain_t get_min_factor(gain_t factor); - int size() { return routes.size();} - void set_active (bool yn, void *src); void set_relative (bool yn, void *src); void set_hidden (bool yn, void *src); @@ -86,24 +87,23 @@ public: } } - int add (Route *); - - int remove (Route *); + int add (boost::shared_ptr<Route>); + int remove (boost::shared_ptr<Route>); void apply (void (Route::*func)(void *), void *src) { - for (std::list<Route *>::iterator i = routes.begin(); i != routes.end(); i++) { - ((*i)->*func)(src); + for (RouteList::iterator i = routes->begin(); i != routes->end(); i++) { + ((*i).get()->*func)(src); } } template<class T> void apply (void (Route::*func)(T, void *), T val, void *src) { - for (std::list<Route *>::iterator i = routes.begin(); i != routes.end(); i++) { - ((*i)->*func)(val, src); + for (RouteList::iterator i = routes->begin(); i != routes->end(); i++) { + ((*i).get()->*func)(val, src); } } template<class T> void foreach_route (T *obj, void (T::*func)(Route&)) { - for (std::list<Route *>::iterator i = routes.begin(); i != routes.end(); i++) { + for (RouteList::iterator i = routes->begin(); i != routes->end(); i++) { (obj->*func)(**i); } } @@ -114,17 +114,18 @@ public: /* fills at_set with all members of the group that are AudioTracks */ - void audio_track_group (std::set<AudioTrack*>& at_set); + void audio_track_group (std::set<boost::shared_ptr<AudioTrack> >& at_set); void clear () { - routes.clear (); + routes->clear (); changed(); } void make_subgroup (); void destroy_subgroup (); - const std::list<Route*>& route_list() { return routes; } + boost::shared_ptr<RouteList> route_list() { return routes; } + boost::shared_ptr<RouteList> route_list (Property forProperty); sigc::signal<void> changed; sigc::signal<void,void*> FlagsChanged; @@ -135,13 +136,13 @@ public: private: Session& _session; - std::list<Route *> routes; + boost::shared_ptr<RouteList> routes; boost::shared_ptr<Route> subgroup_bus; std::string _name; Flag _flags; Property _properties; - void remove_when_going_away (Route*); + void remove_when_going_away (boost::weak_ptr<Route>); int set_state_2X (const XMLNode&, int); }; diff --git a/libs/ardour/ardour/route_group_member.h b/libs/ardour/ardour/route_group_member.h new file mode 100644 index 0000000000..4b577121a6 --- /dev/null +++ b/libs/ardour/ardour/route_group_member.h @@ -0,0 +1,51 @@ +/* + Copyright (C) 2009 Paul Davis + + This program 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., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#ifndef __libardour_route_group_member_h__ +#define __libardour_route_group_member_h__ + +#include <sigc++/signal.h> + +namespace ARDOUR { + +class RouteGroup; + +class RouteGroupMember +{ + public: + RouteGroupMember () : _route_group (0) {} + virtual ~RouteGroupMember() {} + + RouteGroup* route_group () const { return _route_group; } + + sigc::signal<void> route_group_changed; + + protected: + RouteGroup* _route_group; + + private: + friend class RouteGroup; + + void join_route_group (RouteGroup*); + void leave_route_group (); +}; + +} + +#endif /* __libardour_route_group_member_h__ */ diff --git a/libs/ardour/ardour/route_group_specialized.h b/libs/ardour/ardour/route_group_specialized.h index c9d06a93c9..242a16c43e 100644 --- a/libs/ardour/ardour/route_group_specialized.h +++ b/libs/ardour/ardour/route_group_specialized.h @@ -26,12 +26,13 @@ namespace ARDOUR { template<class T> void -RouteGroup::apply (void (Track::*func)(T, void *), T val, void */*src*/) +RouteGroup::apply (void (Track::*func)(T, void *), T val, void* /*src*/) { - for (std::list<Route *>::iterator i = routes.begin(); i != routes.end(); i++) { - Track *at; - if ((at = dynamic_cast<Track*>(*i)) != 0) { - (at->*func)(val, this); + for (RouteList::iterator i = routes->begin(); i != routes->end(); i++) { + boost::shared_ptr<Track> at; + + if ((at = boost::dynamic_pointer_cast<Track>(*i)) != 0) { + (at.get()->*func)(val, this); } } } @@ -39,3 +40,4 @@ RouteGroup::apply (void (Track::*func)(T, void *), T val, void */*src*/) } /* namespace ARDOUR */ #endif /* __ardour_route_group_specialized_h__ */ + diff --git a/libs/ardour/ardour/slave.h b/libs/ardour/ardour/slave.h index b01722e306..1125e920a0 100644 --- a/libs/ardour/ardour/slave.h +++ b/libs/ardour/ardour/slave.h @@ -31,7 +31,7 @@ #include "midi++/parser.h" #include "midi++/types.h" -class PIController; +class PIChaser; namespace MIDI { class Port; @@ -242,7 +242,7 @@ class MTC_Slave : public Slave, public sigc::trackable { MIDI::Port* port; std::vector<sigc::connection> connections; bool can_notify_on_unknown_rate; - PIController* pic; + PIChaser* pic; static const int frame_tolerance; |