+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock, Glib::Threads::TRY_LOCK);
+ if (!lm.locked()) {
+ return 0;
+ }
+
+ assert(_active);
+
+ framecnt_t playback_distance = nframes;
+ boost::shared_ptr<MidiDiskstream> diskstream = midi_diskstream();
+ BufferSet& bufs = _session.get_route_buffers (n_process_buffers());
+ MidiBuffer& mbuf (bufs.get_midi (0));
+ _silent = false;
+
+ ChanCount cnt (DataType::MIDI, 1);
+ cnt.set (DataType::AUDIO, bufs.count().n_audio());
+ bufs.set_count (cnt);
+
+ if (_queue_panic) {
+ _queue_panic = false;
+ for (uint8_t chn = 0; chn < 0xf; ++chn) {
+ uint8_t buf[3] = { ((uint8_t) (MIDI_CMD_CONTROL | chn)), ((uint8_t) MIDI_CTL_SUSTAIN), 0 };
+ mbuf.push_back(0, 3, buf);
+ buf[1] = MIDI_CTL_ALL_NOTES_OFF;
+ mbuf.push_back(0, 3, buf);
+ buf[1] = MIDI_CTL_RESET_CONTROLLERS;
+ mbuf.push_back(0, 3, buf);
+ }
+ process_output_buffers (bufs, start_frame, start_frame+1, 1, false, false);
+
+ for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
+ boost::shared_ptr<Delivery> d = boost::dynamic_pointer_cast<Delivery> (*i);
+ if (d) {
+ d->flush_buffers (nframes);
+ }
+ }
+ }
+
+ diskstream->get_playback (mbuf, nframes);
+
+ process_output_buffers (bufs, start_frame, end_frame, nframes,
+ declick, (!diskstream->record_enabled() && !_session.transport_stopped()));
+
+ for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
+ boost::shared_ptr<Delivery> d = boost::dynamic_pointer_cast<Delivery> (*i);
+ if (d) {
+ d->flush_buffers (nframes);
+ }
+ }
+
+ need_butler = diskstream->commit (playback_distance);
+ return 0;
+}
+
+
+int
+Auditioner::roll_audio (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool& need_butler) {
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock, Glib::Threads::TRY_LOCK);
+ if (!lm.locked()) {
+ return 0;
+ }
+
+ assert(n_outputs().n_total() > 0);
+ assert(_active);
+
+ int dret;
+ framecnt_t playback_distance;
+ framepos_t transport_frame = _session.transport_frame();
+ boost::shared_ptr<AudioDiskstream> diskstream = audio_diskstream();
+ BufferSet& bufs = _session.get_route_buffers (n_process_buffers ());
+
+ _silent = false;
+ _amp->apply_gain_automation(false);
+
+ if ((dret = diskstream->process (bufs, transport_frame, nframes, playback_distance, (monitoring_state() == MonitoringDisk))) != 0) {
+ need_butler = diskstream->commit (playback_distance);
+ silence (nframes);
+ return dret;
+ }
+
+ process_output_buffers (bufs, start_frame, end_frame, nframes, declick, (!diskstream->record_enabled() && _session.transport_rolling()));
+ need_butler = diskstream->commit (playback_distance);
+ return 0;
+}
+
+void
+Auditioner::set_diskstream (boost::shared_ptr<Diskstream> ds)
+{
+ Track::set_diskstream (ds);
+
+ _diskstream->set_track (this);
+ if (Profile->get_trx()) {
+ _diskstream->set_destructive (false);
+ } else {
+ _diskstream->set_destructive (_mode == Destructive);
+ }
+ _diskstream->set_non_layered (_mode == NonLayered);
+ _diskstream->set_record_enabled (false);
+ _diskstream->request_input_monitoring (false);
+
+ DiskstreamChanged (); /* EMIT SIGNAL */