Use glibmm to simplify my earlier efforts with 'user_config_directory()' and 'user_ca...
[ardour.git] / libs / ardour / track.cc
index 3ad5733320b567898b35dda4dcc6ca9eca0ff825..57239cb841a35201f9d9438bdee416e984978e3f 100644 (file)
@@ -398,6 +398,9 @@ Track::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
                case MonitoringInput:
                        be_silent = false;
                        break;
+               default:
+                       be_silent = false;
+                       break;
                }
        }
 
@@ -416,9 +419,18 @@ Track::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
                        bool const tape_machine_mode = Config->get_tape_machine_mode ();
                        bool no_meter = false;
 
+                       /* this needs a proper K-map
+                        * and should be separated into a function similar to monitoring_state()
+                        * that also handles roll() states in audio_track.cc, midi_track.cc and route.cc
+                        *
+                        * see http://www.oofus.co.uk/ardour/Ardour3MonitorModesV3.pdf
+                        */
                        if (!auto_input && !track_rec) {
                                no_meter=true;
                        }
+                       else if (tape_machine_mode && !track_rec && auto_input) {
+                               no_meter=true;
+                       }
                        else if (!software_monitor && tape_machine_mode && !track_rec) {
                                no_meter=true;
                        }
@@ -427,7 +439,8 @@ Track::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
                        }
 
                        if (no_meter) {
-                               _meter->reset();
+                               BufferSet& bufs (_session.get_silent_buffers (n_process_buffers()));
+                               _meter->run (bufs, 0, 0, nframes, true);
                                _input->process_input (boost::shared_ptr<Processor>(), start_frame, end_frame, nframes);
                        } else {
                                _input->process_input (_meter, start_frame, end_frame, nframes);
@@ -438,7 +451,7 @@ Track::no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
 
        } else {
 
-               BufferSet& bufs = _session.get_scratch_buffers (n_process_buffers());
+               BufferSet& bufs = _session.get_route_buffers (n_process_buffers());
                
                fill_buffers_with_input (bufs, _input, nframes);
 
@@ -464,6 +477,10 @@ Track::silent_roll (pframes_t nframes, framepos_t /*start_frame*/, framepos_t /*
 {
        Glib::Threads::RWLock::ReaderLock lm (_processor_lock, Glib::Threads::TRY_LOCK);
        if (!lm.locked()) {
+               framecnt_t playback_distance = _diskstream->calculate_playback_distance(nframes);
+               if (can_internal_playback_seek(playback_distance)) {
+                       internal_playback_seek(playback_distance);
+               }
                return 0;
        }
 
@@ -483,7 +500,7 @@ Track::silent_roll (pframes_t nframes, framepos_t /*start_frame*/, framepos_t /*
 
        framecnt_t playback_distance;
 
-       BufferSet& bufs (_session.get_silent_buffers (n_process_buffers()));
+       BufferSet& bufs (_session.get_route_buffers (n_process_buffers(), true));
 
        int const dret = _diskstream->process (bufs, _session.transport_frame(), nframes, playback_distance, false);
        need_butler = _diskstream->commit (playback_distance);
@@ -533,15 +550,15 @@ Track::playlist ()
 }
 
 void
-Track::request_jack_monitors_input (bool m)
+Track::request_input_monitoring (bool m)
 {
-       _diskstream->request_jack_monitors_input (m);
+       _diskstream->request_input_monitoring (m);
 }
 
 void
-Track::ensure_jack_monitors_input (bool m)
+Track::ensure_input_monitoring (bool m)
 {
-       _diskstream->ensure_jack_monitors_input (m);
+       _diskstream->ensure_input_monitoring (m);
 }
 
 bool