, _position_lock_style (Properties::position_lock_style, _type == DataType::AUDIO ? AudioTime : MusicTime)
#define REGION_COPY_STATE(other) \
- _muted (other->_muted) \
- , _opaque (other->_opaque) \
- , _locked (other->_locked) \
- , _automatic (other->_automatic) \
- , _whole_file (other->_whole_file) \
- , _import (other->_import) \
- , _external (other->_external) \
- , _sync_marked (other->_sync_marked) \
- , _left_of_split (other->_left_of_split) \
- , _right_of_split (other->_right_of_split) \
- , _hidden (other->_hidden) \
- , _position_locked (other->_position_locked) \
- , _valid_transients (other->_valid_transients) \
- , _start(other->_start) \
- , _length(other->_length) \
- , _position(other->_position) \
- , _sync_position(other->_sync_position) \
- , _layer (other->_layer) \
- , _ancestral_start (other->_ancestral_start) \
- , _ancestral_length (other->_ancestral_length) \
- , _stretch (other->_stretch) \
- , _shift (other->_shift) \
- , _position_lock_style (other->_position_lock_style)
+ _muted (Properties::muted, other->_muted) \
+ , _opaque (Properties::opaque, other->_opaque) \
+ , _locked (Properties::locked, other->_locked) \
+ , _automatic (Properties::automatic, other->_automatic) \
+ , _whole_file (Properties::whole_file, other->_whole_file) \
+ , _import (Properties::import, other->_import) \
+ , _external (Properties::external, other->_external) \
+ , _sync_marked (Properties::sync_marked, other->_sync_marked) \
+ , _left_of_split (Properties::left_of_split, other->_left_of_split) \
+ , _right_of_split (Properties::right_of_split, other->_right_of_split) \
+ , _hidden (Properties::hidden, other->_hidden) \
+ , _position_locked (Properties::position_locked, other->_position_locked) \
+ , _valid_transients (Properties::valid_transients, other->_valid_transients) \
+ , _start(Properties::start, other->_start) \
+ , _length(Properties::length, other->_length) \
+ , _position(Properties::position, other->_position) \
+ , _sync_position(Properties::sync_position, other->_sync_position) \
+ , _layer (Properties::layer, other->_layer) \
+ , _ancestral_start (Properties::ancestral_start, other->_ancestral_start) \
+ , _ancestral_length (Properties::ancestral_length, other->_ancestral_length) \
+ , _stretch (Properties::stretch, other->_stretch) \
+ , _shift (Properties::shift, other->_shift) \
+ , _position_lock_style (Properties::position_lock_style, other->_position_lock_style)
/* derived-from-derived constructor (no sources in constructor) */
Region::Region (Session& s, framepos_t start, framecnt_t length, const string& name, DataType type)
/** Create a new Region from part of an existing one, starting at one of two places:
- if @param offset_relative is true, then the start within @param other is given by @param offset
- (i.e. relative to the start of @param other's sources, the start is @param offset + @param other.start()
+ if \a offset_relative is true, then the start within \a other is given by \a offset
+ (i.e. relative to the start of \a other's sources, the start is \a offset + \a other.start()
- if @param offset_relative is false, then the start within the source is given @param offset.
+ if @param offset_relative is false, then the start within the source is given \a offset.
*/
Region::Region (boost::shared_ptr<const Region> other, frameoffset_t offset, bool offset_relative)
: SessionObject(other->session(), other->name())
length impossible.
*/
- if (max_frames - len < _position) {
+ if (max_framepos - len < _position) {
return;
}
XXX is this the right thing to do?
*/
- if (max_frames - _length < _position) {
+ if (max_framepos - _length < _position) {
_last_length = _length;
- _length = max_frames - _position;
+ _length = max_framepos - _position;
}
if (allow_bbt_recompute) {
_last_position = _position;
if (n > 0) {
- if (_position > max_frames - n) {
- _position = max_frames;
+ if (_position > max_framepos - n) {
+ _position = max_framepos;
} else {
_position += n;
}
if (start_shift > 0) {
- if (_start > max_frames - start_shift) {
- new_start = max_frames;
+ if (_start > max_framepos - start_shift) {
+ new_start = max_framepos;
} else {
new_start = _start + start_shift;
}
if (new_position < end) { /* can't trim it zero or negative length */
nframes_t newlen = 0;
- nframes64_t delta = 0;
+ framepos_t delta = 0;
/* can't trim it back passed where source position zero is located */
}
void
-Region::modify_end (nframes_t new_endpoint, bool reset_fade, void *src)
+Region::modify_end (nframes_t new_endpoint, bool reset_fade, void* /*src*/)
{
if (locked()) {
return;
if (start_shift > 0) {
- if (_start > max_frames - start_shift) {
- new_start = max_frames;
+ if (_start > max_framepos - start_shift) {
+ new_start = max_framepos;
} else {
new_start = _start + start_shift;
}
}
}
+/** Set the region's sync point.
+ * @param absolute_pos Session time.
+ */
void
Region::set_sync_position (framepos_t absolute_pos)
{
+ /* position within our file */
framepos_t const file_pos = _start + (absolute_pos - _position);
if (file_pos != _sync_position) {
}
}
+/* @return the sync point relative the first frame of the region */
framepos_t
Region::sync_offset (int& dir) const
{
- /* returns the sync point relative the first frame of the region */
-
if (sync_marked()) {
if (_sync_position > _start) {
dir = 1;
pos = 0;
}
} else {
- if (max_frames - pos > offset) {
+ if (max_framepos - pos > offset) {
pos += offset;
}
}
return pos;
}
+/** @return Sync position in session time */
framepos_t
Region::sync_position() const
{
if (sync_marked()) {
- return _sync_position;
+ return _position - _start + _sync_position;
} else {
- return _start;
+ /* if sync has not been marked, use the start of the region */
+ return _position;
}
}
}
XMLNode&
-Region::state (bool full)
+Region::state ()
{
XMLNode *node = new XMLNode ("Region");
char buf[64];
node->add_property (buf2, buf);
}
- if (full && _extra_xml) {
+ if (_extra_xml) {
node->add_child_copy (*_extra_xml);
}
XMLNode&
Region::get_state ()
{
- return state (true);
+ return state ();
}
int
}
int
-Region::_set_state (const XMLNode& node, int version, PropertyChange& what_changed, bool send)
+Region::_set_state (const XMLNode& node, int /*version*/, PropertyChange& what_changed, bool send)
{
const XMLProperty* prop;
- what_changed = set_properties (node);
+ what_changed = set_values (node);
if ((prop = node.property (X_("id")))) {
_id = prop->value();
Stateful::send_change (what_changed);
- if (!_no_property_changes) {
+ if (!Stateful::frozen()) {
/* Try and send a shared_pointer unless this is part of the constructor.
If so, do nothing.
Region::set_master_sources (const SourceList& srcs)
{
for (SourceList::const_iterator i = _master_sources.begin (); i != _master_sources.end(); ++i) {
- cerr << name() << " " << id() << " DEC M SMS\n";
(*i)->dec_use_count ();
}
{
if (!other)
return false;
+
+ if ((_sources.size() != other->_sources.size()) ||
+ (_master_sources.size() != other->_master_sources.size())) {
+ return false;
+ }
SourceList::const_iterator i;
SourceList::const_iterator io;
return false;
}
-sframes_t
+framecnt_t
Region::source_length(uint32_t n) const
{
assert (n < _sources.size());
- return _sources[n]->length(_position - _start);
+ return _sources[n]->length (_position - _start);
}
bool
}
int
-Region::apply (Filter& filter)
+Region::apply (Filter& filter, Progress* progress)
{
- return filter.run (shared_from_this());
+ return filter.run (shared_from_this(), progress);
}
}
}
-PropertyList*
-Region::property_factory (const XMLNode& history_node) const
+Trimmable::CanTrim
+Region::can_trim () const
{
- PropertyList* prop_list = new PropertyList;
+ CanTrim ct = CanTrim (0);
+
+ if (locked()) {
+ return ct;
+ }
+
+ /* if not locked, we can always move the front later, and the end earlier
+ */
- for (OwnedPropertyList::const_iterator i = _properties->begin(); i != _properties->end(); ++i) {
- PropertyBase* prop = i->second->maybe_clone_self_if_found_in_history_node (history_node);
+ ct = CanTrim (ct | FrontTrimLater | EndTrimEarlier);
+
+ if (start() != 0) {
+ ct = CanTrim (ct | FrontTrimEarlier);
+ }
- if (prop) {
- prop_list->add (prop);
+ if (!_sources.empty()) {
+ if ((start() + length()) < _sources.front()->length (0)) {
+ ct = CanTrim (ct | EndTrimLater);
}
}
- return prop_list;
+ return ct;
}
+