Allow normalization to less than max, as per mantis #2739.

git-svn-id: svn://localhost/ardour2/branches/3.0@5223 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2009-06-20 14:02:27 +00:00
parent 3cdc0d104a
commit 37ece84ba6
1 changed files with 22 additions and 5 deletions

View File

@ -4575,17 +4575,34 @@ Editor::remove_last_capture ()
void
Editor::normalize_region ()
{
RegionSelection rs;
get_regions_for_action (rs);
if (!session) {
return;
}
RegionSelection rs;
get_regions_for_action (rs);
if (rs.empty()) {
return;
}
Dialog dialog (rs.size() > 1 ? _("Normalize regions") : _("Normalize region"));
HBox hbox;
hbox.pack_start (*manage (new Label (_("Normalize to:"))));
SpinButton spin (0.2, 2);
spin.set_range (-112, 0);
spin.set_increments (0.1, 1);
spin.set_value (0);
hbox.pack_start (spin);
hbox.pack_start (*manage (new Label (_("dbFS"))));
hbox.show_all ();
dialog.get_vbox()->pack_start (hbox);
dialog.add_button (Stock::CANCEL, RESPONSE_CANCEL);
dialog.add_button (_("Normalize"), RESPONSE_ACCEPT);
if (dialog.run () == RESPONSE_CANCEL) {
return;
}
begin_reversible_command (_("normalize"));
@ -4597,7 +4614,7 @@ Editor::normalize_region ()
if (!arv)
continue;
XMLNode &before = arv->region()->get_state();
arv->audio_region()->normalize_to (0.0f);
arv->audio_region()->normalize_to (spin.get_value());
session->add_command (new MementoCommand<Region>(*(arv->region().get()), &before, &arv->region()->get_state()));
}