summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2009-12-07 23:51:46 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2009-12-07 23:51:46 +0000
commit8faf95b9bdf8985b25e839419acffc495c8107e3 (patch)
tree1cd0870bf3f7654fca846abbc12c684eea50296d /libs
parent9686f8097d45c306168d1a5220d9c8bf225edb8c (diff)
better, cleaner, more generic version of real-time ping pong, still just for one case of rec-enable but more coming soon
git-svn-id: svn://localhost/ardour2/branches/3.0@6325 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/session.h16
-rw-r--r--libs/ardour/ardour/session_event.h11
-rw-r--r--libs/ardour/enums.cc1
-rw-r--r--libs/ardour/session.cc47
-rw-r--r--libs/ardour/session_process.cc26
5 files changed, 13 insertions, 88 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 18af14a313..ed34c387e8 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -303,6 +303,8 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu
sigc::signal<void,RouteList&> RouteAdded;
sigc::signal<void> RouteGroupChanged;
+ void queue_event (SessionEvent*);
+
void request_roll_at_and_return (nframes_t start, nframes_t return_to);
void request_bounded_roll (nframes_t start, nframes_t end);
void request_stop (bool abort = false, bool clear_state = false);
@@ -330,12 +332,6 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu
int remove_region_from_region_list (boost::shared_ptr<Region>);
- /* ask the session to do realtime things, in RT context, then get back to us via a callback (which must be
- cross-thread or RT safe, since it too is called from RT context)
- */
-
- void request_real_time_operation (sigc::slot<void> rt_op, sigc::slot<void,SessionEvent*> callback);
-
nframes_t get_maximum_extent () const;
nframes_t current_end_frame() const { return end_location->start(); }
nframes_t current_start_frame() const { return start_location->start(); }
@@ -626,9 +622,8 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu
sigc::signal<void,bool> SoloActive;
sigc::signal<void> SoloChanged;
-
- void record_disenable_all (sigc::slot<void,SessionEvent*>);
- void record_enable_all (sigc::slot<void,SessionEvent*>);
+
+ void set_all_record_enable (boost::shared_ptr<RouteList>, bool);
/* control/master out */
@@ -1188,7 +1183,6 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu
/* SessionEventManager interface */
- void queue_event (SessionEvent*);
void process_event (SessionEvent*);
void set_next_event ();
void cleanup_event (SessionEvent*,int);
@@ -1475,8 +1469,6 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu
void jack_timebase_callback (jack_transport_state_t, nframes_t, jack_position_t*, int);
int jack_sync_callback (jack_transport_state_t, jack_position_t*);
void reset_jack_connection (jack_client_t* jack);
- void record_enable_change_all (bool yn, sigc::slot<void,SessionEvent*>);
- void do_record_enable_change_all (RouteList*, bool);
void process_rtop (SessionEvent*);
XMLNode& state(bool);
diff --git a/libs/ardour/ardour/session_event.h b/libs/ardour/ardour/session_event.h
index a903e3cd4f..7775f4b1ad 100644
--- a/libs/ardour/ardour/session_event.h
+++ b/libs/ardour/ardour/session_event.h
@@ -32,7 +32,6 @@ struct SessionEvent {
Audition,
InputConfigurationChange,
SetPlayAudioRange,
- SetRecordEnable,
RealTimeOperation,
/* only one of each of these events can be queued at any one time */
@@ -64,9 +63,9 @@ struct SessionEvent {
union {
bool second_yes_or_no;
- RouteList* routes;
};
+ boost::shared_ptr<RouteList> routes;
sigc::slot<void> rt_slot; /* what to call in RT context */
sigc::slot<void,SessionEvent*> rt_return; /* called after rt_slot, with this event as an argument */
@@ -118,10 +117,8 @@ class SessionEventManager {
SessionEventManager () : pending_events (2048){}
virtual ~SessionEventManager() {}
- void add_event (nframes64_t action_frame, SessionEvent::Type type, nframes64_t target_frame = 0);
- void remove_event (nframes64_t frame, SessionEvent::Type type);
+ virtual void queue_event (SessionEvent *ev) = 0;
void clear_events (SessionEvent::Type type);
-
protected:
RingBuffer<SessionEvent*> pending_events;
@@ -143,8 +140,10 @@ class SessionEventManager {
bool _remove_event (SessionEvent *);
void _clear_event_type (SessionEvent::Type);
+ void add_event (nframes64_t action_frame, SessionEvent::Type type, nframes64_t target_frame = 0);
+ void remove_event (nframes64_t frame, SessionEvent::Type type);
+
virtual void process_event(SessionEvent*) = 0;
- virtual void queue_event (SessionEvent *ev) = 0;
virtual void set_next_event () = 0;
};
diff --git a/libs/ardour/enums.cc b/libs/ardour/enums.cc
index 0676973e53..be61b2acb2 100644
--- a/libs/ardour/enums.cc
+++ b/libs/ardour/enums.cc
@@ -307,7 +307,6 @@ setup_enum_writer ()
REGISTER_CLASS_ENUM (SessionEvent, Audition);
REGISTER_CLASS_ENUM (SessionEvent, InputConfigurationChange);
REGISTER_CLASS_ENUM (SessionEvent, SetPlayAudioRange);
- REGISTER_CLASS_ENUM (SessionEvent, SetRecordEnable);
REGISTER_CLASS_ENUM (SessionEvent, StopOnce);
REGISTER_CLASS_ENUM (SessionEvent, AutoLoop);
REGISTER (_SessionEvent_Type);
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 5c8c2254f9..cdd5041856 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -3605,53 +3605,12 @@ Session::graph_reordered ()
}
void
-Session::record_disenable_all (sigc::slot<void,SessionEvent*> callback)
+Session::set_all_record_enable (boost::shared_ptr<RouteList> rl, bool yn)
{
if (!writable()) {
return;
}
- record_enable_change_all (false, callback);
-}
-
-void
-Session::record_enable_all (sigc::slot<void,SessionEvent*> callback)
-{
- if (!writable()) {
- return;
- }
-
- record_enable_change_all (true, callback);
-}
-
-void
-Session::record_enable_change_all (bool yn, sigc::slot<void,SessionEvent*> callback)
-{
- shared_ptr<RouteList> r = routes.reader ();
- RouteList* tracks = new RouteList;
-
- for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
- boost::shared_ptr<Track> t;
-
- if (boost::dynamic_pointer_cast<Track>(*i) != 0) {
- tracks->push_back (*i);
- }
- }
-
- sigc::slot<void> rt_op = bind (sigc::mem_fun (*this, &Session::do_record_enable_change_all), tracks, yn);
-
- SessionEvent* ev = new SessionEvent (SessionEvent::RealTimeOperation, SessionEvent::Add, SessionEvent::Immediate, 0, 0.0);
-
- ev->routes = tracks; // set here so that callback can delete it
- ev->rt_slot = rt_op;
- ev->rt_return = callback;
-
- queue_event (ev);
-}
-
-void
-Session::do_record_enable_change_all (RouteList* rl, bool yn)
-{
for (RouteList::iterator i = rl->begin(); i != rl->end(); ) {
boost::shared_ptr<Track> t;
@@ -3663,7 +3622,9 @@ Session::do_record_enable_change_all (RouteList* rl, bool yn)
} else {
++i;
}
- }
+ } else {
+ ++i;
+ }
}
set_dirty ();
diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc
index 22c6abfc73..078ef260c6 100644
--- a/libs/ardour/session_process.cc
+++ b/libs/ardour/session_process.cc
@@ -984,18 +984,6 @@ Session::set_next_event ()
}
void
-Session::cleanup_event (SessionEvent* ev, int status)
-{
- switch (ev->type) {
- case SessionEvent::SetRecordEnable:
- delete ev->routes;
- break;
- default:
- break;
- }
-}
-
-void
Session::process_event (SessionEvent* ev)
{
bool remove = true;
@@ -1134,10 +1122,6 @@ Session::process_event (SessionEvent* ev)
set_play_range (ev->audio_range, (ev->speed == 1.0f));
break;
- case SessionEvent::SetRecordEnable:
- do_record_enable_change_all (ev->routes, ev->yes_or_no);
- break;
-
case SessionEvent::RealTimeOperation:
process_rtop (ev);
del = false; // other side of RT request needs to clean up
@@ -1158,16 +1142,6 @@ Session::process_event (SessionEvent* ev)
}
}
-
-void
-Session::request_real_time_operation (sigc::slot<void> rt_op, sigc::slot<void,SessionEvent*> callback)
-{
- SessionEvent* ev = new SessionEvent (SessionEvent::RealTimeOperation, SessionEvent::Add, SessionEvent::Immediate, 0, 0.0);
- ev->rt_slot = rt_op;
- ev->rt_return = callback;
- queue_event (ev);
-}
-
void
Session::process_rtop (SessionEvent* ev)
{