summaryrefslogtreecommitdiff
path: root/gtk2_ardour/analysis_window.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2008-09-10 15:03:30 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2008-09-10 15:03:30 +0000
commit68e943265edf04e63a8e8b8f62bab20f99d9c637 (patch)
treeff8941a59662fc0c4622944b65f7b2d5e3bdd0c3 /gtk2_ardour/analysis_window.cc
parente4372df05b7d74a6b80dbbf4b6c00cc2b31c4723 (diff)
merge from 2.0-ongoing @ 3581
git-svn-id: svn://localhost/ardour2/branches/3.0@3711 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/analysis_window.cc')
-rw-r--r--gtk2_ardour/analysis_window.cc81
1 files changed, 46 insertions, 35 deletions
diff --git a/gtk2_ardour/analysis_window.cc b/gtk2_ardour/analysis_window.cc
index 8f84febbba..b76a1b356e 100644
--- a/gtk2_ardour/analysis_window.cc
+++ b/gtk2_ardour/analysis_window.cc
@@ -262,7 +262,8 @@ AnalysisWindow::analyze_data (Gtk::Button *button)
continue;
RouteUI *rui = dynamic_cast<RouteUI *>(*i);
-
+ int n_inputs = rui->route()->n_inputs().n_audio(); // FFT is audio only
+
// Busses don't have playlists, so we need to check that we actually are working with a playlist
if (!pl || !rui)
continue;
@@ -275,29 +276,31 @@ AnalysisWindow::analyze_data (Gtk::Button *button)
for (std::list<AudioRange>::iterator j = ts.begin(); j != ts.end(); ++j) {
- nframes_t i = 0;
int n;
-
- while ( i < (*j).length() ) {
- // TODO: What about stereo+ channels? composite all to one, I guess
+ for (int channel = 0; channel < n_inputs; channel++) {
+ nframes_t x = 0;
- n = fft_graph.windowSize();
+ while ( x < (*j).length() ) {
+ // TODO: What about stereo+ channels? composite all to one, I guess
- if (i + n >= (*j).length() ) {
- n = (*j).length() - i;
- }
-
- n = pl->read(buf, mixbuf, gain, (*j).start + i, n);
-
- if ( n < fft_graph.windowSize()) {
- for (int j = n; j < fft_graph.windowSize(); j++) {
- buf[j] = 0.0;
+ n = fft_graph.windowSize();
+
+ if (x + n >= (*j).length() ) {
+ n = (*j).length() - x;
+ }
+
+ n = pl->read(buf, mixbuf, gain, (*j).start + x, n, channel);
+
+ if ( n < fft_graph.windowSize()) {
+ for (int j = n; j < fft_graph.windowSize(); j++) {
+ buf[j] = 0.0;
+ }
}
+
+ res->analyzeWindow(buf);
+
+ x += n;
}
-
- res->analyzeWindow(buf);
-
- i += n;
}
}
} else if (source_selection_regions_rb.get_active()) {
@@ -316,28 +319,36 @@ AnalysisWindow::analyze_data (Gtk::Button *button)
continue;
// cerr << " - " << (*j)->region().name() << ": " << (*j)->region().length() << " samples starting at " << (*j)->region().position() << endl;
- nframes_t i = 0;
int n;
+ for (int channel = 0; channel < n_inputs; channel++) {
- while ( i < arv->region()->length() ) {
- // TODO: What about stereo+ channels? composite all to one, I guess
+ nframes_t x = 0;
- n = fft_graph.windowSize();
- if (i + n >= arv->region()->length() ) {
- n = arv->region()->length() - i;
- }
+ nframes_t length = arv->region()->length();
- n = arv->audio_region()->read_at(buf, mixbuf, gain, arv->region()->position() + i, n);
-
- if ( n < fft_graph.windowSize()) {
- for (int j = n; j < fft_graph.windowSize(); j++) {
- buf[j] = 0.0;
+ while ( x < length ) {
+ // TODO: What about stereo+ channels? composite all to one, I guess
+
+ n = fft_graph.windowSize();
+ if (x + n >= length ) {
+ n = length - x;
}
+
+ n = arv->audio_region()->read_at(buf, mixbuf, gain, arv->region()->position() + x, n, channel);
+
+ if (n == 0)
+ break;
+
+ if ( n < fft_graph.windowSize()) {
+ for (int j = n; j < fft_graph.windowSize(); j++) {
+ buf[j] = 0.0;
+ }
+ }
+
+ res->analyzeWindow(buf);
+
+ x += n;
}
-
- res->analyzeWindow(buf);
-
- i += n;
}
// cerr << "Found: " << (*j)->get_item_name() << endl;