diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2009-11-07 17:15:54 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2009-11-07 17:15:54 +0000 |
commit | c033e6f87525b6e0e405b672cf288cf1627bca87 (patch) | |
tree | c81ce53cfb27eb8f865880bc9905eab21d0c6c9d /libs | |
parent | 862cb478a2b9dfa3822c581241396582050bfa44 (diff) |
better design for range plays that leaves the range play button able to play the current range selection
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@6029 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/session.h | 12 | ||||
-rw-r--r-- | libs/ardour/enums.cc | 3 | ||||
-rw-r--r-- | libs/ardour/session_events.cc | 9 | ||||
-rw-r--r-- | libs/ardour/session_transport.cc | 46 | ||||
-rw-r--r-- | libs/surfaces/control_protocol/basic_ui.cc | 3 |
5 files changed, 33 insertions, 40 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 50ca7a91fe..312f0f3628 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -135,8 +135,7 @@ class Session : public PBD::StatefulDestructible SetSlaveSource, Audition, InputConfigurationChange, - SetAudioRange, - SetPlayRange, + SetPlayAudioRange, /* only one of each of these events can be queued at any one time @@ -927,10 +926,7 @@ class Session : public PBD::StatefulDestructible /* ranges */ - void set_audio_range (list<AudioRange>&); - void set_music_range (list<MusicRange>&); - - void request_play_range (bool yn, bool leave_rolling = false); + void request_play_range (list<AudioRange>&, bool yn, bool leave_rolling = false); bool get_play_range () const { return _play_range; } /* favorite dirs */ @@ -1738,8 +1734,8 @@ class Session : public PBD::StatefulDestructible list<AudioRange> current_audio_range; bool _play_range; - void set_play_range (bool yn, bool leave_rolling); - void setup_auto_play (); + void set_play_range (list<AudioRange>&, bool yn, bool leave_rolling); + void setup_auto_play (list<AudioRange>&); /* main outs */ uint32_t main_outs; diff --git a/libs/ardour/enums.cc b/libs/ardour/enums.cc index 78583c8ddf..25f3eccf61 100644 --- a/libs/ardour/enums.cc +++ b/libs/ardour/enums.cc @@ -242,8 +242,7 @@ setup_enum_writer () REGISTER_CLASS_ENUM (Session::Event, SetSlaveSource); REGISTER_CLASS_ENUM (Session::Event, Audition); REGISTER_CLASS_ENUM (Session::Event, InputConfigurationChange); - REGISTER_CLASS_ENUM (Session::Event, SetAudioRange); - REGISTER_CLASS_ENUM (Session::Event, SetPlayRange); + REGISTER_CLASS_ENUM (Session::Event, SetPlayAudioRange); REGISTER_CLASS_ENUM (Session::Event, StopOnce); REGISTER_CLASS_ENUM (Session::Event, AutoLoop); REGISTER (_Session_Event_Type); diff --git a/libs/ardour/session_events.cc b/libs/ardour/session_events.cc index fe5f08fa03..58702c133b 100644 --- a/libs/ardour/session_events.cc +++ b/libs/ardour/session_events.cc @@ -426,13 +426,8 @@ Session::process_event (Event* ev) schedule_butler_transport_work (); break; - case Event::SetAudioRange: - current_audio_range = ev->audio_range; - setup_auto_play (); - break; - - case Event::SetPlayRange: - set_play_range (ev->yes_or_no, (ev->speed == 1.0f)); + case Event::SetPlayAudioRange: + set_play_range (ev->audio_range, ev->yes_or_no, (ev->speed == 1.0f)); break; default: diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc index c4cfbb802f..2ed8746c99 100644 --- a/libs/ardour/session_transport.cc +++ b/libs/ardour/session_transport.cc @@ -140,9 +140,10 @@ Session::request_play_loop (bool yn, bool leave_rolling) } void -Session::request_play_range (bool yn, bool leave_rolling) +Session::request_play_range (list<AudioRange>& range, bool yn, bool leave_rolling) { - Event* ev = new Event (Event::SetPlayRange, Event::Add, Event::Immediate, 0, (leave_rolling ? 1.0 : 0.0), yn); + Event* ev = new Event (Event::SetPlayAudioRange, Event::Add, Event::Immediate, 0, (leave_rolling ? 1.0 : 0.0), yn); + ev->audio_range = range; queue_event (ev); } @@ -616,7 +617,8 @@ Session::set_play_loop (bool yn) if (loc) { - set_play_range (false, true); + list<AudioRange> empty; + set_play_range (empty, false, true); if (Config->get_seamless_loop()) { // set all diskstreams to use internal looping @@ -1184,26 +1186,22 @@ Session::set_diskstream_speed (Diskstream* stream, float speed) } void -Session::set_audio_range (list<AudioRange>& range) -{ - Event *ev = new Event (Event::SetAudioRange, Event::Add, Event::Immediate, 0, 0.0f); - ev->audio_range = range; - queue_event (ev); -} - -void -Session::set_play_range (bool yn, bool leave_rolling) +Session::set_play_range (list<AudioRange>& range, bool yn, bool leave_rolling) { /* Called from event-processing context */ if (yn) { + if (range.empty()) { + /* make it a no-op */ + return; + } /* cancel loop play */ unset_play_loop (); } _play_range = yn; - setup_auto_play (); + setup_auto_play (range); if (!_play_range && !leave_rolling) { /* stop transport */ @@ -1219,13 +1217,13 @@ Session::request_bounded_roll (nframes_t start, nframes_t end) { AudioRange ar (start, end, 0); list<AudioRange> lar; + lar.push_back (ar); - set_audio_range (lar); - request_play_range (true, true); + request_play_range (lar, true, true); } void -Session::setup_auto_play () +Session::setup_auto_play (list<AudioRange>& range) { /* Called from event-processing context */ @@ -1238,14 +1236,14 @@ Session::setup_auto_play () return; } - list<AudioRange>::size_type sz = current_audio_range.size(); + list<AudioRange>::size_type sz = range.size(); if (sz > 1) { - list<AudioRange>::iterator i = current_audio_range.begin(); + list<AudioRange>::iterator i = range.begin(); list<AudioRange>::iterator next; - while (i != current_audio_range.end()) { + while (i != range.end()) { next = i; ++next; @@ -1261,7 +1259,7 @@ Session::setup_auto_play () requested_frame = 0; } - if (next == current_audio_range.end()) { + if (next == range.end()) { ev = new Event (Event::RangeStop, Event::Add, requested_frame, 0, 0.0f); } else { ev = new Event (Event::RangeLocate, Event::Add, requested_frame, (*next).start, 0.0f); @@ -1274,14 +1272,18 @@ Session::setup_auto_play () } else if (sz == 1) { - ev = new Event (Event::RangeStop, Event::Add, current_audio_range.front().end, 0, 0.0f); + ev = new Event (Event::RangeStop, Event::Add, range.front().end, 0, 0.0f); merge_event (ev); } + /* save range so we can do auto-return etc. */ + + current_audio_range = range; + /* now start rolling at the right place */ - ev = new Event (Event::LocateRoll, Event::Add, Event::Immediate, current_audio_range.front().start, 0.0f, false); + ev = new Event (Event::LocateRoll, Event::Add, Event::Immediate, range.front().start, 0.0f, false); merge_event (ev); } diff --git a/libs/surfaces/control_protocol/basic_ui.cc b/libs/surfaces/control_protocol/basic_ui.cc index cda5497700..8f7c0ed771 100644 --- a/libs/surfaces/control_protocol/basic_ui.cc +++ b/libs/surfaces/control_protocol/basic_ui.cc @@ -122,7 +122,8 @@ BasicUI::transport_play (bool from_last_start) } if (session->get_play_range ()) { - session->request_play_range (false); + list<AudioRange> empty; + session->request_play_range (empty, false); } if (from_last_start && rolling) { |