mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-06 13:45:43 +01:00
(MERGED FROM rev 1924 on 2.0-ongoing) fix some (all? not likely) problems with dragging close to 2^32-1 frames
git-svn-id: svn://localhost/ardour2/trunk@1925 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
9316ec6d44
commit
539aa71d18
14 changed files with 251 additions and 157 deletions
|
|
@ -40,7 +40,7 @@ struct DragInfo {
|
|||
ItemType item_type;
|
||||
void* data;
|
||||
nframes_t last_frame_position;
|
||||
int32_t pointer_frame_offset;
|
||||
int64_t pointer_frame_offset;
|
||||
nframes_t grab_frame;
|
||||
nframes_t last_pointer_frame;
|
||||
nframes_t current_pointer_frame;
|
||||
|
|
|
|||
|
|
@ -1409,8 +1409,8 @@ Editor::motion_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item
|
|||
*/
|
||||
if (!drag_info.move_threshold_passed) {
|
||||
|
||||
bool x_threshold_passed = (abs ((int) (drag_info.current_pointer_x - drag_info.grab_x)) > 4);
|
||||
bool y_threshold_passed = (abs ((int) (drag_info.current_pointer_y - drag_info.grab_y)) > 4);
|
||||
bool x_threshold_passed = (abs ((int64_t) (drag_info.current_pointer_x - drag_info.grab_x)) > 4LL);
|
||||
bool y_threshold_passed = (abs ((int64_t) (drag_info.current_pointer_y - drag_info.grab_y)) > 4LL);
|
||||
|
||||
drag_info.move_threshold_passed = (x_threshold_passed || y_threshold_passed);
|
||||
|
||||
|
|
@ -1669,7 +1669,7 @@ Editor::fade_in_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
|
|||
nframes_t pos;
|
||||
nframes_t fade_length;
|
||||
|
||||
if ((int32_t)drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
|
||||
if (drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
|
||||
pos = drag_info.current_pointer_frame - drag_info.pointer_frame_offset;
|
||||
}
|
||||
else {
|
||||
|
|
@ -1714,7 +1714,7 @@ Editor::fade_in_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* even
|
|||
|
||||
if (drag_info.first_move) return;
|
||||
|
||||
if ((int32_t)drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
|
||||
if (drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
|
||||
pos = drag_info.current_pointer_frame - drag_info.pointer_frame_offset;
|
||||
} else {
|
||||
pos = 0;
|
||||
|
|
@ -1824,7 +1824,7 @@ Editor::fade_out_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* eve
|
|||
nframes_t pos;
|
||||
nframes_t fade_length;
|
||||
|
||||
if ((long)drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
|
||||
if (drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
|
||||
pos = drag_info.current_pointer_frame - drag_info.pointer_frame_offset;
|
||||
}
|
||||
else {
|
||||
|
|
@ -1906,7 +1906,7 @@ Editor::cursor_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
|
|||
Cursor* cursor = (Cursor *) drag_info.data;
|
||||
nframes_t adjusted_frame;
|
||||
|
||||
if ((long)drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
|
||||
if (drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
|
||||
adjusted_frame = drag_info.current_pointer_frame - drag_info.pointer_frame_offset;
|
||||
}
|
||||
else {
|
||||
|
|
@ -2022,7 +2022,7 @@ Editor::marker_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
|
|||
|
||||
|
||||
nframes_t newframe;
|
||||
if (drag_info.pointer_frame_offset <= (long) drag_info.current_pointer_frame) {
|
||||
if (drag_info.pointer_frame_offset <= drag_info.current_pointer_frame) {
|
||||
newframe = drag_info.current_pointer_frame - drag_info.pointer_frame_offset;
|
||||
}
|
||||
else {
|
||||
|
|
@ -2203,7 +2203,7 @@ Editor::meter_marker_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* e
|
|||
MeterMarker* marker = (MeterMarker *) drag_info.data;
|
||||
nframes_t adjusted_frame;
|
||||
|
||||
if ((long)drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
|
||||
if (drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
|
||||
adjusted_frame = drag_info.current_pointer_frame - drag_info.pointer_frame_offset;
|
||||
}
|
||||
else {
|
||||
|
|
@ -2334,7 +2334,7 @@ Editor::tempo_marker_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* e
|
|||
TempoMarker* marker = (TempoMarker *) drag_info.data;
|
||||
nframes_t adjusted_frame;
|
||||
|
||||
if ((long)drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
|
||||
if (drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
|
||||
adjusted_frame = drag_info.current_pointer_frame - drag_info.pointer_frame_offset;
|
||||
}
|
||||
else {
|
||||
|
|
@ -2952,14 +2952,14 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
|
|||
|
||||
if (drag_info.move_threshold_passed) {
|
||||
|
||||
if ((int32_t)drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
|
||||
if (drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
|
||||
|
||||
nframes_t sync_frame;
|
||||
nframes_t sync_offset;
|
||||
int32_t sync_dir;
|
||||
|
||||
pending_region_position = drag_info.current_pointer_frame - drag_info.pointer_frame_offset;
|
||||
|
||||
|
||||
sync_offset = rv->region()->sync_offset (sync_dir);
|
||||
sync_frame = rv->region()->adjust_to_sync (pending_region_position);
|
||||
|
||||
|
|
@ -2991,7 +2991,7 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
|
|||
/* now compute the canvas unit distance we need to move the regiondrag_info.last_trackview->order
|
||||
to make it appear at the new location.
|
||||
*/
|
||||
|
||||
|
||||
if (pending_region_position > drag_info.last_frame_position) {
|
||||
x_delta = ((double) (pending_region_position - drag_info.last_frame_position) / frames_per_unit);
|
||||
} else {
|
||||
|
|
@ -3143,7 +3143,7 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
|
|||
if (-x_delta > ix1) {
|
||||
x_delta = -ix1;
|
||||
}
|
||||
} else if ((x_delta > 0) &&(rv->region()->last_frame() > max_frames - x_delta)) {
|
||||
} else if ((x_delta > 0) && (rv->region()->last_frame() > max_frames - x_delta)) {
|
||||
x_delta = max_frames - rv->region()->last_frame();
|
||||
}
|
||||
|
||||
|
|
@ -3761,10 +3761,9 @@ Editor::drag_selection (ArdourCanvas::Item* item, GdkEvent* event)
|
|||
nframes_t length;
|
||||
nframes_t pending_position;
|
||||
|
||||
if ((int32_t) drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
|
||||
if (drag_info.current_pointer_frame > drag_info.pointer_frame_offset) {
|
||||
pending_position = drag_info.current_pointer_frame - drag_info.pointer_frame_offset;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
pending_position = 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -72,11 +72,9 @@ class AudioPlaylist : public ARDOUR::Playlist
|
|||
void remove_dependents (boost::shared_ptr<Region> region);
|
||||
|
||||
private:
|
||||
Crossfades _crossfades;
|
||||
Crossfades _pending_xfade_adds;
|
||||
|
||||
void crossfade_invalidated (boost::shared_ptr<Region>);
|
||||
XMLNode& state (bool full_state);
|
||||
void dump () const;
|
||||
|
||||
bool region_changed (Change, boost::shared_ptr<Region>);
|
||||
|
|
|
|||
|
|
@ -61,10 +61,10 @@ class Crossfade : public ARDOUR::AudioRegion
|
|||
|
||||
Crossfade (boost::shared_ptr<ARDOUR::AudioRegion> in, boost::shared_ptr<ARDOUR::AudioRegion> out, CrossfadeModel, bool active);
|
||||
|
||||
|
||||
/* copy constructor to copy a crossfade with new regions. used (for example)
|
||||
when a playlist copy is made
|
||||
*/
|
||||
|
||||
Crossfade (boost::shared_ptr<Crossfade>, boost::shared_ptr<ARDOUR::AudioRegion>, boost::shared_ptr<ARDOUR::AudioRegion>);
|
||||
|
||||
/* the usual XML constructor */
|
||||
|
|
@ -77,6 +77,8 @@ class Crossfade : public ARDOUR::AudioRegion
|
|||
XMLNode& get_state (void);
|
||||
int set_state (const XMLNode&);
|
||||
|
||||
static std::string node_name();
|
||||
|
||||
boost::shared_ptr<ARDOUR::AudioRegion> in() const { return _in; }
|
||||
boost::shared_ptr<ARDOUR::AudioRegion> out() const { return _out; }
|
||||
|
||||
|
|
@ -86,11 +88,11 @@ class Crossfade : public ARDOUR::AudioRegion
|
|||
|
||||
bool refresh ();
|
||||
|
||||
uint32_t upper_layer () const {
|
||||
layer_t upper_layer () const {
|
||||
return std::max (_in->layer(), _out->layer());
|
||||
}
|
||||
|
||||
uint32_t lower_layer () const {
|
||||
layer_t lower_layer () const {
|
||||
return std::min (_in->layer(), _out->layer());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,8 +52,8 @@ class Curve : public AutomationList
|
|||
Curve (const Curve& other, double start, double end);
|
||||
Curve (const XMLNode&);
|
||||
|
||||
bool rt_safe_get_vector (double x0, double x1, float *arg, int32_t veclen);
|
||||
void get_vector (double x0, double x1, float *arg, int32_t veclen);
|
||||
bool rt_safe_get_vector (double x0, double x1, float *arg, int64_t veclen);
|
||||
void get_vector (double x0, double x1, float *arg, int64_t veclen);
|
||||
|
||||
AutomationEventList::iterator closest_control_point_before (double xval);
|
||||
AutomationEventList::iterator closest_control_point_after (double xval);
|
||||
|
|
@ -72,14 +72,14 @@ class Curve : public AutomationList
|
|||
double unlocked_eval (double where);
|
||||
double multipoint_eval (double x);
|
||||
|
||||
void _get_vector (double x0, double x1, float *arg, int32_t veclen);
|
||||
void _get_vector (double x0, double x1, float *arg, int64_t veclen);
|
||||
|
||||
};
|
||||
|
||||
} // namespace ARDOUR
|
||||
|
||||
extern "C" {
|
||||
void curve_get_vector_from_c (void *arg, double, double, float*, int32_t);
|
||||
void curve_get_vector_from_c (void *arg, double, double, float*, int64_t);
|
||||
}
|
||||
|
||||
#endif /* __ardour_curve_h__ */
|
||||
|
|
|
|||
|
|
@ -253,7 +253,7 @@ class Playlist : public PBD::StatefulDestructible, public boost::enable_shared_f
|
|||
|
||||
int remove_region_internal (boost::shared_ptr<Region>);
|
||||
RegionList *find_regions_at (nframes_t frame);
|
||||
void copy_regions (RegionList&) const;
|
||||
virtual void copy_regions (RegionList&) const;
|
||||
void partition_internal (nframes_t start, nframes_t end, bool cutting, RegionList& thawlist);
|
||||
|
||||
nframes_t _get_maximum_extent() const;
|
||||
|
|
|
|||
|
|
@ -96,6 +96,8 @@ class Region : public PBD::StatefulDestructible, public boost::enable_shared_fro
|
|||
nframes_t start () const { return _start; }
|
||||
nframes_t length() const { return _length; }
|
||||
layer_t layer () const { return _layer; }
|
||||
virtual layer_t lower_layer () const { return _layer; }
|
||||
virtual layer_t upper_layer () const { return _layer; }
|
||||
|
||||
nframes_t sync_offset(int& dir) const;
|
||||
nframes_t sync_position() const;
|
||||
|
|
@ -188,6 +190,8 @@ class Region : public PBD::StatefulDestructible, public boost::enable_shared_fro
|
|||
virtual int set_state (const XMLNode&);
|
||||
virtual int set_live_state (const XMLNode&, Change&, bool send);
|
||||
|
||||
static std::string node_name();
|
||||
|
||||
virtual boost::shared_ptr<Region> get_parent() const;
|
||||
|
||||
uint64_t last_layer_op() const { return _last_layer_op; }
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ AudioPlaylist::AudioPlaylist (boost::shared_ptr<const AudioPlaylist> other, stri
|
|||
boost::shared_ptr<AudioRegion> ar = boost::dynamic_pointer_cast<AudioRegion>(*in_o);
|
||||
|
||||
// We look only for crossfades which begin with the current region, so we don't get doubles
|
||||
|
||||
for (Crossfades::const_iterator xfades = other->_crossfades.begin(); xfades != other->_crossfades.end(); ++xfades) {
|
||||
if ((*xfades)->in() == ar) {
|
||||
// We found one! Now copy it!
|
||||
|
|
@ -113,6 +114,21 @@ AudioPlaylist::~AudioPlaylist ()
|
|||
_crossfades.clear ();
|
||||
}
|
||||
|
||||
void
|
||||
AudioPlaylist::copy_regions (RegionList& newlist) const
|
||||
{
|
||||
RegionLock rlock (const_cast<Playlist *> (this));
|
||||
|
||||
Playlist::copy_regions (newlist, false);
|
||||
|
||||
for (RegionList::const_iterator i = regions.begin(); i != regions.end(); ++i) {
|
||||
if (!(*i)->is_dependent()) {
|
||||
newlist.push_back (RegionFactory::RegionFactory::create (*i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
struct RegionSortByLayer {
|
||||
bool operator() (boost::shared_ptr<Region> a, boost::shared_ptr<Region> b) {
|
||||
return a->layer() < b->layer();
|
||||
|
|
@ -218,11 +234,11 @@ AudioPlaylist::remove_dependents (boost::shared_ptr<Region> region)
|
|||
<< endmsg;
|
||||
return;
|
||||
}
|
||||
|
||||
for (Crossfades::iterator i = _crossfades.begin(); i != _crossfades.end(); ) {
|
||||
|
||||
for (RegionList::iterator i = regions.begin(); i != regions.end(); ) {
|
||||
|
||||
if ((*i)->involves (r)) {
|
||||
i = _crossfades.erase (i);
|
||||
if ((*i)->depends_on (r)) {
|
||||
i = regions.erase (i);
|
||||
} else {
|
||||
++i;
|
||||
}
|
||||
|
|
@ -261,16 +277,16 @@ AudioPlaylist::refresh_dependents (boost::shared_ptr<Region> r)
|
|||
return;
|
||||
}
|
||||
|
||||
for (Crossfades::iterator x = _crossfades.begin(); x != _crossfades.end();) {
|
||||
|
||||
Crossfades::iterator tmp;
|
||||
for (RegionList::iterator x = regions.begin(); x != regions.end();) {
|
||||
|
||||
RegionList::iterator tmp;
|
||||
|
||||
tmp = x;
|
||||
++tmp;
|
||||
|
||||
/* only update them once */
|
||||
|
||||
if ((*x)->involves (ar)) {
|
||||
if ((*x)->depends_on (ar)) {
|
||||
|
||||
if (find (updated.begin(), updated.end(), *x) == updated.end()) {
|
||||
try {
|
||||
|
|
@ -296,35 +312,43 @@ AudioPlaylist::finalize_split_region (boost::shared_ptr<Region> o, boost::shared
|
|||
boost::shared_ptr<AudioRegion> left = boost::dynamic_pointer_cast<AudioRegion>(l);
|
||||
boost::shared_ptr<AudioRegion> right = boost::dynamic_pointer_cast<AudioRegion>(r);
|
||||
|
||||
for (Crossfades::iterator x = _crossfades.begin(); x != _crossfades.end();) {
|
||||
for (RegionList::iterator x = regions.begin(); x !=regions.end();) {
|
||||
Crossfades::iterator tmp;
|
||||
boost::shared_ptr<Crossfade> xfade = boost::dynamic_pointer_cast<Crossfade>(*x);
|
||||
|
||||
if (!xfade) {
|
||||
++x;
|
||||
continue;
|
||||
}
|
||||
|
||||
tmp = x;
|
||||
++tmp;
|
||||
|
||||
boost::shared_ptr<Crossfade> fade;
|
||||
|
||||
if ((*x)->_in == orig) {
|
||||
if (! (*x)->covers(right->position())) {
|
||||
fade = boost::shared_ptr<Crossfade> (new Crossfade (*x, left, (*x)->_out));
|
||||
if (xfade->_in == orig) {
|
||||
if (! xfade->covers(right->position())) {
|
||||
fade = boost::shared_ptr<Crossfade> (new Crossfade (*xfade, left, xfade->_out));
|
||||
} else {
|
||||
// Overlap, the crossfade is copied on the left side of the right region instead
|
||||
fade = boost::shared_ptr<Crossfade> (new Crossfade (*x, right, (*x)->_out));
|
||||
fade = boost::shared_ptr<Crossfade> (new Crossfade (*xfade, right, xfade->_out));
|
||||
}
|
||||
}
|
||||
|
||||
if ((*x)->_out == orig) {
|
||||
if (! (*x)->covers(right->position())) {
|
||||
fade = boost::shared_ptr<Crossfade> (new Crossfade (*x, (*x)->_in, right));
|
||||
if (xfade->_out == orig) {
|
||||
if (! xfade->covers(right->position())) {
|
||||
fade = boost::shared_ptr<Crossfade> (new Crossfade (*xfade, xfade->_in, right));
|
||||
} else {
|
||||
// Overlap, the crossfade is copied on the right side of the left region instead
|
||||
fade = boost::shared_ptr<Crossfade> (new Crossfade (*x, (*x)->_in, left));
|
||||
fade = boost::shared_ptr<Crossfade> (new Crossfade (*xfade, xfade->_in, left));
|
||||
}
|
||||
}
|
||||
|
||||
if (fade) {
|
||||
_crossfades.remove (*x);
|
||||
regions.erase (*x);
|
||||
add_crossfade (fade);
|
||||
}
|
||||
|
||||
x = tmp;
|
||||
}
|
||||
}
|
||||
|
|
@ -442,25 +466,29 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh)
|
|||
}
|
||||
|
||||
void
|
||||
AudioPlaylist::add_crossfade (boost::shared_ptr<Crossfade> xfade)
|
||||
AudioPlaylist::add_crossfade (boost::shared_ptr<Crossfade> new_xfade)
|
||||
{
|
||||
Crossfades::iterator ci;
|
||||
RegionList::iterator r;
|
||||
boost::shared_ptr<Crossfade> xfade;
|
||||
|
||||
for (ci = _crossfades.begin(); ci != _crossfades.end(); ++ci) {
|
||||
if (*(*ci) == *xfade) { // Crossfade::operator==()
|
||||
break;
|
||||
for (r = regions.begin(); r != regions.end(); ++r) {
|
||||
|
||||
if ((xfade = boost::dynamic_pointer_cast<Crossfade>(*r))) {
|
||||
if (*xfade == *new_xfade) { // Crossfade::operator==()
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ci != _crossfades.end()) {
|
||||
if (r != regions.end()) {
|
||||
// it will just go away
|
||||
} else {
|
||||
_crossfades.push_back (xfade);
|
||||
add_region_internal (new_xfade);
|
||||
|
||||
xfade->Invalidated.connect (mem_fun (*this, &AudioPlaylist::crossfade_invalidated));
|
||||
xfade->StateChanged.connect (mem_fun (*this, &AudioPlaylist::crossfade_changed));
|
||||
new_xfade->Invalidated.connect (mem_fun (*this, &AudioPlaylist::crossfade_invalidated));
|
||||
new_xfade->StateChanged.connect (mem_fun (*this, &AudioPlaylist::crossfade_changed));
|
||||
|
||||
notify_crossfade_added (xfade);
|
||||
notify_crossfade_added (new_xfade);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -476,15 +504,12 @@ void AudioPlaylist::notify_crossfade_added (boost::shared_ptr<Crossfade> x)
|
|||
void
|
||||
AudioPlaylist::crossfade_invalidated (boost::shared_ptr<Region> r)
|
||||
{
|
||||
Crossfades::iterator i;
|
||||
boost::shared_ptr<Crossfade> xfade = boost::dynamic_pointer_cast<Crossfade> (r);
|
||||
|
||||
|
||||
xfade->in()->resume_fade_in ();
|
||||
xfade->out()->resume_fade_out ();
|
||||
|
||||
if ((i = find (_crossfades.begin(), _crossfades.end(), xfade)) != _crossfades.end()) {
|
||||
_crossfades.erase (i);
|
||||
}
|
||||
remove_region_internal (r);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
@ -505,13 +530,14 @@ AudioPlaylist::set_state (const XMLNode& node)
|
|||
|
||||
child = *niter;
|
||||
|
||||
if (child->name() != "Crossfade") {
|
||||
if (child->name() != Crossfade::node_name()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
boost::shared_ptr<Crossfade> xfade = boost::shared_ptr<Crossfade> (new Crossfade (*((const Playlist *)this), *child));
|
||||
_crossfades.push_back (xfade);
|
||||
boost::shared_ptr<Crossfade> xfade = boost::dynamic_pointer_cast<Crossfade> (RegionFactory::create (*((const Playlist *) this), *child));
|
||||
assert (xfade);
|
||||
add_region_internal (xfade);
|
||||
xfade->Invalidated.connect (mem_fun (*this, &AudioPlaylist::crossfade_invalidated));
|
||||
xfade->StateChanged.connect (mem_fun (*this, &AudioPlaylist::crossfade_changed));
|
||||
NewCrossfade(xfade);
|
||||
|
|
@ -534,24 +560,9 @@ AudioPlaylist::set_state (const XMLNode& node)
|
|||
void
|
||||
AudioPlaylist::clear (bool with_signals)
|
||||
{
|
||||
_crossfades.clear ();
|
||||
Playlist::clear (with_signals);
|
||||
}
|
||||
|
||||
XMLNode&
|
||||
AudioPlaylist::state (bool full_state)
|
||||
{
|
||||
XMLNode& node = Playlist::state (full_state);
|
||||
|
||||
if (full_state) {
|
||||
for (Crossfades::iterator i = _crossfades.begin(); i != _crossfades.end(); ++i) {
|
||||
node.add_child_nocopy ((*i)->get_state());
|
||||
}
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
void
|
||||
AudioPlaylist::dump () const
|
||||
{
|
||||
|
|
@ -560,33 +571,32 @@ AudioPlaylist::dump () const
|
|||
|
||||
cerr << "Playlist \"" << _name << "\" " << endl
|
||||
<< regions.size() << " regions "
|
||||
<< _crossfades.size() << " crossfades"
|
||||
<< endl;
|
||||
|
||||
for (RegionList::const_iterator i = regions.begin(); i != regions.end(); ++i) {
|
||||
r = *i;
|
||||
cerr << " " << r->name() << " @ " << r << " ["
|
||||
<< r->start() << "+" << r->length()
|
||||
<< "] at "
|
||||
<< r->position()
|
||||
<< " on layer "
|
||||
<< r->layer ()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
for (Crossfades::const_iterator i = _crossfades.begin(); i != _crossfades.end(); ++i) {
|
||||
x = *i;
|
||||
cerr << " xfade ["
|
||||
<< x->out()->name()
|
||||
<< ','
|
||||
<< x->in()->name()
|
||||
<< " @ "
|
||||
<< x->position()
|
||||
<< " length = "
|
||||
<< x->length ()
|
||||
<< " active ? "
|
||||
<< (x->active() ? "yes" : "no")
|
||||
<< endl;
|
||||
if ((x = boost::dynamic_pointer_cast<Crossfade> (r))) {
|
||||
cerr << " xfade ["
|
||||
<< x->out()->name()
|
||||
<< ','
|
||||
<< x->in()->name()
|
||||
<< " @ "
|
||||
<< x->position()
|
||||
<< " length = "
|
||||
<< x->length ()
|
||||
<< " active ? "
|
||||
<< (x->active() ? "yes" : "no")
|
||||
<< endl;
|
||||
} else {
|
||||
cerr << " " << r->name() << " @ " << r << " ["
|
||||
<< r->start() << "+" << r->length()
|
||||
<< "] at "
|
||||
<< r->position()
|
||||
<< " on layer "
|
||||
<< r->layer ()
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -595,8 +605,6 @@ AudioPlaylist::destroy_region (boost::shared_ptr<Region> region)
|
|||
{
|
||||
boost::shared_ptr<AudioRegion> r = boost::dynamic_pointer_cast<AudioRegion> (region);
|
||||
bool changed = false;
|
||||
Crossfades::iterator c, ctmp;
|
||||
set<boost::shared_ptr<Crossfade> > unique_xfades;
|
||||
|
||||
if (r == 0) {
|
||||
fatal << _("programming error: non-audio Region passed to remove_overlap in audio playlist")
|
||||
|
|
@ -616,6 +624,9 @@ AudioPlaylist::destroy_region (boost::shared_ptr<Region> region)
|
|||
if ((*i) == region) {
|
||||
regions.erase (i);
|
||||
changed = true;
|
||||
} else if ((*i)->depends_on (region)) {
|
||||
regions.erase (i);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
i = tmp;
|
||||
|
|
@ -629,6 +640,9 @@ AudioPlaylist::destroy_region (boost::shared_ptr<Region> region)
|
|||
if ((*x) == region) {
|
||||
all_regions.erase (x);
|
||||
changed = true;
|
||||
} else if ((*x)->depends_on (region)) {
|
||||
all_regions.erase (x);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
x = xtmp;
|
||||
|
|
@ -637,18 +651,6 @@ AudioPlaylist::destroy_region (boost::shared_ptr<Region> region)
|
|||
region->set_playlist (boost::shared_ptr<Playlist>());
|
||||
}
|
||||
|
||||
for (c = _crossfades.begin(); c != _crossfades.end(); ) {
|
||||
ctmp = c;
|
||||
++ctmp;
|
||||
|
||||
if ((*c)->involves (r)) {
|
||||
unique_xfades.insert (*c);
|
||||
_crossfades.erase (c);
|
||||
}
|
||||
|
||||
c = ctmp;
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
/* overload this, it normally means "removed", not destroyed */
|
||||
notify_region_removed (region);
|
||||
|
|
@ -698,20 +700,3 @@ AudioPlaylist::region_changed (Change what_changed, boost::shared_ptr<Region> re
|
|||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
AudioPlaylist::crossfades_at (nframes_t frame, Crossfades& clist)
|
||||
{
|
||||
RegionLock rlock (this);
|
||||
|
||||
for (Crossfades::iterator i = _crossfades.begin(); i != _crossfades.end(); ++i) {
|
||||
nframes_t start, end;
|
||||
|
||||
start = (*i)->position();
|
||||
end = start + (*i)->overlap_length(); // not length(), important difference
|
||||
|
||||
if (frame >= start && frame <= end) {
|
||||
clist.push_back (*i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -194,6 +194,11 @@ Crossfade::Crossfade (boost::shared_ptr<Crossfade> orig, boost::shared_ptr<Audio
|
|||
set_length(_length);
|
||||
}
|
||||
|
||||
Crossfade::Crossfade (boost::shared_ptr<Playlist> pl, boost::shared_ptr<Crossfade> other)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
Crossfade::~Crossfade ()
|
||||
{
|
||||
|
|
@ -624,7 +629,7 @@ Crossfade::compute (boost::shared_ptr<AudioRegion> a, boost::shared_ptr<AudioReg
|
|||
XMLNode&
|
||||
Crossfade::get_state ()
|
||||
{
|
||||
XMLNode* node = new XMLNode (X_("Crossfade"));
|
||||
XMLNode* node = new XMLNode (node_name());
|
||||
XMLNode* child;
|
||||
char buf[64];
|
||||
LocaleGuard lg (X_("POSIX"));
|
||||
|
|
@ -886,3 +891,9 @@ Crossfade::invalidate ()
|
|||
{
|
||||
Invalidated (shared_from_this ()); /* EMIT SIGNAL */
|
||||
}
|
||||
|
||||
string
|
||||
Crossfade::node_name ()
|
||||
{
|
||||
return X_("Crossfade");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ Curve::~Curve ()
|
|||
void
|
||||
Curve::solve ()
|
||||
{
|
||||
uint32_t npoints;
|
||||
uint64_t npoints;
|
||||
|
||||
if (!_dirty) {
|
||||
return;
|
||||
|
|
@ -87,7 +87,7 @@ Curve::solve ()
|
|||
|
||||
double x[npoints];
|
||||
double y[npoints];
|
||||
uint32_t i;
|
||||
uint64_t i;
|
||||
AutomationEventList::iterator xx;
|
||||
|
||||
for (i = 0, xx = events.begin(); xx != events.end(); ++xx, ++i) {
|
||||
|
|
@ -206,7 +206,7 @@ Curve::solve ()
|
|||
}
|
||||
|
||||
bool
|
||||
Curve::rt_safe_get_vector (double x0, double x1, float *vec, int32_t veclen)
|
||||
Curve::rt_safe_get_vector (double x0, double x1, float *vec, int64_t veclen)
|
||||
{
|
||||
Glib::Mutex::Lock lm (lock, Glib::TRY_LOCK);
|
||||
|
||||
|
|
@ -219,19 +219,19 @@ Curve::rt_safe_get_vector (double x0, double x1, float *vec, int32_t veclen)
|
|||
}
|
||||
|
||||
void
|
||||
Curve::get_vector (double x0, double x1, float *vec, int32_t veclen)
|
||||
Curve::get_vector (double x0, double x1, float *vec, int64_t veclen)
|
||||
{
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
_get_vector (x0, x1, vec, veclen);
|
||||
}
|
||||
|
||||
void
|
||||
Curve::_get_vector (double x0, double x1, float *vec, int32_t veclen)
|
||||
Curve::_get_vector (double x0, double x1, float *vec, int64_t veclen)
|
||||
{
|
||||
double rx, dx, lx, hx, max_x, min_x;
|
||||
int32_t i;
|
||||
int32_t original_veclen;
|
||||
int32_t npoints;
|
||||
int64_t i;
|
||||
int64_t original_veclen;
|
||||
int64_t npoints;
|
||||
|
||||
if ((npoints = events.size()) == 0) {
|
||||
for (i = 0; i < veclen; ++i) {
|
||||
|
|
@ -262,7 +262,7 @@ Curve::_get_vector (double x0, double x1, float *vec, int32_t veclen)
|
|||
*/
|
||||
|
||||
double frac = (min_x - x0) / (x1 - x0);
|
||||
int32_t subveclen = (int32_t) floor (veclen * frac);
|
||||
int64_t subveclen = (int64_t) floor (veclen * frac);
|
||||
|
||||
subveclen = min (subveclen, veclen);
|
||||
|
||||
|
|
@ -280,7 +280,7 @@ Curve::_get_vector (double x0, double x1, float *vec, int32_t veclen)
|
|||
|
||||
double frac = (x1 - max_x) / (x1 - x0);
|
||||
|
||||
int32_t subveclen = (int32_t) floor (original_veclen * frac);
|
||||
int64_t subveclen = (int64_t) floor (original_veclen * frac);
|
||||
|
||||
float val;
|
||||
|
||||
|
|
@ -437,7 +437,7 @@ Curve::point_factory (const ControlEvent& other) const
|
|||
extern "C" {
|
||||
|
||||
void
|
||||
curve_get_vector_from_c (void *arg, double x0, double x1, float* vec, int32_t vecsize)
|
||||
curve_get_vector_from_c (void *arg, double x0, double x1, float* vec, int64_t vecsize)
|
||||
{
|
||||
static_cast<Curve*>(arg)->get_vector (x0, x1, vec, vecsize);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -217,7 +217,9 @@ Playlist::copy_regions (RegionList& newlist) const
|
|||
RegionLock rlock (const_cast<Playlist *> (this));
|
||||
|
||||
for (RegionList::const_iterator i = regions.begin(); i != regions.end(); ++i) {
|
||||
newlist.push_back (RegionFactory::RegionFactory::create (*i));
|
||||
if (!(*i)->is_dependent()) {
|
||||
newlist.push_back (RegionFactory::RegionFactory::create (*i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1385,7 +1387,7 @@ Playlist::set_state (const XMLNode& node)
|
|||
|
||||
child = *niter;
|
||||
|
||||
if (child->name() == "Region") {
|
||||
if (child->name() == Region::node_name()) {
|
||||
|
||||
if ((prop = child->property ("id")) == 0) {
|
||||
error << _("region state node has no ID, ignored") << endmsg;
|
||||
|
|
@ -1611,6 +1613,11 @@ Playlist::relayer ()
|
|||
|
||||
for (RegionList::iterator i = copy.begin(); i != copy.end(); ++i) {
|
||||
|
||||
if ((*i)->is_dependent()) {
|
||||
/* handle dependent regions in a later pass */
|
||||
continue;
|
||||
}
|
||||
|
||||
/* find the lowest layer that this region can go on */
|
||||
size_t j = layers.size();
|
||||
while (j > 0) {
|
||||
|
|
@ -1648,6 +1655,50 @@ Playlist::relayer ()
|
|||
}
|
||||
}
|
||||
|
||||
/* second pass: set up layer numbers for all dependent regions */
|
||||
|
||||
for (RegionList::iterator i = copy.begin(); i != copy.end(); ++i) {
|
||||
|
||||
cerr << "pass 2, looking at " << (*i)->name() << " dep? " << (*i)->is_dependent() << endl;
|
||||
|
||||
if ((*i)->is_dependent()) {
|
||||
|
||||
size_t one_higher = (*i)->upper_layer() + 1;
|
||||
|
||||
cerr << "Setting xfade to " << one_higher << endl;
|
||||
|
||||
(*i)->set_layer (one_higher);
|
||||
|
||||
if (one_higher < layers.size()) {
|
||||
|
||||
/* find the layer list representing the next higher layer */
|
||||
|
||||
vector<RegionList>::iterator x = layers.begin();
|
||||
for (size_t n = 0; n < one_higher; ++n) {
|
||||
++x;
|
||||
}
|
||||
|
||||
/* add a new layer list containing just the dependent region
|
||||
we set the layer for
|
||||
*/
|
||||
|
||||
layers.insert (x, RegionList());
|
||||
layers[one_higher].push_back (*i);
|
||||
|
||||
/* move everything on higher layers one layer higher */
|
||||
|
||||
for (size_t j = one_higher; j < layers.size(); ++j) {
|
||||
for (RegionList::iterator i = layers[j].begin(); i != layers[j].end(); ++i) {
|
||||
cerr << "Bumping " << (*i)->name() << " to " << j << endl;
|
||||
(*i)->set_layer (j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* sending Modified means that various kinds of layering
|
||||
models operate correctly at the GUI
|
||||
level. slightly inefficient, but only slightly.
|
||||
|
|
|
|||
|
|
@ -1265,3 +1265,8 @@ Region::get_parent() const
|
|||
return boost::shared_ptr<Region>();
|
||||
}
|
||||
|
||||
string
|
||||
Region::node_name ()
|
||||
{
|
||||
return X_("Region");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,6 +89,24 @@ RegionFactory::create (boost::shared_ptr<Region> region)
|
|||
}
|
||||
}
|
||||
|
||||
boost::shared_ptr<Region>
|
||||
RegionFactory::create (const Playlist& playlist, boost::shared_ptr<Region> region)
|
||||
{
|
||||
boost::shared_ptr<Crossfade> xfade;
|
||||
boost::shared_ptr<MidiRegion> mr;
|
||||
|
||||
if ((xfade = boost::dynamic_pointer_cast<Crossfade>(region)) != 0) {
|
||||
boost::shared_ptr<Region> ret (new Crossfade (playlist, xfade));
|
||||
/* pure copy constructor - no CheckNewRegion emitted */
|
||||
return ret;
|
||||
} else {
|
||||
fatal << _("programming error: RegionFactory::create(Playlist,Region) called with unknown Region type")
|
||||
<< endmsg;
|
||||
/*NOTREACHED*/
|
||||
return boost::shared_ptr<Region>();
|
||||
}
|
||||
}
|
||||
|
||||
boost::shared_ptr<Region>
|
||||
RegionFactory::create (boost::shared_ptr<AudioRegion> region, nframes_t start,
|
||||
nframes_t length, std::string name,
|
||||
|
|
@ -137,6 +155,22 @@ RegionFactory::create (SourceList& srcs, nframes_t start, nframes_t length, cons
|
|||
return boost::shared_ptr<Region> ();
|
||||
}
|
||||
|
||||
boost::shared_ptr<Region>
|
||||
RegionFactory::create (const Playlist& playlist, const XMLNode& node)
|
||||
{
|
||||
/* this is a constructor for "dependent" region types.
|
||||
these objects require a playlist so that they can
|
||||
look up the region instances that they depend upon.
|
||||
*/
|
||||
|
||||
if (node.name() == Crossfade::node_name()) {
|
||||
boost::shared_ptr<Region> ret (new Crossfade (playlist, node));
|
||||
return ret;
|
||||
}
|
||||
|
||||
return boost::shared_ptr<Region> ();
|
||||
}
|
||||
|
||||
boost::shared_ptr<Region>
|
||||
RegionFactory::create (SourceList& srcs, const XMLNode& node)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1805,20 +1805,25 @@ Route::_set_state (const XMLNode& node, bool call_base)
|
|||
}
|
||||
}
|
||||
|
||||
XMLNodeList redirect_nodes;
|
||||
|
||||
for (niter = nlist.begin(); niter != nlist.end(); ++niter){
|
||||
if (ports_legal) {
|
||||
|
||||
child = *niter;
|
||||
/* if ports are not legal, this will happen in set_deferred_state() */
|
||||
|
||||
XMLNodeList redirect_nodes;
|
||||
|
||||
for (niter = nlist.begin(); niter != nlist.end(); ++niter){
|
||||
|
||||
child = *niter;
|
||||
|
||||
if (child->name() == X_("Send") || child->name() == X_("Insert")) {
|
||||
redirect_nodes.push_back(child);
|
||||
}
|
||||
|
||||
if (child->name() == X_("Send") || child->name() == X_("Insert")) {
|
||||
redirect_nodes.push_back(child);
|
||||
}
|
||||
|
||||
|
||||
_set_redirect_states (redirect_nodes);
|
||||
}
|
||||
|
||||
_set_redirect_states(redirect_nodes);
|
||||
|
||||
|
||||
for (niter = nlist.begin(); niter != nlist.end(); ++niter){
|
||||
child = *niter;
|
||||
|
|
@ -1942,9 +1947,9 @@ Route::_set_redirect_states(const XMLNodeList &nlist)
|
|||
|
||||
RedirectList::iterator last = _redirects.end();
|
||||
--last;
|
||||
|
||||
|
||||
if (prev_last == last) {
|
||||
cerr << "Could not fully restore state as some redirects were not possible to create" << endl;
|
||||
warning << _name << ": could not fully restore state as some redirects were not possible to create" << endmsg;
|
||||
continue;
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue