mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-15 19:16:40 +01:00
region fade in operations now mapped over the current region selection
git-svn-id: svn://localhost/ardour2/trunk@1338 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
838a37a4fe
commit
729e6cc980
6 changed files with 221 additions and 130 deletions
|
|
@ -249,55 +249,6 @@ AudioRegionView::fade_out_changed ()
|
|||
{
|
||||
reset_fade_out_shape ();
|
||||
}
|
||||
|
||||
void
|
||||
AudioRegionView::set_fade_in_shape (AudioRegion::FadeShape shape)
|
||||
{
|
||||
AutomationList& alist = audio_region()->fade_in();
|
||||
XMLNode& before (alist.get_state());
|
||||
trackview.session().begin_reversible_command ("fade in shape");
|
||||
audio_region()->set_fade_in_shape (shape);
|
||||
XMLNode& after (alist.get_state());
|
||||
trackview.session().add_command (new MementoCommand<AutomationList>(alist, &before, &after));
|
||||
trackview.session().commit_reversible_command ();
|
||||
}
|
||||
|
||||
void
|
||||
AudioRegionView::set_fade_out_shape (AudioRegion::FadeShape shape)
|
||||
{
|
||||
AutomationList& alist = audio_region()->fade_out();
|
||||
XMLNode& before (alist.get_state());
|
||||
trackview.session().begin_reversible_command ("fade out shape");
|
||||
audio_region()->set_fade_out_shape (shape);
|
||||
XMLNode& after (alist.get_state());
|
||||
trackview.session().add_command (new MementoCommand<AutomationList>(alist, &before, &after));
|
||||
trackview.session().commit_reversible_command ();
|
||||
}
|
||||
|
||||
void
|
||||
AudioRegionView::set_fade_in_active (bool yn)
|
||||
{
|
||||
AutomationList& alist = audio_region()->fade_in();
|
||||
XMLNode& before (alist.get_state());
|
||||
trackview.session().begin_reversible_command ("fade in shape");
|
||||
audio_region()->set_fade_in_active (yn);
|
||||
XMLNode& after (alist.get_state());
|
||||
trackview.session().add_command (new MementoCommand<AutomationList>(alist, &before, &after));
|
||||
trackview.session().commit_reversible_command ();
|
||||
}
|
||||
|
||||
void
|
||||
AudioRegionView::set_fade_out_active (bool yn)
|
||||
{
|
||||
AutomationList& alist = audio_region()->fade_out();
|
||||
XMLNode& before (alist.get_state());
|
||||
trackview.session().begin_reversible_command ("fade out shape");
|
||||
audio_region()->set_fade_out_active (yn);
|
||||
XMLNode& after (alist.get_state());
|
||||
trackview.session().add_command (new MementoCommand<AutomationList>(alist, &before, &after));
|
||||
trackview.session().commit_reversible_command ();
|
||||
}
|
||||
|
||||
void
|
||||
AudioRegionView::fade_in_active_changed ()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -93,10 +93,6 @@ class AudioRegionView : public RegionView
|
|||
|
||||
void reset_fade_in_shape_width (nframes_t);
|
||||
void reset_fade_out_shape_width (nframes_t);
|
||||
void set_fade_in_active (bool);
|
||||
void set_fade_out_active (bool);
|
||||
void set_fade_in_shape (ARDOUR::AudioRegion::FadeShape);
|
||||
void set_fade_out_shape (ARDOUR::AudioRegion::FadeShape);
|
||||
|
||||
virtual void entered ();
|
||||
virtual void exited ();
|
||||
|
|
|
|||
|
|
@ -1232,35 +1232,35 @@ Editor::popup_fade_context_menu (int button, int32_t time, ArdourCanvas::Item* i
|
|||
case FadeInItem:
|
||||
case FadeInHandleItem:
|
||||
if (arv->audio_region()->fade_in_active()) {
|
||||
items.push_back (MenuElem (_("Deactivate"), bind (mem_fun (*arv, &AudioRegionView::set_fade_in_active), false)));
|
||||
items.push_back (MenuElem (_("Deactivate"), bind (mem_fun (*this, &Editor::set_fade_in_active), false)));
|
||||
} else {
|
||||
items.push_back (MenuElem (_("Activate"), bind (mem_fun (*arv, &AudioRegionView::set_fade_in_active), true)));
|
||||
items.push_back (MenuElem (_("Activate"), bind (mem_fun (*this, &Editor::set_fade_in_active), true)));
|
||||
}
|
||||
|
||||
items.push_back (SeparatorElem());
|
||||
|
||||
items.push_back (MenuElem (_("Linear"), bind (mem_fun (*arv, &AudioRegionView::set_fade_in_shape), AudioRegion::Linear)));
|
||||
items.push_back (MenuElem (_("Slowest"), bind (mem_fun (*arv, &AudioRegionView::set_fade_in_shape), AudioRegion::LogB)));
|
||||
items.push_back (MenuElem (_("Slow"), bind (mem_fun (*arv, &AudioRegionView::set_fade_in_shape), AudioRegion::Fast)));
|
||||
items.push_back (MenuElem (_("Fast"), bind (mem_fun (*arv, &AudioRegionView::set_fade_in_shape), AudioRegion::LogA)));
|
||||
items.push_back (MenuElem (_("Fastest"), bind (mem_fun (*arv, &AudioRegionView::set_fade_in_shape), AudioRegion::Slow)));
|
||||
items.push_back (MenuElem (_("Linear"), bind (mem_fun (*this, &Editor::set_fade_in_shape), AudioRegion::Linear)));
|
||||
items.push_back (MenuElem (_("Slowest"), bind (mem_fun (*this, &Editor::set_fade_in_shape), AudioRegion::LogB)));
|
||||
items.push_back (MenuElem (_("Slow"), bind (mem_fun (*this, &Editor::set_fade_in_shape), AudioRegion::Fast)));
|
||||
items.push_back (MenuElem (_("Fast"), bind (mem_fun (*this, &Editor::set_fade_in_shape), AudioRegion::LogA)));
|
||||
items.push_back (MenuElem (_("Fastest"), bind (mem_fun (*this, &Editor::set_fade_in_shape), AudioRegion::Slow)));
|
||||
break;
|
||||
|
||||
case FadeOutItem:
|
||||
case FadeOutHandleItem:
|
||||
if (arv->audio_region()->fade_out_active()) {
|
||||
items.push_back (MenuElem (_("Deactivate"), bind (mem_fun (*arv, &AudioRegionView::set_fade_out_active), false)));
|
||||
items.push_back (MenuElem (_("Deactivate"), bind (mem_fun (*this, &Editor::set_fade_out_active), false)));
|
||||
} else {
|
||||
items.push_back (MenuElem (_("Activate"), bind (mem_fun (*arv, &AudioRegionView::set_fade_out_active), true)));
|
||||
items.push_back (MenuElem (_("Activate"), bind (mem_fun (*this, &Editor::set_fade_out_active), true)));
|
||||
}
|
||||
|
||||
items.push_back (SeparatorElem());
|
||||
|
||||
items.push_back (MenuElem (_("Linear"), bind (mem_fun (*arv, &AudioRegionView::set_fade_out_shape), AudioRegion::Linear)));
|
||||
items.push_back (MenuElem (_("Slowest"), bind (mem_fun (*arv, &AudioRegionView::set_fade_out_shape), AudioRegion::Fast)));
|
||||
items.push_back (MenuElem (_("Slow"), bind (mem_fun (*arv, &AudioRegionView::set_fade_out_shape), AudioRegion::LogB)));
|
||||
items.push_back (MenuElem (_("Fast"), bind (mem_fun (*arv, &AudioRegionView::set_fade_out_shape), AudioRegion::LogA)));
|
||||
items.push_back (MenuElem (_("Fastest"), bind (mem_fun (*arv, &AudioRegionView::set_fade_out_shape), AudioRegion::Slow)));
|
||||
items.push_back (MenuElem (_("Linear"), bind (mem_fun (*this, &Editor::set_fade_out_shape), AudioRegion::Linear)));
|
||||
items.push_back (MenuElem (_("Slowest"), bind (mem_fun (*this, &Editor::set_fade_out_shape), AudioRegion::Fast)));
|
||||
items.push_back (MenuElem (_("Slow"), bind (mem_fun (*this, &Editor::set_fade_out_shape), AudioRegion::LogB)));
|
||||
items.push_back (MenuElem (_("Fast"), bind (mem_fun (*this, &Editor::set_fade_out_shape), AudioRegion::LogA)));
|
||||
items.push_back (MenuElem (_("Fastest"), bind (mem_fun (*this, &Editor::set_fade_out_shape), AudioRegion::Slow)));
|
||||
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
#include <ardour/session.h>
|
||||
#include <ardour/tempo.h>
|
||||
#include <ardour/location.h>
|
||||
#include <ardour/region.h>
|
||||
#include <ardour/audioregion.h>
|
||||
|
||||
#include "audio_clock.h"
|
||||
#include "gtk-custom-ruler.h"
|
||||
|
|
@ -1068,6 +1068,12 @@ class Editor : public PublicEditor
|
|||
void fade_out_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
|
||||
void fade_in_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
|
||||
void fade_out_drag_finished_callback (ArdourCanvas::Item*, GdkEvent*);
|
||||
|
||||
void set_fade_in_shape (ARDOUR::AudioRegion::FadeShape);
|
||||
void set_fade_out_shape (ARDOUR::AudioRegion::FadeShape);
|
||||
|
||||
void set_fade_in_active (bool);
|
||||
void set_fade_out_active (bool);
|
||||
|
||||
std::set<boost::shared_ptr<ARDOUR::Playlist> > motion_frozen_playlists;
|
||||
void region_drag_motion_callback (ArdourCanvas::Item*, GdkEvent*);
|
||||
|
|
|
|||
|
|
@ -329,6 +329,15 @@ Editor::button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType it
|
|||
c2 = set_selected_regionview_from_click (press, op, true);
|
||||
commit = (c1 || c2);
|
||||
break;
|
||||
|
||||
case FadeInHandleItem:
|
||||
case FadeInItem:
|
||||
case FadeOutHandleItem:
|
||||
case FadeOutItem:
|
||||
/* XXX make tying track/region selection optional */
|
||||
c1 = set_selected_track_from_click (op, true);
|
||||
c2 = set_selected_regionview_from_click (press, op, true);
|
||||
commit = (c1 || c2);
|
||||
|
||||
case GainAutomationControlPointItem:
|
||||
case PanAutomationControlPointItem:
|
||||
|
|
@ -1764,7 +1773,7 @@ Editor::fade_in_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
|
|||
nframes_t pos;
|
||||
nframes_t fade_length;
|
||||
|
||||
if ((long)drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
|
||||
if ((int32_t)drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
|
||||
pos = drag_info.current_pointer_frame - drag_info.pointer_frame_offset;
|
||||
}
|
||||
else {
|
||||
|
|
@ -1774,16 +1783,27 @@ Editor::fade_in_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
|
|||
if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) {
|
||||
snap_to (pos);
|
||||
}
|
||||
|
||||
/* mapover the region selection */
|
||||
|
||||
for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) {
|
||||
|
||||
AudioRegionView* tmp = dynamic_cast<AudioRegionView*> (*i);
|
||||
|
||||
if (!tmp) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pos < (arv->region()->position() + 64)) {
|
||||
fade_length = 64; // this should be a minimum defined somewhere
|
||||
} else if (pos > arv->region()->last_frame()) {
|
||||
fade_length = arv->region()->length();
|
||||
} else {
|
||||
fade_length = pos - arv->region()->position();
|
||||
if (pos < (tmp->region()->position() + 64)) {
|
||||
fade_length = 64; // this should be a minimum defined somewhere
|
||||
} else if (pos > tmp->region()->last_frame()) {
|
||||
fade_length = tmp->region()->length();
|
||||
} else {
|
||||
fade_length = pos - tmp->region()->position();
|
||||
}
|
||||
|
||||
tmp->reset_fade_in_shape_width (fade_length);
|
||||
}
|
||||
|
||||
arv->reset_fade_in_shape_width (fade_length);
|
||||
|
||||
show_verbose_duration_cursor (arv->region()->position(), arv->region()->position() + fade_length, 10);
|
||||
|
||||
|
|
@ -1793,43 +1813,45 @@ Editor::fade_in_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
|
|||
void
|
||||
Editor::fade_in_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event)
|
||||
{
|
||||
if (drag_info.first_move) return;
|
||||
|
||||
AudioRegionView* arv = static_cast<AudioRegionView*>(drag_info.data);
|
||||
nframes_t pos;
|
||||
nframes_t fade_length;
|
||||
|
||||
if ((long)drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
|
||||
if (drag_info.first_move) return;
|
||||
|
||||
if ((int32_t)drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
|
||||
pos = drag_info.current_pointer_frame - drag_info.pointer_frame_offset;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
pos = 0;
|
||||
}
|
||||
|
||||
if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) {
|
||||
snap_to (pos);
|
||||
}
|
||||
|
||||
if (pos < (arv->region()->position() + 64)) {
|
||||
fade_length = 64; // this should be a minimum defined somewhere
|
||||
}
|
||||
else if (pos > arv->region()->last_frame()) {
|
||||
fade_length = arv->region()->length();
|
||||
}
|
||||
else {
|
||||
fade_length = pos - arv->region()->position();
|
||||
}
|
||||
|
||||
begin_reversible_command (_("change fade in length"));
|
||||
AutomationList& alist = arv->audio_region()->fade_in();
|
||||
XMLNode &before = alist.get_state();
|
||||
|
||||
arv->audio_region()->set_fade_in_length (fade_length);
|
||||
for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) {
|
||||
|
||||
AudioRegionView* tmp = dynamic_cast<AudioRegionView*> (*i);
|
||||
|
||||
if (!tmp) {
|
||||
continue;
|
||||
}
|
||||
|
||||
AutomationList& alist = tmp->audio_region()->fade_in();
|
||||
XMLNode &before = alist.get_state();
|
||||
|
||||
if (pos < (tmp->region()->position() + 64)) {
|
||||
fade_length = 64; // this should be a minimum defined somewhere
|
||||
} else if (pos > tmp->region()->last_frame()) {
|
||||
fade_length = tmp->region()->length();
|
||||
} else {
|
||||
fade_length = pos - tmp->region()->position();
|
||||
}
|
||||
|
||||
tmp->audio_region()->set_fade_in_length (fade_length);
|
||||
|
||||
XMLNode &after = alist.get_state();
|
||||
session->add_command(new MementoCommand<AutomationList>(alist, &before, &after));
|
||||
}
|
||||
|
||||
XMLNode &after = alist.get_state();
|
||||
session->add_command(new MementoCommand<AutomationList>(alist, &before, &after));
|
||||
commit_reversible_command ();
|
||||
fade_in_drag_motion_callback (item, event);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -1869,17 +1891,28 @@ Editor::fade_out_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event
|
|||
snap_to (pos);
|
||||
}
|
||||
|
||||
if (pos > (arv->region()->last_frame() - 64)) {
|
||||
fade_length = 64; // this should really be a minimum fade defined somewhere
|
||||
}
|
||||
else if (pos < arv->region()->position()) {
|
||||
fade_length = arv->region()->length();
|
||||
}
|
||||
else {
|
||||
fade_length = arv->region()->last_frame() - pos;
|
||||
}
|
||||
/* mapover the region selection */
|
||||
|
||||
for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) {
|
||||
|
||||
AudioRegionView* tmp = dynamic_cast<AudioRegionView*> (*i);
|
||||
|
||||
if (!tmp) {
|
||||
continue;
|
||||
}
|
||||
|
||||
arv->reset_fade_out_shape_width (fade_length);
|
||||
if (pos > (tmp->region()->last_frame() - 64)) {
|
||||
fade_length = 64; // this should really be a minimum fade defined somewhere
|
||||
}
|
||||
else if (pos < arv->region()->position()) {
|
||||
fade_length = tmp->region()->length();
|
||||
}
|
||||
else {
|
||||
fade_length = tmp->region()->last_frame() - pos;
|
||||
}
|
||||
|
||||
tmp->reset_fade_out_shape_width (fade_length);
|
||||
}
|
||||
|
||||
show_verbose_duration_cursor (arv->region()->last_frame() - fade_length, arv->region()->last_frame(), 10);
|
||||
|
||||
|
|
@ -1906,27 +1939,36 @@ Editor::fade_out_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* eve
|
|||
snap_to (pos);
|
||||
}
|
||||
|
||||
if (pos > (arv->region()->last_frame() - 64)) {
|
||||
fade_length = 64; // this should really be a minimum fade defined somewhere
|
||||
}
|
||||
else if (pos < arv->region()->position()) {
|
||||
fade_length = arv->region()->length();
|
||||
}
|
||||
else {
|
||||
fade_length = arv->region()->last_frame() - pos;
|
||||
}
|
||||
|
||||
begin_reversible_command (_("change fade out length"));
|
||||
AutomationList& alist = arv->audio_region()->fade_out();
|
||||
XMLNode &before = alist.get_state();
|
||||
|
||||
arv->audio_region()->set_fade_out_length (fade_length);
|
||||
for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) {
|
||||
|
||||
AudioRegionView* tmp = dynamic_cast<AudioRegionView*> (*i);
|
||||
|
||||
if (!tmp) {
|
||||
continue;
|
||||
}
|
||||
|
||||
AutomationList& alist = tmp->audio_region()->fade_out();
|
||||
XMLNode &before = alist.get_state();
|
||||
|
||||
if (pos > (tmp->region()->last_frame() - 64)) {
|
||||
fade_length = 64; // this should really be a minimum fade defined somewhere
|
||||
}
|
||||
else if (pos < tmp->region()->position()) {
|
||||
fade_length = tmp->region()->length();
|
||||
}
|
||||
else {
|
||||
fade_length = tmp->region()->last_frame() - pos;
|
||||
}
|
||||
|
||||
tmp->audio_region()->set_fade_out_length (fade_length);
|
||||
|
||||
XMLNode &after = alist.get_state();
|
||||
session->add_command(new MementoCommand<AutomationList>(alist, &before, &after));
|
||||
}
|
||||
|
||||
XMLNode &after = alist.get_state();
|
||||
session->add_command(new MementoCommand<AutomationList>(alist, &before, &after));
|
||||
commit_reversible_command ();
|
||||
|
||||
fade_out_drag_motion_callback (item, event);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -3689,3 +3689,99 @@ Editor::toggle_region_opaque ()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Editor::set_fade_in_shape (AudioRegion::FadeShape shape)
|
||||
{
|
||||
begin_reversible_command (_("set fade in shape"));
|
||||
|
||||
for (RegionSelection::iterator x = selection->regions.begin(); x != selection->regions.end(); ++x) {
|
||||
AudioRegionView* tmp = dynamic_cast<AudioRegionView*> (*x);
|
||||
|
||||
if (!tmp) {
|
||||
return;
|
||||
}
|
||||
|
||||
AutomationList& alist = tmp->audio_region()->fade_in();
|
||||
XMLNode &before = alist.get_state();
|
||||
|
||||
tmp->audio_region()->set_fade_in_shape (shape);
|
||||
|
||||
XMLNode &after = alist.get_state();
|
||||
session->add_command(new MementoCommand<AutomationList>(alist, &before, &after));
|
||||
}
|
||||
|
||||
commit_reversible_command ();
|
||||
}
|
||||
|
||||
void
|
||||
Editor::set_fade_out_shape (AudioRegion::FadeShape shape)
|
||||
{
|
||||
begin_reversible_command (_("set fade out shape"));
|
||||
|
||||
for (RegionSelection::iterator x = selection->regions.begin(); x != selection->regions.end(); ++x) {
|
||||
AudioRegionView* tmp = dynamic_cast<AudioRegionView*> (*x);
|
||||
|
||||
if (!tmp) {
|
||||
return;
|
||||
}
|
||||
|
||||
AutomationList& alist = tmp->audio_region()->fade_out();
|
||||
XMLNode &before = alist.get_state();
|
||||
|
||||
tmp->audio_region()->set_fade_out_shape (shape);
|
||||
|
||||
XMLNode &after = alist.get_state();
|
||||
session->add_command(new MementoCommand<AutomationList>(alist, &before, &after));
|
||||
}
|
||||
|
||||
commit_reversible_command ();
|
||||
}
|
||||
|
||||
void
|
||||
Editor::set_fade_in_active (bool yn)
|
||||
{
|
||||
begin_reversible_command (_("set fade in active"));
|
||||
|
||||
for (RegionSelection::iterator x = selection->regions.begin(); x != selection->regions.end(); ++x) {
|
||||
AudioRegionView* tmp = dynamic_cast<AudioRegionView*> (*x);
|
||||
|
||||
if (!tmp) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
boost::shared_ptr<AudioRegion> ar (tmp->audio_region());
|
||||
|
||||
XMLNode &before = ar->get_state();
|
||||
|
||||
ar->set_fade_in_active (yn);
|
||||
|
||||
XMLNode &after = ar->get_state();
|
||||
session->add_command(new MementoCommand<AudioRegion>(*ar, &before, &after));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Editor::set_fade_out_active (bool yn)
|
||||
{
|
||||
begin_reversible_command (_("set fade out active"));
|
||||
|
||||
for (RegionSelection::iterator x = selection->regions.begin(); x != selection->regions.end(); ++x) {
|
||||
AudioRegionView* tmp = dynamic_cast<AudioRegionView*> (*x);
|
||||
|
||||
if (!tmp) {
|
||||
return;
|
||||
}
|
||||
|
||||
boost::shared_ptr<AudioRegion> ar (tmp->audio_region());
|
||||
|
||||
XMLNode &before = ar->get_state();
|
||||
|
||||
ar->set_fade_out_active (yn);
|
||||
|
||||
XMLNode &after = ar->get_state();
|
||||
session->add_command(new MementoCommand<AudioRegion>(*ar, &before, &after));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue