Important engine bugfixes: Ladspa plugin parameter automation crackles
and varispeed "correction" deadlocks both fixed. git-svn-id: svn://localhost/trunk/ardour2@90 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
2533e82a0f
commit
55b517464d
|
@ -1038,9 +1038,9 @@ AudioTimeAxisView::get_selectables (jack_nframes_t start, jack_nframes_t end, do
|
|||
speed = get_diskstream()->speed();
|
||||
}
|
||||
|
||||
jack_nframes_t start_adjusted = (jack_nframes_t) (start * speed);
|
||||
jack_nframes_t end_adjusted = (jack_nframes_t) (end * speed);
|
||||
|
||||
jack_nframes_t start_adjusted = session_frame_to_track_frame(start, speed);
|
||||
jack_nframes_t end_adjusted = session_frame_to_track_frame(start, speed);
|
||||
|
||||
if (view && touched (top, bot)) {
|
||||
view->get_selectables (start_adjusted, end_adjusted, results);
|
||||
}
|
||||
|
@ -1782,8 +1782,8 @@ AudioTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op)
|
|||
float speed = ds->speed();
|
||||
if (speed != 1.0f) {
|
||||
for (TimeSelection::iterator i = time.begin(); i != time.end(); ++i) {
|
||||
(*i).start = (jack_nframes_t)floor( (float) (*i).start * speed);
|
||||
(*i).end = (jack_nframes_t)floor( (float) (*i).end * speed);
|
||||
(*i).start = session_frame_to_track_frame((*i).start, speed);
|
||||
(*i).end = session_frame_to_track_frame((*i).end, speed);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1832,7 +1832,7 @@ AudioTimeAxisView::paste (jack_nframes_t pos, float times, Selection& selection,
|
|||
}
|
||||
|
||||
if (get_diskstream()->speed() != 1.0f)
|
||||
pos = (jack_nframes_t) floor( (float) pos * get_diskstream()->speed() );
|
||||
pos = session_frame_to_track_frame(pos, get_diskstream()->speed() );
|
||||
|
||||
_session.add_undo (playlist->get_memento());
|
||||
playlist->paste (**p, pos, times);
|
||||
|
|
|
@ -547,7 +547,7 @@ Editor::build_region_boundary_cache ()
|
|||
}
|
||||
}
|
||||
|
||||
rpos = (jack_nframes_t) floor ( (float) rpos / speed );
|
||||
rpos = track_frame_to_session_frame(rpos, speed);
|
||||
|
||||
if (region_boundary_cache.empty() || rpos != region_boundary_cache.back()) {
|
||||
if (snap_type == SnapToRegionBoundary) {
|
||||
|
@ -583,7 +583,7 @@ Editor::find_next_region (jack_nframes_t frame, RegionPoint point, int32_t dir,
|
|||
track_speed = atav->get_diskstream()->speed();
|
||||
}
|
||||
|
||||
track_frame = (jack_nframes_t) floor ( (float) frame * track_speed );
|
||||
track_frame = session_frame_to_track_frame(frame, track_speed);
|
||||
|
||||
if ((r = (*i)->find_next_region (track_frame, point, dir)) == 0) {
|
||||
continue;
|
||||
|
@ -602,8 +602,8 @@ Editor::find_next_region (jack_nframes_t frame, RegionPoint point, int32_t dir,
|
|||
rpos = r->adjust_to_sync (r->first_frame());
|
||||
break;
|
||||
}
|
||||
// rpos is a "track frame", converting it to "time frame"
|
||||
rpos = (jack_nframes_t) floor ( (float) rpos / track_speed );
|
||||
// rpos is a "track frame", converting it to "session frame"
|
||||
rpos = track_frame_to_session_frame(rpos, track_speed);
|
||||
|
||||
if (rpos > frame) {
|
||||
distance = rpos - frame;
|
||||
|
@ -681,8 +681,7 @@ Editor::cursor_to_region_point (Cursor* cursor, RegionPoint point, int32_t dir)
|
|||
}
|
||||
}
|
||||
|
||||
pos = (jack_nframes_t) floor ( (float) pos / speed );
|
||||
|
||||
pos = track_frame_to_session_frame(pos, speed);
|
||||
|
||||
if (cursor == playhead_cursor) {
|
||||
session->request_locate (pos);
|
||||
|
@ -2833,7 +2832,7 @@ Editor::trim_region_to_edit_cursor ()
|
|||
|
||||
begin_reversible_command (_("trim to edit"));
|
||||
session->add_undo (region.playlist()->get_memento());
|
||||
region.trim_end ( (jack_nframes_t) floor( (float)edit_cursor->current_frame * speed), this);
|
||||
region.trim_end( session_frame_to_track_frame(edit_cursor->current_frame, speed), this);
|
||||
session->add_redo_no_execute (region.playlist()->get_memento());
|
||||
commit_reversible_command ();
|
||||
}
|
||||
|
@ -2858,7 +2857,7 @@ Editor::trim_region_from_edit_cursor ()
|
|||
|
||||
begin_reversible_command (_("trim to edit"));
|
||||
session->add_undo (region.playlist()->get_memento());
|
||||
region.trim_front ( (jack_nframes_t) floor( (float)edit_cursor->current_frame * speed), this);
|
||||
region.trim_end( session_frame_to_track_frame(edit_cursor->current_frame, speed), this);
|
||||
session->add_redo_no_execute (region.playlist()->get_memento());
|
||||
commit_reversible_command ();
|
||||
}
|
||||
|
|
|
@ -116,8 +116,8 @@ class DiskStream : public Stateful, public sigc::trackable
|
|||
void punch_out ();
|
||||
|
||||
bool reversed() const { return _actual_speed < 0.0f; }
|
||||
float speed() const { return _visible_speed; }
|
||||
void set_speed (float);
|
||||
double speed() const { return _visible_speed; }
|
||||
void set_speed (double);
|
||||
|
||||
float peak_power(uint32_t n=0) {
|
||||
float x = channels[n].peak_power;
|
||||
|
@ -307,8 +307,8 @@ class DiskStream : public Stateful, public sigc::trackable
|
|||
atomic_t _record_enabled;
|
||||
bool rec_monitoring_off_for_roll;
|
||||
AudioPlaylist* _playlist;
|
||||
float _visible_speed;
|
||||
float _actual_speed;
|
||||
double _visible_speed;
|
||||
double _actual_speed;
|
||||
/* items needed for speed change logic */
|
||||
bool _buffer_reallocation_required;
|
||||
bool _seek_required;
|
||||
|
@ -413,7 +413,7 @@ class DiskStream : public Stateful, public sigc::trackable
|
|||
|
||||
int ports_created ();
|
||||
|
||||
bool realtime_set_speed (float, bool global_change);
|
||||
bool realtime_set_speed (double, bool global_change);
|
||||
void non_realtime_set_speed ();
|
||||
|
||||
std::list<Region*> _last_capture_regions;
|
||||
|
|
|
@ -239,5 +239,20 @@ namespace ARDOUR {
|
|||
};
|
||||
};
|
||||
|
||||
|
||||
static inline jack_nframes_t
|
||||
session_frame_to_track_frame (jack_nframes_t session_frame, double speed)
|
||||
{
|
||||
return (jack_nframes_t)( (double)session_frame * speed );
|
||||
}
|
||||
|
||||
|
||||
static inline jack_nframes_t
|
||||
track_frame_to_session_frame (jack_nframes_t track_frame, double speed)
|
||||
{
|
||||
return (jack_nframes_t)( (double)track_frame / speed );
|
||||
}
|
||||
|
||||
|
||||
#endif /* __ardour_types_h__ */
|
||||
|
||||
|
|
|
@ -453,7 +453,7 @@ DiskStream::set_name (string str, void *src)
|
|||
}
|
||||
|
||||
void
|
||||
DiskStream::set_speed (float sp)
|
||||
DiskStream::set_speed (double sp)
|
||||
{
|
||||
_session.request_diskstream_speed (*this, sp);
|
||||
|
||||
|
@ -462,10 +462,10 @@ DiskStream::set_speed (float sp)
|
|||
}
|
||||
|
||||
bool
|
||||
DiskStream::realtime_set_speed (float sp, bool global)
|
||||
DiskStream::realtime_set_speed (double sp, bool global)
|
||||
{
|
||||
bool changed = false;
|
||||
float new_speed = sp * _session.transport_speed();
|
||||
double new_speed = sp * _session.transport_speed();
|
||||
|
||||
if (_visible_speed != sp) {
|
||||
_visible_speed = sp;
|
||||
|
@ -1938,7 +1938,7 @@ DiskStream::set_state (const XMLNode& node)
|
|||
}
|
||||
|
||||
if ((prop = node.property ("speed")) != 0) {
|
||||
float sp = atof (prop->value().c_str());
|
||||
double sp = atof (prop->value().c_str());
|
||||
|
||||
if (realtime_set_speed (sp, false)) {
|
||||
non_realtime_set_speed ();
|
||||
|
@ -2053,7 +2053,7 @@ DiskStream::allocate_temporary_buffers ()
|
|||
when slaving to MTC, SMPTE etc.
|
||||
*/
|
||||
|
||||
float sp = max (fabsf (_actual_speed), 1.2f);
|
||||
double sp = max (fabsf (_actual_speed), 1.2f);
|
||||
jack_nframes_t required_wrap_size = (jack_nframes_t) floor (_session.get_block_size() * sp) + 1;
|
||||
|
||||
if (required_wrap_size > wrap_buffer_size) {
|
||||
|
|
|
@ -609,14 +609,14 @@ LadspaPlugin::connect_and_run (vector<Sample*>& bufs, uint32_t nbufs, int32_t& i
|
|||
while (port_index < parameter_count()) {
|
||||
if (LADSPA_IS_PORT_AUDIO (port_descriptor(port_index))) {
|
||||
if (LADSPA_IS_PORT_INPUT (port_descriptor(port_index))) {
|
||||
connect_port (port_index, bufs[min((uint32_t) in_index,nbufs)]);
|
||||
connect_port (port_index, bufs[min((uint32_t) in_index,nbufs)] + offset);
|
||||
//cerr << this << ' ' << name() << " @ " << offset << " inport " << in_index << " = buf "
|
||||
//<< min((uint32_t)in_index,nbufs) << " = " << &bufs[min((uint32_t)in_index,nbufs)][offset] << endl;
|
||||
in_index++;
|
||||
|
||||
|
||||
} else if (LADSPA_IS_PORT_OUTPUT (port_descriptor (port_index))) {
|
||||
connect_port (port_index, bufs[min((uint32_t) out_index,nbufs)]);
|
||||
connect_port (port_index, bufs[min((uint32_t) out_index,nbufs)] + offset);
|
||||
//cerr << this << ' ' << name() << " @ " << offset << " outport " << out_index << " = buf "
|
||||
//<< min((uint32_t)out_index,nbufs) << " = " << &bufs[min((uint32_t)out_index,nbufs)][offset] << endl;
|
||||
out_index++;
|
||||
|
|
Loading…
Reference in New Issue