summaryrefslogtreecommitdiff
path: root/gtk2_ardour/rhythm_ferret.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2008-02-01 04:26:22 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2008-02-01 04:26:22 +0000
commitbd3b9d763b0409c8e59d5ea38857d604e917818a (patch)
treed9d5dbb001901da5ab5522777055513a79522a77 /gtk2_ardour/rhythm_ferret.cc
parent76c658ea48e1ad11b7f407d15e5e8c1e3e55ebb4 (diff)
large chunks of code to deal with pre-analysis of audio; transient/perconset data used for new tab-to-transient; all ArdourDialogs push the splash screen out of the way; try to keep verbose canvas cursor within the editor canvas visible area; fix template use from NSD
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2983 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/rhythm_ferret.cc')
-rw-r--r--gtk2_ardour/rhythm_ferret.cc34
1 files changed, 7 insertions, 27 deletions
diff --git a/gtk2_ardour/rhythm_ferret.cc b/gtk2_ardour/rhythm_ferret.cc
index 4cdb408076..cb24e97f43 100644
--- a/gtk2_ardour/rhythm_ferret.cc
+++ b/gtk2_ardour/rhythm_ferret.cc
@@ -194,14 +194,14 @@ RhythmFerret::run_analysis ()
}
int
-RhythmFerret::run_percussion_onset_analysis (boost::shared_ptr<Readable> readable, nframes64_t offset, vector<nframes64_t>& results)
+RhythmFerret::run_percussion_onset_analysis (boost::shared_ptr<Readable> readable, nframes64_t offset, AnalysisFeatureList& results)
{
TransientDetector t (session->frame_rate());
bool existing_results = !results.empty();
for (uint32_t i = 0; i < readable->n_channels(); ++i) {
- vector<nframes64_t> these_results;
+ AnalysisFeatureList these_results;
t.reset ();
t.set_threshold (detection_threshold_adjustment.get_value());
@@ -213,38 +213,18 @@ RhythmFerret::run_percussion_onset_analysis (boost::shared_ptr<Readable> readabl
/* translate all transients to give absolute position */
- for (vector<nframes64_t>::iterator i = these_results.begin(); i != these_results.end(); ++i) {
- (*i) += offset;
+ for (AnalysisFeatureList::iterator x = these_results.begin(); x != these_results.end(); ++x) {
+ (*x) += offset;
}
/* merge */
results.insert (results.end(), these_results.begin(), these_results.end());
+ these_results.clear ();
}
-
- if (!results.empty()) {
-
- /* now resort to bring transients from different channels together */
-
- sort (results.begin(), results.end());
-
- /* remove duplicates or other things that are too close */
-
- vector<nframes64_t>::iterator i = results.begin();
- nframes64_t curr = (*i);
- nframes64_t gap_frames = (nframes64_t) floor (trigger_gap_adjustment.get_value() * (session->frame_rate() / 1000.0));
-
- ++i;
-
- while (i != results.end()) {
- if (((*i) == curr) || (((*i) - curr) < gap_frames)) {
- i = results.erase (i);
- } else {
- ++i;
- curr = *i;
- }
- }
+ if (!results.empty()) {
+ TransientDetector::cleanup_transients (results, session->frame_rate(), trigger_gap_adjustment.get_value());
}
return 0;