summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk2_ardour/editor.cc131
-rw-r--r--gtk2_ardour/editor.h8
-rw-r--r--gtk2_ardour/editor_ops.cc4
-rw-r--r--libs/ardour/ardour/audioregion.h8
-rw-r--r--libs/ardour/ardour/types.h8
-rw-r--r--libs/ardour/audioregion.cc24
-rw-r--r--libs/ardour/enums.cc14
-rw-r--r--libs/ardour/strip_silence.cc2
8 files changed, 153 insertions, 46 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index a91a0572e4..4d3ecb80c8 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -737,6 +737,8 @@ Editor::Editor ()
constructed = true;
instant_save ();
+
+ setup_fade_images ();
}
Editor::~Editor()
@@ -1312,14 +1314,57 @@ Editor::popup_fade_context_menu (int button, int32_t time, ArdourCanvas::Item* i
items.push_back (SeparatorElem());
if (Profile->get_sae()) {
- items.push_back (MenuElem (_("Linear"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), AudioRegion::Linear)));
- items.push_back (MenuElem (_("Slowest"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), AudioRegion::Fast)));
+
+ items.push_back (MenuElem (_("Linear"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeLinear)));
+ items.push_back (MenuElem (_("Slowest"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeFast)));
+
} else {
- items.push_back (MenuElem (_("Linear"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), AudioRegion::Linear)));
- items.push_back (MenuElem (_("Slowest"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), AudioRegion::Fast)));
- items.push_back (MenuElem (_("Slow"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), AudioRegion::LogB)));
- items.push_back (MenuElem (_("Fast"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), AudioRegion::LogA)));
- items.push_back (MenuElem (_("Fastest"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), AudioRegion::Slow)));
+
+ items.push_back (
+ ImageMenuElem (
+ _("Linear"),
+ *_fade_in_images[FadeLinear],
+ sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeLinear)
+ )
+ );
+
+ dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image ();
+
+ items.push_back (
+ ImageMenuElem (
+ _("Slowest"),
+ *_fade_in_images[FadeFast],
+ sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeFast)
+ ));
+
+ dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image ();
+
+ items.push_back (
+ ImageMenuElem (
+ _("Slow"),
+ *_fade_in_images[FadeLogB],
+ sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeLogB)
+ ));
+
+ dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image ();
+
+ items.push_back (
+ ImageMenuElem (
+ _("Fast"),
+ *_fade_in_images[FadeLogA],
+ sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeLogA)
+ ));
+
+ dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image ();
+
+ items.push_back (
+ ImageMenuElem (
+ _("Fastest"),
+ *_fade_in_images[FadeSlow],
+ sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_in_shape), FadeSlow)
+ ));
+
+ dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image ();
}
break;
@@ -1335,14 +1380,55 @@ Editor::popup_fade_context_menu (int button, int32_t time, ArdourCanvas::Item* i
items.push_back (SeparatorElem());
if (Profile->get_sae()) {
- items.push_back (MenuElem (_("Linear"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), AudioRegion::Linear)));
- items.push_back (MenuElem (_("Slowest"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), AudioRegion::Slow)));
+ items.push_back (MenuElem (_("Linear"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), FadeLinear)));
+ items.push_back (MenuElem (_("Slowest"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), FadeSlow)));
} else {
- items.push_back (MenuElem (_("Linear"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), AudioRegion::Linear)));
- items.push_back (MenuElem (_("Slowest"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), AudioRegion::Slow)));
- items.push_back (MenuElem (_("Slow"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), AudioRegion::LogA)));
- items.push_back (MenuElem (_("Fast"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), AudioRegion::LogB)));
- items.push_back (MenuElem (_("Fastest"), sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), AudioRegion::Fast)));
+
+ items.push_back (
+ ImageMenuElem (
+ _("Linear"),
+ *_fade_out_images[FadeLinear],
+ sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), FadeLinear)
+ )
+ );
+
+ dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image ();
+
+ items.push_back (
+ ImageMenuElem (
+ _("Slowest"),
+ *_fade_out_images[FadeFast],
+ sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), FadeSlow)
+ ));
+
+ dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image ();
+
+ items.push_back (
+ ImageMenuElem (
+ _("Slow"),
+ *_fade_out_images[FadeLogB],
+ sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), FadeLogA)
+ ));
+
+ dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image ();
+
+ items.push_back (
+ ImageMenuElem (
+ _("Fast"),
+ *_fade_out_images[FadeLogA],
+ sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), FadeLogB)
+ ));
+
+ dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image ();
+
+ items.push_back (
+ ImageMenuElem (
+ _("Fastest"),
+ *_fade_out_images[FadeSlow],
+ sigc::bind (sigc::mem_fun (*this, &Editor::set_fade_out_shape), FadeFast)
+ ));
+
+ dynamic_cast<ImageMenuItem*>(&items.back())->set_always_show_image ();
}
break;
@@ -5614,3 +5700,20 @@ Editor::update_region_layering_order_editor (framepos_t frame)
change_region_layering_order (frame);
}
}
+
+void
+Editor::setup_fade_images ()
+{
+ _fade_in_images[FadeLinear] = new Gtk::Image (get_icon_path (X_("crossfade-in-linear")));
+ _fade_in_images[FadeFast] = new Gtk::Image (get_icon_path (X_("crossfade-in-short-cut")));
+ _fade_in_images[FadeLogB] = new Gtk::Image (get_icon_path (X_("crossfade-in-slow-cut")));
+ _fade_in_images[FadeLogA] = new Gtk::Image (get_icon_path (X_("crossfade-in-fast-cut")));
+ _fade_in_images[FadeSlow] = new Gtk::Image (get_icon_path (X_("crossfade-in-long-cut")));
+
+ _fade_out_images[FadeLinear] = new Gtk::Image (get_icon_path (X_("crossfade-out-linear")));
+ _fade_out_images[FadeFast] = new Gtk::Image (get_icon_path (X_("crossfade-out-short-cut")));
+ _fade_out_images[FadeLogB] = new Gtk::Image (get_icon_path (X_("crossfade-out-slow-cut")));
+ _fade_out_images[FadeLogA] = new Gtk::Image (get_icon_path (X_("crossfade-out-fast-cut")));
+ _fade_out_images[FadeSlow] = new Gtk::Image (get_icon_path (X_("crossfade-out-long-cut")));
+}
+
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index e47946499d..9063599e23 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -1308,8 +1308,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
Gtk::Menu fade_context_menu;
void popup_fade_context_menu (int, int, ArdourCanvas::Item*, ItemType);
- void set_fade_in_shape (ARDOUR::AudioRegion::FadeShape);
- void set_fade_out_shape (ARDOUR::AudioRegion::FadeShape);
+ void set_fade_in_shape (ARDOUR::FadeShape);
+ void set_fade_out_shape (ARDOUR::FadeShape);
void set_fade_length (bool in);
void toggle_fade_active (bool in);
@@ -2052,6 +2052,10 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
*/
bool _block_region_list_update_if_empty;
+ void setup_fade_images ();
+ std::map<ARDOUR::FadeShape, Gtk::Image*> _fade_in_images;
+ std::map<ARDOUR::FadeShape, Gtk::Image*> _fade_out_images;
+
friend class Drag;
friend class RegionDrag;
friend class RegionMoveDrag;
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index ce9aafb3fb..10d8410dad 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -5272,7 +5272,7 @@ Editor::toggle_fade_active (bool in)
}
void
-Editor::set_fade_in_shape (AudioRegion::FadeShape shape)
+Editor::set_fade_in_shape (FadeShape shape)
{
RegionSelection rs;
@@ -5305,7 +5305,7 @@ Editor::set_fade_in_shape (AudioRegion::FadeShape shape)
}
void
-Editor::set_fade_out_shape (AudioRegion::FadeShape shape)
+Editor::set_fade_out_shape (FadeShape shape)
{
RegionSelection rs;
diff --git a/libs/ardour/ardour/audioregion.h b/libs/ardour/ardour/audioregion.h
index b294082273..b919b6572c 100644
--- a/libs/ardour/ardour/audioregion.h
+++ b/libs/ardour/ardour/audioregion.h
@@ -129,14 +129,6 @@ class AudioRegion : public Region
bool fade_in_is_default () const;
bool fade_out_is_default () const;
- enum FadeShape {
- Linear,
- Fast,
- Slow,
- LogA,
- LogB
- };
-
void set_fade_in_active (bool yn);
void set_fade_in_shape (FadeShape);
void set_fade_in_length (framecnt_t);
diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h
index cc36941ba8..d452cd6b54 100644
--- a/libs/ardour/ardour/types.h
+++ b/libs/ardour/ardour/types.h
@@ -495,6 +495,14 @@ namespace ARDOUR {
uint32_t requested_physical_out; /* now many of the available physical inputs to consider usable */
};
+ enum FadeShape {
+ FadeLinear,
+ FadeFast,
+ FadeSlow,
+ FadeLogA,
+ FadeLogB
+ };
+
} // namespace ARDOUR
diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc
index 214d31165b..afd4456cdd 100644
--- a/libs/ardour/audioregion.cc
+++ b/libs/ardour/audioregion.cc
@@ -736,12 +736,12 @@ AudioRegion::set_fade_in (FadeShape shape, framecnt_t len)
_fade_in->clear ();
switch (shape) {
- case Linear:
+ case FadeLinear:
_fade_in->fast_simple_add (0.0, 0.0);
_fade_in->fast_simple_add (len, 1.0);
break;
- case Fast:
+ case FadeFast:
_fade_in->fast_simple_add (0, 0);
_fade_in->fast_simple_add (len * 0.389401, 0.0333333);
_fade_in->fast_simple_add (len * 0.629032, 0.0861111);
@@ -751,7 +751,7 @@ AudioRegion::set_fade_in (FadeShape shape, framecnt_t len)
_fade_in->fast_simple_add (len, 1);
break;
- case Slow:
+ case FadeSlow:
_fade_in->fast_simple_add (0, 0);
_fade_in->fast_simple_add (len * 0.0207373, 0.197222);
_fade_in->fast_simple_add (len * 0.0645161, 0.525);
@@ -762,7 +762,7 @@ AudioRegion::set_fade_in (FadeShape shape, framecnt_t len)
_fade_in->fast_simple_add (len, 1);
break;
- case LogA:
+ case FadeLogA:
_fade_in->fast_simple_add (0, 0);
_fade_in->fast_simple_add (len * 0.0737327, 0.308333);
_fade_in->fast_simple_add (len * 0.246544, 0.658333);
@@ -772,7 +772,7 @@ AudioRegion::set_fade_in (FadeShape shape, framecnt_t len)
_fade_in->fast_simple_add (len, 1);
break;
- case LogB:
+ case FadeLogB:
_fade_in->fast_simple_add (0, 0);
_fade_in->fast_simple_add (len * 0.304147, 0.0694444);
_fade_in->fast_simple_add (len * 0.529954, 0.152778);
@@ -804,7 +804,7 @@ AudioRegion::set_fade_out (FadeShape shape, framecnt_t len)
_fade_out->clear ();
switch (shape) {
- case Fast:
+ case FadeFast:
_fade_out->fast_simple_add (len * 0, 1);
_fade_out->fast_simple_add (len * 0.023041, 0.697222);
_fade_out->fast_simple_add (len * 0.0553, 0.483333);
@@ -814,7 +814,7 @@ AudioRegion::set_fade_out (FadeShape shape, framecnt_t len)
_fade_out->fast_simple_add (len * 1, 0);
break;
- case LogA:
+ case FadeLogA:
_fade_out->fast_simple_add (len * 0, 1);
_fade_out->fast_simple_add (len * 0.228111, 0.988889);
_fade_out->fast_simple_add (len * 0.347926, 0.972222);
@@ -824,7 +824,7 @@ AudioRegion::set_fade_out (FadeShape shape, framecnt_t len)
_fade_out->fast_simple_add (len * 1, 0);
break;
- case Slow:
+ case FadeSlow:
_fade_out->fast_simple_add (len * 0, 1);
_fade_out->fast_simple_add (len * 0.305556, 1);
_fade_out->fast_simple_add (len * 0.548611, 0.991736);
@@ -834,7 +834,7 @@ AudioRegion::set_fade_out (FadeShape shape, framecnt_t len)
_fade_out->fast_simple_add (len * 1, 0);
break;
- case LogB:
+ case FadeLogB:
_fade_out->fast_simple_add (len * 0, 1);
_fade_out->fast_simple_add (len * 0.080645, 0.730556);
_fade_out->fast_simple_add (len * 0.277778, 0.289256);
@@ -843,7 +843,7 @@ AudioRegion::set_fade_out (FadeShape shape, framecnt_t len)
_fade_out->fast_simple_add (len * 1, 0);
break;
- case Linear:
+ case FadeLinear:
_fade_out->fast_simple_add (len * 0, 1);
_fade_out->fast_simple_add (len * 1, 0);
break;
@@ -920,14 +920,14 @@ void
AudioRegion::set_default_fade_in ()
{
_fade_in_suspended = 0;
- set_fade_in (Linear, 64);
+ set_fade_in (FadeLinear, 64);
}
void
AudioRegion::set_default_fade_out ()
{
_fade_out_suspended = 0;
- set_fade_out (Linear, 64);
+ set_fade_out (FadeLinear, 64);
}
void
diff --git a/libs/ardour/enums.cc b/libs/ardour/enums.cc
index 972ff2efb7..bde6d7a7fe 100644
--- a/libs/ardour/enums.cc
+++ b/libs/ardour/enums.cc
@@ -82,7 +82,7 @@ setup_enum_writer ()
SessionEvent::Type _SessionEvent_Type;
TimecodeFormat _Session_TimecodeFormat;
Session::PullupFormat _Session_PullupFormat;
- AudioRegion::FadeShape _AudioRegion_FadeShape;
+ FadeShape _FadeShape;
Panner::LinkDirection _Panner_LinkDirection;
IOChange _IOChange;
AutomationType _AutomationType;
@@ -387,12 +387,12 @@ setup_enum_writer ()
REGISTER_CLASS_ENUM (Source, Destructive);
REGISTER_BITS (_Source_Flag);
- REGISTER_CLASS_ENUM (AudioRegion, Linear);
- REGISTER_CLASS_ENUM (AudioRegion, Fast);
- REGISTER_CLASS_ENUM (AudioRegion, Slow);
- REGISTER_CLASS_ENUM (AudioRegion, LogA);
- REGISTER_CLASS_ENUM (AudioRegion, LogB);
- REGISTER (_AudioRegion_FadeShape);
+ REGISTER_ENUM (FadeLinear);
+ REGISTER_ENUM (FadeFast);
+ REGISTER_ENUM (FadeSlow);
+ REGISTER_ENUM (FadeLogA);
+ REGISTER_ENUM (FadeLogB);
+ REGISTER (_FadeShape);
REGISTER_CLASS_ENUM (Diskstream, Recordable);
REGISTER_CLASS_ENUM (Diskstream, Hidden);
diff --git a/libs/ardour/strip_silence.cc b/libs/ardour/strip_silence.cc
index 21faeded68..a7d7ab073f 100644
--- a/libs/ardour/strip_silence.cc
+++ b/libs/ardour/strip_silence.cc
@@ -111,7 +111,7 @@ StripSilence::run (boost::shared_ptr<Region> r)
copy->position() << std::endl;
copy->set_fade_in_active (true);
- copy->set_fade_in (AudioRegion::Linear, _fade_length);
+ copy->set_fade_in (FadeLinear, _fade_length);
results.push_back (copy);
}