fix up and re-enable MTC transmission
[ardour.git] / libs / ardour / session_click.cc
index 72ce4e25f6903a8be7e4146fec9281c2469dbee1..7161de6d78fa6d2f84c6b823702ce79ebad3be40 100644 (file)
@@ -15,7 +15,6 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id$
 */
 
 #include <list>
@@ -25,6 +24,7 @@
 #include <ardour/session.h>
 #include <ardour/tempo.h>
 #include <ardour/io.h>
+#include <ardour/buffer_set.h>
 
 #include <sndfile.h>
 
@@ -40,9 +40,7 @@ void
 Session::click (nframes_t start, nframes_t nframes, nframes_t offset)
 {
        TempoMap::BBTPointList *points;
-       nframes_t end;
        Sample *buf;
-       vector<Sample*> bufs;
 
        if (_click_io == 0) {
                return;
@@ -55,9 +53,10 @@ Session::click (nframes_t start, nframes_t nframes, nframes_t offset)
                return;
        } 
 
-       end = start + nframes;
+       const nframes_t end = start + (nframes_t)floor(nframes * _transport_speed);
 
-       buf = _passthru_buffers[0];
+       BufferSet& bufs = get_scratch_buffers(ChanCount(DataType::AUDIO, 1));
+       buf = bufs.get_audio(0).data();
        points = _tempo_map->get_points (start, end);
 
        if (points == 0) {
@@ -84,7 +83,7 @@ Session::click (nframes_t start, nframes_t nframes, nframes_t offset)
                        break;
                }
        }
-
+       
   run_clicks:
        memset (buf, 0, sizeof (Sample) * nframes);
 
@@ -126,8 +125,8 @@ Session::click (nframes_t start, nframes_t nframes, nframes_t offset)
 
                i = next;
        }
-
-       _click_io->deliver_output (_passthru_buffers, 1, nframes, offset);
+       
+       _click_io->deliver_output (bufs, start, end, nframes, offset);
 }
 
 void
@@ -145,7 +144,7 @@ Session::setup_click_sounds (int which)
                        click_data = 0;
                }
 
-               string path = Config->get_click_emphasis_sound();
+               string path = Config->get_click_sound();
 
                if (path.empty()) {