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
This commit is contained in:
parent
9686f8097d
commit
8faf95b9bd
@ -1003,7 +1003,7 @@ RCOptionEditor::RCOptionEditor ()
|
|||||||
add_option (_("Transport"),
|
add_option (_("Transport"),
|
||||||
new BoolOption (
|
new BoolOption (
|
||||||
"disable-disarm-during-roll",
|
"disable-disarm-during-roll",
|
||||||
_("Disable record disarm when transport is rolling"),
|
_("Disable per-track record disarm while rolling"),
|
||||||
mem_fun (*_rc_config, &RCConfiguration::get_disable_disarm_during_roll),
|
mem_fun (*_rc_config, &RCConfiguration::get_disable_disarm_during_roll),
|
||||||
mem_fun (*_rc_config, &RCConfiguration::set_disable_disarm_during_roll)
|
mem_fun (*_rc_config, &RCConfiguration::set_disable_disarm_during_roll)
|
||||||
));
|
));
|
||||||
|
@ -457,7 +457,6 @@ RouteUI::post_rec_cleanup (SessionEvent* ev, UndoTransaction* undo, Session::Glo
|
|||||||
{
|
{
|
||||||
ENSURE_GUI_THREAD (bind (mem_fun (*this, &RouteUI::post_rec_cleanup), ev, undo, cmd));
|
ENSURE_GUI_THREAD (bind (mem_fun (*this, &RouteUI::post_rec_cleanup), ev, undo, cmd));
|
||||||
|
|
||||||
delete ev->routes;
|
|
||||||
delete ev;
|
delete ev;
|
||||||
|
|
||||||
check_rec_enable_sensitivity ();
|
check_rec_enable_sensitivity ();
|
||||||
@ -493,13 +492,11 @@ RouteUI::rec_enable_press(GdkEventButton* ev)
|
|||||||
UndoTransaction* undo = _session.start_reversible_command (_("rec-enable change"));
|
UndoTransaction* undo = _session.start_reversible_command (_("rec-enable change"));
|
||||||
Session::GlobalRecordEnableStateCommand *cmd = new Session::GlobalRecordEnableStateCommand(_session, this);
|
Session::GlobalRecordEnableStateCommand *cmd = new Session::GlobalRecordEnableStateCommand(_session, this);
|
||||||
|
|
||||||
sigc::slot<void,SessionEvent*> callback = bind (sigc::mem_fun (*this, &RouteUI::post_rec_cleanup), undo, cmd);
|
SessionEvent* ev = new SessionEvent (SessionEvent::RealTimeOperation, SessionEvent::Add, SessionEvent::Immediate, 0, 0.0);
|
||||||
|
ev->rt_slot = bind (sigc::mem_fun (_session, &Session::set_all_record_enable), _session.get_routes(), !rec_enable_button->get_active());
|
||||||
|
ev->rt_return = bind (sigc::mem_fun (*this, &RouteUI::post_rec_cleanup), undo, cmd);
|
||||||
|
|
||||||
if (rec_enable_button->get_active()) {
|
_session.queue_event (ev);
|
||||||
_session.record_disenable_all (callback);
|
|
||||||
} else {
|
|
||||||
_session.record_enable_all (callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
|
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
|
||||||
|
|
||||||
|
@ -303,6 +303,8 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu
|
|||||||
sigc::signal<void,RouteList&> RouteAdded;
|
sigc::signal<void,RouteList&> RouteAdded;
|
||||||
sigc::signal<void> RouteGroupChanged;
|
sigc::signal<void> RouteGroupChanged;
|
||||||
|
|
||||||
|
void queue_event (SessionEvent*);
|
||||||
|
|
||||||
void request_roll_at_and_return (nframes_t start, nframes_t return_to);
|
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_bounded_roll (nframes_t start, nframes_t end);
|
||||||
void request_stop (bool abort = false, bool clear_state = false);
|
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>);
|
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 get_maximum_extent () const;
|
||||||
nframes_t current_end_frame() const { return end_location->start(); }
|
nframes_t current_end_frame() const { return end_location->start(); }
|
||||||
nframes_t current_start_frame() const { return start_location->start(); }
|
nframes_t current_start_frame() const { return start_location->start(); }
|
||||||
@ -627,8 +623,7 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu
|
|||||||
sigc::signal<void,bool> SoloActive;
|
sigc::signal<void,bool> SoloActive;
|
||||||
sigc::signal<void> SoloChanged;
|
sigc::signal<void> SoloChanged;
|
||||||
|
|
||||||
void record_disenable_all (sigc::slot<void,SessionEvent*>);
|
void set_all_record_enable (boost::shared_ptr<RouteList>, bool);
|
||||||
void record_enable_all (sigc::slot<void,SessionEvent*>);
|
|
||||||
|
|
||||||
/* control/master out */
|
/* control/master out */
|
||||||
|
|
||||||
@ -1188,7 +1183,6 @@ class Session : public PBD::StatefulDestructible, public SessionEventManager, pu
|
|||||||
|
|
||||||
/* SessionEventManager interface */
|
/* SessionEventManager interface */
|
||||||
|
|
||||||
void queue_event (SessionEvent*);
|
|
||||||
void process_event (SessionEvent*);
|
void process_event (SessionEvent*);
|
||||||
void set_next_event ();
|
void set_next_event ();
|
||||||
void cleanup_event (SessionEvent*,int);
|
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);
|
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*);
|
int jack_sync_callback (jack_transport_state_t, jack_position_t*);
|
||||||
void reset_jack_connection (jack_client_t* jack);
|
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*);
|
void process_rtop (SessionEvent*);
|
||||||
|
|
||||||
XMLNode& state(bool);
|
XMLNode& state(bool);
|
||||||
|
@ -32,7 +32,6 @@ struct SessionEvent {
|
|||||||
Audition,
|
Audition,
|
||||||
InputConfigurationChange,
|
InputConfigurationChange,
|
||||||
SetPlayAudioRange,
|
SetPlayAudioRange,
|
||||||
SetRecordEnable,
|
|
||||||
RealTimeOperation,
|
RealTimeOperation,
|
||||||
|
|
||||||
/* only one of each of these events can be queued at any one time */
|
/* only one of each of these events can be queued at any one time */
|
||||||
@ -64,9 +63,9 @@ struct SessionEvent {
|
|||||||
|
|
||||||
union {
|
union {
|
||||||
bool second_yes_or_no;
|
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> rt_slot; /* what to call in RT context */
|
||||||
sigc::slot<void,SessionEvent*> rt_return; /* called after rt_slot, with this event as an argument */
|
sigc::slot<void,SessionEvent*> rt_return; /* called after rt_slot, with this event as an argument */
|
||||||
|
|
||||||
@ -118,11 +117,9 @@ class SessionEventManager {
|
|||||||
SessionEventManager () : pending_events (2048){}
|
SessionEventManager () : pending_events (2048){}
|
||||||
virtual ~SessionEventManager() {}
|
virtual ~SessionEventManager() {}
|
||||||
|
|
||||||
void add_event (nframes64_t action_frame, SessionEvent::Type type, nframes64_t target_frame = 0);
|
virtual void queue_event (SessionEvent *ev) = 0;
|
||||||
void remove_event (nframes64_t frame, SessionEvent::Type type);
|
|
||||||
void clear_events (SessionEvent::Type type);
|
void clear_events (SessionEvent::Type type);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
RingBuffer<SessionEvent*> pending_events;
|
RingBuffer<SessionEvent*> pending_events;
|
||||||
typedef std::list<SessionEvent *> Events;
|
typedef std::list<SessionEvent *> Events;
|
||||||
@ -143,8 +140,10 @@ class SessionEventManager {
|
|||||||
bool _remove_event (SessionEvent *);
|
bool _remove_event (SessionEvent *);
|
||||||
void _clear_event_type (SessionEvent::Type);
|
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 process_event(SessionEvent*) = 0;
|
||||||
virtual void queue_event (SessionEvent *ev) = 0;
|
|
||||||
virtual void set_next_event () = 0;
|
virtual void set_next_event () = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -307,7 +307,6 @@ setup_enum_writer ()
|
|||||||
REGISTER_CLASS_ENUM (SessionEvent, Audition);
|
REGISTER_CLASS_ENUM (SessionEvent, Audition);
|
||||||
REGISTER_CLASS_ENUM (SessionEvent, InputConfigurationChange);
|
REGISTER_CLASS_ENUM (SessionEvent, InputConfigurationChange);
|
||||||
REGISTER_CLASS_ENUM (SessionEvent, SetPlayAudioRange);
|
REGISTER_CLASS_ENUM (SessionEvent, SetPlayAudioRange);
|
||||||
REGISTER_CLASS_ENUM (SessionEvent, SetRecordEnable);
|
|
||||||
REGISTER_CLASS_ENUM (SessionEvent, StopOnce);
|
REGISTER_CLASS_ENUM (SessionEvent, StopOnce);
|
||||||
REGISTER_CLASS_ENUM (SessionEvent, AutoLoop);
|
REGISTER_CLASS_ENUM (SessionEvent, AutoLoop);
|
||||||
REGISTER (_SessionEvent_Type);
|
REGISTER (_SessionEvent_Type);
|
||||||
|
@ -3605,53 +3605,12 @@ Session::graph_reordered ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Session::record_disenable_all (sigc::slot<void,SessionEvent*> callback)
|
Session::set_all_record_enable (boost::shared_ptr<RouteList> rl, bool yn)
|
||||||
{
|
{
|
||||||
if (!writable()) {
|
if (!writable()) {
|
||||||
return;
|
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(); ) {
|
for (RouteList::iterator i = rl->begin(); i != rl->end(); ) {
|
||||||
boost::shared_ptr<Track> t;
|
boost::shared_ptr<Track> t;
|
||||||
|
|
||||||
@ -3663,6 +3622,8 @@ Session::do_record_enable_change_all (RouteList* rl, bool yn)
|
|||||||
} else {
|
} else {
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -983,18 +983,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
|
void
|
||||||
Session::process_event (SessionEvent* ev)
|
Session::process_event (SessionEvent* ev)
|
||||||
{
|
{
|
||||||
@ -1134,10 +1122,6 @@ Session::process_event (SessionEvent* ev)
|
|||||||
set_play_range (ev->audio_range, (ev->speed == 1.0f));
|
set_play_range (ev->audio_range, (ev->speed == 1.0f));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SessionEvent::SetRecordEnable:
|
|
||||||
do_record_enable_change_all (ev->routes, ev->yes_or_no);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SessionEvent::RealTimeOperation:
|
case SessionEvent::RealTimeOperation:
|
||||||
process_rtop (ev);
|
process_rtop (ev);
|
||||||
del = false; // other side of RT request needs to clean up
|
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
|
void
|
||||||
Session::process_rtop (SessionEvent* ev)
|
Session::process_rtop (SessionEvent* ev)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user