fixup botched xfade-as-audioregion; apply work from 2.0-ongoing

git-svn-id: svn://localhost/ardour2/trunk@1933 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis
2007-05-31 21:15:28 +00:00
parent 539aa71d18
commit 52a8242a11
20 changed files with 209 additions and 301 deletions

View File

@@ -721,6 +721,20 @@ CrossfadeEditor::redraw ()
void
CrossfadeEditor::apply_preset (Preset *preset)
{
WhichFade wf = find(fade_in_presets->begin(), fade_in_presets->end(), preset) != fade_in_presets->end() ? In : Out;
if (current != wf) {
if (wf == In) {
select_in_button.clicked();
} else {
select_out_button.clicked();
}
curve_select_clicked (wf);
}
for (list<Point*>::iterator i = fade[current].points.begin(); i != fade[current].points.end(); ++i) {
delete *i;
}
@@ -820,6 +834,8 @@ CrossfadeEditor::reset ()
{
set (xfade->fade_in(), In);
set (xfade->fade_out(), Out);
curve_select_clicked (current);
}
void
@@ -980,14 +996,6 @@ CrossfadeEditor::curve_select_clicked (WhichFade wf)
(*i)->box->show ();
}
for (vector<Button*>::iterator i = fade_out_buttons.begin(); i != fade_out_buttons.end(); ++i) {
(*i)->set_sensitive (false);
}
for (vector<Button*>::iterator i = fade_in_buttons.begin(); i != fade_in_buttons.end(); ++i) {
(*i)->set_sensitive (true);
}
} else {
for (vector<ArdourCanvas::WaveView*>::iterator i = fade[In].waves.begin(); i != fade[In].waves.end(); ++i) {
@@ -1011,14 +1019,6 @@ CrossfadeEditor::curve_select_clicked (WhichFade wf)
(*i)->box->show();
}
for (vector<Button*>::iterator i = fade_out_buttons.begin(); i != fade_out_buttons.end(); ++i) {
(*i)->set_sensitive (true);
}
for (vector<Button*>::iterator i = fade_in_buttons.begin(); i != fade_in_buttons.end(); ++i) {
(*i)->set_sensitive (false);
}
}
}

View File

@@ -39,11 +39,11 @@ struct DragInfo {
ArdourCanvas::Item* item;
ItemType item_type;
void* data;
nframes_t last_frame_position;
int64_t pointer_frame_offset;
nframes_t grab_frame;
nframes_t last_pointer_frame;
nframes_t current_pointer_frame;
nframes64_t last_frame_position;
nframes64_t pointer_frame_offset;
nframes64_t grab_frame;
nframes64_t last_pointer_frame;
nframes64_t current_pointer_frame;
double grab_x, grab_y;
double cumulative_x_drag;
double cumulative_y_drag;

View File

@@ -2059,7 +2059,7 @@ Editor::trackview_by_y_position (double y)
}
void
Editor::snap_to (nframes_t& start, int32_t direction, bool for_mark)
Editor::snap_to (nframes64_t& start, int32_t direction, bool for_mark)
{
Location* before = 0;
Location* after = 0;
@@ -2068,11 +2068,11 @@ Editor::snap_to (nframes_t& start, int32_t direction, bool for_mark)
return;
}
const nframes_t one_second = session->frame_rate();
const nframes_t one_minute = session->frame_rate() * 60;
const nframes_t one_smpte_second = (nframes_t)(rint(session->smpte_frames_per_second()) * session->frames_per_smpte_frame());
nframes_t one_smpte_minute = (nframes_t)(rint(session->smpte_frames_per_second()) * session->frames_per_smpte_frame() * 60);
nframes_t presnap = start;
const nframes64_t one_second = session->frame_rate();
const nframes64_t one_minute = session->frame_rate() * 60;
const nframes64_t one_smpte_second = (nframes64_t)(rint(session->smpte_frames_per_second()) * session->frames_per_smpte_frame());
nframes64_t one_smpte_minute = (nframes64_t)(rint(session->smpte_frames_per_second()) * session->frames_per_smpte_frame() * 60);
nframes64_t presnap = start;
switch (snap_type) {
case SnapToFrame:

View File

@@ -1286,7 +1286,14 @@ class Editor : public PublicEditor
void tempo_map_changed (ARDOUR::Change);
void redisplay_tempo (bool immediate_redraw);
void snap_to (nframes_t& first, int32_t direction = 0, bool for_mark = false);
void snap_to (nframes64_t& first, int32_t direction = 0, bool for_mark = false);
void snap_to (nframes_t& first, int32_t direction = 0, bool for_mark = false) {
/* XXX remove this function when everything moves to 64 bit frame counts */
nframes64_t first64 = first;
snap_to (first64, direction, for_mark);
first = (nframes_t) first64;
}
uint32_t bbt_beat_subdivision;
/* toolbar */

View File

@@ -1409,9 +1409,9 @@ Editor::motion_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item
*/
if (!drag_info.move_threshold_passed) {
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);
bool x_threshold_passed = (abs ((nframes64_t) (drag_info.current_pointer_x - drag_info.grab_x)) > 4LL);
bool y_threshold_passed = (abs ((nframes64_t) (drag_info.current_pointer_y - drag_info.grab_y)) > 4LL);
drag_info.move_threshold_passed = (x_threshold_passed || y_threshold_passed);
// and change the initial grab loc/frame if this drag info wants us to
@@ -1525,7 +1525,7 @@ Editor::start_grab (GdkEvent* event, Gdk::Cursor *cursor)
drag_info.y_constrained = false;
}
drag_info.grab_frame = event_frame(event, &drag_info.grab_x, &drag_info.grab_y);
drag_info.grab_frame = event_frame (event, &drag_info.grab_x, &drag_info.grab_y);
drag_info.last_pointer_frame = drag_info.grab_frame;
drag_info.current_pointer_frame = drag_info.grab_frame;
drag_info.current_pointer_x = drag_info.grab_x;
@@ -1776,10 +1776,9 @@ Editor::fade_out_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event
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 {
} else {
pos = 0;
}
@@ -2024,8 +2023,7 @@ Editor::marker_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
nframes_t newframe;
if (drag_info.pointer_frame_offset <= drag_info.current_pointer_frame) {
newframe = drag_info.current_pointer_frame - drag_info.pointer_frame_offset;
}
else {
} else {
newframe = 0;
}
@@ -2959,7 +2957,7 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
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);
@@ -2997,7 +2995,7 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
} else {
x_delta = -((double) (drag_info.last_frame_position - pending_region_position) / frames_per_unit);
}
drag_info.last_frame_position = pending_region_position;
} else {
@@ -3021,6 +3019,7 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
return;
}
if (x_delta < 0) {
for (list<RegionView*>::const_iterator i = selection->regions.by_layer().begin(); i != selection->regions.by_layer().end(); ++i) {
@@ -3147,6 +3146,7 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
x_delta = max_frames - rv->region()->last_frame();
}
if (drag_info.first_move) {
/* hide any dependent views */

View File

@@ -101,8 +101,9 @@ Editor::add_region_to_region_display (boost::shared_ptr<Region> region)
TreeModel::Row parent;
TreeModel::Row child;
if (iter == region_list_model->children().end()) {
if (!iter) {
parent = *(region_list_model->append());
parent[region_list_columns.name] = _("Hidden");
@@ -119,6 +120,7 @@ Editor::add_region_to_region_display (boost::shared_ptr<Region> region)
proxy.reset ();
} else {
parent = *iter;
}
@@ -594,7 +596,6 @@ Editor::hide_a_region (boost::shared_ptr<Region> r)
void
Editor::remove_a_region (boost::shared_ptr<Region> r)
{
cerr << "remove " << r->name();
session->remove_region_from_region_list (r);
}
@@ -613,7 +614,6 @@ Editor::hide_region_from_region_list ()
void
Editor::remove_region_from_region_list ()
{
cerr << "Mapping remove over region selection\n";
region_list_selection_mapover (mem_fun (*this, &Editor::remove_a_region));
}
@@ -636,8 +636,15 @@ bool
Editor::region_list_selection_filter (const RefPtr<TreeModel>& model, const TreeModel::Path& path, bool yn)
{
/* not possible to select rows that do not represent regions, like "Hidden" */
TreeModel::iterator iter = model->get_iter (path);
if (iter) {
boost::shared_ptr<Region> r =(*iter)[region_list_columns.region];
if (!r) {
return false;
}
}
/// XXXX FIXME boost::shared_ptr<Region> r = ((model->get_iter (path)))[region_list_columns.region];
/// return r != 0;
return true;
}

View File

@@ -268,8 +268,7 @@ Editor::ruler_mouse_motion (GdkEventMotion* ev)
nframes_t where = leftmost_frame + pixel_to_frame (x);
/// ripped from maybe_autoscroll, and adapted to work here
nframes_t one_page = (nframes_t) rint (canvas_width * frames_per_unit);
nframes_t rightmost_frame = leftmost_frame + one_page;
nframes_t rightmost_frame = leftmost_frame + current_page_frames ();
jack_nframes_t frame = pixel_to_frame (cx);
@@ -730,12 +729,7 @@ Editor::update_just_smpte ()
return;
}
/* XXX Note the potential loss of accuracy here as we convert from
an uint32_t (or larger) to a float ... what to do ?
*/
nframes_t page = (nframes_t) floor (canvas_width * frames_per_unit);
nframes_t rightmost_frame = leftmost_frame + page;
nframes_t rightmost_frame = leftmost_frame + current_page_frames();
if (ruler_shown[ruler_metric_smpte]) {
gtk_custom_ruler_set_range (GTK_CUSTOM_RULER(_smpte_ruler), leftmost_frame, rightmost_frame,
@@ -752,17 +746,11 @@ Editor::update_fixed_rulers ()
return;
}
/* XXX Note the potential loss of accuracy here as we convert from
an uint32_t (or larger) to a float ... what to do ?
*/
nframes_t page = (nframes_t) floor (canvas_width * frames_per_unit);
ruler_metrics[ruler_metric_smpte].units_per_pixel = frames_per_unit;
ruler_metrics[ruler_metric_frames].units_per_pixel = frames_per_unit;
ruler_metrics[ruler_metric_minsec].units_per_pixel = frames_per_unit;
rightmost_frame = leftmost_frame + page;
rightmost_frame = leftmost_frame + current_page_frames ();
/* these force a redraw, which in turn will force execution of the metric callbacks
to compute the relevant ticks to display.
@@ -791,15 +779,10 @@ Editor::update_tempo_based_rulers ()
return;
}
/* XXX Note the potential loss of accuracy here as we convert from
an uint32_t (or larger) to a float ... what to do ?
*/
nframes_t page = (nframes_t) floor (canvas_width * frames_per_unit);
ruler_metrics[ruler_metric_bbt].units_per_pixel = frames_per_unit;
if (ruler_shown[ruler_metric_bbt]) {
gtk_custom_ruler_set_range (GTK_CUSTOM_RULER(_bbt_ruler), leftmost_frame, leftmost_frame+page,
gtk_custom_ruler_set_range (GTK_CUSTOM_RULER(_bbt_ruler), leftmost_frame, leftmost_frame+current_page_frames(),
leftmost_frame, session->current_end_frame());
}
}

View File

@@ -72,9 +72,11 @@ 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>);

View File

@@ -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,8 +77,6 @@ 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; }
@@ -88,11 +86,11 @@ class Crossfade : public ARDOUR::AudioRegion
bool refresh ();
layer_t upper_layer () const {
uint32_t upper_layer () const {
return std::max (_in->layer(), _out->layer());
}
layer_t lower_layer () const {
uint32_t lower_layer () const {
return std::min (_in->layer(), _out->layer());
}

View File

@@ -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, int64_t veclen);
void get_vector (double x0, double x1, float *arg, int64_t veclen);
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);
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, int64_t veclen);
void _get_vector (double x0, double x1, float *arg, int32_t veclen);
};
} // namespace ARDOUR
extern "C" {
void curve_get_vector_from_c (void *arg, double, double, float*, int64_t);
void curve_get_vector_from_c (void *arg, double, double, float*, int32_t);
}
#endif /* __ardour_curve_h__ */

View File

@@ -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);
virtual void copy_regions (RegionList&) const;
void copy_regions (RegionList&) const;
void partition_internal (nframes_t start, nframes_t end, bool cutting, RegionList& thawlist);
nframes_t _get_maximum_extent() const;

View File

@@ -96,8 +96,6 @@ 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;
@@ -190,8 +188,6 @@ 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; }

View File

@@ -41,6 +41,12 @@
typedef int intptr_t;
#endif
/* eventually, we'd like everything (including JACK) to
move to this. for now, its a dedicated type.
*/
typedef int64_t nframes64_t;
namespace ARDOUR {
class Source;

View File

@@ -65,7 +65,6 @@ 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!
@@ -114,21 +113,6 @@ 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();
@@ -234,11 +218,11 @@ AudioPlaylist::remove_dependents (boost::shared_ptr<Region> region)
<< endmsg;
return;
}
for (RegionList::iterator i = regions.begin(); i != regions.end(); ) {
for (Crossfades::iterator i = _crossfades.begin(); i != _crossfades.end(); ) {
if ((*i)->depends_on (r)) {
i = regions.erase (i);
if ((*i)->involves (r)) {
i = _crossfades.erase (i);
} else {
++i;
}
@@ -277,16 +261,16 @@ AudioPlaylist::refresh_dependents (boost::shared_ptr<Region> r)
return;
}
for (RegionList::iterator x = regions.begin(); x != regions.end();) {
RegionList::iterator tmp;
for (Crossfades::iterator x = _crossfades.begin(); x != _crossfades.end();) {
Crossfades::iterator tmp;
tmp = x;
++tmp;
/* only update them once */
if ((*x)->depends_on (ar)) {
if ((*x)->involves (ar)) {
if (find (updated.begin(), updated.end(), *x) == updated.end()) {
try {
@@ -312,43 +296,35 @@ 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 (RegionList::iterator x = regions.begin(); x !=regions.end();) {
for (Crossfades::iterator x = _crossfades.begin(); x != _crossfades.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 (xfade->_in == orig) {
if (! xfade->covers(right->position())) {
fade = boost::shared_ptr<Crossfade> (new Crossfade (*xfade, left, xfade->_out));
if ((*x)->_in == orig) {
if (! (*x)->covers(right->position())) {
fade = boost::shared_ptr<Crossfade> (new Crossfade (*x, left, (*x)->_out));
} else {
// Overlap, the crossfade is copied on the left side of the right region instead
fade = boost::shared_ptr<Crossfade> (new Crossfade (*xfade, right, xfade->_out));
fade = boost::shared_ptr<Crossfade> (new Crossfade (*x, right, (*x)->_out));
}
}
if (xfade->_out == orig) {
if (! xfade->covers(right->position())) {
fade = boost::shared_ptr<Crossfade> (new Crossfade (*xfade, xfade->_in, right));
if ((*x)->_out == orig) {
if (! (*x)->covers(right->position())) {
fade = boost::shared_ptr<Crossfade> (new Crossfade (*x, (*x)->_in, right));
} else {
// Overlap, the crossfade is copied on the right side of the left region instead
fade = boost::shared_ptr<Crossfade> (new Crossfade (*xfade, xfade->_in, left));
fade = boost::shared_ptr<Crossfade> (new Crossfade (*x, (*x)->_in, left));
}
}
if (fade) {
regions.erase (*x);
_crossfades.remove (*x);
add_crossfade (fade);
}
x = tmp;
}
}
@@ -466,29 +442,25 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh)
}
void
AudioPlaylist::add_crossfade (boost::shared_ptr<Crossfade> new_xfade)
AudioPlaylist::add_crossfade (boost::shared_ptr<Crossfade> xfade)
{
RegionList::iterator r;
boost::shared_ptr<Crossfade> xfade;
Crossfades::iterator ci;
for (r = regions.begin(); r != regions.end(); ++r) {
if ((xfade = boost::dynamic_pointer_cast<Crossfade>(*r))) {
if (*xfade == *new_xfade) { // Crossfade::operator==()
break;
}
for (ci = _crossfades.begin(); ci != _crossfades.end(); ++ci) {
if (*(*ci) == *xfade) { // Crossfade::operator==()
break;
}
}
if (r != regions.end()) {
if (ci != _crossfades.end()) {
// it will just go away
} else {
add_region_internal (new_xfade);
_crossfades.push_back (xfade);
new_xfade->Invalidated.connect (mem_fun (*this, &AudioPlaylist::crossfade_invalidated));
new_xfade->StateChanged.connect (mem_fun (*this, &AudioPlaylist::crossfade_changed));
xfade->Invalidated.connect (mem_fun (*this, &AudioPlaylist::crossfade_invalidated));
xfade->StateChanged.connect (mem_fun (*this, &AudioPlaylist::crossfade_changed));
notify_crossfade_added (new_xfade);
notify_crossfade_added (xfade);
}
}
@@ -504,12 +476,15 @@ 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 ();
remove_region_internal (r);
if ((i = find (_crossfades.begin(), _crossfades.end(), xfade)) != _crossfades.end()) {
_crossfades.erase (i);
}
}
int
@@ -530,14 +505,13 @@ AudioPlaylist::set_state (const XMLNode& node)
child = *niter;
if (child->name() != Crossfade::node_name()) {
if (child->name() != "Crossfade") {
continue;
}
try {
boost::shared_ptr<Crossfade> xfade = boost::dynamic_pointer_cast<Crossfade> (RegionFactory::create (*((const Playlist *) this), *child));
assert (xfade);
add_region_internal (xfade);
boost::shared_ptr<Crossfade> xfade = boost::shared_ptr<Crossfade> (new Crossfade (*((const Playlist *)this), *child));
_crossfades.push_back (xfade);
xfade->Invalidated.connect (mem_fun (*this, &AudioPlaylist::crossfade_invalidated));
xfade->StateChanged.connect (mem_fun (*this, &AudioPlaylist::crossfade_changed));
NewCrossfade(xfade);
@@ -560,9 +534,24 @@ 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
{
@@ -571,32 +560,33 @@ 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;
}
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;
}
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;
}
}
@@ -605,6 +595,8 @@ 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")
@@ -624,9 +616,6 @@ 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;
@@ -640,9 +629,6 @@ 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;
@@ -651,6 +637,18 @@ 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);
@@ -700,3 +698,20 @@ 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);
}
}
}

View File

@@ -194,11 +194,6 @@ 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 ()
{
@@ -629,7 +624,7 @@ Crossfade::compute (boost::shared_ptr<AudioRegion> a, boost::shared_ptr<AudioReg
XMLNode&
Crossfade::get_state ()
{
XMLNode* node = new XMLNode (node_name());
XMLNode* node = new XMLNode (X_("Crossfade"));
XMLNode* child;
char buf[64];
LocaleGuard lg (X_("POSIX"));
@@ -891,9 +886,3 @@ Crossfade::invalidate ()
{
Invalidated (shared_from_this ()); /* EMIT SIGNAL */
}
string
Crossfade::node_name ()
{
return X_("Crossfade");
}

View File

@@ -72,7 +72,7 @@ Curve::~Curve ()
void
Curve::solve ()
{
uint64_t npoints;
uint32_t npoints;
if (!_dirty) {
return;
@@ -87,7 +87,7 @@ Curve::solve ()
double x[npoints];
double y[npoints];
uint64_t i;
uint32_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, int64_t veclen)
Curve::rt_safe_get_vector (double x0, double x1, float *vec, int32_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, int64_t veclen)
}
void
Curve::get_vector (double x0, double x1, float *vec, int64_t veclen)
Curve::get_vector (double x0, double x1, float *vec, int32_t veclen)
{
Glib::Mutex::Lock lm (lock);
_get_vector (x0, x1, vec, veclen);
}
void
Curve::_get_vector (double x0, double x1, float *vec, int64_t veclen)
Curve::_get_vector (double x0, double x1, float *vec, int32_t veclen)
{
double rx, dx, lx, hx, max_x, min_x;
int64_t i;
int64_t original_veclen;
int64_t npoints;
int32_t i;
int32_t original_veclen;
int32_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, int64_t veclen)
*/
double frac = (min_x - x0) / (x1 - x0);
int64_t subveclen = (int64_t) floor (veclen * frac);
int32_t subveclen = (int32_t) floor (veclen * frac);
subveclen = min (subveclen, veclen);
@@ -280,7 +280,7 @@ Curve::_get_vector (double x0, double x1, float *vec, int64_t veclen)
double frac = (x1 - max_x) / (x1 - x0);
int64_t subveclen = (int64_t) floor (original_veclen * frac);
int32_t subveclen = (int32_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, int64_t vecsize)
curve_get_vector_from_c (void *arg, double x0, double x1, float* vec, int32_t vecsize)
{
static_cast<Curve*>(arg)->get_vector (x0, x1, vec, vecsize);
}

View File

@@ -217,9 +217,7 @@ Playlist::copy_regions (RegionList& newlist) const
RegionLock rlock (const_cast<Playlist *> (this));
for (RegionList::const_iterator i = regions.begin(); i != regions.end(); ++i) {
if (!(*i)->is_dependent()) {
newlist.push_back (RegionFactory::RegionFactory::create (*i));
}
newlist.push_back (RegionFactory::RegionFactory::create (*i));
}
}
@@ -1387,7 +1385,7 @@ Playlist::set_state (const XMLNode& node)
child = *niter;
if (child->name() == Region::node_name()) {
if (child->name() == "Region") {
if ((prop = child->property ("id")) == 0) {
error << _("region state node has no ID, ignored") << endmsg;
@@ -1613,11 +1611,6 @@ 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) {
@@ -1655,50 +1648,6 @@ 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.

View File

@@ -1265,8 +1265,3 @@ Region::get_parent() const
return boost::shared_ptr<Region>();
}
string
Region::node_name ()
{
return X_("Region");
}

View File

@@ -89,24 +89,6 @@ 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,
@@ -155,22 +137,6 @@ 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)
{

View File

@@ -1805,25 +1805,20 @@ Route::_set_state (const XMLNode& node, bool call_base)
}
}
if (ports_legal) {
XMLNodeList redirect_nodes;
for (niter = nlist.begin(); niter != nlist.end(); ++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);
}
child = *niter;
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;
@@ -1947,9 +1942,9 @@ Route::_set_redirect_states(const XMLNodeList &nlist)
RedirectList::iterator last = _redirects.end();
--last;
if (prev_last == last) {
warning << _name << ": could not fully restore state as some redirects were not possible to create" << endmsg;
cerr << "Could not fully restore state as some redirects were not possible to create" << endl;
continue;
}