diff options
author | Sampo Savolainen <v2@iki.fi> | 2005-11-14 15:44:23 +0000 |
---|---|---|
committer | Sampo Savolainen <v2@iki.fi> | 2005-11-14 15:44:23 +0000 |
commit | 55b517464de78663d46a77a05786efb32bf21058 (patch) | |
tree | c62d88c13c37c8f77123ea11065f4f1ec5fcd168 /libs/ardour | |
parent | 2533e82a0fc4efa625a7e02066a1b932c1bfe822 (diff) |
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
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/ardour/diskstream.h | 10 | ||||
-rw-r--r-- | libs/ardour/ardour/types.h | 15 | ||||
-rw-r--r-- | libs/ardour/diskstream.cc | 10 | ||||
-rw-r--r-- | libs/ardour/ladspa_plugin.cc | 4 |
4 files changed, 27 insertions, 12 deletions
diff --git a/libs/ardour/ardour/diskstream.h b/libs/ardour/ardour/diskstream.h index 9028f0d9e0..3c9aa0e0f6 100644 --- a/libs/ardour/ardour/diskstream.h +++ b/libs/ardour/ardour/diskstream.h @@ -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; diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index 95f3c471f2..a77a02c95b 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -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__ */ diff --git a/libs/ardour/diskstream.cc b/libs/ardour/diskstream.cc index 1b8de068b2..351fdde33f 100644 --- a/libs/ardour/diskstream.cc +++ b/libs/ardour/diskstream.cc @@ -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) { diff --git a/libs/ardour/ladspa_plugin.cc b/libs/ardour/ladspa_plugin.cc index ef136a7807..18a9dd3e95 100644 --- a/libs/ardour/ladspa_plugin.cc +++ b/libs/ardour/ladspa_plugin.cc @@ -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++; |