- } else if (source_selection_regions_rb.get_active()) {
-// cerr << "Analyzing selected regions on track " << *&rui->route().name() << endl;
-
- TimeAxisView *current_axis = (*i);
-
- for (std::set<RegionView *>::iterator j = ars.begin(); j != ars.end(); ++j) {
- // Check that the region is actually audio (so we can analyze it)
- AudioRegionView* arv = dynamic_cast<AudioRegionView*>(*j);
- if (!arv)
- continue;
-
- // Check that the region really is selected on _this_ track/solo
- if ( &arv->get_time_axis_view() != current_axis)
- continue;
-
-// cerr << " - " << (*j)->region().name() << ": " << (*j)->region().length() << " samples starting at " << (*j)->region().position() << endl;
- nframes_t i = 0;
- int n;
+ res->finalize();
+
+ Gtk::TreeModel::Row newrow = *(tlmodel)->append();
+ newrow[tlcols.trackname] = rui->route()->name();
+ newrow[tlcols.visible] = true;
+ newrow[tlcols.color] = rui->color();
+ newrow[tlcols.graph] = res;
+ }
+ } else if (source_selection_regions_rb.get_active()) {
+ RegionSelection ars = s.regions;
+ // std::cerr << "Analyzing selected regions" << std::endl;
+
+ for (RegionSelection::iterator j = ars.begin(); j != ars.end(); ++j) {
+ // Check that the region is actually audio (so we can analyze it)
+ AudioRegionView* arv = dynamic_cast<AudioRegionView*>(*j);
+ if (!arv)
+ continue;
+
+ // std::cerr << " - " << (*j)->region().name() << ": " << (*j)->region().length() << " samples starting at " << (*j)->region().position() << std::endl;
+ RouteTimeAxisView *rtav = dynamic_cast<RouteTimeAxisView *>(&arv->get_time_axis_view());
+ if (!rtav) {
+ /* shouldn't happen... */
+ continue;
+ }
+ FFTResult *res = fft_graph.prepareResult(rtav->color(), arv->get_item_name());
+ int n;
+ for (unsigned int channel = 0; channel < arv->region()->n_channels(); channel++) {
+
+ framecnt_t x = 0;
+ framecnt_t length = arv->region()->length();