Move request pipe setup into separate function
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 11 Jul 2013 18:35:26 +0000 (14:35 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Thu, 11 Jul 2013 18:35:26 +0000 (14:35 -0400)
libs/ardour/ardour/butler.h
libs/ardour/butler.cc

index cdd48c3e3a2c655a89718b5320e65ff675eeb8ab..321755197c2ba9a9f7a1ad16aad73ec18b9493be 100644 (file)
@@ -80,6 +80,8 @@ class Butler : public SessionHandleRef
 private:
        void empty_pool_trash ();
        void config_changed (std::string);
+
+       int setup_request_pipe ();
 };
 
 } // namespace ARDOUR
index db1b316368e7d1b0fc3f4cb5e6ba72a48cefc33f..38ffef6fbc860ea8eaff7a7899099aab65425f9c 100644 (file)
@@ -69,24 +69,8 @@ Butler::config_changed (std::string p)
 }
 
 int
-Butler::start_thread()
+Butler::setup_request_pipe ()
 {
-       const float rate = (float)_session.frame_rate();
-
-       /* size is in Samples, not bytes */
-       audio_dstream_capture_buffer_size = (uint32_t) floor (Config->get_audio_capture_buffer_seconds() * rate);
-       audio_dstream_playback_buffer_size = (uint32_t) floor (Config->get_audio_playback_buffer_seconds() * 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() * rate);
-
-       MidiDiskstream::set_readahead_frames ((framecnt_t) (Config->get_midi_readahead() * rate));
-
-       should_run = false;
-
        if (pipe (request_pipe)) {
                error << string_compose(_("Cannot create transport request signal pipe (%1)"),
                                strerror (errno)) << endmsg;
@@ -104,6 +88,29 @@ Butler::start_thread()
                                strerror (errno)) << endmsg;
                return -1;
        }
+       return 0;
+}
+
+int
+Butler::start_thread()
+{
+       const float rate = (float)_session.frame_rate();
+
+       /* size is in Samples, not bytes */
+       audio_dstream_capture_buffer_size = (uint32_t) floor (Config->get_audio_capture_buffer_seconds() * rate);
+       audio_dstream_playback_buffer_size = (uint32_t) floor (Config->get_audio_playback_buffer_seconds() * 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() * rate);
+
+       MidiDiskstream::set_readahead_frames ((framecnt_t) (Config->get_midi_readahead() * rate));
+
+       should_run = false;
+
+       if (setup_request_pipe() != 0) return -1;
 
        if (pthread_create_and_store ("disk butler", &thread, _thread_work, this)) {
                error << _("Session: could not create butler thread") << endmsg;