diff options
author | David Robillard <d@drobilla.net> | 2008-01-19 05:06:33 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-01-19 05:06:33 +0000 |
commit | 7295d8e9f675f4441ab626c0655b2d2e6663e47e (patch) | |
tree | 50a1bf7d6b736c02591de3904909dda5cdd625d4 /gtk2_ardour/editor_ops.cc | |
parent | 4ca1fe7993adf63ea3f35958f63dd20ee546e7ae (diff) |
Merge with 2.0-ongoing R2943.
git-svn-id: svn://localhost/ardour2/branches/3.0@2944 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/editor_ops.cc')
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index a81a6e6965..33a0e6920c 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -49,6 +49,7 @@ #include <ardour/region_factory.h> #include <ardour/playlist_factory.h> #include <ardour/reverse.h> +#include <ardour/dB.h> #include <ardour/quantize.h> #include "ardour_ui.h" @@ -66,6 +67,7 @@ #include "gtk-custom-hruler.h" #include "gui_thread.h" #include "keyboard.h" +#include "utils.h" #include "i18n.h" @@ -4119,6 +4121,8 @@ Editor::denormalize_region () return; } + ExclusiveRegionSelection (*this, entered_regionview); + if (selection->regions.empty()) { return; } @@ -4137,6 +4141,62 @@ Editor::denormalize_region () commit_reversible_command (); } +void +Editor::adjust_region_scale_amplitude (bool up) +{ + if (!session) { + return; + } + + ExclusiveRegionSelection (*this, entered_regionview); + + if (selection->regions.empty()) { + return; + } + + begin_reversible_command ("denormalize"); + + for (RegionSelection::iterator r = selection->regions.begin(); r != selection->regions.end(); ++r) { + AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*r); + if (!arv) + continue; + XMLNode &before = arv->region()->get_state(); + + double fraction = gain_to_slider_position (arv->audio_region()->scale_amplitude ()); + + cerr << "slider pos for " << arv->audio_region()->scale_amplitude () + << " = " << fraction + << endl; + + if (up) { + fraction += 0.05; + fraction = min (fraction, 1.0); + } else { + fraction -= 0.05; + fraction = max (fraction, 0.0); + } + + if (!up && fraction <= 0) { + continue; + } + + if (up && fraction >= 1.0) { + continue; + } + + fraction = slider_position_to_gain (fraction); + fraction = coefficient_to_dB (fraction); + fraction = dB_to_coefficient (fraction); + + cerr << "set scale amp for " << arv->audio_region()->name() << " to " << fraction << endl; + + arv->audio_region()->set_scale_amplitude (fraction); + session->add_command (new MementoCommand<Region>(*(arv->region().get()), &before, &arv->region()->get_state())); + } + + commit_reversible_command (); +} + void Editor::reverse_region () |