mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 23:35:03 +01:00
Allow loudness analysis for session-range
This commit is contained in:
parent
4037534860
commit
251f683119
5 changed files with 42 additions and 11 deletions
|
|
@ -308,7 +308,10 @@ public:
|
|||
void export_selection ();
|
||||
void export_range ();
|
||||
void export_region ();
|
||||
|
||||
/* export for analysis only */
|
||||
void analyze_range_export ();
|
||||
void measure_master_loudness (bool);
|
||||
|
||||
bool process_midi_export_dialog (MidiExportDialog& dialog, boost::shared_ptr<ARDOUR::MidiRegion> midi_region);
|
||||
|
||||
|
|
|
|||
|
|
@ -92,8 +92,27 @@ Editor::export_selection ()
|
|||
}
|
||||
|
||||
void
|
||||
Editor::analyze_range_export ()
|
||||
Editor::measure_master_loudness (bool range_selection)
|
||||
{
|
||||
samplepos_t start, end;
|
||||
TimeSelection const& ts (get_selection().time);
|
||||
if (range_selection && !ts.empty ()) {
|
||||
start = ts.start();
|
||||
end = ts.end_sample();
|
||||
} else {
|
||||
start = _session->current_start_sample();
|
||||
end = _session->current_end_sample();
|
||||
}
|
||||
|
||||
if (start >= end) {
|
||||
if (range_selection) {
|
||||
ArdourMessageDialog (_("Loudness Analysis requires a session-range or range-selection."));
|
||||
} else {
|
||||
ArdourMessageDialog (_("Loudness Analysis requires a session-range."));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_session->master_volume()) {
|
||||
ArdourMessageDialog (_("Loudness Analysis is only available for sessions with a master-bus"));
|
||||
return;
|
||||
|
|
@ -104,10 +123,11 @@ Editor::analyze_range_export ()
|
|||
return;
|
||||
}
|
||||
|
||||
ARDOUR::AudioRange ar (start, end, 0);
|
||||
float prev_gain = _session->master_volume()->get_value();
|
||||
_session->master_volume ()->set_value (GAIN_COEFF_UNITY, Controllable::NoGroup);
|
||||
|
||||
LoudnessDialog ld (_session, get_selection().time);
|
||||
LoudnessDialog ld (_session, ar);
|
||||
|
||||
if (ld.run () == RESPONSE_APPLY) {
|
||||
_session->master_volume ()->set_value (dB_to_coefficient (ld.gain_db ()), Controllable::NoGroup);
|
||||
|
|
@ -116,6 +136,12 @@ Editor::analyze_range_export ()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
Editor::analyze_range_export ()
|
||||
{
|
||||
measure_master_loudness (true);
|
||||
}
|
||||
|
||||
void
|
||||
Editor::export_range ()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@
|
|||
#include <gtkmm/label.h>
|
||||
#include <gtkmm/stock.h>
|
||||
|
||||
#include "ardour/session.h"
|
||||
#include "ardour/dB.h"
|
||||
#include "ardour/session.h"
|
||||
|
||||
#include "ardour/export_channel_configuration.h"
|
||||
#include "ardour/export_filename.h"
|
||||
|
|
@ -38,10 +38,10 @@
|
|||
using namespace Gtk;
|
||||
using namespace ARDOUR;
|
||||
|
||||
LoudnessDialog::LoudnessDialog (Session* s, TimeSelection const& ts)
|
||||
LoudnessDialog::LoudnessDialog (Session* s, AudioRange const& ar)
|
||||
: ArdourDialog (_("Loudness Mate"))
|
||||
, _session (s)
|
||||
, _time (ts)
|
||||
, _range (ar)
|
||||
, _status (s->get_export_status ())
|
||||
, _report_button (_("Show"))
|
||||
, _dbfs_adjustment ( 0.00, -90.00, 0.00, 0.1, 0.2)
|
||||
|
|
@ -174,8 +174,8 @@ LoudnessDialog::analyze ()
|
|||
if (master_out->n_ports().n_audio() != 2) {
|
||||
return -2;
|
||||
}
|
||||
if (_time.empty()) {
|
||||
// use whole session ?!
|
||||
|
||||
if (_range.start >= _range.end) {
|
||||
return -3;
|
||||
}
|
||||
|
||||
|
|
@ -197,7 +197,7 @@ LoudnessDialog::analyze ()
|
|||
|
||||
/* setup range */
|
||||
// TODO: consider multiple ranges
|
||||
tsp->set_range (_time.front().start, _time.front().end);
|
||||
tsp->set_range (_range.start, _range.end);
|
||||
tsp->set_range_id ("selection");
|
||||
tsp->set_realtime (false);
|
||||
|
||||
|
|
|
|||
|
|
@ -26,9 +26,9 @@
|
|||
|
||||
#include "ardour_dialog.h"
|
||||
#include "progress_reporter.h"
|
||||
#include "time_selection.h"
|
||||
|
||||
namespace ARDOUR {
|
||||
class AudioRange;
|
||||
class ExportStatus;
|
||||
class Session;
|
||||
}
|
||||
|
|
@ -36,7 +36,7 @@ namespace ARDOUR {
|
|||
class LoudnessDialog : public ArdourDialog
|
||||
{
|
||||
public:
|
||||
LoudnessDialog (ARDOUR::Session*, TimeSelection const&);
|
||||
LoudnessDialog (ARDOUR::Session*, ARDOUR::AudioRange const&);
|
||||
int run ();
|
||||
float gain_db () const { return _gain; }
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ private:
|
|||
void calculate_gain ();
|
||||
|
||||
ARDOUR::Session* _session;
|
||||
TimeSelection const& _time;
|
||||
ARDOUR::AudioRange const& _range;
|
||||
boost::shared_ptr<ARDOUR::ExportStatus> _status;
|
||||
|
||||
Gtk::VBox _progress_box;
|
||||
|
|
|
|||
|
|
@ -278,6 +278,8 @@ public:
|
|||
/** Open export dialog with current range pre-selected */
|
||||
virtual void export_range () = 0;
|
||||
|
||||
virtual void measure_master_loudness (bool) = 0;
|
||||
|
||||
virtual void register_actions () = 0;
|
||||
virtual void set_zoom_focus (Editing::ZoomFocus) = 0;
|
||||
virtual Editing::ZoomFocus get_zoom_focus () const = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue