#include <pbd/error.h>
#include <pbd/pthread_utils.h>
+#include <pbd/stacktrace.h>
#include <ardour/configuration.h>
#include <ardour/audioengine.h>
Session::start_butler_thread ()
{
/* size is in Samples, not bytes */
-
- dstream_buffer_size = (uint32_t) floor (Config->get_track_buffer_seconds() * (float) frame_rate());
-
- Crossfade::set_buffer_size (dstream_buffer_size);
+ audio_dstream_buffer_size = (uint32_t) floor (Config->get_audio_track_buffer_seconds() * (float) frame_rate());
+
+ /* size is in bytes
+ * XXX: Jack needs to tell us the MIDI buffer size
+ * (i.e. how many MIDI bytes we might see in a cycle)
+ */
+ midi_dstream_buffer_size = (uint32_t) floor (Config->get_midi_track_buffer_seconds() * (float)frame_rate());
+
+ Crossfade::set_buffer_size (audio_dstream_buffer_size);
butler_should_run = false;
{
char c = ButlerRequest::Run;
::write (butler_request_pipe[1], &c, 1);
+ // PBD::stacktrace (cerr);
}
void
}
}
- //for (i = diskstreams.begin(); i != diskstreams.end(); ++i) {
- // cerr << "BEFORE " << (*i)->name() << ": pb = " << (*i)->playback_buffer_load() << " cp = " << (*i)->capture_buffer_load() << endl;
- //}
-
if (transport_work_requested()) {
butler_transport_work ();
}
gettimeofday (&begin, 0);
boost::shared_ptr<DiskstreamList> dsl = diskstreams.reader ();
-
+
+// for (i = dsl->begin(); i != dsl->end(); ++i) {
+// cerr << "BEFORE " << (*i)->name() << ": pb = " << (*i)->playback_buffer_load() << " cp = " << (*i)->capture_buffer_load() << endl;
+// }
+
for (i = dsl->begin(); !transport_work_requested() && butler_should_run && i != dsl->end(); ++i) {
boost::shared_ptr<Diskstream> ds = *i;
+ /* don't read inactive tracks */
+
+ IO* io = ds->io();
+
+ if (io && !io->active()) {
+ continue;
+ }
+
switch (ds->do_refill ()) {
case 0:
bytes += ds->read_data_count();
for (i = dsl->begin(); !transport_work_requested() && butler_should_run && i != dsl->end(); ++i) {
// cerr << "write behind for " << (*i)->name () << endl;
+
+ /* note that we still try to flush diskstreams attached to inactive routes
+ */
switch ((*i)->do_flush (Session::ButlerContext)) {
case 0: