From 15936ab6d9569838024a2d83145052d1e495b2ed Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sun, 17 Feb 2008 22:41:34 +0000 Subject: a boatload of changes and fixes related to SAE menu redesign (several new operations, things set up as actions for use in the main menu; fix Editor::snap_to() since it was really severely broken for general use git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3079 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/audioanalyser.cc | 4 ++-- libs/ardour/tempo.cc | 14 +++++++------- libs/ardour/transient_detector.cc | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'libs') diff --git a/libs/ardour/audioanalyser.cc b/libs/ardour/audioanalyser.cc index 9da404e5bf..eccc38434d 100644 --- a/libs/ardour/audioanalyser.cc +++ b/libs/ardour/audioanalyser.cc @@ -119,7 +119,7 @@ AudioAnalyser::analyse (const string& path, Readable* src, uint32_t channel) /* zero fill buffer if necessary */ if (to_read != bufsize) { - memset (data + to_read, 0, (bufsize - to_read)); + memset (data + to_read, 0, (bufsize - to_read) * sizeof (Sample)); } features = plugin->process (bufs, RealTime::fromSeconds ((double) pos / sample_rate)); @@ -128,7 +128,7 @@ AudioAnalyser::analyse (const string& path, Readable* src, uint32_t channel) goto out; } - pos += stepsize; + pos += min (stepsize, to_read); if (pos >= len) { done = true; diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc index 3170d588a1..bcbb01d9c9 100644 --- a/libs/ardour/tempo.cc +++ b/libs/ardour/tempo.cc @@ -1141,16 +1141,16 @@ TempoMap::round_to_type (nframes_t frame, int dir, BBTPointType type) case Bar: if (dir < 0) { /* relax */ - } else if (dir > 0) { if (bbt.beats > 0) { bbt.bars++; + } else if (metric.frame() < frame) { + bbt.bars++; } } else { if (bbt.beats > metric.meter().beats_per_bar()/2) { bbt.bars++; } - } bbt.beats = 1; bbt.ticks = 0; @@ -1162,6 +1162,8 @@ TempoMap::round_to_type (nframes_t frame, int dir, BBTPointType type) } else if (dir > 0) { if (bbt.ticks > 0) { bbt.beats++; + } else if (metric.frame() < frame) { + bbt.beats++; } } else { if (bbt.ticks >= (Meter::ticks_per_beat/2)) { @@ -1177,11 +1179,9 @@ TempoMap::round_to_type (nframes_t frame, int dir, BBTPointType type) } - /* - cerr << "for " << frame << " round to " << bbt << " using " - << metric.start() - << endl; - */ + cerr << "for " << frame << " round to " << bbt << " using " + << metric.start() + << endl; return metric.frame() + count_frames_between (metric.start(), bbt); } diff --git a/libs/ardour/transient_detector.cc b/libs/ardour/transient_detector.cc index d24c4c9442..d3200d72e4 100644 --- a/libs/ardour/transient_detector.cc +++ b/libs/ardour/transient_detector.cc @@ -54,7 +54,7 @@ TransientDetector::use_features (Plugin::FeatureSet& features, ostream* out) if (out) { (*out) << (*f).timestamp.toString() << endl; } - + current_results->push_back (RealTime::realTime2Frame ((*f).timestamp, (nframes_t) floor(sample_rate))); } } -- cgit v1.2.3