diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2007-05-03 23:28:57 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2007-05-03 23:28:57 +0000 |
commit | a8da89d745c6a7e7d4c20dfcfb16b2537d767428 (patch) | |
tree | 06fb6cc1795ef89a7ed847395c550b6215e253df /libs/ardour/audioengine.cc | |
parent | 5a1ca70f07aeb999ba3f0f09dbd49f1d50505f3c (diff) |
optimize some performance bottlenecks; remove jack_nframes_t that crept back into the code
git-svn-id: svn://localhost/ardour2/branches/midi@1779 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/audioengine.cc')
-rw-r--r-- | libs/ardour/audioengine.cc | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc index 273829fa75..3b85ea2147 100644 --- a/libs/ardour/audioengine.cc +++ b/libs/ardour/audioengine.cc @@ -304,13 +304,26 @@ AudioEngine::process_callback (nframes_t nframes) return 0; } - if (run_process_cycle (session, nframes)) { - /* we were zombified, maybe because a ladspa plugin took - too long, or jackd exited, or something like that. - */ + boost::shared_ptr<Ports> p = ports.reader(); + + // Prepare ports (ie read data if necessary) + for (Ports::iterator i = p->begin(); i != p->end(); ++i) { + (*i)->cycle_start (nframes); + } + + if (session) { + session->process (nframes); + } + + if (!_running) { _processed_frames = next_processed_frames; return 0; } + + // Finalize ports (ie write data if necessary) + for (Ports::iterator i = p->begin(); i != p->end(); ++i) { + (*i)->cycle_end (); + } if (last_monitor_check + monitor_check_interval < next_processed_frames) { @@ -337,28 +350,6 @@ AudioEngine::process_callback (nframes_t nframes) } int -AudioEngine::run_process_cycle (Session* s, jack_nframes_t nframes) -{ - boost::shared_ptr<Ports> p = ports.reader(); - - // Prepare ports (ie read data if necessary) - for (Ports::iterator i = p->begin(); i != p->end(); ++i) - (*i)->cycle_start (nframes); - - s->process (nframes); - - if (!_running) { - return -1; - } - - // Finalize ports (ie write data if necessary) - for (Ports::iterator i = p->begin(); i != p->end(); ++i) - (*i)->cycle_end (); - - return 0; -} - -int AudioEngine::_sample_rate_callback (nframes_t nframes, void *arg) { return static_cast<AudioEngine *> (arg)->jack_sample_rate_callback (nframes); @@ -456,14 +447,23 @@ AudioEngine::set_session (Session *s) can before we really start running. */ - run_process_cycle (session, blocksize); - run_process_cycle (session, blocksize); - run_process_cycle (session, blocksize); - run_process_cycle (session, blocksize); - run_process_cycle (session, blocksize); - run_process_cycle (session, blocksize); - run_process_cycle (session, blocksize); - run_process_cycle (session, blocksize); + boost::shared_ptr<Ports> p = ports.reader(); + + for (Ports::iterator i = p->begin(); i != p->end(); ++i) + (*i)->cycle_start (blocksize); + + s->process (blocksize); + s->process (blocksize); + s->process (blocksize); + s->process (blocksize); + s->process (blocksize); + s->process (blocksize); + s->process (blocksize); + s->process (blocksize); + + for (Ports::iterator i = p->begin(); i != p->end(); ++i) + (*i)->cycle_end (); + } } |