Remove unnecessary 0 checks before delete; see http://www.parashift.com/c++-faq-lite...
[ardour.git] / libs / ardour / audioengine.cc
index 1b9962744df1f739f89f4b89e6abdad809d5cf51..8b5d4ba42cfd76ce39fb6ad69c42b9a7d5bb4c69 100644 (file)
@@ -132,7 +132,7 @@ _thread_init_callback (void *arg)
           knows about it.
        */
 
-       PBD::ThreadCreatedWithRequestSize (pthread_self(), X_("Audioengine"), 4096);
+       PBD::notify_gui_about_thread_creation (pthread_self(), X_("Audioengine"), 4096);
        MIDI::JACK_MidiPort::set_process_thread (pthread_self());
 }
 
@@ -351,9 +351,7 @@ AudioEngine::process_callback (nframes_t nframes)
                   which requires interleaving with route processing.
                */
 
-               if ((*i)->sends_output()) {
-                       (*i)->cycle_start (nframes, 0);
-               }
+               (*i)->cycle_start (nframes, 0);
        }
 
        if (_freewheeling) {
@@ -368,12 +366,6 @@ AudioEngine::process_callback (nframes_t nframes)
                }
        }
        
-       // Finalize ports (ie write data if necessary)
-
-       for (Ports::iterator i = p->begin(); i != p->end(); ++i) {
-               (*i)->cycle_end (nframes, 0);
-       }
-
        if (_freewheeling) {
                return 0;
        }
@@ -412,11 +404,18 @@ AudioEngine::process_callback (nframes_t nframes)
                        Port *port = (*i);
                        
                        if (port->sends_output()) {
-                               port->get_buffer().silence(nframes);
+                               port->get_buffer(nframes, 0 ).silence(nframes);
                        }
                }
        }
 
+       // Finalize ports (ie write data if necessary)
+
+       for (Ports::iterator i = p->begin(); i != p->end(); ++i) {
+
+               (*i)->cycle_end (nframes, 0);
+       }
+
        _processed_frames = next_processed_frames;
        return 0;
 }
@@ -523,9 +522,7 @@ AudioEngine::set_session (Session *s)
                boost::shared_ptr<Ports> p = ports.reader();
 
                for (Ports::iterator i = p->begin(); i != p->end(); ++i) {
-                       if ((*i)->sends_output()) {
-                               (*i)->cycle_start (blocksize, 0);
-                       }
+                       (*i)->cycle_start (blocksize, 0);
                }
 
                s->process (blocksize);
@@ -925,8 +922,6 @@ AudioEngine::halted (void *arg)
        ae->_buffer_size = 0;
        ae->_frame_rate = 0;
 
-       cerr << "!!! HALTED !!!\n";
-
        if (was_running) {
                ae->Halted(); /* EMIT SIGNAL */
        }
@@ -1106,7 +1101,6 @@ AudioEngine::transport_stop ()
 void
 AudioEngine::transport_start ()
 {
-       // cerr << "tell JACK to start\n";
        if (_jack) {
                jack_transport_start (_jack);
        }
@@ -1212,19 +1206,10 @@ AudioEngine::connect_to_jack (string client_name)
        _jack = jack_client_open (jack_client_name.c_str(), options, &status, server_name);
 
        if (_jack == NULL) {
-
-               if (status & JackServerFailed) {
-                       error << _("Unable to connect to JACK server") << endmsg;
-               }
-               
                // error message is not useful here
                return -1;
        }
 
-       if (status & JackServerStarted) {
-               info << _("JACK server started") << endmsg;
-       }
-
        if (status & JackNameNotUnique) {
                jack_client_name = jack_get_client_name (_jack);
        }
@@ -1331,7 +1316,7 @@ AudioEngine::reconnect_to_jack ()
        
        if (Config->get_jack_time_master()) {
                jack_set_timebase_callback (_jack, 0, _jack_timebase_callback, this);
-       }
+       } 
        
        if (jack_activate (_jack) == 0) {
                _running = true;