mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
add region & range loudnless report
This commit is contained in:
parent
361309d83f
commit
c9d6d9ed85
6 changed files with 155 additions and 9 deletions
|
|
@ -306,7 +306,8 @@
|
|||
<menuitem action='loop-region'/>
|
||||
<menuitem action='rename-region'/>
|
||||
<menuitem action='show-region-properties'/>
|
||||
<menuitem action='analyze-region'/>
|
||||
<menuitem action='loudness-analyze-region'/>
|
||||
<menuitem action='spectal-analyze-region'/>
|
||||
<menu action='RegionMenuEdit'>
|
||||
<menuitem action='combine-regions'/>
|
||||
<menuitem action='uncombine-regions'/>
|
||||
|
|
@ -774,7 +775,8 @@
|
|||
<menuitem action='export-region'/>
|
||||
<menuitem action='bounce-regions-processed'/>
|
||||
<menuitem action='bounce-regions-unprocessed'/>
|
||||
<menuitem action='analyze-region'/>
|
||||
<menuitem action='loudness-analyze-region'/>
|
||||
<menuitem action='spectral-analyze-region'/>
|
||||
<separator/>
|
||||
<menuitem action='remove-region'/>
|
||||
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@
|
|||
#include "gtkmm2ext/choice.h"
|
||||
#include "gtkmm2ext/cell_renderer_pixbuf_toggle.h"
|
||||
|
||||
#include "ardour/analysis_graph.h"
|
||||
#include "ardour/audio_track.h"
|
||||
#include "ardour/audioengine.h"
|
||||
#include "ardour/audioregion.h"
|
||||
|
|
@ -102,6 +103,7 @@
|
|||
#include "editor_routes.h"
|
||||
#include "editor_snapshots.h"
|
||||
#include "editor_summary.h"
|
||||
#include "export_report.h"
|
||||
#include "global_port_matrix.h"
|
||||
#include "gui_object.h"
|
||||
#include "gui_thread.h"
|
||||
|
|
@ -121,6 +123,7 @@
|
|||
#include "rgb_macros.h"
|
||||
#include "rhythm_ferret.h"
|
||||
#include "selection.h"
|
||||
#include "simple_progress_dialog.h"
|
||||
#include "sfdb_ui.h"
|
||||
#include "tempo_lines.h"
|
||||
#include "time_axis_view.h"
|
||||
|
|
@ -1714,7 +1717,103 @@ Editor::build_track_region_context_menu ()
|
|||
}
|
||||
|
||||
void
|
||||
Editor::analyze_region_selection ()
|
||||
Editor::loudness_analyze_region_selection ()
|
||||
{
|
||||
if (!_session) {
|
||||
return;
|
||||
}
|
||||
Selection& s (PublicEditor::instance ().get_selection ());
|
||||
RegionSelection ars = s.regions;
|
||||
ARDOUR::AnalysisGraph ag (_session);
|
||||
framecnt_t total_work = 0;
|
||||
|
||||
for (RegionSelection::iterator j = ars.begin (); j != ars.end (); ++j) {
|
||||
AudioRegionView* arv = dynamic_cast<AudioRegionView*> (*j);
|
||||
if (!arv) {
|
||||
continue;
|
||||
}
|
||||
if (!boost::dynamic_pointer_cast<AudioRegion> (arv->region ())) {
|
||||
continue;
|
||||
}
|
||||
assert (dynamic_cast<RouteTimeAxisView *> (&arv->get_time_axis_view ()));
|
||||
total_work += arv->region ()->length ();
|
||||
}
|
||||
|
||||
SimpleProgressDialog spd (_("Region Loudness Analysis"), sigc::mem_fun (ag, &AnalysisGraph::cancel));
|
||||
ScopedConnection c;
|
||||
ag.set_total_frames (total_work);
|
||||
ag.Progress.connect_same_thread (c, boost::bind (&SimpleProgressDialog::update_progress, &spd, _1, _2));
|
||||
spd.show();
|
||||
|
||||
for (RegionSelection::iterator j = ars.begin (); j != ars.end (); ++j) {
|
||||
AudioRegionView* arv = dynamic_cast<AudioRegionView*> (*j);
|
||||
if (!arv) {
|
||||
continue;
|
||||
}
|
||||
boost::shared_ptr<AudioRegion> ar = boost::dynamic_pointer_cast<AudioRegion> (arv->region ());
|
||||
if (!ar) {
|
||||
continue;
|
||||
}
|
||||
ag.analyze_region (ar);
|
||||
}
|
||||
spd.hide();
|
||||
if (!ag.canceled ()) {
|
||||
ExportReport er (_("Audio Report/Analysis"), ag.results ());
|
||||
er.run();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Editor::loudness_analyze_range_selection ()
|
||||
{
|
||||
if (!_session) {
|
||||
return;
|
||||
}
|
||||
Selection& s (PublicEditor::instance ().get_selection ());
|
||||
TimeSelection ts = s.time;
|
||||
ARDOUR::AnalysisGraph ag (_session);
|
||||
framecnt_t total_work = 0;
|
||||
|
||||
for (TrackSelection::iterator i = s.tracks.begin (); i != s.tracks.end (); ++i) {
|
||||
boost::shared_ptr<AudioPlaylist> pl = boost::dynamic_pointer_cast<AudioPlaylist> ((*i)->playlist ());
|
||||
if (!pl) {
|
||||
continue;
|
||||
}
|
||||
RouteUI *rui = dynamic_cast<RouteUI *> (*i);
|
||||
if (!pl || !rui) {
|
||||
continue;
|
||||
}
|
||||
for (std::list<AudioRange>::iterator j = ts.begin (); j != ts.end (); ++j) {
|
||||
total_work += j->length ();
|
||||
}
|
||||
}
|
||||
|
||||
SimpleProgressDialog spd (_("Range Loudness Analysis"), sigc::mem_fun (ag, &AnalysisGraph::cancel));
|
||||
ScopedConnection c;
|
||||
ag.set_total_frames (total_work);
|
||||
ag.Progress.connect_same_thread (c, boost::bind (&SimpleProgressDialog::update_progress, &spd, _1, _2));
|
||||
spd.show();
|
||||
|
||||
for (TrackSelection::iterator i = s.tracks.begin (); i != s.tracks.end (); ++i) {
|
||||
boost::shared_ptr<AudioPlaylist> pl = boost::dynamic_pointer_cast<AudioPlaylist> ((*i)->playlist ());
|
||||
if (!pl) {
|
||||
continue;
|
||||
}
|
||||
RouteUI *rui = dynamic_cast<RouteUI *> (*i);
|
||||
if (!pl || !rui) {
|
||||
continue;
|
||||
}
|
||||
ag.analyze_range (rui->route (), pl, ts);
|
||||
}
|
||||
spd.hide();
|
||||
if (!ag.canceled ()) {
|
||||
ExportReport er (_("Audio Report/Analysis"), ag.results ());
|
||||
er.run();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Editor::spectral_analyze_region_selection ()
|
||||
{
|
||||
if (analysis_window == 0) {
|
||||
analysis_window = new AnalysisWindow();
|
||||
|
|
@ -1732,7 +1831,7 @@ Editor::analyze_region_selection ()
|
|||
}
|
||||
|
||||
void
|
||||
Editor::analyze_range_selection()
|
||||
Editor::spectral_analyze_range_selection()
|
||||
{
|
||||
if (analysis_window == 0) {
|
||||
analysis_window = new AnalysisWindow();
|
||||
|
|
@ -1826,7 +1925,8 @@ Editor::add_selection_context_items (Menu_Helpers::MenuList& edit_items)
|
|||
edit_items.push_back (MenuElem (_("Zoom to Range"), sigc::bind (sigc::mem_fun(*this, &Editor::temporal_zoom_selection), false)));
|
||||
|
||||
edit_items.push_back (SeparatorElem());
|
||||
edit_items.push_back (MenuElem (_("Spectral Analysis"), sigc::mem_fun(*this, &Editor::analyze_range_selection)));
|
||||
edit_items.push_back (MenuElem (_("Loudness Analysis"), sigc::mem_fun(*this, &Editor::loudness_analyze_range_selection)));
|
||||
edit_items.push_back (MenuElem (_("Spectral Analysis"), sigc::mem_fun(*this, &Editor::spectral_analyze_range_selection)));
|
||||
|
||||
edit_items.push_back (SeparatorElem());
|
||||
|
||||
|
|
|
|||
|
|
@ -274,8 +274,11 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
|||
|
||||
/* analysis window */
|
||||
|
||||
void analyze_region_selection();
|
||||
void analyze_range_selection();
|
||||
void loudness_analyze_region_selection();
|
||||
void loudness_analyze_range_selection();
|
||||
|
||||
void spectral_analyze_region_selection();
|
||||
void spectral_analyze_range_selection();
|
||||
|
||||
/* export */
|
||||
|
||||
|
|
|
|||
|
|
@ -1924,7 +1924,8 @@ Editor::register_region_actions ()
|
|||
reg_sens (_region_actions, "combine-regions", _("Combine"), sigc::mem_fun (*this, &Editor::combine_regions));
|
||||
reg_sens (_region_actions, "uncombine-regions", _("Uncombine"), sigc::mem_fun (*this, &Editor::uncombine_regions));
|
||||
|
||||
reg_sens (_region_actions, "analyze-region", _("Spectral Analysis..."), sigc::mem_fun (*this, &Editor::analyze_region_selection));
|
||||
reg_sens (_region_actions, "loudness-analyze-region", _("Loudness Analysis..."), sigc::mem_fun (*this, &Editor::loudness_analyze_region_selection));
|
||||
reg_sens (_region_actions, "spectral-analyze-region", _("Spectral Analysis..."), sigc::mem_fun (*this, &Editor::spectral_analyze_region_selection));
|
||||
|
||||
reg_sens (_region_actions, "reset-region-gain-envelopes", _("Reset Envelope"), sigc::mem_fun (*this, &Editor::reset_region_gain_envelopes));
|
||||
|
||||
|
|
|
|||
|
|
@ -1258,7 +1258,8 @@ Editor::sensitize_the_right_region_actions ()
|
|||
|
||||
} else {
|
||||
|
||||
_region_actions->get_action("analyze-region")->set_sensitive (false);
|
||||
_region_actions->get_action("loudness-analyze-region")->set_sensitive (false);
|
||||
_region_actions->get_action("spectral-analyze-region")->set_sensitive (false);
|
||||
_region_actions->get_action("reset-region-gain-envelopes")->set_sensitive (false);
|
||||
_region_actions->get_action("toggle-region-gain-envelope-active")->set_sensitive (false);
|
||||
_region_actions->get_action("pitch-shift-region")->set_sensitive (false);
|
||||
|
|
|
|||
39
gtk2_ardour/simple_progress_dialog.h
Normal file
39
gtk2_ardour/simple_progress_dialog.h
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#ifndef _ardour_gtk_simpple_progress_dialog_h_
|
||||
#define _ardour_gtk_simpple_progress_dialog_h_
|
||||
|
||||
#include <gtkmm/messagedialog.h>
|
||||
#include <gtkmm/button.h>
|
||||
#include <gtkmm/progressbar.h>
|
||||
|
||||
#include "ardour/types.h"
|
||||
|
||||
class SimpleProgressDialog : public Gtk::MessageDialog
|
||||
{
|
||||
public:
|
||||
SimpleProgressDialog (std::string title, const Glib::SignalProxy0< void >::SlotType & cancel)
|
||||
: MessageDialog (title, false, MESSAGE_OTHER, BUTTONS_NONE, true)
|
||||
{
|
||||
get_vbox()->set_size_request(400,-1);
|
||||
set_title (title);
|
||||
pbar = manage (new Gtk::ProgressBar());
|
||||
pbar->show();
|
||||
get_vbox()->pack_start (*pbar, PACK_SHRINK, 4);
|
||||
|
||||
Gtk::Button *cancel_button = add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
|
||||
cancel_button->signal_clicked().connect (cancel);
|
||||
cancel_button->show();
|
||||
get_vbox()->pack_start (*cancel_button, PACK_SHRINK);
|
||||
}
|
||||
|
||||
void update_progress (framecnt_t c, framecnt_t t) {
|
||||
pbar->set_fraction ((float) c / (float) t);
|
||||
// see also ARDOUR_UI::gui_idle_handler();
|
||||
int timeout = 30;
|
||||
while (gtk_events_pending() && --timeout) {
|
||||
gtk_main_iteration ();
|
||||
}
|
||||
}
|
||||
private:
|
||||
Gtk::ProgressBar *pbar;
|
||||
};
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue