2008-06-02 17:41:35 -04:00
|
|
|
/*
|
2009-10-14 12:10:01 -04:00
|
|
|
Copyright (C) 2000-2001 Paul Davis
|
2008-06-02 17:41:35 -04:00
|
|
|
|
|
|
|
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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ardour_region_h__
|
|
|
|
#define __ardour_region_h__
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
#include <boost/enable_shared_from_this.hpp>
|
2009-02-16 22:49:32 -05:00
|
|
|
#include <boost/utility.hpp>
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "pbd/undo.h"
|
2009-12-19 15:26:31 -05:00
|
|
|
#include "pbd/signals.h"
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/ardour.h"
|
|
|
|
#include "ardour/data_type.h"
|
|
|
|
#include "ardour/automatable.h"
|
2010-09-22 11:21:06 -04:00
|
|
|
#include "ardour/movable.h"
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/readable.h"
|
|
|
|
#include "ardour/session_object.h"
|
2010-09-22 11:21:06 -04:00
|
|
|
#include "ardour/trimmable.h"
|
2017-04-19 12:22:44 -04:00
|
|
|
#include "ardour/types_convert.h"
|
2008-06-02 17:41:35 -04:00
|
|
|
|
|
|
|
class XMLNode;
|
|
|
|
|
|
|
|
namespace ARDOUR {
|
|
|
|
|
2010-02-18 08:59:49 -05:00
|
|
|
namespace Properties {
|
2013-10-17 12:41:28 -04:00
|
|
|
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> muted;
|
|
|
|
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> opaque;
|
|
|
|
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> locked;
|
|
|
|
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> video_locked;
|
|
|
|
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> automatic;
|
|
|
|
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> whole_file;
|
|
|
|
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> import;
|
|
|
|
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> external;
|
|
|
|
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> sync_marked;
|
|
|
|
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> left_of_split;
|
|
|
|
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> right_of_split;
|
|
|
|
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> hidden;
|
|
|
|
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> position_locked;
|
|
|
|
LIBARDOUR_API extern PBD::PropertyDescriptor<bool> valid_transients;
|
2019-04-07 23:16:33 -04:00
|
|
|
LIBARDOUR_API extern PBD::PropertyDescriptor<samplepos_t> start;
|
|
|
|
LIBARDOUR_API extern PBD::PropertyDescriptor<samplecnt_t> length;
|
|
|
|
LIBARDOUR_API extern PBD::PropertyDescriptor<samplepos_t> position;
|
2016-07-22 12:23:08 -04:00
|
|
|
LIBARDOUR_API extern PBD::PropertyDescriptor<double> beat;
|
2019-04-07 23:16:33 -04:00
|
|
|
LIBARDOUR_API extern PBD::PropertyDescriptor<samplecnt_t> sync_position;
|
2013-10-17 12:41:28 -04:00
|
|
|
LIBARDOUR_API extern PBD::PropertyDescriptor<layer_t> layer;
|
2019-04-07 23:16:33 -04:00
|
|
|
LIBARDOUR_API extern PBD::PropertyDescriptor<samplepos_t> ancestral_start;
|
|
|
|
LIBARDOUR_API extern PBD::PropertyDescriptor<samplecnt_t> ancestral_length;
|
2013-10-17 12:41:28 -04:00
|
|
|
LIBARDOUR_API extern PBD::PropertyDescriptor<float> stretch;
|
|
|
|
LIBARDOUR_API extern PBD::PropertyDescriptor<float> shift;
|
|
|
|
LIBARDOUR_API extern PBD::PropertyDescriptor<PositionLockStyle> position_lock_style;
|
|
|
|
LIBARDOUR_API extern PBD::PropertyDescriptor<uint64_t> layering_index;
|
2010-02-18 08:59:49 -05:00
|
|
|
};
|
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
class Playlist;
|
|
|
|
class Filter;
|
|
|
|
class ExportSpecification;
|
2011-06-01 12:50:12 -04:00
|
|
|
class Progress;
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2013-10-17 10:02:11 -04:00
|
|
|
enum LIBARDOUR_API RegionEditState {
|
2008-06-02 17:41:35 -04:00
|
|
|
EditChangesNothing = 0,
|
|
|
|
EditChangesName = 1,
|
|
|
|
EditChangesID = 2
|
|
|
|
};
|
|
|
|
|
2010-02-18 08:59:49 -05:00
|
|
|
|
2013-10-17 10:02:11 -04:00
|
|
|
class LIBARDOUR_API Region
|
2009-12-19 15:26:31 -05:00
|
|
|
: public SessionObject
|
|
|
|
, public boost::enable_shared_from_this<Region>
|
|
|
|
, public Readable
|
2010-12-20 16:22:49 -05:00
|
|
|
, public Trimmable
|
|
|
|
, public Movable
|
2008-06-02 17:41:35 -04:00
|
|
|
{
|
2017-10-03 18:35:29 -04:00
|
|
|
public:
|
2008-06-02 17:41:35 -04:00
|
|
|
typedef std::vector<boost::shared_ptr<Source> > SourceList;
|
|
|
|
|
2010-02-18 08:59:49 -05:00
|
|
|
static void make_property_quarks ();
|
2011-06-01 12:50:12 -04:00
|
|
|
|
2010-02-19 13:09:08 -05:00
|
|
|
static PBD::Signal2<void,boost::shared_ptr<ARDOUR::Region>, const PBD::PropertyChange&> RegionPropertyChanged;
|
2008-06-02 17:41:35 -04:00
|
|
|
|
|
|
|
virtual ~Region();
|
2011-06-01 12:50:12 -04:00
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
/** Note: changing the name of a Region does not constitute an edit */
|
|
|
|
bool set_name (const std::string& str);
|
|
|
|
|
2010-12-20 16:22:49 -05:00
|
|
|
const DataType& data_type () const { return _type; }
|
2011-06-01 12:50:12 -04:00
|
|
|
|
2009-10-22 10:46:47 -04:00
|
|
|
/** How the region parameters play together:
|
2011-06-01 12:50:12 -04:00
|
|
|
*
|
2017-09-18 12:39:17 -04:00
|
|
|
* POSITION: first sample of the region along the timeline
|
|
|
|
* START: first sample of the region within its source(s)
|
|
|
|
* LENGTH: number of samples the region represents
|
2008-06-02 17:41:35 -04:00
|
|
|
*/
|
2019-04-07 23:16:33 -04:00
|
|
|
samplepos_t position () const { return _position; }
|
|
|
|
samplepos_t start () const { return _start; }
|
|
|
|
samplecnt_t length () const { return _length; }
|
2010-12-20 16:22:49 -05:00
|
|
|
layer_t layer () const { return _layer; }
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2018-02-11 10:39:36 -05:00
|
|
|
void set_selected_for_solo(bool yn);
|
|
|
|
|
2019-04-07 23:16:33 -04:00
|
|
|
samplecnt_t source_length (uint32_t n) const;
|
2011-05-15 22:17:58 -04:00
|
|
|
uint32_t max_source_level () const;
|
2009-02-19 19:30:42 -05:00
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
/* these two are valid ONLY during a StateChanged signal handler */
|
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
samplepos_t last_position () const { return _last_position; }
|
|
|
|
samplecnt_t last_length () const { return _last_length; }
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
samplepos_t ancestral_start () const { return _ancestral_start; }
|
|
|
|
samplecnt_t ancestral_length () const { return _ancestral_length; }
|
2011-06-01 12:50:12 -04:00
|
|
|
|
2010-12-20 16:22:49 -05:00
|
|
|
float stretch () const { return _stretch; }
|
|
|
|
float shift () const { return _shift; }
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
void set_ancestral_data (samplepos_t start, samplecnt_t length, float stretch, float shift);
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
sampleoffset_t sync_offset (int& dir) const;
|
|
|
|
samplepos_t sync_position () const;
|
2011-06-01 12:50:12 -04:00
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
samplepos_t adjust_to_sync (samplepos_t) const;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
/* first_sample() is an alias; last_sample() just hides some math */
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
samplepos_t first_sample () const { return _position; }
|
|
|
|
samplepos_t last_sample () const { return _position + _length - 1; }
|
2010-12-20 16:22:49 -05:00
|
|
|
|
2012-05-10 14:17:47 -04:00
|
|
|
/** Return the earliest possible value of _position given the
|
|
|
|
* value of _start within the region's sources
|
|
|
|
*/
|
2017-09-18 12:39:17 -04:00
|
|
|
samplepos_t earliest_possible_position () const;
|
|
|
|
/** Return the last possible value of _last_sample given the
|
2012-05-10 14:17:47 -04:00
|
|
|
* value of _startin the regions's sources
|
|
|
|
*/
|
2017-09-18 12:39:17 -04:00
|
|
|
samplepos_t latest_possible_sample () const;
|
2012-05-10 14:17:47 -04:00
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
Evoral::Range<samplepos_t> last_range () const {
|
|
|
|
return Evoral::Range<samplepos_t> (_last_position, _last_position + _last_length - 1);
|
2012-04-16 12:32:22 -04:00
|
|
|
}
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
Evoral::Range<samplepos_t> range () const {
|
|
|
|
return Evoral::Range<samplepos_t> (first_sample(), last_sample());
|
2012-04-16 12:32:22 -04:00
|
|
|
}
|
|
|
|
|
2011-02-14 20:09:03 -05:00
|
|
|
bool hidden () const { return _hidden; }
|
|
|
|
bool muted () const { return _muted; }
|
|
|
|
bool opaque () const { return _opaque; }
|
|
|
|
bool locked () const { return _locked; }
|
|
|
|
bool position_locked () const { return _position_locked; }
|
2013-03-12 17:00:09 -04:00
|
|
|
bool video_locked () const { return _video_locked; }
|
2011-02-14 20:09:03 -05:00
|
|
|
bool automatic () const { return _automatic; }
|
|
|
|
bool whole_file () const { return _whole_file; }
|
|
|
|
bool captured () const { return !(_import || _external); }
|
2012-09-07 21:03:00 -04:00
|
|
|
bool can_move () const { return !_position_locked && !_locked; }
|
2011-02-14 20:09:03 -05:00
|
|
|
bool sync_marked () const { return _sync_marked; }
|
|
|
|
bool external () const { return _external; }
|
|
|
|
bool import () const { return _import; }
|
2011-06-01 12:50:12 -04:00
|
|
|
|
|
|
|
Trimmable::CanTrim can_trim () const;
|
2010-12-20 16:22:49 -05:00
|
|
|
|
|
|
|
PositionLockStyle position_lock_style () const { return _position_lock_style; }
|
2008-06-02 17:41:35 -04:00
|
|
|
void set_position_lock_style (PositionLockStyle ps);
|
2016-07-10 09:30:41 -04:00
|
|
|
void recompute_position_from_lock_style (const int32_t sub_num);
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2016-10-30 09:01:02 -04:00
|
|
|
/* meter-based beat at the region position */
|
2016-06-16 13:20:37 -04:00
|
|
|
double beat () const { return _beat; }
|
|
|
|
void set_beat (double beat) { _beat = beat; }
|
2016-11-08 12:51:19 -05:00
|
|
|
/* quarter-note at the region position */
|
|
|
|
double quarter_note () const { return _quarter_note; }
|
|
|
|
void set_quarter_note (double qn) { _quarter_note = qn; }
|
2016-06-16 13:20:37 -04:00
|
|
|
|
2010-03-02 13:05:26 -05:00
|
|
|
void suspend_property_changes ();
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
bool covers (samplepos_t sample) const {
|
|
|
|
return first_sample() <= sample && sample <= last_sample();
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
|
|
|
|
2012-04-16 12:32:22 -04:00
|
|
|
/** @return coverage of this region with the given range;
|
|
|
|
* OverlapInternal: the range is internal to this region.
|
|
|
|
* OverlapStart: the range overlaps the start of this region.
|
|
|
|
* OverlapEnd: the range overlaps the end of this region.
|
|
|
|
* OverlapExternal: the range overlaps all of this region.
|
|
|
|
*/
|
2017-09-18 12:39:17 -04:00
|
|
|
Evoral::OverlapType coverage (samplepos_t start, samplepos_t end) const {
|
|
|
|
return Evoral::coverage (first_sample(), last_sample(), start, end);
|
2008-06-02 17:41:35 -04:00
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2018-09-13 14:05:47 -04:00
|
|
|
bool exact_equivalent (boost::shared_ptr<const Region>) const;
|
2008-06-02 17:41:35 -04:00
|
|
|
bool size_equivalent (boost::shared_ptr<const Region>) const;
|
|
|
|
bool overlap_equivalent (boost::shared_ptr<const Region>) const;
|
2018-09-13 14:05:47 -04:00
|
|
|
bool enclosed_equivalent (boost::shared_ptr<const Region>) const;
|
2019-03-12 10:15:44 -04:00
|
|
|
bool layer_and_time_equivalent (boost::shared_ptr<const Region>) const;
|
2008-06-02 17:41:35 -04:00
|
|
|
bool region_list_equivalent (boost::shared_ptr<const Region>) const;
|
|
|
|
bool source_equivalent (boost::shared_ptr<const Region>) const;
|
2013-01-04 17:46:51 -05:00
|
|
|
bool any_source_equivalent (boost::shared_ptr<const Region>) const;
|
2016-06-28 15:05:48 -04:00
|
|
|
bool uses_source (boost::shared_ptr<const Source>, bool shallow = false) const;
|
|
|
|
void deep_sources (std::set<boost::shared_ptr<Source> >&) const;
|
2011-06-01 12:50:12 -04:00
|
|
|
|
2011-02-14 16:49:43 -05:00
|
|
|
std::string source_string () const;
|
|
|
|
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
/* EDITING OPERATIONS */
|
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
void set_length (samplecnt_t, const int32_t sub_num);
|
|
|
|
void set_start (samplepos_t);
|
|
|
|
void set_position (samplepos_t, int32_t sub_num = 0);
|
2017-01-26 08:41:17 -05:00
|
|
|
void set_position_music (double qn);
|
2017-09-18 12:39:17 -04:00
|
|
|
void set_initial_position (samplepos_t);
|
|
|
|
void special_set_position (samplepos_t);
|
2016-05-24 14:09:15 -04:00
|
|
|
virtual void update_after_tempo_map_change (bool send_change = true);
|
2017-09-18 12:39:17 -04:00
|
|
|
void nudge_position (sampleoffset_t);
|
2008-06-02 17:41:35 -04:00
|
|
|
|
|
|
|
bool at_natural_position () const;
|
2011-05-30 09:54:44 -04:00
|
|
|
void move_to_natural_position ();
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
void move_start (sampleoffset_t distance, const int32_t sub_num = 0);
|
|
|
|
void trim_front (samplepos_t new_position, const int32_t sub_num = 0);
|
|
|
|
void trim_end (samplepos_t new_position, const int32_t sub_num = 0);
|
|
|
|
void trim_to (samplepos_t position, samplecnt_t length, const int32_t sub_num = 0);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
virtual void fade_range (samplepos_t, samplepos_t) {}
|
2014-07-10 08:16:55 -04:00
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
void cut_front (samplepos_t new_position, const int32_t sub_num = 0);
|
|
|
|
void cut_end (samplepos_t new_position, const int32_t sub_num = 0);
|
2010-04-15 16:42:05 -04:00
|
|
|
|
2011-12-29 17:14:15 -05:00
|
|
|
void set_layer (layer_t l); /* ONLY Playlist can call this */
|
2008-06-02 17:41:35 -04:00
|
|
|
void raise ();
|
|
|
|
void lower ();
|
|
|
|
void raise_to_top ();
|
|
|
|
void lower_to_bottom ();
|
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
void set_sync_position (samplepos_t n);
|
2008-06-02 17:41:35 -04:00
|
|
|
void clear_sync_position ();
|
|
|
|
void set_hidden (bool yn);
|
|
|
|
void set_muted (bool yn);
|
2010-02-18 08:59:49 -05:00
|
|
|
void set_whole_file (bool yn);
|
|
|
|
void set_automatic (bool yn);
|
2008-06-02 17:41:35 -04:00
|
|
|
void set_opaque (bool yn);
|
|
|
|
void set_locked (bool yn);
|
2013-03-12 17:00:09 -04:00
|
|
|
void set_video_locked (bool yn);
|
2008-06-02 17:41:35 -04:00
|
|
|
void set_position_locked (bool yn);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-09-19 20:58:25 -04:00
|
|
|
int apply (Filter &, Progress* progress = 0);
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2010-12-20 16:22:49 -05:00
|
|
|
boost::shared_ptr<ARDOUR::Playlist> playlist () const { return _playlist.lock(); }
|
2008-06-02 17:41:35 -04:00
|
|
|
virtual void set_playlist (boost::weak_ptr<ARDOUR::Playlist>);
|
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
void source_deleted (boost::weak_ptr<Source>);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2011-05-22 12:11:00 -04:00
|
|
|
bool is_compound () const;
|
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
boost::shared_ptr<Source> source (uint32_t n=0) const { return _sources[ (n < _sources.size()) ? n : 0 ]; }
|
2011-02-14 16:49:43 -05:00
|
|
|
uint32_t n_channels() const { return _sources.size(); }
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2010-12-20 16:22:49 -05:00
|
|
|
const SourceList& sources () const { return _sources; }
|
|
|
|
const SourceList& master_sources () const { return _master_sources; }
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2009-05-12 13:03:42 -04:00
|
|
|
std::vector<std::string> master_source_names();
|
2008-09-10 17:27:39 -04:00
|
|
|
void set_master_sources (const SourceList&);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-21 12:17:02 -04:00
|
|
|
/* automation */
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-21 12:17:02 -04:00
|
|
|
virtual boost::shared_ptr<Evoral::Control>
|
2010-12-20 16:22:49 -05:00
|
|
|
control (const Evoral::Parameter& id, bool create=false) = 0;
|
2008-09-21 12:17:02 -04:00
|
|
|
|
|
|
|
virtual boost::shared_ptr<const Evoral::Control>
|
2010-12-20 16:22:49 -05:00
|
|
|
control (const Evoral::Parameter& id) const = 0;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
/* serialization */
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
XMLNode& get_state ();
|
2009-10-15 14:56:11 -04:00
|
|
|
virtual int set_state (const XMLNode&, int version);
|
2008-06-02 17:41:35 -04:00
|
|
|
|
|
|
|
virtual boost::shared_ptr<Region> get_parent() const;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2011-12-29 17:14:15 -05:00
|
|
|
uint64_t layering_index () const { return _layering_index; }
|
|
|
|
void set_layering_index (uint64_t when) { _layering_index = when; }
|
2008-06-02 17:41:35 -04:00
|
|
|
|
|
|
|
virtual bool is_dependent() const { return false; }
|
2009-07-21 11:55:17 -04:00
|
|
|
virtual bool depends_on (boost::shared_ptr<Region> /*other*/) const { return false; }
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
virtual void add_transient (samplepos_t) {
|
2010-07-06 07:33:27 -04:00
|
|
|
// no transients, but its OK
|
|
|
|
}
|
|
|
|
|
2016-04-30 20:02:04 -04:00
|
|
|
virtual void clear_transients () {
|
2010-07-06 07:33:27 -04:00
|
|
|
// no transients, but its OK
|
|
|
|
}
|
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
virtual void update_transient (samplepos_t /* old_position */, samplepos_t /* new_position */) {
|
2010-07-06 07:33:27 -04:00
|
|
|
// no transients, but its OK
|
|
|
|
}
|
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
virtual void remove_transient (samplepos_t /* where */) {
|
2010-07-06 07:33:27 -04:00
|
|
|
// no transients, but its OK
|
|
|
|
}
|
|
|
|
|
2016-04-30 20:02:04 -04:00
|
|
|
virtual void set_onsets (AnalysisFeatureList&) {
|
2008-06-02 17:41:35 -04:00
|
|
|
// no transients, but its OK
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2016-04-30 20:02:04 -04:00
|
|
|
/** merges _onsets and _user_transients into given list
|
|
|
|
* and removed exact duplicates.
|
|
|
|
*/
|
|
|
|
void transients (AnalysisFeatureList&);
|
|
|
|
|
|
|
|
/** merges _onsets OR _transients with _user_transients into given list
|
|
|
|
* if _onsets and _transients are unset, run analysis.
|
|
|
|
* list is not thinned, duplicates remain in place.
|
2016-06-28 15:05:48 -04:00
|
|
|
*
|
2016-04-30 20:02:04 -04:00
|
|
|
* intended for: Playlist::find_next_transient ()
|
|
|
|
*/
|
|
|
|
virtual void get_transients (AnalysisFeatureList&) {
|
2010-07-06 07:33:27 -04:00
|
|
|
// no transients, but its OK
|
|
|
|
}
|
|
|
|
|
2017-03-17 13:12:50 -04:00
|
|
|
/* wrapper to the above for easy access throug Lua */
|
|
|
|
AnalysisFeatureList transients () {
|
|
|
|
AnalysisFeatureList rv;
|
|
|
|
get_transients (rv);
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2016-04-30 20:02:04 -04:00
|
|
|
bool has_transients () const;
|
|
|
|
|
2017-08-23 13:37:45 -04:00
|
|
|
virtual int separate_by_channel (std::vector< boost::shared_ptr<Region> >&) const {
|
|
|
|
return -1;
|
2009-02-16 02:04:27 -05:00
|
|
|
}
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2016-04-30 20:02:04 -04:00
|
|
|
void maybe_invalidate_transients ();
|
2009-08-25 20:06:21 -04:00
|
|
|
|
2011-12-29 17:14:15 -05:00
|
|
|
void drop_sources ();
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2017-10-03 18:35:29 -04:00
|
|
|
protected:
|
|
|
|
virtual XMLNode& state ();
|
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
friend class RegionFactory;
|
|
|
|
|
2010-02-18 08:59:49 -05:00
|
|
|
/** Construct a region from multiple sources*/
|
|
|
|
Region (const SourceList& srcs);
|
2010-12-20 16:22:49 -05:00
|
|
|
|
2010-12-21 12:03:16 -05:00
|
|
|
/** Construct a region from another region */
|
|
|
|
Region (boost::shared_ptr<const Region>);
|
|
|
|
|
2010-02-18 08:59:49 -05:00
|
|
|
/** Construct a region from another region, at an offset within that region */
|
2017-09-18 12:39:17 -04:00
|
|
|
Region (boost::shared_ptr<const Region>, ARDOUR::MusicSample start_offset);
|
2011-06-01 12:50:12 -04:00
|
|
|
|
2010-02-18 08:59:49 -05:00
|
|
|
/** Construct a region as a copy of another region, but with different sources */
|
|
|
|
Region (boost::shared_ptr<const Region>, const SourceList&);
|
2010-12-20 16:22:49 -05:00
|
|
|
|
2010-02-18 08:59:49 -05:00
|
|
|
/** Constructor for derived types only */
|
2017-09-18 12:39:17 -04:00
|
|
|
Region (Session& s, samplepos_t start, samplecnt_t length, const std::string& name, DataType);
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2010-12-09 16:34:46 -05:00
|
|
|
virtual bool can_trim_start_before_source_start () const {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-10-03 18:35:29 -04:00
|
|
|
protected:
|
2011-12-16 21:04:58 -05:00
|
|
|
|
2010-02-19 13:09:08 -05:00
|
|
|
void send_change (const PBD::PropertyChange&);
|
2011-12-16 21:04:58 -05:00
|
|
|
virtual int _set_state (const XMLNode&, int version, PBD::PropertyChange& what_changed, bool send_signal);
|
|
|
|
void post_set (const PBD::PropertyChange&);
|
2017-09-18 12:39:17 -04:00
|
|
|
virtual void set_position_internal (samplepos_t pos, bool allow_bbt_recompute, const int32_t sub_num);
|
2017-01-26 08:41:17 -05:00
|
|
|
virtual void set_position_music_internal (double qn);
|
2017-09-18 12:39:17 -04:00
|
|
|
virtual void set_length_internal (samplecnt_t, const int32_t sub_num);
|
|
|
|
virtual void set_start_internal (samplecnt_t, const int32_t sub_num = 0);
|
|
|
|
bool verify_start_and_length (samplepos_t, samplecnt_t&);
|
2016-06-10 15:40:50 -04:00
|
|
|
void first_edit ();
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2011-12-16 21:04:58 -05:00
|
|
|
DataType _type;
|
|
|
|
|
|
|
|
PBD::Property<bool> _sync_marked;
|
|
|
|
PBD::Property<bool> _left_of_split;
|
|
|
|
PBD::Property<bool> _right_of_split;
|
|
|
|
PBD::Property<bool> _valid_transients;
|
2019-04-07 23:16:33 -04:00
|
|
|
PBD::Property<samplepos_t> _start;
|
|
|
|
PBD::Property<samplecnt_t> _length;
|
|
|
|
PBD::Property<samplepos_t> _position;
|
2016-07-22 12:23:08 -04:00
|
|
|
PBD::Property<double> _beat;
|
2011-12-16 21:04:58 -05:00
|
|
|
/** Sync position relative to the start of our file */
|
2019-04-07 23:16:33 -04:00
|
|
|
PBD::Property<samplepos_t> _sync_position;
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2016-11-08 12:51:19 -05:00
|
|
|
double _quarter_note;
|
2016-09-30 21:13:41 -04:00
|
|
|
|
2011-12-16 21:04:58 -05:00
|
|
|
SourceList _sources;
|
|
|
|
/** Used when timefx are applied, so we can always use the original source */
|
|
|
|
SourceList _master_sources;
|
|
|
|
|
|
|
|
boost::weak_ptr<ARDOUR::Playlist> _playlist;
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
void merge_features (AnalysisFeatureList&, const AnalysisFeatureList&, const sampleoffset_t) const;
|
2016-04-30 20:02:04 -04:00
|
|
|
|
|
|
|
AnalysisFeatureList _onsets; // used by the Ferret (Aubio OnsetDetector)
|
|
|
|
|
|
|
|
// _transient_user_start is covered by _valid_transients
|
|
|
|
AnalysisFeatureList _user_transients; // user added
|
2019-04-07 23:16:33 -04:00
|
|
|
samplepos_t _transient_user_start; // region's _start relative to user_transients
|
2016-04-30 20:02:04 -04:00
|
|
|
|
|
|
|
// these are used by Playlist::find_next_transient() in absence of onsets
|
|
|
|
AnalysisFeatureList _transients; // Source Analysis (QM Transient), user read-only
|
2019-04-07 23:16:33 -04:00
|
|
|
samplepos_t _transient_analysis_start;
|
|
|
|
samplepos_t _transient_analysis_end;
|
2016-04-30 20:02:04 -04:00
|
|
|
|
2018-02-11 10:39:36 -05:00
|
|
|
bool _soloSelected;
|
|
|
|
|
2017-10-03 18:35:29 -04:00
|
|
|
private:
|
2010-12-20 16:22:49 -05:00
|
|
|
void mid_thaw (const PBD::PropertyChange&);
|
2008-06-02 17:41:35 -04:00
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
virtual void trim_to_internal (samplepos_t position, samplecnt_t length, const int32_t sub_num);
|
|
|
|
void modify_front (samplepos_t new_position, bool reset_fade, const int32_t sub_num);
|
|
|
|
void modify_end (samplepos_t new_position, bool reset_fade, const int32_t sub_num);
|
2008-06-02 17:41:35 -04:00
|
|
|
|
|
|
|
void maybe_uncopy ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
bool verify_start (samplepos_t);
|
|
|
|
bool verify_start_mutable (samplepos_t&_start);
|
|
|
|
bool verify_length (samplecnt_t&);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-06-02 17:41:35 -04:00
|
|
|
virtual void recompute_at_start () = 0;
|
|
|
|
virtual void recompute_at_end () = 0;
|
2011-06-01 12:50:12 -04:00
|
|
|
|
2010-02-18 08:59:49 -05:00
|
|
|
PBD::Property<bool> _muted;
|
|
|
|
PBD::Property<bool> _opaque;
|
|
|
|
PBD::Property<bool> _locked;
|
2013-03-12 17:00:09 -04:00
|
|
|
PBD::Property<bool> _video_locked;
|
2010-02-18 08:59:49 -05:00
|
|
|
PBD::Property<bool> _automatic;
|
|
|
|
PBD::Property<bool> _whole_file;
|
|
|
|
PBD::Property<bool> _import;
|
|
|
|
PBD::Property<bool> _external;
|
|
|
|
PBD::Property<bool> _hidden;
|
|
|
|
PBD::Property<bool> _position_locked;
|
2019-04-07 23:16:33 -04:00
|
|
|
PBD::Property<samplepos_t> _ancestral_start;
|
|
|
|
PBD::Property<samplecnt_t> _ancestral_length;
|
2010-02-18 08:59:49 -05:00
|
|
|
PBD::Property<float> _stretch;
|
|
|
|
PBD::Property<float> _shift;
|
2010-06-27 20:34:09 -04:00
|
|
|
PBD::EnumProperty<PositionLockStyle> _position_lock_style;
|
2011-12-29 17:14:15 -05:00
|
|
|
PBD::Property<uint64_t> _layering_index;
|
2010-02-18 08:59:49 -05:00
|
|
|
|
2019-04-07 23:16:33 -04:00
|
|
|
samplecnt_t _last_length;
|
|
|
|
samplepos_t _last_position;
|
2008-06-02 17:41:35 -04:00
|
|
|
mutable RegionEditState _first_edit;
|
2011-12-30 15:05:48 -05:00
|
|
|
layer_t _layer;
|
2011-12-29 17:14:15 -05:00
|
|
|
|
2010-02-18 08:59:49 -05:00
|
|
|
void register_properties ();
|
|
|
|
|
2009-06-09 20:18:15 -04:00
|
|
|
void use_sources (SourceList const &);
|
2008-06-02 17:41:35 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
} /* namespace ARDOUR */
|
|
|
|
|
|
|
|
#endif /* __ardour_region_h__ */
|