diff options
author | Robin Gareus <robin@gareus.org> | 2017-10-29 18:30:18 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-10-29 20:04:00 +0100 |
commit | 927788a0b0bf6a621e7cee60365f4e8cbd67d829 (patch) | |
tree | 43ebe89319b4b9416391f2f195dbc4f8effad161 /libs/ardour/ardour/port.h | |
parent | 7fb3c3e137d7a96998f21a4ec275339b4bc08c1a (diff) |
Move vari-speed into backend (resample ports)
Previously Ardour used a /local/ per track vari-speed mechanism.
Now that the disk-reader is a latency-compensated processor, the speed
of each disk-reader would need to be maintained locally, offset by each
disk-reader's output latency. Furthermore each disk-reader may
produce a different number of samples, depending on its global alignment.
This commit introduces port-data resampling directly at the engine-level:
Up/down-sample all input ports at the beginning, and down/up-sample output
port-data using the inverse ratio at the end of the session's process
cycle.
The session itself is unaware of the speed-change, and only needs to
handle transport speeds {-1, 0, +1}.
This also allows for aligned cue-monitoring and vari-speed recording,
and also pitch-shifts synthesized MIDI along.
Diffstat (limited to 'libs/ardour/ardour/port.h')
-rw-r--r-- | libs/ardour/ardour/port.h | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/libs/ardour/ardour/port.h b/libs/ardour/ardour/port.h index e59df0cb03..18d56dd8df 100644 --- a/libs/ardour/ardour/port.h +++ b/libs/ardour/ardour/port.h @@ -106,7 +106,7 @@ public: void set_private_latency_range (LatencyRange& range, bool playback); const LatencyRange& private_latency_range (bool playback) const; - void set_public_latency_range (LatencyRange& range, bool playback) const; + void set_public_latency_range (LatencyRange const& range, bool playback) const; LatencyRange public_latency_range (bool playback) const; virtual void reset (); @@ -121,15 +121,16 @@ public: virtual void realtime_locate () {} bool physically_connected () const; + bool externally_connected () const; PBD::Signal1<void,bool> MonitorInputChanged; static PBD::Signal2<void,boost::shared_ptr<Port>,boost::shared_ptr<Port> > PostDisconnect; static PBD::Signal0<void> PortDrop; static PBD::Signal0<void> PortSignalDrop; - static void set_cycle_samplecnt (pframes_t n) { - _cycle_nframes = n; - } + static void set_speed_ratio (double s); + static void set_cycle_samplecnt (pframes_t n); + static samplecnt_t port_offset() { return _global_port_buffer_offset; } static void set_global_port_buffer_offset (pframes_t off) { _global_port_buffer_offset = off; @@ -145,21 +146,26 @@ public: static std::string state_node_name; + static pframes_t cycle_nframes () { return _cycle_nframes; } + protected: Port (std::string const &, DataType, PortFlags); - PortEngine::PortHandle _port_handle; + PortEngine::PortHandle _port_handle; - static bool _connecting_blocked; - static pframes_t _global_port_buffer_offset; /* access only from process() tree */ + static bool _connecting_blocked; static pframes_t _cycle_nframes; /* access only from process() tree */ - samplecnt_t _port_buffer_offset; /* access only from process() tree */ + static pframes_t _global_port_buffer_offset; /* access only from process() tree */ + samplecnt_t _port_buffer_offset; /* access only from process() tree */ LatencyRange _private_playback_latency; LatencyRange _private_capture_latency; + static double _speed_ratio; + static const uint32_t _resampler_quality; /* also latency of the resampler */ + private: std::string _name; ///< port short name PortFlags _flags; ///< flags |