Demote message about empty MIDI tracks to info.
[ardour.git] / libs / ardour / session_click.cc
index 72816f3f198ced2a033348d2e2b3c119d10edae8..e6e8749aec8c4c34367ec17f8555576e54d27b34 100644 (file)
 #include <list>
 #include <cerrno>
 
-#include "ardour/ardour.h"
+#include "ardour/amp.h"
 #include "ardour/audio_buffer.h"
 #include "ardour/buffer_set.h"
 #include "ardour/click.h"
 #include "ardour/io.h"
 #include "ardour/session.h"
 #include "ardour/tempo.h"
+#include "ardour/types.h"
 
 #include <sndfile.h>
 
@@ -36,7 +37,7 @@ using namespace std;
 using namespace ARDOUR;
 using namespace PBD;
 
-Pool Click::pool ("click", sizeof (Click), 128);
+Pool Click::pool ("click", sizeof (Click), 1024);
 
 void
 Session::click (framepos_t start, framecnt_t nframes)
@@ -50,7 +51,7 @@ Session::click (framepos_t start, framecnt_t nframes)
                return;
        }
 
-       Glib::RWLock::WriterLock clickm (click_lock, Glib::TRY_LOCK);
+       Glib::Threads::RWLock::WriterLock clickm (click_lock, Glib::Threads::TRY_LOCK);
 
        /* how far have we moved since the last time the clicks got cleared
         */
@@ -82,14 +83,12 @@ Session::click (framepos_t start, framecnt_t nframes)
                case 1:
                        if (click_emphasis_data) {
                                clicks.push_back (new Click ((*i).frame, click_emphasis_length, click_emphasis_data));
-                               cerr << "click emph @ " << (*i).frame << endl;
                        }
                        break;
 
                default:
                        if (click_emphasis_data == 0 || (click_emphasis_data && (*i).beat != 1)) {
                                clicks.push_back (new Click ((*i).frame, click_length, click_data));
-                               cerr << "click norm @ " << (*i).frame << endl;
                        }
                        break;
                }
@@ -120,9 +119,9 @@ Session::click (framepos_t start, framecnt_t nframes)
                }
 
                copy = min (clk->duration - clk->offset, nframes - internal_offset);
-
+               
                memcpy (buf + internal_offset, &clk->data[clk->offset], copy * sizeof (Sample));
-
+               
                clk->offset += copy;
 
                if (clk->offset >= clk->duration) {
@@ -133,6 +132,7 @@ Session::click (framepos_t start, framecnt_t nframes)
                }
        }
 
+       _click_gain->run (bufs, 0, 0, nframes, false);
        _click_io->copy_to_outputs (bufs, DataType::AUDIO, nframes, 0);
 }
 
@@ -225,7 +225,7 @@ Session::setup_click_sounds (int which)
 void
 Session::clear_clicks ()
 {
-       Glib::RWLock::WriterLock lm (click_lock);
+       Glib::Threads::RWLock::WriterLock lm (click_lock);
 
        for (Clicks::iterator i = clicks.begin(); i != clicks.end(); ++i) {
                delete *i;