summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_ops.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gtk2_ardour/editor_ops.cc')
-rw-r--r--gtk2_ardour/editor_ops.cc32
1 files changed, 32 insertions, 0 deletions
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index 581326e278..2b8a5fd018 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -5217,6 +5217,38 @@ Editor::adjust_region_gain (bool up)
}
}
+void
+Editor::reset_region_gain ()
+{
+ RegionSelection rs = get_regions_from_selection_and_entered ();
+
+ if (!_session || rs.empty()) {
+ return;
+ }
+
+ bool in_command = false;
+
+ for (RegionSelection::iterator r = rs.begin(); r != rs.end(); ++r) {
+ AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*r);
+ if (!arv) {
+ continue;
+ }
+
+ arv->region()->clear_changes ();
+
+ arv->audio_region()->set_scale_amplitude (1.0f);
+
+ if (!in_command) {
+ begin_reversible_command ("reset region gain");
+ in_command = true;
+ }
+ _session->add_command (new StatefulDiffCommand (arv->region()));
+ }
+
+ if (in_command) {
+ commit_reversible_command ();
+ }
+}
void
Editor::reverse_region ()