#include <libgnomecanvasmm/line.h>
-#include <ardour/automation_event.h>
-#include <ardour/curve.h>
-#include <ardour/crossfade.h>
-#include <ardour/session.h>
-#include <ardour/auditioner.h>
-#include <ardour/audioplaylist.h>
-#include <ardour/audiosource.h>
-#include <ardour/playlist_templates.h>
-#include <ardour/region_factory.h>
+#include "ardour/automation_list.h"
+#include "evoral/Curve.hpp"
+#include "ardour/crossfade.h"
+#include "ardour/session.h"
+#include "ardour/auditioner.h"
+#include "ardour/audioplaylist.h"
+#include "ardour/audiosource.h"
+#include "ardour/region_factory.h"
+#include "ardour/profile.h"
#include <gtkmm2ext/gtk_ui.h>
#include "canvas_impl.h"
#include "simplerect.h"
#include "waveview.h"
+#include "actions.h"
using namespace std;
using namespace ARDOUR;
CrossfadeEditor::Presets* CrossfadeEditor::fade_out_presets = 0;
CrossfadeEditor::Half::Half ()
- : line (0),
- normative_curve (Parameter(GainAutomation), 0.0, 1.0, 1.0), // FIXME: GainAutomation?
- gain_curve (Parameter(GainAutomation), 0.0, 2.0, 1.0)
+ : line (0)
+ , normative_curve (Evoral::Parameter(GainAutomation))
+ , gain_curve (Evoral::Parameter(GainAutomation))
{
}
set_name ("CrossfadeEditWindow");
set_position (Gtk::WIN_POS_MOUSE);
+ add_accel_group (ActionManager::ui_manager->get_accel_group());
+
add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::POINTER_MOTION_MASK);
RadioButtonGroup sel_but_group = select_in_button.get_group();
pbutton->add (*pxmap);
pbutton->set_name ("CrossfadeEditButton");
pbutton->signal_clicked().connect (bind (mem_fun(*this, &CrossfadeEditor::apply_preset), *i));
+ ARDOUR_UI::instance()->set_tip (pbutton, (*i)->name, "");
fade_in_table.attach (*pbutton, col, col+1, row, row+1);
fade_in_buttons.push_back (pbutton);
pbutton->add (*pxmap);
pbutton->set_name ("CrossfadeEditButton");
pbutton->signal_clicked().connect (bind (mem_fun(*this, &CrossfadeEditor::apply_preset), *i));
+ ARDOUR_UI::instance()->set_tip (pbutton, (*i)->name, "");
fade_out_table.attach (*pbutton, col, col+1, row, row+1);
fade_out_buttons.push_back (pbutton);
goto out;
}
- the_end = curve.const_end();
+ the_end = curve.end();
--the_end;
- firstx = (*curve.const_begin())->when;
+ firstx = (*curve.begin())->when;
endx = (*the_end)->when;
- for (ARDOUR::AutomationList::const_iterator i = curve.const_begin(); i != curve.const_end(); ++i) {
+ for (ARDOUR::AutomationList::const_iterator i = curve.begin(); i != curve.end(); ++i) {
double xfract = ((*i)->when - firstx) / (endx - firstx);
double yfract = ((*i)->value - miny) / (maxy - miny);
if (Keyboard::is_delete_event (&event->button)) {
fade[current].points.remove (point);
delete point;
- }
+ }
redraw ();
break;
case GDK_BUTTON_PRESS:
add_control_point ((event->button.x - canvas_border)/effective_width(),
1.0 - ((event->button.y - canvas_border)/effective_height()));
- return TRUE;
+ return true;
break;
default:
break;
}
- return FALSE;
+ return false;
}
CrossfadeEditor::Point::~Point()
}
void
-CrossfadeEditor::canvas_allocation (Gtk::Allocation& alloc)
+CrossfadeEditor::canvas_allocation (Gtk::Allocation& /*alloc*/)
{
if (toplevel) {
toplevel->property_x1() = 0.0;
void
-CrossfadeEditor::xfade_changed (Change ignored)
+CrossfadeEditor::xfade_changed (Change)
{
set (xfade->fade_in(), In);
set (xfade->fade_out(), Out);
for (list<Point*>::iterator i = fade[current].points.begin(); i != fade[current].points.end(); ++i) {
fade[current].normative_curve.add ((*i)->x, (*i)->y);
- fade[current].gain_curve.add (((*i)->x * len), (*i)->y);
+ double offset;
+ if (current==In)
+ offset = xfade->in()->start();
+ else
+ offset = xfade->out()->start()+xfade->out()->length()-xfade->length();
+ fade[current].gain_curve.add (((*i)->x * len) + offset, (*i)->y);
}
+
size_t npoints = (size_t) effective_width();
float vec[npoints];
fade[current].shading->property_points() = spts;
for (vector<ArdourCanvas::WaveView*>::iterator i = fade[current].waves.begin(); i != fade[current].waves.end(); ++i) {
- (*i)->property_gain_src() = &fade[current].gain_curve;
+ (*i)->property_gain_src() = static_cast<Evoral::Curve*>(&fade[current].gain_curve.curve());
}
}
/* IN */
- ARDOUR::AutomationList::const_iterator the_end = in.const_end();
+ ARDOUR::AutomationList::const_iterator the_end = in.end();
--the_end;
double firstx = (*in.begin())->when;
/* OUT */
- the_end = out.const_end();
+ the_end = out.end();
--the_end;
firstx = (*out.begin())->when;
fade_in_presets = new Presets;
fade_out_presets = new Presets;
- /* FADE OUT */
- // p = new Preset ("hiin.xpm");
- p = new Preset ("crossfade_in_fast-cut");
- p->push_back (PresetPoint (0, 0));
- p->push_back (PresetPoint (0.0207373, 0.197222));
- p->push_back (PresetPoint (0.0645161, 0.525));
- p->push_back (PresetPoint (0.152074, 0.802778));
- p->push_back (PresetPoint (0.276498, 0.919444));
- p->push_back (PresetPoint (0.481567, 0.980556));
- p->push_back (PresetPoint (0.767281, 1));
- p->push_back (PresetPoint (1, 1));
- fade_in_presets->push_back (p);
-
- // p = new Preset ("loin.xpm");
- p = new Preset ("crossfade_in_transition");
- p->push_back (PresetPoint (0, 0));
- p->push_back (PresetPoint (0.389401, 0.0333333));
- p->push_back (PresetPoint (0.629032, 0.0861111));
- p->push_back (PresetPoint (0.829493, 0.233333));
- p->push_back (PresetPoint (0.9447, 0.483333));
- p->push_back (PresetPoint (0.976959, 0.697222));
- p->push_back (PresetPoint (1, 1));
- fade_in_presets->push_back (p);
-
- // p = new Preset ("regin.xpm");
- p = new Preset ("crossfade_in_constant");
- p->push_back (PresetPoint (0, 0));
- p->push_back (PresetPoint (0.0737327, 0.308333));
- p->push_back (PresetPoint (0.246544, 0.658333));
- p->push_back (PresetPoint (0.470046, 0.886111));
- p->push_back (PresetPoint (0.652074, 0.972222));
- p->push_back (PresetPoint (0.771889, 0.988889));
- p->push_back (PresetPoint (1, 1));
- fade_in_presets->push_back (p);
-
- // p = new Preset ("regin2.xpm");
- p = new Preset ("crossfade_in_slow-cut");
- p->push_back (PresetPoint (0, 0));
- p->push_back (PresetPoint (0.304147, 0.0694444));
- p->push_back (PresetPoint (0.529954, 0.152778));
- p->push_back (PresetPoint (0.725806, 0.333333));
- p->push_back (PresetPoint (0.847926, 0.558333));
- p->push_back (PresetPoint (0.919355, 0.730556));
- p->push_back (PresetPoint (1, 1));
- fade_in_presets->push_back (p);
+ /* FADE IN */
- // p = new Preset ("linin.xpm");
- p = new Preset ("crossfade_in_dipped");
+ p = new Preset ("Linear (-6dB)", "crossfade-in-linear");
p->push_back (PresetPoint (0, 0));
- p->push_back (PresetPoint (1, 1));
+ p->push_back (PresetPoint (0.000000, 0.000000));
+ p->push_back (PresetPoint (0.166667, 0.166366));
+ p->push_back (PresetPoint (0.333333, 0.332853));
+ p->push_back (PresetPoint (0.500000, 0.499459));
+ p->push_back (PresetPoint (0.666667, 0.666186));
+ p->push_back (PresetPoint (0.833333, 0.833033));
+ p->push_back (PresetPoint (1.000000, 1.000000));
fade_in_presets->push_back (p);
- p = new Preset ("crossfade_in_default");
+ p = new Preset ("S(1)-curve", "crossfade-in-S1");
p->push_back (PresetPoint (0, 0));
p->push_back (PresetPoint (0.1, 0.01));
p->push_back (PresetPoint (0.2, 0.03));
p->push_back (PresetPoint (0.9, 0.99));
p->push_back (PresetPoint (1, 1));
fade_in_presets->push_back (p);
+
+ p = new Preset ("S(2)-curve", "crossfade-in-S2");
+ p->push_back (PresetPoint (0.0, 0.0));
+ p->push_back (PresetPoint (0.055, 0.222));
+ p->push_back (PresetPoint (0.163, 0.35));
+ p->push_back (PresetPoint (0.837, 0.678));
+ p->push_back (PresetPoint (0.945, 0.783));
+ p->push_back (PresetPoint (1.0, 1.0));
+ fade_in_presets->push_back (p);
+
+ p = new Preset ("Constant Power (-3dB)", "crossfade-in-constant-power");
+
+ p->push_back (PresetPoint (0.000000, 0.000000));
+ p->push_back (PresetPoint (0.166667, 0.282192));
+ p->push_back (PresetPoint (0.333333, 0.518174));
+ p->push_back (PresetPoint (0.500000, 0.707946));
+ p->push_back (PresetPoint (0.666667, 0.851507));
+ p->push_back (PresetPoint (0.833333, 0.948859));
+ p->push_back (PresetPoint (1.000000, 1.000000));
+
+ fade_in_presets->push_back (p);
+
+ if (!Profile->get_sae()) {
+
+ p = new Preset ("Short cut", "crossfade-in-short-cut");
+ p->push_back (PresetPoint (0, 0));
+ p->push_back (PresetPoint (0.389401, 0.0333333));
+ p->push_back (PresetPoint (0.629032, 0.0861111));
+ p->push_back (PresetPoint (0.829493, 0.233333));
+ p->push_back (PresetPoint (0.9447, 0.483333));
+ p->push_back (PresetPoint (0.976959, 0.697222));
+ p->push_back (PresetPoint (1, 1));
+ fade_in_presets->push_back (p);
+
+ p = new Preset ("Slow cut", "crossfade-in-slow-cut");
+ p->push_back (PresetPoint (0, 0));
+ p->push_back (PresetPoint (0.304147, 0.0694444));
+ p->push_back (PresetPoint (0.529954, 0.152778));
+ p->push_back (PresetPoint (0.725806, 0.333333));
+ p->push_back (PresetPoint (0.847926, 0.558333));
+ p->push_back (PresetPoint (0.919355, 0.730556));
+ p->push_back (PresetPoint (1, 1));
+ fade_in_presets->push_back (p);
+
+ p = new Preset ("Fast cut", "crossfade-in-fast-cut");
+ p->push_back (PresetPoint (0, 0));
+ p->push_back (PresetPoint (0.0737327, 0.308333));
+ p->push_back (PresetPoint (0.246544, 0.658333));
+ p->push_back (PresetPoint (0.470046, 0.886111));
+ p->push_back (PresetPoint (0.652074, 0.972222));
+ p->push_back (PresetPoint (0.771889, 0.988889));
+ p->push_back (PresetPoint (1, 1));
+ fade_in_presets->push_back (p);
+
+ p = new Preset ("Long cut", "crossfade-in-long-cut");
+ p->push_back (PresetPoint (0, 0));
+ p->push_back (PresetPoint (0.0207373, 0.197222));
+ p->push_back (PresetPoint (0.0645161, 0.525));
+ p->push_back (PresetPoint (0.152074, 0.802778));
+ p->push_back (PresetPoint (0.276498, 0.919444));
+ p->push_back (PresetPoint (0.481567, 0.980556));
+ p->push_back (PresetPoint (0.767281, 1));
+ p->push_back (PresetPoint (1, 1));
+ fade_in_presets->push_back (p);
+ }
/* FADE OUT */
- // p = new Preset ("hiout.xpm");
- p = new Preset ("crossfade_out_fast-cut");
- p->push_back (PresetPoint (0, 1));
- p->push_back (PresetPoint (0.305556, 1));
- p->push_back (PresetPoint (0.548611, 0.991736));
- p->push_back (PresetPoint (0.759259, 0.931129));
- p->push_back (PresetPoint (0.918981, 0.68595));
- p->push_back (PresetPoint (0.976852, 0.22865));
- p->push_back (PresetPoint (1, 0));
- fade_out_presets->push_back (p);
-
// p = new Preset ("regout.xpm");
- p = new Preset ("crossfade_out_constant");
+ p = new Preset ("Linear (-6dB cut)", "crossfade-out-linear");
p->push_back (PresetPoint (0, 1));
- p->push_back (PresetPoint (0.228111, 0.988889));
- p->push_back (PresetPoint (0.347926, 0.972222));
- p->push_back (PresetPoint (0.529954, 0.886111));
- p->push_back (PresetPoint (0.753456, 0.658333));
- p->push_back (PresetPoint (0.9262673, 0.308333));
- p->push_back (PresetPoint (1, 0));
+ p->push_back (PresetPoint (0.000000, 1.000000));
+ p->push_back (PresetPoint (0.166667, 0.833033));
+ p->push_back (PresetPoint (0.333333, 0.666186));
+ p->push_back (PresetPoint (0.500000, 0.499459));
+ p->push_back (PresetPoint (0.666667, 0.332853));
+ p->push_back (PresetPoint (0.833333, 0.166366));
+ p->push_back (PresetPoint (1.000000, 0.000000));
fade_out_presets->push_back (p);
- // p = new Preset ("loout.xpm");
- p = new Preset ("crossfade_out_transition");
+ p = new Preset ("S(1)-Curve", "crossfade-out-S1");
p->push_back (PresetPoint (0, 1));
- p->push_back (PresetPoint (0.023041, 0.697222));
- p->push_back (PresetPoint (0.0553, 0.483333));
- p->push_back (PresetPoint (0.170507, 0.233333));
- p->push_back (PresetPoint (0.370968, 0.0861111));
- p->push_back (PresetPoint (0.610599, 0.0333333));
+ p->push_back (PresetPoint (0.1, 0.99));
+ p->push_back (PresetPoint (0.2, 0.97));
+ p->push_back (PresetPoint (0.8, 0.03));
+ p->push_back (PresetPoint (0.9, 0.01));
p->push_back (PresetPoint (1, 0));
fade_out_presets->push_back (p);
- // p = new Preset ("regout2.xpm");
- p = new Preset ("crossfade_out_slow-fade");
- p->push_back (PresetPoint (0, 1));
- p->push_back (PresetPoint (0.080645, 0.730556));
- p->push_back (PresetPoint (0.277778, 0.289256));
- p->push_back (PresetPoint (0.470046, 0.152778));
- p->push_back (PresetPoint (0.695853, 0.0694444));
- p->push_back (PresetPoint (1, 0));
+ p = new Preset ("S(2)-Curve", "crossfade-out-S2");
+ p->push_back (PresetPoint (0.0, 1.0));
+ p->push_back (PresetPoint (0.163, 0.678));
+ p->push_back (PresetPoint (0.055, 0.783));
+ p->push_back (PresetPoint (0.837, 0.35));
+ p->push_back (PresetPoint (0.945, 0.222));
+ p->push_back (PresetPoint (1.0, 0.0));
fade_out_presets->push_back (p);
// p = new Preset ("linout.xpm");
- p = new Preset ("crossfade_out_dipped");
- p->push_back (PresetPoint (0, 1));
- p->push_back (PresetPoint (1, 0));
+ p = new Preset ("Constant Power (-3dB cut)", "crossfade-out-constant-power");
+ p->push_back (PresetPoint (0.000000, 1.000000));
+ p->push_back (PresetPoint (0.166667, 0.948859));
+ p->push_back (PresetPoint (0.333333, 0.851507));
+ p->push_back (PresetPoint (0.500000, 0.707946));
+ p->push_back (PresetPoint (0.666667, 0.518174));
+ p->push_back (PresetPoint (0.833333, 0.282192));
+ p->push_back (PresetPoint (1.000000, 0.000000));
fade_out_presets->push_back (p);
- p = new Preset ("crossfade_out_default");
- p->push_back (PresetPoint (0, 1));
- p->push_back (PresetPoint (0.1, 0.99));
- p->push_back (PresetPoint (0.2, 0.97));
- p->push_back (PresetPoint (0.8, 0.03));
- p->push_back (PresetPoint (0.9, 0.01));
- p->push_back (PresetPoint (1, 0));
- fade_out_presets->push_back (p);
+ if (!Profile->get_sae()) {
+ // p = new Preset ("hiout.xpm");
+ p = new Preset ("Short cut", "crossfade-out-short-cut");
+ p->push_back (PresetPoint (0, 1));
+ p->push_back (PresetPoint (0.305556, 1));
+ p->push_back (PresetPoint (0.548611, 0.991736));
+ p->push_back (PresetPoint (0.759259, 0.931129));
+ p->push_back (PresetPoint (0.918981, 0.68595));
+ p->push_back (PresetPoint (0.976852, 0.22865));
+ p->push_back (PresetPoint (1, 0));
+ fade_out_presets->push_back (p);
+
+ p = new Preset ("Slow cut", "crossfade-out-slow-cut");
+ p->push_back (PresetPoint (0, 1));
+ p->push_back (PresetPoint (0.228111, 0.988889));
+ p->push_back (PresetPoint (0.347926, 0.972222));
+ p->push_back (PresetPoint (0.529954, 0.886111));
+ p->push_back (PresetPoint (0.753456, 0.658333));
+ p->push_back (PresetPoint (0.9262673, 0.308333));
+ p->push_back (PresetPoint (1, 0));
+ fade_out_presets->push_back (p);
+
+ p = new Preset ("Fast cut", "crossfade-out-fast-cut");
+ p->push_back (PresetPoint (0, 1));
+ p->push_back (PresetPoint (0.080645, 0.730556));
+ p->push_back (PresetPoint (0.277778, 0.289256));
+ p->push_back (PresetPoint (0.470046, 0.152778));
+ p->push_back (PresetPoint (0.695853, 0.0694444));
+ p->push_back (PresetPoint (1, 0));
+ fade_out_presets->push_back (p);
+
+ // p = new Preset ("loout.xpm");
+ p = new Preset ("Long cut", "crossfade-out-long-cut");
+ p->push_back (PresetPoint (0, 1));
+ p->push_back (PresetPoint (0.023041, 0.697222));
+ p->push_back (PresetPoint (0.0553, 0.483333));
+ p->push_back (PresetPoint (0.170507, 0.233333));
+ p->push_back (PresetPoint (0.370968, 0.0861111));
+ p->push_back (PresetPoint (0.610599, 0.0333333));
+ p->push_back (PresetPoint (1, 0));
+ fade_out_presets->push_back (p);
+
+ }
}
void
for (vector<ArdourCanvas::WaveView*>::iterator i = fade[In].waves.begin(); i != fade[In].waves.end(); ++i) {
(*i)->property_wave_color() = ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorWave.get();
+ (*i)->property_fill_color() = ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorWave.get();
}
for (vector<ArdourCanvas::WaveView*>::iterator i = fade[Out].waves.begin(); i != fade[Out].waves.end(); ++i) {
(*i)->property_wave_color() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorWave.get();
+ (*i)->property_fill_color() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorWave.get();
}
fade[In].line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorLine.get();
for (vector<ArdourCanvas::WaveView*>::iterator i = fade[In].waves.begin(); i != fade[In].waves.end(); ++i) {
(*i)->property_wave_color() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorWave.get();
+ (*i)->property_fill_color() = ARDOUR_UI::config()->canvasvar_CrossfadeEditorWave.get();
}
for (vector<ArdourCanvas::WaveView*>::iterator i = fade[Out].waves.begin(); i != fade[Out].waves.end(); ++i) {
(*i)->property_wave_color() = ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorWave.get();
+ (*i)->property_fill_color() = ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorWave.get();
}
fade[Out].line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_SelectedCrossfadeEditorLine.get();
{
xfract = min (1.0, xfract);
xfract = max (0.0, xfract);
-
+
return canvas_border + (xfract * effective_width());
}
waveview->property_sourcefile_length_function() = (void*) sourcefile_length_from_c;
waveview->property_peak_function() = (void*) region_read_peaks_from_c;
waveview->property_gain_function() = (void*) curve_get_vector_from_c;
- waveview->property_gain_src() = &fade[which].gain_curve;
+ waveview->property_gain_src() = static_cast<Evoral::Curve*>(&fade[which].gain_curve.curve());
waveview->property_x() = canvas_border;
waveview->property_y() = yoff;
waveview->property_height() = ht;
waveview->property_samples_per_unit() = spu;
waveview->property_amplitude_above_axis() = 2.0;
waveview->property_wave_color() = color;
+ waveview->property_fill_color() = color;
+ if (which==In)
+ waveview->property_region_start() = region->start();
+ else
+ waveview->property_region_start() = region->start()+region->length()-xfade->length();
+
waveview->lower_to_bottom();
fade[which].waves.push_back (waveview);
}
}
void
-CrossfadeEditor::audition_both ()
+CrossfadeEditor::audition (Audition which)
{
AudioPlaylist& pl (session.the_auditioner()->prepare_playlist());
nframes_t preroll;
nframes_t postroll;
- nframes_t length;
nframes_t left_start_offset;
nframes_t right_length;
nframes_t left_length;
- if (preroll_button.get_active()) {
- preroll = ARDOUR_UI::instance()->preroll_clock.current_duration ();
+ if (which != Right && preroll_button.get_active()) {
+ preroll = session.frame_rate() * 2; //2 second hardcoded preroll for now
} else {
preroll = 0;
}
- if (postroll_button.get_active()) {
- postroll = ARDOUR_UI::instance()->postroll_clock.current_duration ();
+ if (which != Left && postroll_button.get_active()) {
+ postroll = session.frame_rate() * 2; //2 second hardcoded postroll for now
} else {
postroll = 0;
}
- if ((left_start_offset = xfade->out()->length() - xfade->length()) >= preroll) {
- left_start_offset -= preroll;
- }
-
- length = 0;
-
- if ((left_length = xfade->length()) < xfade->out()->length() - left_start_offset) {
- length += postroll;
- }
+ // Is there enough data for the whole preroll?
+ left_length = xfade->length();
+ if ((left_start_offset = xfade->out()->length() - xfade->length()) > preroll) {
+ left_start_offset -= preroll;
+ } else {
+ preroll = left_start_offset;
+ left_start_offset = 0;
+ }
+ left_length += preroll;
+ // Is there enough data for the whole postroll?
right_length = xfade->length();
-
- if (xfade->in()->length() - right_length < postroll) {
+ if ((xfade->in()->length() - right_length) > postroll) {
right_length += postroll;
+ } else {
+ right_length = xfade->in()->length();
}
boost::shared_ptr<AudioRegion> left (boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (xfade->out(), left_start_offset, left_length, "xfade out",
boost::shared_ptr<AudioRegion> right (boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (xfade->in(), 0, right_length, "xfade in",
0, Region::DefaultFlags, false)));
+ //apply a 20ms declicking fade at the start and end of auditioning
+ left->set_fade_in_active(true);
+ left->set_fade_in_length(session.frame_rate() / 50);
+ right->set_fade_out_active(true);
+ right->set_fade_out_length(session.frame_rate() / 50);
+
pl.add_region (left, 0);
- pl.add_region (right, 1+preroll);
+ pl.add_region (right, 1 + preroll);
+
+ if (which == Left) {
+ right->set_scale_amplitude (0.0);
+ } else if (which == Right) {
+ left->set_scale_amplitude (0.0);
+ }
/* there is only one ... */
-
- pl.foreach_crossfade (this, &CrossfadeEditor::setup);
+ pl.foreach_crossfade (sigc::mem_fun (*this, &CrossfadeEditor::setup));
session.audition_playlist ();
}
+void
+CrossfadeEditor::audition_both ()
+{
+ audition (Both);
+}
+
void
CrossfadeEditor::audition_left_dry ()
{
void
CrossfadeEditor::audition_left ()
{
- AudioPlaylist& pl (session.the_auditioner()->prepare_playlist());
-
- boost::shared_ptr<AudioRegion> left (boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (xfade->out(), xfade->out()->length() - xfade->length(), xfade->length(), "xfade left",
- 0, Region::DefaultFlags, false)));
- boost::shared_ptr<AudioRegion> right (boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (xfade->in(), 0, xfade->length(), "xfade in",
- 0, Region::DefaultFlags, false)));
-
- pl.add_region (left, 0);
- pl.add_region (right, 1);
-
- right->set_muted (true);
-
- /* there is only one ... */
-
- pl.foreach_crossfade (this, &CrossfadeEditor::setup);
-
- session.audition_playlist ();
-
- /* memory leak for regions */
+ audition (Left);
}
void
void
CrossfadeEditor::audition_right ()
{
- AudioPlaylist& pl (session.the_auditioner()->prepare_playlist());
-
- boost::shared_ptr<AudioRegion> left (boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (xfade->out(), xfade->out()->length() - xfade->length(), xfade->length(), "xfade out",
- 0, Region::DefaultFlags, false)));
- boost::shared_ptr<AudioRegion> right (boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (xfade->out(), 0, xfade->length(), "xfade out",
- 0, Region::DefaultFlags, false)));
-
- pl.add_region (left, 0);
- pl.add_region (right, 1);
-
- left->set_muted (true);
-
- /* there is only one ... */
-
- pl.foreach_crossfade (this, &CrossfadeEditor::setup);
-
- session.audition_playlist ();
+ audition (Right);
}
void
}
}
}
+
+bool
+CrossfadeEditor::on_key_press_event (GdkEventKey */*ev*/)
+{
+ return true;
+}
+
+bool
+CrossfadeEditor::on_key_release_event (GdkEventKey* ev)
+{
+ switch (ev->keyval) {
+ case GDK_Right:
+ if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
+ audition_right_dry_button.set_active (!audition_right_dry_button.get_active());
+ } else {
+ audition_right_button.set_active (!audition_right_button.get_active());
+ }
+ break;
+
+ case GDK_Left:
+ if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
+ audition_left_dry_button.set_active (!audition_left_dry_button.get_active());
+ } else {
+ audition_left_button.set_active (!audition_left_button.get_active());
+ }
+ break;
+
+ case GDK_space:
+ if (session.is_auditioning()) {
+ cancel_audition ();
+ } else {
+ audition_both_button.set_active (!audition_both_button.get_active());
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return true;
+}