diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2010-12-07 15:15:25 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2010-12-07 15:15:25 +0000 |
commit | eead73098d19743446c1d5d615e1106efe6e37a1 (patch) | |
tree | c957ae9c3985430f36117ef1ea6d764790d7f0e7 | |
parent | b83f21c3cf6f9385697ce4b2ca2b0f840a8438aa (diff) |
reimplement Route::shift() from 2.X for "Insert Time"
git-svn-id: svn://localhost/ardour2/branches/3.0@8209 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | libs/ardour/ardour/route.h | 5 | ||||
-rw-r--r-- | libs/ardour/audio_track.cc | 16 | ||||
-rw-r--r-- | libs/ardour/midi_track.cc | 6 | ||||
-rw-r--r-- | libs/ardour/route.cc | 84 |
4 files changed, 58 insertions, 53 deletions
diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index 7f2f5dc719..5a6fbd04b6 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -404,8 +404,9 @@ class Route : public SessionObject, public Automatable, public RouteGroupMember, framecnt_t /* nframes */) {} virtual void process_output_buffers (BufferSet& bufs, - framepos_t start_frame, framepos_t end_frame, - pframes_t nframes, bool with_processors, int declick); + framepos_t start_frame, framepos_t end_frame, + pframes_t nframes, bool with_processors, int declick, + bool gain_automation_ok); boost::shared_ptr<IO> _input; boost::shared_ptr<IO> _output; diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc index 182fdccd26..0b963f19bc 100644 --- a/libs/ardour/audio_track.cc +++ b/libs/ardour/audio_track.cc @@ -503,21 +503,11 @@ AudioTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_fram bufs.set_count (chn); } - /* don't waste time with automation if we're recording or we've just stopped (yes it can happen) */ + /* final argument: don't waste time with automation if we're recording or we've just stopped (yes it can happen) */ - if (!diskstream->record_enabled() && _session.transport_rolling()) { -#ifdef XXX_MOVE_THIS_TO_AMP - Glib::Mutex::Lock am (data().control_lock(), Glib::TRY_LOCK); + process_output_buffers (bufs, start_frame, end_frame, nframes, (!_session.get_record_enabled() || !Config->get_do_not_record_plugins()), declick, + (!diskstream->record_enabled() && _session.transport_rolling())); - if (am.locked() && gain_control()->automation_playback()) { - _amp->apply_gain_automation( - gain_control()->list()->curve().rt_safe_get_vector ( - start_frame, end_frame, _session.gain_automation_buffer(), nframes)); - } -#endif - } - - process_output_buffers (bufs, start_frame, end_frame, nframes, (!_session.get_record_enabled() || !Config->get_do_not_record_plugins()), declick); } else { /* problem with the diskstream; just be quiet for a bit */ diff --git a/libs/ardour/midi_track.cc b/libs/ardour/midi_track.cc index fa406adfa0..cdd4633448 100644 --- a/libs/ardour/midi_track.cc +++ b/libs/ardour/midi_track.cc @@ -379,9 +379,11 @@ MidiTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame write_out_of_band_data (bufs, start_frame, end_frame, nframes); - process_output_buffers (bufs, start_frame, end_frame, nframes, - (!_session.get_record_enabled() || !Config->get_do_not_record_plugins()), declick); + /* final argument: don't waste time with automation if we're recording or we've just stopped (yes it can happen) */ + process_output_buffers (bufs, start_frame, end_frame, nframes, + (!_session.get_record_enabled() || !Config->get_do_not_record_plugins()), declick, + (!diskstream->record_enabled() && !_session.transport_stopped())); } _main_outs->flush_buffers (nframes, end_frame - start_frame - 1); diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index dba087c61d..5de42c0b96 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -383,7 +383,8 @@ Route::set_gain (gain_t val, void *src) void Route::process_output_buffers (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, pframes_t nframes, - bool /*with_processors*/, int declick) + bool /*with_processors*/, int declick, + bool gain_automation_ok) { bool monitor; @@ -403,9 +404,12 @@ Route::process_output_buffers (BufferSet& bufs, } /* figure out if we're going to use gain automation */ - _amp->setup_gain_automation (start_frame, end_frame, nframes); - - + if (gain_automation_ok) { + _amp->setup_gain_automation (start_frame, end_frame, nframes); + } else { + _amp->apply_gain_automation (false); + } + /* tell main outs what to do about monitoring */ _main_outs->no_outs_cuz_we_no_monitor (!monitor); @@ -543,7 +547,7 @@ Route::passthru (framepos_t start_frame, framepos_t end_frame, pframes_t nframes } write_out_of_band_data (bufs, start_frame, end_frame, nframes); - process_output_buffers (bufs, start_frame, end_frame, nframes, true, declick); + process_output_buffers (bufs, start_frame, end_frame, nframes, true, declick, true); } void @@ -552,7 +556,7 @@ Route::passthru_silence (framepos_t start_frame, framepos_t end_frame, pframes_t BufferSet& bufs (_session.get_silent_buffers (n_process_buffers())); bufs.set_count (_input->n_ports()); write_out_of_band_data (bufs, start_frame, end_frame, nframes); - process_output_buffers (bufs, start_frame, end_frame, nframes, true, declick); + process_output_buffers (bufs, start_frame, end_frame, nframes, true, declick, false); } void @@ -3226,44 +3230,52 @@ Route::set_pending_declick (int declick) */ void -Route::shift (framepos_t /*pos*/, framecnt_t /*frames*/) +Route::shift (framepos_t pos, framecnt_t frames) { -#ifdef THIS_NEEDS_FIXING_FOR_V3 - /* gain automation */ - XMLNode &before = _gain_control->get_state (); - _gain_control->shift (pos, frames); - XMLNode &after = _gain_control->get_state (); - _session.add_command (new MementoCommand<AutomationList> (_gain_automation_curve, &before, &after)); + { + boost::shared_ptr<AutomationControl> gc = _amp->gain_control(); + + XMLNode &before = gc->alist()->get_state (); + gc->alist()->shift (pos, frames); + XMLNode &after = gc->alist()->get_state (); + _session.add_command (new MementoCommand<AutomationList> (*gc->alist().get(), &before, &after)); + } /* pan automation */ - for (std::vector<StreamPanner*>::iterator i = _panner->begin (); i != _panner->end (); ++i) { - Curve & c = (*i)->automation (); - XMLNode &before = c.get_state (); - c.shift (pos, frames); - XMLNode &after = c.get_state (); - _session.add_command (new MementoCommand<AutomationList> (c, &before, &after)); - } + { + boost::shared_ptr<AutomationControl> pc; + uint32_t npans = _main_outs->panner()->npanners(); + + for (uint32_t p = 0; p < npans; ++p) { + pc = _main_outs->panner()->pan_control (0, p); + boost::shared_ptr<AutomationList> al = pc->alist(); + XMLNode& before = al->get_state (); + al->shift (pos, frames); + XMLNode& after = al->get_state (); + _session.add_command (new MementoCommand<AutomationList> (*al.get(), &before, &after)); + } + } /* redirect automation */ { - Glib::RWLock::ReaderLock lm (redirect_lock); - for (RedirectList::iterator i = _redirects.begin (); i != _redirects.end (); ++i) { - - set<uint32_t> a; - (*i)->what_has_automation (a); - - for (set<uint32_t>::const_iterator j = a.begin (); j != a.end (); ++j) { - AutomationList & al = (*i)->automation_list (*j); - XMLNode &before = al.get_state (); - al.shift (pos, frames); - XMLNode &after = al.get_state (); - _session.add_command (new MementoCommand<AutomationList> (al, &before, &after)); - } - } + Glib::RWLock::ReaderLock lm (_processor_lock); + for (ProcessorList::iterator i = _processors.begin (); i != _processors.end (); ++i) { + + set<Evoral::Parameter> parameters = (*i)->what_can_be_automated(); + + for (set<Evoral::Parameter>::const_iterator p = parameters.begin (); p != parameters.end (); ++p) { + boost::shared_ptr<AutomationControl> ac = (*i)->automation_control (*p); + if (ac) { + boost::shared_ptr<AutomationList> al = ac->alist(); + XMLNode &before = al->get_state (); + al->shift (pos, frames); + XMLNode &after = al->get_state (); + _session.add_command (new MementoCommand<AutomationList> (*al.get(), &before, &after)); + } + } + } } -#endif - } |