2006-07-23 08:03:19 -04:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2006-2014 David Robillard <d@drobilla.net>
|
|
|
|
* Copyright (C) 2007-2012 Carl Hetherington <carl@carlh.net>
|
|
|
|
* Copyright (C) 2007 Doug McLain <doug@nostar.net>
|
|
|
|
* Copyright (C) 2008-2017 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2012 Ben Loftis <ben@harrisonconsoles.com>
|
|
|
|
* Copyright (C) 2014-2019 Robin Gareus <robin@gareus.org>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2006-07-23 08:03:19 -04:00
|
|
|
|
|
|
|
#ifndef __gtk_ardour_audio_region_view_h__
|
|
|
|
#define __gtk_ardour_audio_region_view_h__
|
|
|
|
|
2013-07-11 15:29:28 -04:00
|
|
|
#ifdef interface
|
|
|
|
#undef interface
|
|
|
|
#endif
|
|
|
|
|
2006-07-23 08:03:19 -04:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include <sigc++/signal.h>
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/audioregion.h"
|
2006-07-23 08:03:19 -04:00
|
|
|
|
2013-04-04 00:32:52 -04:00
|
|
|
#include "canvas/fwd.h"
|
2014-05-28 21:10:22 -04:00
|
|
|
#include "canvas/xfade_curve.h"
|
2013-04-04 00:32:52 -04:00
|
|
|
|
2017-07-17 14:12:33 -04:00
|
|
|
#include "waveview/wave_view.h"
|
|
|
|
|
2006-08-01 13:19:38 -04:00
|
|
|
#include "region_view.h"
|
2006-07-23 08:03:19 -04:00
|
|
|
#include "time_axis_view_item.h"
|
|
|
|
#include "automation_line.h"
|
|
|
|
#include "enums.h"
|
|
|
|
|
|
|
|
namespace ARDOUR {
|
|
|
|
class AudioRegion;
|
2012-05-23 22:54:10 -04:00
|
|
|
struct PeakData;
|
2006-07-23 08:03:19 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
class AudioTimeAxisView;
|
|
|
|
class AudioRegionGainLine;
|
|
|
|
class GhostRegion;
|
|
|
|
class AutomationTimeAxisView;
|
2009-06-28 20:38:32 -04:00
|
|
|
class RouteTimeAxisView;
|
2006-07-23 08:03:19 -04:00
|
|
|
|
|
|
|
class AudioRegionView : public RegionView
|
|
|
|
{
|
2017-07-01 15:11:14 -04:00
|
|
|
public:
|
2014-06-22 11:41:05 -04:00
|
|
|
AudioRegionView (ArdourCanvas::Container *,
|
2017-07-01 15:11:14 -04:00
|
|
|
RouteTimeAxisView&,
|
|
|
|
boost::shared_ptr<ARDOUR::AudioRegion>,
|
|
|
|
double initial_samples_per_pixel,
|
|
|
|
uint32_t base_color);
|
2006-07-23 08:03:19 -04:00
|
|
|
|
2014-06-22 11:41:05 -04:00
|
|
|
AudioRegionView (ArdourCanvas::Container *,
|
2017-07-01 15:11:14 -04:00
|
|
|
RouteTimeAxisView&,
|
|
|
|
boost::shared_ptr<ARDOUR::AudioRegion>,
|
|
|
|
double samples_per_pixel,
|
|
|
|
uint32_t base_color,
|
|
|
|
bool recording,
|
|
|
|
TimeAxisViewItem::Visibility);
|
2008-09-10 11:03:30 -04:00
|
|
|
|
2008-09-26 13:18:22 -04:00
|
|
|
AudioRegionView (const AudioRegionView& other, boost::shared_ptr<ARDOUR::AudioRegion>);
|
2007-03-18 02:07:08 -04:00
|
|
|
|
2006-07-23 08:03:19 -04:00
|
|
|
~AudioRegionView ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2014-06-09 23:28:32 -04:00
|
|
|
void init (bool wait_for_data);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-08-29 17:21:48 -04:00
|
|
|
boost::shared_ptr<ARDOUR::AudioRegion> audio_region() const;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
void create_waves ();
|
2015-09-15 08:42:43 -04:00
|
|
|
void delete_waves ();
|
2008-03-17 16:54:03 -04:00
|
|
|
|
2008-09-19 15:32:10 -04:00
|
|
|
void set_height (double);
|
2013-04-12 11:31:50 -04:00
|
|
|
void set_samples_per_pixel (double);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-08-29 17:21:48 -04:00
|
|
|
void set_amplitude_above_axis (gdouble spp);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-08-29 17:21:48 -04:00
|
|
|
void temporarily_hide_envelope (); ///< Dangerous!
|
|
|
|
void unhide_envelope (); ///< Dangerous!
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2012-05-29 14:38:54 -04:00
|
|
|
void update_envelope_visibility ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2017-07-01 12:42:24 -04:00
|
|
|
void add_gain_point_event (ArdourCanvas::Item *item, GdkEvent *event, bool with_guard_points);
|
2006-08-29 17:21:48 -04:00
|
|
|
void remove_gain_point_event (ArdourCanvas::Item *item, GdkEvent *event);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2012-03-09 16:22:09 -05:00
|
|
|
boost::shared_ptr<AudioRegionGainLine> get_gain_line() const { return gain_line; }
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-02-19 13:09:08 -05:00
|
|
|
void region_changed (const PBD::PropertyChange&);
|
2006-08-29 17:21:48 -04:00
|
|
|
void envelope_active_changed ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-07-09 13:58:13 -04:00
|
|
|
GhostRegion* add_ghost (TimeAxisView&);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
void reset_fade_in_shape_width (boost::shared_ptr<ARDOUR::AudioRegion> ar, samplecnt_t, bool drag_active = false);
|
|
|
|
void reset_fade_out_shape_width (boost::shared_ptr<ARDOUR::AudioRegion> ar, samplecnt_t, bool drag_active = false);
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
samplepos_t get_fade_in_shape_width ();
|
|
|
|
samplepos_t get_fade_out_shape_width ();
|
2012-11-20 14:43:43 -05:00
|
|
|
|
2008-10-09 17:55:05 -04:00
|
|
|
void set_fade_visibility (bool);
|
2019-04-08 15:40:33 -04:00
|
|
|
void update_coverage_frame (LayerDisplay);
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-07-06 07:33:27 -04:00
|
|
|
void update_transient(float old_pos, float new_pos);
|
|
|
|
void remove_transient(float pos);
|
2008-10-09 17:55:05 -04:00
|
|
|
|
2010-05-21 20:26:26 -04:00
|
|
|
void show_region_editor ();
|
|
|
|
|
2014-12-08 23:00:00 -05:00
|
|
|
virtual void entered ();
|
2006-08-29 17:21:48 -04:00
|
|
|
virtual void exited ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-11-08 20:58:12 -05:00
|
|
|
void thaw_after_trim ();
|
|
|
|
|
2012-05-07 18:02:17 -04:00
|
|
|
void drag_start ();
|
|
|
|
void drag_end ();
|
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
void redraw_start_xfade_to (boost::shared_ptr<ARDOUR::AudioRegion>, samplecnt_t, ArdourCanvas::Points&, double, double);
|
|
|
|
void redraw_end_xfade_to (boost::shared_ptr<ARDOUR::AudioRegion>, samplecnt_t, ArdourCanvas::Points&, double, double, double);
|
2012-05-09 20:46:22 -04:00
|
|
|
void redraw_start_xfade ();
|
|
|
|
void redraw_end_xfade ();
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2012-05-10 09:48:23 -04:00
|
|
|
void hide_xfades ();
|
2012-07-04 17:09:32 -04:00
|
|
|
void hide_start_xfade ();
|
|
|
|
void hide_end_xfade ();
|
2012-05-10 09:48:23 -04:00
|
|
|
void show_xfades ();
|
2012-07-04 17:09:32 -04:00
|
|
|
void show_start_xfade ();
|
|
|
|
void show_end_xfade ();
|
|
|
|
|
|
|
|
bool start_xfade_visible () const {
|
|
|
|
return _start_xfade_visible;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool end_xfade_visible () const {
|
|
|
|
return _end_xfade_visible;
|
|
|
|
}
|
2012-05-09 20:46:22 -04:00
|
|
|
|
2017-07-01 15:11:14 -04:00
|
|
|
protected:
|
2006-07-23 08:03:19 -04:00
|
|
|
|
2010-11-16 09:41:17 -05:00
|
|
|
/* this constructor allows derived types
|
2017-07-01 15:11:14 -04:00
|
|
|
* to specify their visibility requirements
|
|
|
|
* to the TimeAxisViewItem parent class
|
|
|
|
*/
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-11-16 09:41:17 -05:00
|
|
|
enum Flags {
|
|
|
|
WaveformVisible = 0x4,
|
|
|
|
WaveformRectified = 0x8,
|
|
|
|
WaveformLogScaled = 0x10,
|
|
|
|
};
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2017-07-17 14:12:33 -04:00
|
|
|
std::vector<ArdourWaveView::WaveView *> waves;
|
2019-09-30 12:20:15 -04:00
|
|
|
std::vector<ArdourWaveView::WaveView *> tmp_waves; ///< see \ref create_waves()
|
2011-02-14 16:49:43 -05:00
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
std::list<std::pair<samplepos_t, ArdourCanvas::Line*> > feature_lines;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2013-04-04 00:32:52 -04:00
|
|
|
ArdourCanvas::Rectangle* fade_in_handle; ///< fade in handle, or 0
|
|
|
|
ArdourCanvas::Rectangle* fade_out_handle; ///< fade out handle, or 0
|
2014-05-30 21:53:59 -04:00
|
|
|
ArdourCanvas::Rectangle* fade_in_trim_handle; ///< fade in trim handle, or 0
|
|
|
|
ArdourCanvas::Rectangle* fade_out_trim_handle; ///< fade out trim handle, or 0
|
2015-09-14 18:19:02 -04:00
|
|
|
ArdourCanvas::Rectangle* pending_peak_data;
|
|
|
|
|
|
|
|
static Cairo::RefPtr<Cairo::Pattern> pending_peak_pattern;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2014-05-28 21:10:22 -04:00
|
|
|
ArdourCanvas::XFadeCurve* start_xfade_curve;
|
|
|
|
ArdourCanvas::Rectangle* start_xfade_rect;
|
2012-07-04 17:09:32 -04:00
|
|
|
bool _start_xfade_visible;
|
2012-04-30 23:22:04 -04:00
|
|
|
|
2014-05-28 21:10:22 -04:00
|
|
|
ArdourCanvas::XFadeCurve* end_xfade_curve;
|
|
|
|
ArdourCanvas::Rectangle* end_xfade_rect;
|
2012-07-04 17:09:32 -04:00
|
|
|
bool _end_xfade_visible;
|
2012-04-30 23:22:04 -04:00
|
|
|
|
2012-03-09 16:22:09 -05:00
|
|
|
boost::shared_ptr<AudioRegionGainLine> gain_line;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-11-16 09:41:17 -05:00
|
|
|
double _amplitude_above_axis;
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-11-16 09:41:17 -05:00
|
|
|
void reset_fade_shapes ();
|
|
|
|
void reset_fade_in_shape ();
|
|
|
|
void reset_fade_out_shape ();
|
|
|
|
void fade_in_changed ();
|
|
|
|
void fade_out_changed ();
|
|
|
|
void fade_in_active_changed ();
|
|
|
|
void fade_out_active_changed ();
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-11-16 09:41:17 -05:00
|
|
|
void region_resized (const PBD::PropertyChange&);
|
|
|
|
void region_muted ();
|
|
|
|
void region_scale_amplitude_changed ();
|
|
|
|
void region_renamed ();
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-11-16 09:41:17 -05:00
|
|
|
void create_one_wave (uint32_t, bool);
|
|
|
|
void peaks_ready_handler (uint32_t);
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-11-16 09:41:17 -05:00
|
|
|
void set_colors ();
|
2017-07-01 12:42:24 -04:00
|
|
|
void set_waveform_colors ();
|
2010-11-16 09:41:17 -05:00
|
|
|
void reset_width_dependent_items (double pixel_width);
|
2019-04-08 14:00:02 -04:00
|
|
|
void set_frame_color ();
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-11-16 09:41:17 -05:00
|
|
|
void color_handler ();
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-11-16 09:41:17 -05:00
|
|
|
void transients_changed();
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2012-05-29 14:30:10 -04:00
|
|
|
AutomationLine::VisibleAspects automation_line_visibility () const;
|
2022-04-02 00:24:01 -04:00
|
|
|
void _redisplay (bool) {}
|
2012-05-29 14:30:10 -04:00
|
|
|
|
2010-11-16 09:41:17 -05:00
|
|
|
private:
|
|
|
|
void setup_fade_handle_positions ();
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2012-06-17 07:48:51 -04:00
|
|
|
void parameter_changed (std::string const &);
|
|
|
|
void setup_waveform_visibility ();
|
2017-07-17 14:12:33 -04:00
|
|
|
void set_some_waveform_colors (std::vector<ArdourWaveView::WaveView*>& waves_to_color);
|
2012-06-17 07:48:51 -04:00
|
|
|
|
2010-04-21 21:40:33 -04:00
|
|
|
/** A ScopedConnection for each PeaksReady callback (one per channel). Each member
|
|
|
|
* may be 0 if no connection exists.
|
|
|
|
*/
|
|
|
|
std::vector<PBD::ScopedConnection*> _data_ready_connections;
|
2012-06-15 11:01:35 -04:00
|
|
|
|
2012-07-04 17:09:32 -04:00
|
|
|
/** RegionViews that we hid the xfades for at the start of the current drag;
|
|
|
|
* first list is for start xfades, second list is for end xfades.
|
|
|
|
*/
|
|
|
|
std::pair<std::list<AudioRegionView*>, std::list<AudioRegionView*> > _hidden_xfades;
|
2014-05-30 21:53:59 -04:00
|
|
|
|
|
|
|
bool trim_fade_in_drag_active;
|
|
|
|
bool trim_fade_out_drag_active;
|
2006-07-23 08:03:19 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __gtk_ardour_audio_region_view_h__ */
|