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;
}
{
set (xfade->fade_in(), In);
set (xfade->fade_out(), Out);
+
+ curve_select_clicked (current);
}
void
(*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) {
(*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);
- }
-
}
}
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;
}
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;
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:
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 */
*/
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
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;
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;
}
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;
}
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);
} else {
x_delta = -((double) (drag_info.last_frame_position - pending_region_position) / frames_per_unit);
}
-
+
drag_info.last_frame_position = pending_region_position;
} else {
return;
}
+
if (x_delta < 0) {
for (list<RegionView*>::const_iterator i = selection->regions.by_layer().begin(); i != selection->regions.by_layer().end(); ++i) {
x_delta = max_frames - rv->region()->last_frame();
}
+
if (drag_info.first_move) {
/* hide any dependent views */
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");
proxy.reset ();
} else {
+
parent = *iter;
}
void
Editor::remove_a_region (boost::shared_ptr<Region> r)
{
- cerr << "remove " << r->name();
session->remove_region_from_region_list (r);
}
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));
}
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;
}
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);
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,
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.
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());
}
}
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>);
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 */
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; }
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());
}
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);
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__ */
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;
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;
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; }
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;
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!
_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();
<< 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;
}
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 {
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;
}
}
}
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);
}
}
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
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);
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
{
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;
}
}
{
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")
if ((*i) == region) {
regions.erase (i);
changed = true;
- } else if ((*i)->depends_on (region)) {
- regions.erase (i);
- changed = true;
}
i = tmp;
if ((*x) == region) {
all_regions.erase (x);
changed = true;
- } else if ((*x)->depends_on (region)) {
- all_regions.erase (x);
- changed = true;
}
x = xtmp;
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);
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);
+ }
+ }
+}
+
set_length(_length);
}
-Crossfade::Crossfade (boost::shared_ptr<Playlist> pl, boost::shared_ptr<Crossfade> other)
-{
-
-}
-
Crossfade::~Crossfade ()
{
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"));
{
Invalidated (shared_from_this ()); /* EMIT SIGNAL */
}
-
-string
-Crossfade::node_name ()
-{
- return X_("Crossfade");
-}
void
Curve::solve ()
{
- uint64_t npoints;
+ uint32_t npoints;
if (!_dirty) {
return;
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) {
}
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);
}
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) {
*/
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);
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;
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);
}
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));
}
}
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;
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) {
}
}
- /* 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.
return boost::shared_ptr<Region>();
}
-string
-Region::node_name ()
-{
- return X_("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,
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)
{
}
}
- if (ports_legal) {
-
- /* 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;
+ XMLNodeList redirect_nodes;
- if (child->name() == X_("Send") || child->name() == X_("Insert")) {
- redirect_nodes.push_back(child);
- }
+ for (niter = nlist.begin(); niter != nlist.end(); ++niter){
+
+ 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;
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;
}