projects
/
ardour.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Plugin selector keyboard focus should now stay in the plugin list. More
[ardour.git]
/
gtk2_ardour
/
analysis_window.cc
diff --git
a/gtk2_ardour/analysis_window.cc
b/gtk2_ardour/analysis_window.cc
index a26186ab423315dc08b451d7ff3e3499be05ceba..24c6cc4fb8ea3d070f4c36e8ea526825a3d0fcb9 100644
(file)
--- a/
gtk2_ardour/analysis_window.cc
+++ b/
gtk2_ardour/analysis_window.cc
@@
-1,5
+1,6
@@
/*
Copyright (C) 2006 Paul Davis
/*
Copyright (C) 2006 Paul Davis
+ Written by Sampo Savolainen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@
-15,9
+16,9
@@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ $Id$
*/
*/
-
#include <gtkmm2ext/gtk_ui.h>
#include <gtkmm/stock.h>
#include <gtkmm/label.h>
#include <gtkmm2ext/gtk_ui.h>
#include <gtkmm/stock.h>
#include <gtkmm/label.h>
@@
-25,7
+26,7
@@
#include <gtkmm/treeiter.h>
#include <ardour/audioregion.h>
#include <gtkmm/treeiter.h>
#include <ardour/audioregion.h>
-#include <ardour/playlist.h>
+#include <ardour/
audio
playlist.h>
#include <ardour/types.h>
#include "analysis_window.h"
#include <ardour/types.h>
#include "analysis_window.h"
@@
-34,27
+35,26
@@
#include "time_axis_view.h"
#include "public_editor.h"
#include "selection.h"
#include "time_axis_view.h"
#include "public_editor.h"
#include "selection.h"
-#include "
region
view.h"
+#include "
audio_region_
view.h"
#include "i18n.h"
using namespace ARDOUR;
#include "i18n.h"
using namespace ARDOUR;
+using namespace PBD;
AnalysisWindow::AnalysisWindow()
: ArdourDialog(_("analysis window")),
AnalysisWindow::AnalysisWindow()
: ArdourDialog(_("analysis window")),
- fft_graph (2048),
-
source_selection_label (_("Signal source")),
source_selection_ranges_rb (_("Selected ranges")),
source_selection_regions_rb (_("Selected regions")),
source_selection_label (_("Signal source")),
source_selection_ranges_rb (_("Selected ranges")),
source_selection_regions_rb (_("Selected regions")),
-
+
display_model_label (_("Display model")),
display_model_composite_separate_rb (_("Composite graphs for each track")),
display_model_label (_("Display model")),
display_model_composite_separate_rb (_("Composite graphs for each track")),
- display_model_composite_all_tracks_rb (_("Composite graph of all tracks"))
+ display_model_composite_all_tracks_rb (_("Composite graph of all tracks"))
,
+ fft_graph (2048)
{
{
-
track_list_ready = false;
// Left side: track list + controls
track_list_ready = false;
// Left side: track list + controls
@@
-200,12
+200,18
@@
AnalysisWindow::clear_tracklist()
tlmodel->clear();
}
tlmodel->clear();
}
+void
+AnalysisWindow::analyze()
+{
+ analyze_data(&refresh_button);
+}
+
void
AnalysisWindow::analyze_data (Gtk::Button *button)
{
track_list_ready = false;
{
void
AnalysisWindow::analyze_data (Gtk::Button *button)
{
track_list_ready = false;
{
-
LockMonitor lm (track_list_lock, __LINE__, __FILE__
);
+
Glib::Mutex::Lock lm (track_list_lock
);
// Empty track list & free old graphs
clear_tracklist();
// Empty track list & free old graphs
clear_tracklist();
@@
-215,22
+221,26
@@
AnalysisWindow::analyze_data (Gtk::Button *button)
Sample *buf = (Sample *) malloc(sizeof(Sample) * fft_graph.windowSize());
Sample *mixbuf = (Sample *) malloc(sizeof(Sample) * fft_graph.windowSize());
float *gain = (float *) malloc(sizeof(float) * fft_graph.windowSize());
Sample *buf = (Sample *) malloc(sizeof(Sample) * fft_graph.windowSize());
Sample *mixbuf = (Sample *) malloc(sizeof(Sample) * fft_graph.windowSize());
float *gain = (float *) malloc(sizeof(float) * fft_graph.windowSize());
- char *work = (char *) malloc(sizeof(char) * fft_graph.windowSize());
Selection s = PublicEditor::instance().get_selection();
TimeSelection ts = s.time;
Selection s = PublicEditor::instance().get_selection();
TimeSelection ts = s.time;
-
AudioRegionSelection ars = s.audio_
regions;
+
RegionSelection ars = s.
regions;
for (TrackSelection::iterator i = s.tracks.begin(); i != s.tracks.end(); ++i) {
for (TrackSelection::iterator i = s.tracks.begin(); i != s.tracks.end(); ++i) {
- ARDOUR::Playlist *pl = (*i)->playlist();
+ ARDOUR::AudioPlaylist *pl
+ = dynamic_cast<ARDOUR::AudioPlaylist*>((*i)->playlist());
+
+ if (!pl)
+ continue;
+
RouteUI *rui = dynamic_cast<RouteUI *>(*i);
// Busses don't have playlists, so we need to check that we actually are working with a playlist
if (!pl || !rui)
continue;
RouteUI *rui = dynamic_cast<RouteUI *>(*i);
// Busses don't have playlists, so we need to check that we actually are working with a playlist
if (!pl || !rui)
continue;
- FFTResult *res = fft_graph.prepareResult(
*&rui->color(), *&rui->route().
name());
+ FFTResult *res = fft_graph.prepareResult(
rui->color(), rui->route()->
name());
// if timeSelection
if (source_selection_ranges_rb.get_active()) {
// if timeSelection
if (source_selection_ranges_rb.get_active()) {
@@
-250,7
+260,7
@@
AnalysisWindow::analyze_data (Gtk::Button *button)
n = (*j).length() - i;
}
n = (*j).length() - i;
}
- n = pl->read(buf, mixbuf, gain,
work,
(*j).start + i, n);
+ n = pl->read(buf, mixbuf, gain, (*j).start + i, n);
if ( n < fft_graph.windowSize()) {
for (int j = n; j < fft_graph.windowSize(); j++) {
if ( n < fft_graph.windowSize()) {
for (int j = n; j < fft_graph.windowSize(); j++) {
@@
-268,24
+278,29
@@
AnalysisWindow::analyze_data (Gtk::Button *button)
TimeAxisView *current_axis = (*i);
TimeAxisView *current_axis = (*i);
- for (std::set<AudioRegionView *>::iterator j = ars.begin(); j != ars.end(); ++j) {
+ 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
// Check that the region really is selected on _this_ track/solo
- if ( &
(*j)
->get_time_axis_view() != current_axis)
+ if ( &
arv
->get_time_axis_view() != current_axis)
continue;
continue;
-// cerr << " - " << (*j)->region
.name() << ": " << (*j)->region.length() << " samples starting at " << (*j)->region
.position() << endl;
+// cerr << " - " << (*j)->region
().name() << ": " << (*j)->region().length() << " samples starting at " << (*j)->region()
.position() << endl;
jack_nframes_t i = 0;
int n;
jack_nframes_t i = 0;
int n;
- while ( i <
(*j)->region
.length() ) {
+ while ( i <
arv->region()
.length() ) {
// TODO: What about stereo+ channels? composite all to one, I guess
n = fft_graph.windowSize();
// TODO: What about stereo+ channels? composite all to one, I guess
n = fft_graph.windowSize();
- if (i + n >=
(*j)->region
.length() ) {
- n =
(*j)->region
.length() - i;
+ if (i + n >=
arv->region()
.length() ) {
+ n =
arv->region()
.length() - i;
}
}
-
- n =
(*j)->region.read_at(buf, mixbuf, gain, work, (*j)->region
.position() + i, n);
+
+ 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++) {
if ( n < fft_graph.windowSize()) {
for (int j = n; j < fft_graph.windowSize(); j++) {
@@
-306,16
+321,15
@@
AnalysisWindow::analyze_data (Gtk::Button *button)
Gtk::TreeModel::Row newrow = *(tlmodel)->append();
Gtk::TreeModel::Row newrow = *(tlmodel)->append();
- newrow[tlcols.trackname] = rui->route()
.
name();
+ newrow[tlcols.trackname] = rui->route()
->
name();
newrow[tlcols.visible] = true;
newrow[tlcols.visible] = true;
- newrow[tlcols.color] =
*&
rui->color();
+ newrow[tlcols.color] = rui->color();
newrow[tlcols.graph] = res;
}
free(buf);
free(mixbuf);
newrow[tlcols.graph] = res;
}
free(buf);
free(mixbuf);
- free(work);
track_list_ready = true;
} /* end lock */
track_list_ready = true;
} /* end lock */