Respond to MMC even when synced to JACK. Fixes #3700.
[ardour.git] / libs / ardour / butler.cc
index 1efca35196b1072615ada74ebc51dd2d97c37909..72f2a0971d0cce97d35799c3eb1c73fd6320fe76 100644 (file)
@@ -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);
 
@@ -127,7 +127,7 @@ Butler::terminate_thread ()
        if (thread) {
                void* status;
                const char c = Request::Quit;
-               ::write (request_pipe[1], &c, 1);
+               (void) ::write (request_pipe[1], &c, 1);
                pthread_join (thread, &status);
        }
 }
@@ -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<RouteList> rl = _session.get_routes();
@@ -273,7 +276,7 @@ Butler::thread_work ()
                }
 
                if (!err && transport_work_requested()) {
-                       continue;
+                       goto restart;
                }
 
                if (compute_io) {
@@ -332,7 +335,7 @@ Butler::thread_work ()
                }
 
                if (!err && transport_work_requested()) {
-                       continue;
+                       goto restart;
                }
 
                if (compute_io) {
@@ -358,7 +361,7 @@ Butler::thread_work ()
 //                                     cerr << "AFTER " << (*i)->name() << ": pb = " << (*i)->playback_buffer_load() << " cp = " << (*i)->capture_buffer_load() << endl;
 //                             }
 
-                               continue;
+                               goto restart;
                        }
 
                        paused.signal();
@@ -383,7 +386,7 @@ void
 Butler::summon ()
 {
        char c = Request::Run;
-       ::write (request_pipe[1], &c, 1);
+       (void) ::write (request_pipe[1], &c, 1);
 }
 
 void
@@ -391,7 +394,7 @@ Butler::stop ()
 {
        Glib::Mutex::Lock lm (request_lock);
        char c = Request::Pause;
-       ::write (request_pipe[1], &c, 1);
+       (void) ::write (request_pipe[1], &c, 1);
        paused.wait(request_lock);
 }
 
@@ -400,7 +403,7 @@ Butler::wait_until_finished ()
 {
        Glib::Mutex::Lock lm (request_lock);
        char c = Request::Wake;
-       ::write (request_pipe[1], &c, 1);
+       (void) ::write (request_pipe[1], &c, 1);
        paused.wait(request_lock);
 }