X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fbutler.cc;h=46bb830cbe19717070dc9e5a7f99754c0a1921e9;hb=ecbd2ebb7446f9f3069145ea8b233e30a9218060;hp=3b717942f3190b40def969d385c96ef1eb55add4;hpb=dbf3ba2d73dfa2b3230ff5829e4a4a49c7c5ba5f;p=ardour.git diff --git a/libs/ardour/butler.cc b/libs/ardour/butler.cc index 3b717942f3..46bb830cbe 100644 --- a/libs/ardour/butler.cc +++ b/libs/ardour/butler.cc @@ -87,7 +87,7 @@ Butler::start_thread() */ midi_dstream_buffer_size = (uint32_t) floor (Config->get_midi_track_buffer_seconds() * rate); - MidiDiskstream::set_readahead_frames ((nframes_t)(Config->get_midi_readahead() * rate)); + MidiDiskstream::set_readahead_frames ((framecnt_t) (Config->get_midi_readahead() * rate)); Crossfade::set_buffer_size (audio_dstream_playback_buffer_size); @@ -135,7 +135,7 @@ Butler::terminate_thread () void * Butler::_thread_work (void* arg) { - SessionEvent::create_per_thread_pool ("butler events", 64); + SessionEvent::create_per_thread_pool ("butler events", 4096); pthread_set_name (X_("butler")); return ((Butler *) arg)->thread_work (); } @@ -216,14 +216,17 @@ Butler::thread_work () } } - if (transport_work_requested()) { - _session.butler_transport_work (); - } - disk_work_outstanding = false; bytes = 0; compute_io = true; +restart: + disk_work_outstanding = false; + + if (transport_work_requested()) { + _session.butler_transport_work (); + } + begin = get_microseconds(); boost::shared_ptr rl = _session.get_routes(); @@ -238,15 +241,15 @@ Butler::thread_work () for (i = rl_with_auditioner.begin(); !transport_work_requested() && should_run && i != rl_with_auditioner.end(); ++i) { boost::shared_ptr tr = boost::dynamic_pointer_cast (*i); + if (!tr) { continue; } - /* don't read inactive tracks */ - boost::shared_ptr io = tr->input (); if (io && !io->active()) { + /* don't read inactive tracks */ continue; } @@ -273,7 +276,7 @@ Butler::thread_work () } if (!err && transport_work_requested()) { - continue; + goto restart; } if (compute_io) { @@ -293,10 +296,11 @@ Butler::thread_work () // cerr << "write behind for " << (*i)->name () << endl; boost::shared_ptr tr = boost::dynamic_pointer_cast (*i); + if (!tr) { continue; } - + /* note that we still try to flush diskstreams attached to inactive routes */ @@ -332,7 +336,7 @@ Butler::thread_work () } if (!err && transport_work_requested()) { - continue; + goto restart; } if (compute_io) { @@ -358,7 +362,7 @@ Butler::thread_work () // cerr << "AFTER " << (*i)->name() << ": pb = " << (*i)->playback_buffer_load() << " cp = " << (*i)->capture_buffer_load() << endl; // } - continue; + goto restart; } paused.signal(); @@ -432,12 +436,12 @@ void Butler::empty_pool_trash () { /* look in the trash, deleting empty pools until we come to one that is not empty */ - + RingBuffer::rw_vector vec; pool_trash.get_read_vector (&vec); guint deleted = 0; - + for (int i = 0; i < 2; ++i) { for (guint j = 0; j < vec.len[i]; ++j) { if (vec.buf[i][j]->empty()) {