diff options
Diffstat (limited to 'libs/ardour/ardour')
121 files changed, 1253 insertions, 1253 deletions
diff --git a/libs/ardour/ardour/amp.h b/libs/ardour/ardour/amp.h index 5bafc04e07..f3b401fc02 100644 --- a/libs/ardour/ardour/amp.h +++ b/libs/ardour/ardour/amp.h @@ -47,11 +47,11 @@ public: bool can_support_io_configuration (const ChanCount& in, ChanCount& out); bool configure_io (ChanCount in, ChanCount out); - void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool); + void run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool); void set_gain_automation_buffer (gain_t *); - void setup_gain_automation (framepos_t start_frame, framepos_t end_frame, framecnt_t nframes); + void setup_gain_automation (samplepos_t start_sample, samplepos_t end_sample, samplecnt_t nframes); bool apply_gain_automation() const { return _apply_gain_automation; } void apply_gain_automation(bool yn) { _apply_gain_automation = yn; } @@ -59,13 +59,13 @@ public: XMLNode& state (bool full); int set_state (const XMLNode&, int version); - static gain_t apply_gain (BufferSet& bufs, framecnt_t sample_rate, framecnt_t nframes, gain_t initial, gain_t target, bool midi_amp = true); - static void apply_simple_gain(BufferSet& bufs, framecnt_t nframes, gain_t target, bool midi_amp = true); + static gain_t apply_gain (BufferSet& bufs, samplecnt_t sample_rate, samplecnt_t nframes, gain_t initial, gain_t target, bool midi_amp = true); + static void apply_simple_gain(BufferSet& bufs, samplecnt_t nframes, gain_t target, bool midi_amp = true); - static gain_t apply_gain (AudioBuffer& buf, framecnt_t sample_rate, framecnt_t nframes, gain_t initial, gain_t target); - static void apply_simple_gain(AudioBuffer& buf, framecnt_t nframes, gain_t target); + static gain_t apply_gain (AudioBuffer& buf, samplecnt_t sample_rate, samplecnt_t nframes, gain_t initial, gain_t target); + static void apply_simple_gain(AudioBuffer& buf, samplecnt_t nframes, gain_t target); - static void declick (BufferSet& bufs, framecnt_t nframes, int dir); + static void declick (BufferSet& bufs, samplecnt_t nframes, int dir); static void update_meters(); boost::shared_ptr<GainControl> gain_control() { @@ -80,7 +80,7 @@ private: bool _denormal_protection; bool _apply_gain_automation; float _current_gain; - framepos_t _current_automation_frame; + samplepos_t _current_automation_sample; std::string _display_name; diff --git a/libs/ardour/ardour/analysis_graph.h b/libs/ardour/ardour/analysis_graph.h index 4724b826c1..c9ea4f4863 100644 --- a/libs/ardour/ardour/analysis_graph.h +++ b/libs/ardour/ardour/analysis_graph.h @@ -48,19 +48,19 @@ class LIBARDOUR_API AnalysisGraph { void cancel () { _canceled = true; } bool canceled () const { return _canceled; } - void set_total_frames (framecnt_t p) { _frames_end = p; } - PBD::Signal2<void, framecnt_t, framecnt_t> Progress; + void set_total_samples (samplecnt_t p) { _samples_end = p; } + PBD::Signal2<void, samplecnt_t, samplecnt_t> Progress; private: ARDOUR::Session* _session; AnalysisResults _results; - framecnt_t _max_chunksize; + samplecnt_t _max_chunksize; ARDOUR::Sample* _buf; ARDOUR::Sample* _mixbuf; float* _gainbuf; - framecnt_t _frames_read; - framecnt_t _frames_end; + samplecnt_t _samples_read; + samplecnt_t _samples_end; bool _canceled; typedef boost::shared_ptr<AudioGrapher::Analyser> AnalysisPtr; diff --git a/libs/ardour/ardour/async_midi_port.h b/libs/ardour/ardour/async_midi_port.h index 35f3f53e4f..3639304f77 100644 --- a/libs/ardour/ardour/async_midi_port.h +++ b/libs/ardour/ardour/async_midi_port.h @@ -55,7 +55,7 @@ class LIBARDOUR_API AsyncMIDIPort : public ARDOUR::MidiPort, public MIDI::Port { void cycle_end (pframes_t nframes); /* called from non-RT context */ - void parse (framecnt_t timestamp); + void parse (samplecnt_t timestamp); int write (const MIDI::byte *msg, size_t msglen, MIDI::timestamp_t timestamp); int read (MIDI::byte *buf, size_t bufsize); /* waits for output to be cleared */ @@ -72,7 +72,7 @@ class LIBARDOUR_API AsyncMIDIPort : public ARDOUR::MidiPort, public MIDI::Port { /* Not selectable; use ios() */ int selectable() const { return -1; } - void set_timer (boost::function<framecnt_t (void)>&); + void set_timer (boost::function<samplecnt_t (void)>&); static void set_process_thread (pthread_t); static pthread_t get_process_thread () { return _process_thread; } @@ -83,7 +83,7 @@ class LIBARDOUR_API AsyncMIDIPort : public ARDOUR::MidiPort, public MIDI::Port { MIDI::timestamp_t _last_write_timestamp; bool _flush_at_cycle_start; bool have_timer; - boost::function<framecnt_t (void)> timer; + boost::function<samplecnt_t (void)> timer; PBD::RingBuffer< Evoral::Event<double> > output_fifo; EventRingBuffer<MIDI::timestamp_t> input_fifo; Glib::Threads::Mutex output_fifo_lock; diff --git a/libs/ardour/ardour/audio_backend.h b/libs/ardour/ardour/audio_backend.h index 6523eb5081..7c0c893103 100644 --- a/libs/ardour/ardour/audio_backend.h +++ b/libs/ardour/ardour/audio_backend.h @@ -629,11 +629,11 @@ class LIBARDOUR_API AudioBackend : public PortEngine { virtual TransportState transport_state () const { return TransportStopped; } /** Attempt to locate the transport to @param pos */ - virtual void transport_locate (framepos_t /*pos*/) {} + virtual void transport_locate (samplepos_t /*pos*/) {} /** Return the current transport location, in samples measured * from the origin (defined by the transport time master) */ - virtual framepos_t transport_frame() const { return 0; } + virtual samplepos_t transport_sample() const { return 0; } /** If @param yn is true, become the time master for any inter-application transport * timebase, otherwise cease to be the time master for the same. @@ -661,12 +661,12 @@ class LIBARDOUR_API AudioBackend : public PortEngine { * * Can be called from any thread. */ - virtual framepos_t sample_time () = 0; + virtual samplepos_t sample_time () = 0; /** Return the time according to the sample clock in use when the most * recent buffer process cycle began. Can be called from any thread. */ - virtual framepos_t sample_time_at_cycle_start () = 0; + virtual samplepos_t sample_time_at_cycle_start () = 0; /** Return the time since the current buffer process cycle started, * in samples, according to the sample clock in use. @@ -730,7 +730,7 @@ class LIBARDOUR_API AudioBackend : public PortEngine { * handled by Ardour itself (LTC and MTC are both handled by Ardour). * The canonical example is JACK Transport. */ - virtual bool speed_and_position (double& speed, framepos_t& position) { + virtual bool speed_and_position (double& speed, samplepos_t& position) { speed = 0.0; position = 0; return false; diff --git a/libs/ardour/ardour/audio_buffer.h b/libs/ardour/ardour/audio_buffer.h index 7d255c5c50..833d1dcb18 100644 --- a/libs/ardour/ardour/audio_buffer.h +++ b/libs/ardour/ardour/audio_buffer.h @@ -37,7 +37,7 @@ public: * @param len number of samples to clear * @laram offset start offset */ - void silence (framecnt_t len, framecnt_t offset = 0); + void silence (samplecnt_t len, samplecnt_t offset = 0); /** Copy samples from src array starting at src_offset into self starting at dst_offset * @param src array to read from @@ -45,7 +45,7 @@ public: * @param dst_offset offset in destination buffer * @param src_offset start offset in src buffer */ - void read_from (const Sample* src, framecnt_t len, frameoffset_t dst_offset = 0, frameoffset_t src_offset = 0) { + void read_from (const Sample* src, samplecnt_t len, sampleoffset_t dst_offset = 0, sampleoffset_t src_offset = 0) { assert(src != 0); assert(_capacity > 0); assert(len <= _capacity); @@ -54,12 +54,12 @@ public: _written = true; } - void read_from_with_gain (const Sample* src, framecnt_t len, gain_t gain, frameoffset_t dst_offset = 0, frameoffset_t src_offset = 0) { + void read_from_with_gain (const Sample* src, samplecnt_t len, gain_t gain, sampleoffset_t dst_offset = 0, sampleoffset_t src_offset = 0) { assert(src != 0); assert(_capacity > 0); assert(len <= _capacity); src += src_offset; - for (framecnt_t n = 0; n < len; ++n) { + for (samplecnt_t n = 0; n < len; ++n) { _data[dst_offset+n] = src[n] * gain; } _silent = false; @@ -72,12 +72,12 @@ public: * @param dst_offset offset in destination buffer * @param src_offset start offset in src buffer */ - void read_from (const Buffer& src, framecnt_t len, frameoffset_t dst_offset = 0, frameoffset_t src_offset = 0) { + void read_from (const Buffer& src, samplecnt_t len, sampleoffset_t dst_offset = 0, sampleoffset_t src_offset = 0) { assert(&src != this); assert(_capacity > 0); assert(src.type() == DataType::AUDIO); assert(dst_offset + len <= _capacity); - assert( src_offset <= ((framecnt_t) src.capacity()-len)); + assert( src_offset <= ((samplecnt_t) src.capacity()-len)); memcpy(_data + dst_offset, ((const AudioBuffer&)src).data() + src_offset, sizeof(Sample) * len); if (dst_offset == 0 && src_offset == 0 && len == _capacity) { _silent = src.silent(); @@ -87,15 +87,15 @@ public: _written = true; } - /** Accumulate (add) @a len frames @a src starting at @a src_offset into self starting at @a dst_offset */ - void merge_from (const Buffer& src, framecnt_t len, frameoffset_t dst_offset = 0, frameoffset_t src_offset = 0) { + /** Accumulate (add) @a len samples @a src starting at @a src_offset into self starting at @a dst_offset */ + void merge_from (const Buffer& src, samplecnt_t len, sampleoffset_t dst_offset = 0, sampleoffset_t src_offset = 0) { const AudioBuffer* ab = dynamic_cast<const AudioBuffer*>(&src); assert (ab); accumulate_from (*ab, len, dst_offset, src_offset); } - /** Accumulate (add) @a len frames @a src starting at @a src_offset into self starting at @a dst_offset */ - void accumulate_from (const AudioBuffer& src, framecnt_t len, frameoffset_t dst_offset = 0, frameoffset_t src_offset = 0) { + /** Accumulate (add) @a len samples @a src starting at @a src_offset into self starting at @a dst_offset */ + void accumulate_from (const AudioBuffer& src, samplecnt_t len, sampleoffset_t dst_offset = 0, sampleoffset_t src_offset = 0) { assert(_capacity > 0); assert(len <= _capacity); @@ -108,8 +108,8 @@ public: _written = true; } - /** Accumulate (add) @a len frames @a src starting at @a src_offset into self starting at @a dst_offset */ - void accumulate_from (const Sample* src, framecnt_t len, frameoffset_t dst_offset = 0, frameoffset_t src_offset = 0) { + /** Accumulate (add) @a len samples @a src starting at @a src_offset into self starting at @a dst_offset */ + void accumulate_from (const Sample* src, samplecnt_t len, sampleoffset_t dst_offset = 0, sampleoffset_t src_offset = 0) { assert(_capacity > 0); assert(len <= _capacity); @@ -122,9 +122,9 @@ public: _written = true; } - /** Accumulate (add) @a len frames @a src starting at @a src_offset into self starting at @dst_offset + /** Accumulate (add) @a len samples @a src starting at @a src_offset into self starting at @dst_offset * scaling by @a gain_coeff */ - void accumulate_with_gain_from (const AudioBuffer& src, framecnt_t len, gain_t gain_coeff, frameoffset_t dst_offset = 0, frameoffset_t src_offset = 0) { + void accumulate_with_gain_from (const AudioBuffer& src, samplecnt_t len, gain_t gain_coeff, sampleoffset_t dst_offset = 0, sampleoffset_t src_offset = 0) { assert(_capacity > 0); assert(len <= _capacity); @@ -142,9 +142,9 @@ public: _written = true; } - /** Accumulate (add) @a len frames FROM THE START OF @a src into self + /** Accumulate (add) @a len samples FROM THE START OF @a src into self * scaling by @a gain_coeff */ - void accumulate_with_gain_from (const Sample* src_raw, framecnt_t len, gain_t gain_coeff, frameoffset_t dst_offset = 0) { + void accumulate_with_gain_from (const Sample* src_raw, samplecnt_t len, gain_t gain_coeff, sampleoffset_t dst_offset = 0) { assert(_capacity > 0); assert(len <= _capacity); @@ -157,9 +157,9 @@ public: _written = true; } - /** Accumulate (add) @a len frames FROM THE START OF @a src into self + /** Accumulate (add) @a len samples FROM THE START OF @a src into self * scaling by @a gain_coeff */ - void accumulate_with_ramped_gain_from (const Sample* src, framecnt_t len, gain_t initial, gain_t target, frameoffset_t dst_offset = 0) { + void accumulate_with_ramped_gain_from (const Sample* src, samplecnt_t len, gain_t initial, gain_t target, sampleoffset_t dst_offset = 0) { assert(_capacity > 0); assert(len <= _capacity); @@ -167,7 +167,7 @@ public: Sample* dst = _data + dst_offset; gain_t gain_delta = (target - initial)/len; - for (framecnt_t n = 0; n < len; ++n) { + for (samplecnt_t n = 0; n < len; ++n) { *dst++ += (*src++ * initial); initial += gain_delta; } @@ -178,9 +178,9 @@ public: /** apply a fixed gain factor to the audio buffer * @param gain gain factor - * @param len number of frames to amplify + * @param len number of samples to amplify */ - void apply_gain (gain_t gain, framecnt_t len) { + void apply_gain (gain_t gain, samplecnt_t len) { apply_gain_to_buffer (_data, len, gain); } @@ -202,19 +202,19 @@ public: */ void resize (size_t nframes); - const Sample* data (framecnt_t offset = 0) const { + const Sample* data (samplecnt_t offset = 0) const { assert(offset <= _capacity); return _data + offset; } - Sample* data (framecnt_t offset = 0) { + Sample* data (samplecnt_t offset = 0) { assert(offset <= _capacity); _silent = false; return _data + offset; } /** check buffer for silence - * @param nframes number of frames to check + * @param nframes number of samples to check * @param n first non zero sample (if any) * @return true if all samples are zero */ diff --git a/libs/ardour/ardour/audio_playlist_source.h b/libs/ardour/ardour/audio_playlist_source.h index 9c815fb238..4a1f5953dc 100644 --- a/libs/ardour/ardour/audio_playlist_source.h +++ b/libs/ardour/ardour/audio_playlist_source.h @@ -41,8 +41,8 @@ public: uint32_t n_channels() const; bool clamped_at_unity () const { return false; } - framecnt_t read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) const; - framecnt_t write_unlocked (Sample *src, framecnt_t cnt); + samplecnt_t read_unlocked (Sample *dst, samplepos_t start, samplecnt_t cnt) const; + samplecnt_t write_unlocked (Sample *src, samplecnt_t cnt); float sample_rate () const; int setup_peakfile (); @@ -57,7 +57,7 @@ protected: friend class SourceFactory; AudioPlaylistSource (Session&, const PBD::ID& orig, const std::string& name, boost::shared_ptr<AudioPlaylist>, uint32_t chn, - frameoffset_t begin, framecnt_t len, Source::Flag flags); + sampleoffset_t begin, samplecnt_t len, Source::Flag flags); AudioPlaylistSource (Session&, const XMLNode&); diff --git a/libs/ardour/ardour/audio_track.h b/libs/ardour/ardour/audio_track.h index 2779e6a4f8..e93ebd7f02 100644 --- a/libs/ardour/ardour/audio_track.h +++ b/libs/ardour/ardour/audio_track.h @@ -37,7 +37,7 @@ class LIBARDOUR_API AudioTrack : public Track AudioTrack (Session&, std::string name, TrackMode m = Normal); ~AudioTrack (); - int roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, + int roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, int declick, bool& need_butler); void freeze_me (InterThreadInfo&); @@ -45,9 +45,9 @@ class LIBARDOUR_API AudioTrack : public Track bool bounceable (boost::shared_ptr<Processor>, bool include_endpoint) const; boost::shared_ptr<Region> bounce (InterThreadInfo&); - boost::shared_ptr<Region> bounce_range (framepos_t start, framepos_t end, InterThreadInfo&, + boost::shared_ptr<Region> bounce_range (samplepos_t start, samplepos_t end, InterThreadInfo&, boost::shared_ptr<Processor> endpoint, bool include_endpoint); - int export_stuff (BufferSet& bufs, framepos_t start_frame, framecnt_t nframes, + int export_stuff (BufferSet& bufs, samplepos_t start_sample, samplecnt_t nframes, boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze); int set_state (const XMLNode&, int version); diff --git a/libs/ardour/ardour/audio_unit.h b/libs/ardour/ardour/audio_unit.h index c5c5ed4a95..2e44e6ec63 100644 --- a/libs/ardour/ardour/audio_unit.h +++ b/libs/ardour/ardour/audio_unit.h @@ -70,7 +70,7 @@ class LIBARDOUR_API AUPlugin : public ARDOUR::Plugin const char * maker () const { return _info->creator.c_str(); } uint32_t parameter_count () const; float default_value (uint32_t port); - framecnt_t signal_latency() const; + samplecnt_t signal_latency() const; void set_parameter (uint32_t which, float val); float get_parameter (uint32_t which) const; @@ -84,9 +84,9 @@ class LIBARDOUR_API AUPlugin : public ARDOUR::Plugin int set_block_size (pframes_t nframes); int connect_and_run (BufferSet& bufs, - framepos_t start, framepos_t end, double speed, + samplepos_t start, samplepos_t end, double speed, ChanMapping in, ChanMapping out, - pframes_t nframes, framecnt_t offset); + pframes_t nframes, samplecnt_t offset); std::set<Evoral::Parameter> automatable() const; std::string describe_parameter (Evoral::Parameter); IOPortDescription describe_io_port (DataType dt, bool input, uint32_t id) const; @@ -123,7 +123,7 @@ class LIBARDOUR_API AUPlugin : public ARDOUR::Plugin OSStatus render_callback(AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, - UInt32 inNumberFrames, + UInt32 inNumberSamples, AudioBufferList* ioData); /* "host" callbacks */ @@ -170,7 +170,7 @@ class LIBARDOUR_API AUPlugin : public ARDOUR::Plugin int32_t input_channels; int32_t output_channels; std::vector<std::pair<int,int> > io_configs; - framecnt_t _last_nframes; + samplecnt_t _last_nframes; mutable volatile guint _current_latency; bool _requires_fixed_size_buffers; AudioBufferList* buffers; @@ -213,11 +213,11 @@ class LIBARDOUR_API AUPlugin : public ARDOUR::Plugin typedef std::map<uint32_t, uint32_t> ParameterMap; ParameterMap parameter_map; uint32_t input_maxbuf; - framecnt_t input_offset; - framecnt_t *cb_offsets; + samplecnt_t input_offset; + samplecnt_t *cb_offsets; BufferSet* input_buffers; ChanMapping * input_map; - framecnt_t frames_processed; + samplecnt_t samples_processed; uint32_t audio_input_cnt; std::vector<AUParameterDescriptor> descriptors; @@ -227,7 +227,7 @@ class LIBARDOUR_API AUPlugin : public ARDOUR::Plugin void discover_factory_presets (); - framepos_t transport_frame; + samplepos_t transport_sample; float transport_speed; float last_transport_speed; diff --git a/libs/ardour/ardour/audioanalyser.h b/libs/ardour/ardour/audioanalyser.h index 03eb7d94fa..0474787aec 100644 --- a/libs/ardour/ardour/audioanalyser.h +++ b/libs/ardour/ardour/audioanalyser.h @@ -55,8 +55,8 @@ class LIBARDOUR_API AudioAnalyser : public boost::noncopyable { AnalysisPlugin* plugin; AnalysisPluginKey plugin_key; - framecnt_t bufsize; - framecnt_t stepsize; + samplecnt_t bufsize; + samplecnt_t stepsize; int initialize_plugin (AnalysisPluginKey name, float sample_rate); int analyse (const std::string& path, Readable*, uint32_t channel); diff --git a/libs/ardour/ardour/audioengine.h b/libs/ardour/ardour/audioengine.h index f297e993b3..6e7cdf7496 100644 --- a/libs/ardour/ardour/audioengine.h +++ b/libs/ardour/ardour/audioengine.h @@ -88,14 +88,14 @@ class LIBARDOUR_API AudioEngine : public PortManager, public SessionHandlePtr void transport_start (); void transport_stop (); TransportState transport_state (); - void transport_locate (framepos_t pos); - framepos_t transport_frame(); - framecnt_t sample_rate () const; + void transport_locate (samplepos_t pos); + samplepos_t transport_sample(); + samplecnt_t sample_rate () const; pframes_t samples_per_cycle () const; int usecs_per_cycle () const; size_t raw_buffer_size (DataType t); - framepos_t sample_time (); - framepos_t sample_time_at_cycle_start (); + samplepos_t sample_time (); + samplepos_t sample_time_at_cycle_start (); pframes_t samples_since_cycle_start (); bool get_sync_offset (pframes_t& offset) const; @@ -138,7 +138,7 @@ class LIBARDOUR_API AudioEngine : public PortManager, public SessionHandlePtr return set_buffer_size (samples); } - framecnt_t processed_frames() const { return _processed_frames; } + samplecnt_t processed_samples() const { return _processed_samples; } void set_session (Session *); void remove_session (); // not a replacement for SessionHandle::session_going_away() @@ -166,7 +166,7 @@ class LIBARDOUR_API AudioEngine : public PortManager, public SessionHandlePtr PBD::Signal0<void> Xrun; /** this signal is emitted if the sample rate changes */ - PBD::Signal1<void, framecnt_t> SampleRateChanged; + PBD::Signal1<void, samplecnt_t> SampleRateChanged; /** this signal is emitted if the buffer size changes */ PBD::Signal1<void, pframes_t> BufferSizeChanged; @@ -205,8 +205,8 @@ class LIBARDOUR_API AudioEngine : public PortManager, public SessionHandlePtr int buffer_size_change (pframes_t nframes); int sample_rate_change (pframes_t nframes); void freewheel_callback (bool); - void timebase_callback (TransportState state, pframes_t nframes, framepos_t pos, int new_position); - int sync_callback (TransportState state, framepos_t position); + void timebase_callback (TransportState state, pframes_t nframes, samplepos_t pos, int new_position); + int sync_callback (TransportState state, samplepos_t position); int port_registration_callback (); void latency_callback (bool for_playback); void halted_callback (const char* reason); @@ -258,17 +258,17 @@ class LIBARDOUR_API AudioEngine : public PortManager, public SessionHandlePtr Glib::Threads::RecMutex _state_lock; Glib::Threads::Cond session_removed; bool session_remove_pending; - frameoffset_t session_removal_countdown; + sampleoffset_t session_removal_countdown; gain_t session_removal_gain; gain_t session_removal_gain_step; bool _running; bool _freewheeling; - /// number of frames between each check for changes in monitor input - framecnt_t monitor_check_interval; - /// time of the last monitor check in frames - framecnt_t last_monitor_check; - /// the number of frames processed since start() was called - framecnt_t _processed_frames; + /// number of samples between each check for changes in monitor input + samplecnt_t monitor_check_interval; + /// time of the last monitor check in samples + samplecnt_t last_monitor_check; + /// the number of samples processed since start() was called + samplecnt_t _processed_samples; Glib::Threads::Thread* m_meter_thread; ProcessThread* _main_thread; MTDM* _mtdm; @@ -276,10 +276,10 @@ class LIBARDOUR_API AudioEngine : public PortManager, public SessionHandlePtr LatencyMeasurement _measuring_latency; PortEngine::PortHandle _latency_input_port; PortEngine::PortHandle _latency_output_port; - framecnt_t _latency_flush_frames; + samplecnt_t _latency_flush_samples; std::string _latency_input_name; std::string _latency_output_name; - framecnt_t _latency_signal_latency; + samplecnt_t _latency_signal_latency; bool _stopped_for_latency; bool _started_for_latency; bool _in_destructor; @@ -308,7 +308,7 @@ class LIBARDOUR_API AudioEngine : public PortManager, public SessionHandlePtr void drop_backend (); #ifdef SILENCE_AFTER - framecnt_t _silence_countdown; + samplecnt_t _silence_countdown; uint32_t _silence_hit_cnt; #endif diff --git a/libs/ardour/ardour/audiofilesource.h b/libs/ardour/ardour/audiofilesource.h index 49b62116fc..6a3e2569ce 100644 --- a/libs/ardour/ardour/audiofilesource.h +++ b/libs/ardour/ardour/audiofilesource.h @@ -50,14 +50,14 @@ public: /* this block of methods do nothing for regular file sources, but are significant for files used in destructive recording. */ - virtual framepos_t last_capture_start_frame() const { return 0; } - virtual void mark_capture_start (framepos_t) {} + virtual samplepos_t last_capture_start_sample() const { return 0; } + virtual void mark_capture_start (samplepos_t) {} virtual void mark_capture_end () {} virtual void clear_capture_marks() {} virtual bool one_of_several_channels () const { return false; } virtual void flush () = 0; - virtual int update_header (framepos_t when, struct tm&, time_t) = 0; + virtual int update_header (samplepos_t when, struct tm&, time_t) = 0; virtual int flush_header () = 0; void mark_streaming_write_completed (const Lock& lock); @@ -76,7 +76,7 @@ public: static bool is_empty (Session&, std::string path); static void set_bwf_serial_number (int); - static void set_header_position_offset (framecnt_t offset); + static void set_header_position_offset (samplecnt_t offset); static PBD::Signal0<void> HeaderPositionOffsetChanged; @@ -104,14 +104,14 @@ protected: int move_dependents_to_trash(); - static Sample* get_interleave_buffer (framecnt_t size); + static Sample* get_interleave_buffer (samplecnt_t size); static char bwf_country_code[3]; static char bwf_organization_code[4]; static char bwf_serial_number[13]; /** Kept up to date with the position of the session location start */ - static framecnt_t header_position_offset; + static samplecnt_t header_position_offset; }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/audioplaylist.h b/libs/ardour/ardour/audioplaylist.h index c4196dc3b6..e66ee0e780 100644 --- a/libs/ardour/ardour/audioplaylist.h +++ b/libs/ardour/ardour/audioplaylist.h @@ -39,9 +39,9 @@ public: AudioPlaylist (Session&, const XMLNode&, bool hidden = false); AudioPlaylist (Session&, std::string name, bool hidden = false); AudioPlaylist (boost::shared_ptr<const AudioPlaylist>, std::string name, bool hidden = false); - AudioPlaylist (boost::shared_ptr<const AudioPlaylist>, framepos_t start, framecnt_t cnt, std::string name, bool hidden = false); + AudioPlaylist (boost::shared_ptr<const AudioPlaylist>, samplepos_t start, samplecnt_t cnt, std::string name, bool hidden = false); - framecnt_t read (Sample *dst, Sample *mixdown, float *gain_buffer, framepos_t start, framecnt_t cnt, uint32_t chan_n=0); + samplecnt_t read (Sample *dst, Sample *mixdown, float *gain_buffer, samplepos_t start, samplecnt_t cnt, uint32_t chan_n=0); bool destroy_region (boost::shared_ptr<Region>); diff --git a/libs/ardour/ardour/audioregion.h b/libs/ardour/ardour/audioregion.h index 205998e4a8..1262dece4f 100644 --- a/libs/ardour/ardour/audioregion.h +++ b/libs/ardour/ardour/audioregion.h @@ -103,52 +103,52 @@ class LIBARDOUR_API AudioRegion : public Region boost::shared_ptr<AutomationList> inverse_fade_out() { return _inverse_fade_out.val (); } boost::shared_ptr<AutomationList> envelope() { return _envelope.val (); } - Evoral::Range<framepos_t> body_range () const; + Evoral::Range<samplepos_t> body_range () const; - virtual framecnt_t read_peaks (PeakData *buf, framecnt_t npeaks, - framecnt_t offset, framecnt_t cnt, - uint32_t chan_n=0, double frames_per_pixel = 1.0) const; + virtual samplecnt_t read_peaks (PeakData *buf, samplecnt_t npeaks, + samplecnt_t offset, samplecnt_t cnt, + uint32_t chan_n=0, double samples_per_pixel = 1.0) const; /* Readable interface */ - virtual framecnt_t read (Sample*, framepos_t pos, framecnt_t cnt, int channel) const; - virtual framecnt_t readable_length() const { return length(); } + virtual samplecnt_t read (Sample*, samplepos_t pos, samplecnt_t cnt, int channel) const; + virtual samplecnt_t readable_length() const { return length(); } - virtual framecnt_t read_at (Sample *buf, Sample *mixdown_buf, float *gain_buf, - framepos_t position, - framecnt_t cnt, + virtual samplecnt_t read_at (Sample *buf, Sample *mixdown_buf, float *gain_buf, + samplepos_t position, + samplecnt_t cnt, uint32_t chan_n = 0) const; - virtual framecnt_t master_read_at (Sample *buf, Sample *mixdown_buf, float *gain_buf, - framepos_t position, framecnt_t cnt, uint32_t chan_n=0) const; + virtual samplecnt_t master_read_at (Sample *buf, Sample *mixdown_buf, float *gain_buf, + samplepos_t position, samplecnt_t cnt, uint32_t chan_n=0) const; - virtual framecnt_t read_raw_internal (Sample*, framepos_t, framecnt_t, int channel) const; + virtual samplecnt_t read_raw_internal (Sample*, samplepos_t, samplecnt_t, int channel) const; XMLNode& state (); XMLNode& get_basic_state (); int set_state (const XMLNode&, int version); - void fade_range (framepos_t, framepos_t); + void fade_range (samplepos_t, samplepos_t); bool fade_in_is_default () const; bool fade_out_is_default () const; void set_fade_in_active (bool yn); void set_fade_in_shape (FadeShape); - void set_fade_in_length (framecnt_t); - void set_fade_in (FadeShape, framecnt_t); + void set_fade_in_length (samplecnt_t); + void set_fade_in (FadeShape, samplecnt_t); void set_fade_in (boost::shared_ptr<AutomationList>); void set_fade_out_active (bool yn); void set_fade_out_shape (FadeShape); - void set_fade_out_length (framecnt_t); - void set_fade_out (FadeShape, framecnt_t); + void set_fade_out_length (samplecnt_t); + void set_fade_out (FadeShape, samplecnt_t); void set_fade_out (boost::shared_ptr<AutomationList>); void set_default_fade_in (); void set_default_fade_out (); - framecnt_t verify_xfade_bounds (framecnt_t, bool start); + samplecnt_t verify_xfade_bounds (samplecnt_t, bool start); void set_envelope_active (bool yn); void set_default_envelope (); @@ -174,14 +174,14 @@ class LIBARDOUR_API AudioRegion : public Region void resume_fade_in (); void resume_fade_out (); - void add_transient (framepos_t where); - void remove_transient (framepos_t where); + void add_transient (samplepos_t where); + void remove_transient (samplepos_t where); void clear_transients (); void set_onsets (AnalysisFeatureList&); void get_transients (AnalysisFeatureList&); - void update_transient (framepos_t old_position, framepos_t new_position); + void update_transient (samplepos_t old_position, samplepos_t new_position); - AudioIntervalResult find_silence (Sample, framecnt_t, framecnt_t, InterThreadInfo&) const; + AudioIntervalResult find_silence (Sample, samplecnt_t, samplecnt_t, InterThreadInfo&) const; private: friend class RegionFactory; @@ -189,7 +189,7 @@ class LIBARDOUR_API AudioRegion : public Region AudioRegion (boost::shared_ptr<AudioSource>); AudioRegion (const SourceList &); AudioRegion (boost::shared_ptr<const AudioRegion>); - AudioRegion (boost::shared_ptr<const AudioRegion>, ARDOUR::MusicFrame offset); + AudioRegion (boost::shared_ptr<const AudioRegion>, ARDOUR::MusicSample offset); AudioRegion (boost::shared_ptr<const AudioRegion>, const SourceList&); AudioRegion (SourceList &); @@ -216,7 +216,7 @@ class LIBARDOUR_API AudioRegion : public Region void recompute_gain_at_end (); void recompute_gain_at_start (); - framecnt_t read_from_sources (SourceList const &, framecnt_t, Sample *, framepos_t, framecnt_t, uint32_t) const; + samplecnt_t read_from_sources (SourceList const &, samplecnt_t, Sample *, samplepos_t, samplecnt_t, uint32_t) const; void recompute_at_start (); void recompute_at_end (); @@ -244,7 +244,7 @@ class LIBARDOUR_API AudioRegion : public Region protected: /* default constructor for derived (compound) types */ - AudioRegion (Session& s, framepos_t, framecnt_t, std::string name); + AudioRegion (Session& s, samplepos_t, samplecnt_t, std::string name); int _set_state (const XMLNode&, int version, PBD::PropertyChange& what_changed, bool send_signal); }; diff --git a/libs/ardour/ardour/audiosource.h b/libs/ardour/ardour/audiosource.h index 59d5add122..6df4146259 100644 --- a/libs/ardour/ardour/audiosource.h +++ b/libs/ardour/ardour/audiosource.h @@ -47,17 +47,17 @@ class LIBARDOUR_API AudioSource : virtual public Source, AudioSource (Session&, const XMLNode&); virtual ~AudioSource (); - framecnt_t readable_length() const { return _length; } + samplecnt_t readable_length() const { return _length; } virtual uint32_t n_channels() const { return 1; } virtual bool empty() const; - framecnt_t length (framepos_t pos) const; - void update_length (framecnt_t cnt); + samplecnt_t length (samplepos_t pos) const; + void update_length (samplecnt_t cnt); - virtual framecnt_t available_peaks (double zoom) const; + virtual samplecnt_t available_peaks (double zoom) const; - virtual framecnt_t read (Sample *dst, framepos_t start, framecnt_t cnt, int channel=0) const; - virtual framecnt_t write (Sample *src, framecnt_t cnt); + virtual samplecnt_t read (Sample *dst, samplepos_t start, samplecnt_t cnt, int channel=0) const; + virtual samplecnt_t write (Sample *src, samplecnt_t cnt); virtual float sample_rate () const = 0; @@ -68,14 +68,14 @@ class LIBARDOUR_API AudioSource : virtual public Source, void set_captured_for (std::string str) { _captured_for = str; } std::string captured_for() const { return _captured_for; } - int read_peaks (PeakData *peaks, framecnt_t npeaks, - framepos_t start, framecnt_t cnt, double samples_per_visual_peak) const; + int read_peaks (PeakData *peaks, samplecnt_t npeaks, + samplepos_t start, samplecnt_t cnt, double samples_per_visual_peak) const; int build_peaks (); bool peaks_ready (boost::function<void()> callWhenReady, PBD::ScopedConnection** connection_created_if_not_ready, PBD::EventLoop* event_loop) const; mutable PBD::Signal0<void> PeaksReady; - mutable PBD::Signal2<void,framepos_t,framepos_t> PeakRangeReady; + mutable PBD::Signal2<void,samplepos_t,samplepos_t> PeakRangeReady; XMLNode& get_state (); int set_state (const XMLNode&, int version); @@ -104,7 +104,7 @@ class LIBARDOUR_API AudioSource : virtual public Source, /** @return true if the each source sample s must be clamped to -1 < s < 1 */ virtual bool clamped_at_unity () const = 0; - static void allocate_working_buffers (framecnt_t framerate); + static void allocate_working_buffers (samplecnt_t framerate); protected: static bool _build_missing_peakfiles; @@ -120,32 +120,32 @@ class LIBARDOUR_API AudioSource : virtual public Source, static std::vector<boost::shared_array<gain_t> > _gain_buffers; static Glib::Threads::Mutex _level_buffer_lock; - static void ensure_buffers_for_level (uint32_t, framecnt_t); - static void ensure_buffers_for_level_locked (uint32_t, framecnt_t); + static void ensure_buffers_for_level (uint32_t, samplecnt_t); + static void ensure_buffers_for_level_locked (uint32_t, samplecnt_t); - framecnt_t _length; + samplecnt_t _length; std::string _peakpath; std::string _captured_for; int initialize_peakfile (const std::string& path, const bool in_session = false); int build_peaks_from_scratch (); - int compute_and_write_peaks (Sample* buf, framecnt_t first_frame, framecnt_t cnt, + int compute_and_write_peaks (Sample* buf, samplecnt_t first_sample, samplecnt_t cnt, bool force, bool intermediate_peaks_ready_signal); void truncate_peakfile(); mutable off_t _peak_byte_max; // modified in compute_and_write_peak() - virtual framecnt_t read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) const = 0; - virtual framecnt_t write_unlocked (Sample *dst, framecnt_t cnt) = 0; + virtual samplecnt_t read_unlocked (Sample *dst, samplepos_t start, samplecnt_t cnt) const = 0; + virtual samplecnt_t write_unlocked (Sample *dst, samplecnt_t cnt) = 0; virtual std::string construct_peak_filepath (const std::string& audio_path, const bool in_session = false, const bool old_peak_name = false) const = 0; virtual int read_peaks_with_fpp (PeakData *peaks, - framecnt_t npeaks, framepos_t start, framecnt_t cnt, - double samples_per_visual_peak, framecnt_t fpp) const; + samplecnt_t npeaks, samplepos_t start, samplecnt_t cnt, + double samples_per_visual_peak, samplecnt_t fpp) const; - int compute_and_write_peaks (Sample* buf, framecnt_t first_frame, framecnt_t cnt, + int compute_and_write_peaks (Sample* buf, samplecnt_t first_sample, samplecnt_t cnt, bool force, bool intermediate_peaks_ready_signal, - framecnt_t frames_per_peak); + samplecnt_t samples_per_peak); private: bool _peaks_built; @@ -159,10 +159,10 @@ class LIBARDOUR_API AudioSource : virtual public Source, Glib::Threads::Mutex _initialize_peaks_lock; int _peakfile_fd; - framecnt_t peak_leftover_cnt; - framecnt_t peak_leftover_size; + samplecnt_t peak_leftover_cnt; + samplecnt_t peak_leftover_size; Sample* peak_leftovers; - framepos_t peak_leftover_frame; + samplepos_t peak_leftover_sample; mutable bool _first_run; mutable double _last_scale; diff --git a/libs/ardour/ardour/auditioner.h b/libs/ardour/ardour/auditioner.h index ffc0ddb331..61d4f2c1cf 100644 --- a/libs/ardour/ardour/auditioner.h +++ b/libs/ardour/ardour/auditioner.h @@ -47,10 +47,10 @@ class LIBARDOUR_API Auditioner : public Track void audition_region (boost::shared_ptr<Region>); - void seek_to_frame (frameoffset_t pos) { if (_seek_frame < 0 && !_seeking) { _seek_frame = pos; }} - void seek_to_percent (float const pos) { if (_seek_frame < 0 && !_seeking) { _seek_frame = floorf(length * pos / 100.0); }} + void seek_to_sample (sampleoffset_t pos) { if (_seek_sample < 0 && !_seeking) { _seek_sample = pos; }} + void seek_to_percent (float const pos) { if (_seek_sample < 0 && !_seeking) { _seek_sample = floorf(length * pos / 100.0); }} - int play_audition (framecnt_t nframes); + int play_audition (samplecnt_t nframes); MonitorState monitoring_state () const; @@ -63,20 +63,20 @@ class LIBARDOUR_API Auditioner : public Track virtual ChanCount input_streams () const; - frameoffset_t seek_frame() const { return _seeking ? _seek_frame : -1;} - void seek_response(frameoffset_t pos) { + sampleoffset_t seek_sample() const { return _seeking ? _seek_sample : -1;} + void seek_response(sampleoffset_t pos) { _seek_complete = true; - if (_seeking) { current_frame = pos; _seek_complete = true;} + if (_seeking) { current_sample = pos; _seek_complete = true;} } - PBD::Signal2<void, ARDOUR::framecnt_t, ARDOUR::framecnt_t> AuditionProgress; + PBD::Signal2<void, ARDOUR::samplecnt_t, ARDOUR::samplecnt_t> AuditionProgress; /* Track */ - int roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool& need_butler); + int roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, int declick, bool& need_butler); DataType data_type () const; - int roll_audio (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool& need_butler); - int roll_midi (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool& need_butler); + int roll_audio (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, int declick, bool& need_butler); + int roll_midi (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, int declick, bool& need_butler); /* fake track */ void set_state_part_two () {} @@ -88,20 +88,20 @@ class LIBARDOUR_API Auditioner : public Track boost::shared_ptr<Region> bounce (InterThreadInfo&) { return boost::shared_ptr<Region> (); } - boost::shared_ptr<Region> bounce_range (framepos_t, framepos_t, InterThreadInfo&, boost::shared_ptr<Processor>, bool) + boost::shared_ptr<Region> bounce_range (samplepos_t, samplepos_t, InterThreadInfo&, boost::shared_ptr<Processor>, bool) { return boost::shared_ptr<Region> (); } - int export_stuff (BufferSet&, framepos_t, framecnt_t, boost::shared_ptr<Processor>, bool, bool, bool) + int export_stuff (BufferSet&, samplepos_t, samplecnt_t, boost::shared_ptr<Processor>, bool, bool, bool) { return -1; } private: boost::shared_ptr<AudioRegion> the_region; boost::shared_ptr<MidiRegion> midi_region; - framepos_t current_frame; + samplepos_t current_sample; mutable gint _auditioning; Glib::Threads::Mutex lock; - framecnt_t length; - frameoffset_t _seek_frame; + samplecnt_t length; + sampleoffset_t _seek_sample; bool _seeking; bool _seek_complete; bool via_monitor; @@ -118,7 +118,7 @@ class LIBARDOUR_API Auditioner : public Track static void *_drop_ports (void *); void actually_drop_ports (); void output_changed (IOChange, void*); - frameoffset_t _import_position; + sampleoffset_t _import_position; }; }; /* namespace ARDOUR */ diff --git a/libs/ardour/ardour/automatable.h b/libs/ardour/ardour/automatable.h index ead74d311d..84164568c5 100644 --- a/libs/ardour/ardour/automatable.h +++ b/libs/ardour/ardour/automatable.h @@ -83,10 +83,10 @@ public: virtual bool find_next_event (double start, double end, Evoral::ControlEvent& ev, bool only_active = true) const; void clear_controls (); - virtual void non_realtime_locate (framepos_t now); - virtual void non_realtime_transport_stop (framepos_t now, bool flush); + virtual void non_realtime_locate (samplepos_t now); + virtual void non_realtime_transport_stop (samplepos_t now, bool flush); - virtual void automation_run (framepos_t, pframes_t); + virtual void automation_run (samplepos_t, pframes_t); virtual std::string describe_parameter(Evoral::Parameter param); @@ -117,7 +117,7 @@ protected: std::set<Evoral::Parameter> _can_automate_list; - framepos_t _last_automation_snapshot; + samplepos_t _last_automation_snapshot; SlavableControlList slavables () const { return SlavableControlList(); } diff --git a/libs/ardour/ardour/automation_control.h b/libs/ardour/ardour/automation_control.h index e875ea98a6..8de0ec6ec0 100644 --- a/libs/ardour/ardour/automation_control.h +++ b/libs/ardour/ardour/automation_control.h @@ -106,7 +106,7 @@ public: actually_set_value (val, PBD::Controllable::NoGroup); } - virtual void automation_run (framepos_t start, pframes_t nframes); + virtual void automation_run (samplepos_t start, pframes_t nframes); double lower() const { return _desc.lower; } double upper() const { return _desc.upper; } diff --git a/libs/ardour/ardour/automation_list.h b/libs/ardour/ardour/automation_list.h index 4601740af1..d6de3decda 100644 --- a/libs/ardour/ardour/automation_list.h +++ b/libs/ardour/ardour/automation_list.h @@ -40,7 +40,7 @@ namespace ARDOUR { class AutomationList; -class DoubleBeatsFramesConverter; +class DoubleBeatsSamplesConverter; /** A SharedStatefulProperty for AutomationLists */ class LIBARDOUR_API AutomationListProperty : public PBD::SharedStatefulProperty<AutomationList> @@ -82,7 +82,7 @@ public: AutomationList& operator= (const AutomationList&); void thaw (); - bool paste (const ControlList&, double, DoubleBeatsFramesConverter const&); + bool paste (const ControlList&, double, DoubleBeatsSamplesConverter const&); void set_automation_state (AutoState); AutoState automation_state() const; diff --git a/libs/ardour/ardour/automation_watch.h b/libs/ardour/ardour/automation_watch.h index bd8263fc26..5c13184bc7 100644 --- a/libs/ardour/ardour/automation_watch.h +++ b/libs/ardour/ardour/automation_watch.h @@ -40,7 +40,7 @@ public: void add_automation_watch (boost::shared_ptr<ARDOUR::AutomationControl>); void remove_automation_watch (boost::shared_ptr<ARDOUR::AutomationControl>); - void transport_stop_automation_watches (ARDOUR::framepos_t); + void transport_stop_automation_watches (ARDOUR::samplepos_t); void set_session (ARDOUR::Session*); gint timer (); @@ -54,7 +54,7 @@ private: static AutomationWatch* _instance; Glib::Threads::Thread* _thread; - framepos_t _last_time; + samplepos_t _last_time; bool _run_thread; AutomationWatches automation_watches; AutomationConnection automation_connections; diff --git a/libs/ardour/ardour/beats_frames_converter.h b/libs/ardour/ardour/beats_samples_converter.h index 19275927a8..f9ca27f209 100644 --- a/libs/ardour/ardour/beats_frames_converter.h +++ b/libs/ardour/ardour/beats_samples_converter.h @@ -25,46 +25,46 @@ #include "ardour/libardour_visibility.h" #include "ardour/types.h" -#ifndef __ardour_beats_frames_converter_h__ -#define __ardour_beats_frames_converter_h__ +#ifndef __ardour_beats_samples_converter_h__ +#define __ardour_beats_samples_converter_h__ namespace ARDOUR { class TempoMap; -/** Converter between quarter-note beats and frames. Takes distances in quarter-note beats or frames - * from some origin (supplied to the constructor in frames), and converts +/** Converter between quarter-note beats and samples. Takes distances in quarter-note beats or samples + * from some origin (supplied to the constructor in samples), and converts * them to the opposite unit, taking tempo changes into account. */ -class LIBARDOUR_API BeatsFramesConverter - : public Evoral::TimeConverter<Evoral::Beats,framepos_t> { +class LIBARDOUR_API BeatsSamplesConverter + : public Evoral::TimeConverter<Evoral::Beats,samplepos_t> { public: - BeatsFramesConverter (const TempoMap& tempo_map, framepos_t origin) - : Evoral::TimeConverter<Evoral::Beats, framepos_t> (origin) + BeatsSamplesConverter (const TempoMap& tempo_map, samplepos_t origin) + : Evoral::TimeConverter<Evoral::Beats, samplepos_t> (origin) , _tempo_map(tempo_map) {} - framepos_t to (Evoral::Beats beats) const; - Evoral::Beats from (framepos_t frames) const; + samplepos_t to (Evoral::Beats beats) const; + Evoral::Beats from (samplepos_t samples) const; private: const TempoMap& _tempo_map; }; -/** Converter between quarter-note beats and frames. Takes distances in quarter-note beats or frames - * from some origin (supplied to the constructor in frames), and converts +/** Converter between quarter-note beats and samples. Takes distances in quarter-note beats or samples + * from some origin (supplied to the constructor in samples), and converts * them to the opposite unit, taking tempo changes into account. */ -class LIBARDOUR_API DoubleBeatsFramesConverter - : public Evoral::TimeConverter<double,framepos_t> { +class LIBARDOUR_API DoubleBeatsSamplesConverter + : public Evoral::TimeConverter<double,samplepos_t> { public: - DoubleBeatsFramesConverter (const TempoMap& tempo_map, framepos_t origin) - : Evoral::TimeConverter<double, framepos_t> (origin) + DoubleBeatsSamplesConverter (const TempoMap& tempo_map, samplepos_t origin) + : Evoral::TimeConverter<double, samplepos_t> (origin) , _tempo_map(tempo_map) {} - framepos_t to (double beats) const; - double from (framepos_t frames) const; + samplepos_t to (double beats) const; + double from (samplepos_t samples) const; private: const TempoMap& _tempo_map; @@ -72,4 +72,4 @@ private: } /* namespace ARDOUR */ -#endif /* __ardour_beats_frames_converter_h__ */ +#endif /* __ardour_beats_samples_converter_h__ */ diff --git a/libs/ardour/ardour/buffer.h b/libs/ardour/ardour/buffer.h index 7d6fa75620..349dfbd4b2 100644 --- a/libs/ardour/ardour/buffer.h +++ b/libs/ardour/ardour/buffer.h @@ -64,13 +64,13 @@ public: virtual void resize (size_t) = 0; /** Clear (eg zero, or empty) buffer */ - virtual void silence (framecnt_t len, framecnt_t offset = 0) = 0; + virtual void silence (samplecnt_t len, samplecnt_t offset = 0) = 0; /** Clear the entire buffer */ virtual void clear() { silence(_capacity, 0); } - virtual void read_from (const Buffer& src, framecnt_t len, frameoffset_t dst_offset = 0, frameoffset_t src_offset = 0) = 0; - virtual void merge_from (const Buffer& src, framecnt_t len, frameoffset_t dst_offset = 0, frameoffset_t src_offset = 0) = 0; + virtual void read_from (const Buffer& src, samplecnt_t len, sampleoffset_t dst_offset = 0, sampleoffset_t src_offset = 0) = 0; + virtual void merge_from (const Buffer& src, samplecnt_t len, sampleoffset_t dst_offset = 0, sampleoffset_t src_offset = 0) = 0; protected: Buffer(DataType type) diff --git a/libs/ardour/ardour/buffer_set.h b/libs/ardour/ardour/buffer_set.h index a4fa53e2fc..bd0c23d9e7 100644 --- a/libs/ardour/ardour/buffer_set.h +++ b/libs/ardour/ardour/buffer_set.h @@ -71,10 +71,10 @@ public: void clear(); void attach_buffers (PortSet& ports); - void get_backend_port_addresses (PortSet &, framecnt_t); + void get_backend_port_addresses (PortSet &, samplecnt_t); /* the capacity here is a size_t and has a different interpretation depending - on the DataType of the buffers. for audio, its a frame count. for MIDI + on the DataType of the buffers. for audio, its a sample count. for MIDI its a byte count. */ @@ -87,7 +87,7 @@ public: const ChanCount& count() const { return _count; } ChanCount& count() { return _count; } - void silence (framecnt_t nframes, framecnt_t offset); + void silence (samplecnt_t nframes, samplecnt_t offset); bool is_mirror() const { return _is_mirror; } void set_count(const ChanCount& count) { assert(count <= _available); _count = count; } @@ -134,9 +134,9 @@ public: VstEvents* get_vst_midi (size_t); #endif - void read_from(const BufferSet& in, framecnt_t nframes); - void read_from(const BufferSet& in, framecnt_t nframes, DataType); - void merge_from(const BufferSet& in, framecnt_t nframes); + void read_from(const BufferSet& in, samplecnt_t nframes); + void read_from(const BufferSet& in, samplecnt_t nframes, DataType); + void merge_from(const BufferSet& in, samplecnt_t nframes); template <typename BS, typename B> class iterator_base { @@ -196,7 +196,7 @@ private: ~VSTBuffer (); void clear (); - void push_back (Evoral::Event<framepos_t> const &); + void push_back (Evoral::Event<samplepos_t> const &); VstEvents* events () const { return _events; } diff --git a/libs/ardour/ardour/butler.h b/libs/ardour/ardour/butler.h index 3c254648ff..75a238af4f 100644 --- a/libs/ardour/ardour/butler.h +++ b/libs/ardour/ardour/butler.h @@ -59,8 +59,8 @@ class LIBARDOUR_API Butler : public SessionHandleRef void map_parameters (); - framecnt_t audio_diskstream_capture_buffer_size() const { return audio_dstream_capture_buffer_size; } - framecnt_t audio_diskstream_playback_buffer_size() const { return audio_dstream_playback_buffer_size; } + samplecnt_t audio_diskstream_capture_buffer_size() const { return audio_dstream_capture_buffer_size; } + samplecnt_t audio_diskstream_playback_buffer_size() const { return audio_dstream_playback_buffer_size; } uint32_t midi_diskstream_buffer_size() const { return midi_dstream_buffer_size; } bool flush_tracks_to_disk_after_locate (boost::shared_ptr<RouteList>, uint32_t& errors); @@ -82,8 +82,8 @@ class LIBARDOUR_API Butler : public SessionHandleRef Glib::Threads::Cond paused; bool should_run; mutable gint should_do_transport_work; - framecnt_t audio_dstream_capture_buffer_size; - framecnt_t audio_dstream_playback_buffer_size; + samplecnt_t audio_dstream_capture_buffer_size; + samplecnt_t audio_dstream_playback_buffer_size; uint32_t midi_dstream_buffer_size; PBD::RingBuffer<CrossThreadPool*> pool_trash; diff --git a/libs/ardour/ardour/caimportable.h b/libs/ardour/ardour/caimportable.h index 441008f521..23fc1782ed 100644 --- a/libs/ardour/ardour/caimportable.h +++ b/libs/ardour/ardour/caimportable.h @@ -38,12 +38,12 @@ class LIBARDOUR_API CAImportableSource : public ImportableSource { CAImportableSource (const std::string& path); virtual ~CAImportableSource(); - framecnt_t read (Sample* buffer, framecnt_t nframes); + samplecnt_t read (Sample* buffer, samplecnt_t nframes); uint32_t channels() const; - framecnt_t length() const; - framecnt_t samplerate() const; - void seek (framepos_t pos); - framepos_t natural_position() const { return 0; } + samplecnt_t length() const; + samplecnt_t samplerate() const; + void seek (samplepos_t pos); + samplepos_t natural_position() const { return 0; } bool clamped_at_unity () const { return false; } protected: diff --git a/libs/ardour/ardour/capturing_processor.h b/libs/ardour/ardour/capturing_processor.h index dccb7eb99e..fe548d7bbc 100644 --- a/libs/ardour/ardour/capturing_processor.h +++ b/libs/ardour/ardour/capturing_processor.h @@ -29,7 +29,7 @@ namespace ARDOUR { class LIBARDOUR_API CapturingProcessor : public Processor { public: - CapturingProcessor (Session & session, framecnt_t latency); + CapturingProcessor (Session & session, samplecnt_t latency); ~CapturingProcessor(); public: // main interface @@ -38,7 +38,7 @@ class LIBARDOUR_API CapturingProcessor : public Processor public: // Processor overrides bool display_to_user() const { return false; } int set_block_size (pframes_t nframes); - void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool result_required); + void run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool result_required); bool configure_io (ChanCount in, ChanCount out); bool can_support_io_configuration (const ChanCount& in, ChanCount& out); virtual XMLNode& state (bool); @@ -47,10 +47,10 @@ class LIBARDOUR_API CapturingProcessor : public Processor void realloc_buffers(); - framecnt_t block_size; + samplecnt_t block_size; BufferSet capture_buffers; FixedDelay _delaybuffers; - framecnt_t _latency; + samplecnt_t _latency; }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/click.h b/libs/ardour/ardour/click.h index 7fc6d21f73..498a18219d 100644 --- a/libs/ardour/ardour/click.h +++ b/libs/ardour/ardour/click.h @@ -31,12 +31,12 @@ namespace ARDOUR { class LIBARDOUR_API Click { public: - framepos_t start; - framecnt_t duration; - framecnt_t offset; + samplepos_t start; + samplecnt_t duration; + samplecnt_t offset; const Sample *data; - Click (framepos_t s, framecnt_t d, const Sample *b) : start (s), duration (d), offset (0), data (b) {} + Click (samplepos_t s, samplecnt_t d, const Sample *b) : start (s), duration (d), offset (0), data (b) {} void *operator new (size_t) { return pool.alloc (); diff --git a/libs/ardour/ardour/coreaudiosource.h b/libs/ardour/ardour/coreaudiosource.h index bb00776839..f61c6bb984 100644 --- a/libs/ardour/ardour/coreaudiosource.h +++ b/libs/ardour/ardour/coreaudiosource.h @@ -41,7 +41,7 @@ class LIBARDOUR_API CoreAudioSource : public AudioFileSource { void set_path (const std::string& p); float sample_rate() const; - int update_header (framepos_t when, struct tm&, time_t); + int update_header (samplepos_t when, struct tm&, time_t); uint32_t channel_count () const { return n_channels; } @@ -55,8 +55,8 @@ class LIBARDOUR_API CoreAudioSource : public AudioFileSource { protected: void close (); - framecnt_t read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) const; - framecnt_t write_unlocked (Sample *, framecnt_t) { return 0; } + samplecnt_t read_unlocked (Sample *dst, samplepos_t start, samplecnt_t cnt) const; + samplecnt_t write_unlocked (Sample *, samplecnt_t) { return 0; } private: #ifdef COREAUDIO105 @@ -67,7 +67,7 @@ class LIBARDOUR_API CoreAudioSource : public AudioFileSource { uint16_t n_channels; void init_cafile (); - int safe_read (Sample*, framepos_t start, framecnt_t cnt, AudioBufferList&) const; + int safe_read (Sample*, samplepos_t start, samplecnt_t cnt, AudioBufferList&) const; }; }; /* namespace ARDOUR */ diff --git a/libs/ardour/ardour/delayline.h b/libs/ardour/ardour/delayline.h index af025130d2..b760bd94f1 100644 --- a/libs/ardour/ardour/delayline.h +++ b/libs/ardour/ardour/delayline.h @@ -42,9 +42,9 @@ public: bool display_to_user() const { return false; } - void run (BufferSet&, framepos_t, framepos_t, double, pframes_t, bool); - void set_delay(framecnt_t signal_delay); - framecnt_t get_delay() { return _pending_delay; } + void run (BufferSet&, samplepos_t, samplepos_t, double, pframes_t, bool); + void set_delay(samplecnt_t signal_delay); + samplecnt_t get_delay() { return _pending_delay; } bool configure_io (ChanCount in, ChanCount out); bool can_support_io_configuration (const ChanCount& in, ChanCount& out); @@ -57,12 +57,12 @@ public: XMLNode& state (bool full); private: - void allocate_pending_buffers (framecnt_t); + void allocate_pending_buffers (samplecnt_t); friend class IO; - framecnt_t _delay, _pending_delay; - framecnt_t _bsiz, _pending_bsiz; - frameoffset_t _roff, _woff; + samplecnt_t _delay, _pending_delay; + samplecnt_t _bsiz, _pending_bsiz; + sampleoffset_t _roff, _woff; boost::shared_array<Sample> _buf; boost::shared_array<Sample> _pending_buf; boost::shared_ptr<MidiBuffer> _midi_buf; diff --git a/libs/ardour/ardour/delivery.h b/libs/ardour/ardour/delivery.h index 7084008949..ce5b050982 100644 --- a/libs/ardour/ardour/delivery.h +++ b/libs/ardour/ardour/delivery.h @@ -71,13 +71,13 @@ public: bool can_support_io_configuration (const ChanCount& in, ChanCount& out); bool configure_io (ChanCount in, ChanCount out); - void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool); + void run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool); /* supplemental method used with MIDI */ - void flush_buffers (framecnt_t nframes); + void flush_buffers (samplecnt_t nframes); void no_outs_cuz_we_no_monitor(bool); - void non_realtime_transport_stop (framepos_t now, bool flush); + void non_realtime_transport_stop (samplepos_t now, bool flush); void realtime_locate (); BufferSet& output_buffers() { return *_output_buffers; } diff --git a/libs/ardour/ardour/disk_io.h b/libs/ardour/ardour/disk_io.h index 7f9232b426..c839191331 100644 --- a/libs/ardour/ardour/disk_io.h +++ b/libs/ardour/ardour/disk_io.h @@ -79,7 +79,7 @@ class LIBARDOUR_API DiskIOProcessor : public Processor bool recordable() const { return _flags & Recordable; } bool non_layered() const { return _flags & NonLayered; } - virtual void non_realtime_locate (framepos_t); + virtual void non_realtime_locate (samplepos_t); void non_realtime_speed_change (); bool realtime_speed_change (); @@ -116,7 +116,7 @@ class LIBARDOUR_API DiskIOProcessor : public Processor protected: friend class Auditioner; - virtual int seek (framepos_t which_sample, bool complete_refill = false) = 0; + virtual int seek (samplepos_t which_sample, bool complete_refill = false) = 0; protected: Flag _flags; @@ -129,9 +129,9 @@ class LIBARDOUR_API DiskIOProcessor : public Processor bool _slaved; Location* loop_location; bool in_set_state; - framepos_t playback_sample; - framecnt_t wrap_buffer_size; - framecnt_t speed_buffer_size; + samplepos_t playback_sample; + samplecnt_t wrap_buffer_size; + samplecnt_t speed_buffer_size; bool _need_butler; boost::shared_ptr<Route> _route; @@ -140,10 +140,10 @@ class LIBARDOUR_API DiskIOProcessor : public Processor Glib::Threads::Mutex state_lock; static bool get_buffering_presets (BufferingPreset bp, - framecnt_t& read_chunk_size, - framecnt_t& read_buffer_size, - framecnt_t& write_chunk_size, - framecnt_t& write_buffer_size); + samplecnt_t& read_chunk_size, + samplecnt_t& read_buffer_size, + samplecnt_t& write_chunk_size, + samplecnt_t& write_buffer_size); enum TransitionType { CaptureStart = 0, @@ -152,7 +152,7 @@ class LIBARDOUR_API DiskIOProcessor : public Processor struct CaptureTransition { TransitionType type; - framepos_t capture_val; ///< The start or end file frame position + samplepos_t capture_val; ///< The start or end file sample position }; /** Information about one audio channel, playback or capture @@ -160,7 +160,7 @@ class LIBARDOUR_API DiskIOProcessor : public Processor */ struct ChannelInfo : public boost::noncopyable { - ChannelInfo (framecnt_t buffer_size); + ChannelInfo (samplecnt_t buffer_size); ~ChannelInfo (); /** A ringbuffer for data to be played back, written to in the @@ -178,9 +178,9 @@ class LIBARDOUR_API DiskIOProcessor : public Processor boost::shared_ptr<AudioFileSource> write_source; PBD::RingBufferNPT<CaptureTransition> * capture_transition_buf; // the following are used in the butler thread only - framecnt_t curr_capture_cnt; + samplecnt_t curr_capture_cnt; - void resize (framecnt_t); + void resize (samplecnt_t); }; typedef std::vector<ChannelInfo*> ChannelList; @@ -196,16 +196,16 @@ class LIBARDOUR_API DiskIOProcessor : public Processor virtual void playlist_changed (const PBD::PropertyChange&) {} virtual void playlist_deleted (boost::weak_ptr<Playlist>); - virtual void playlist_ranges_moved (std::list< Evoral::RangeMove<framepos_t> > const &, bool) {} + virtual void playlist_ranges_moved (std::list< Evoral::RangeMove<samplepos_t> > const &, bool) {} /* The MIDI stuff */ - MidiRingBuffer<framepos_t>* _midi_buf; - gint _frames_written_to_ringbuffer; - gint _frames_read_from_ringbuffer; + MidiRingBuffer<samplepos_t>* _midi_buf; + gint _samples_written_to_ringbuffer; + gint _samples_read_from_ringbuffer; CubicMidiInterpolation midi_interpolation; - static void get_location_times (const Location* location, framepos_t* start, framepos_t* end, framepos_t* length); + static void get_location_times (const Location* location, samplepos_t* start, samplepos_t* end, samplepos_t* length); }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/disk_reader.h b/libs/ardour/ardour/disk_reader.h index 023f55be87..8e124a27dd 100644 --- a/libs/ardour/ardour/disk_reader.h +++ b/libs/ardour/ardour/disk_reader.h @@ -42,18 +42,18 @@ class LIBARDOUR_API DiskReader : public DiskIOProcessor bool set_name (std::string const & str); std::string display_name() const { return std::string (_("player")); } - static framecnt_t chunk_frames() { return _chunk_frames; } - static framecnt_t default_chunk_frames (); - static void set_chunk_frames (framecnt_t n) { _chunk_frames = n; } + static samplecnt_t chunk_samples() { return _chunk_samples; } + static samplecnt_t default_chunk_samples (); + static void set_chunk_samples (samplecnt_t n) { _chunk_samples = n; } - void run (BufferSet& /*bufs*/, framepos_t /*start_frame*/, framepos_t /*end_frame*/, double speed, pframes_t /*nframes*/, bool /*result_required*/); + void run (BufferSet& /*bufs*/, samplepos_t /*start_sample*/, samplepos_t /*end_sample*/, double speed, pframes_t /*nframes*/, bool /*result_required*/); void realtime_handle_transport_stopped (); void realtime_locate (); int overwrite_existing_buffers (); void set_pending_overwrite (bool yn); - framecnt_t roll_delay() const { return _roll_delay; } - void set_roll_delay (framecnt_t); + samplecnt_t roll_delay() const { return _roll_delay; } + void set_roll_delay (samplecnt_t); virtual XMLNode& state (bool full); int set_state (const XMLNode&, int version); @@ -62,7 +62,7 @@ class LIBARDOUR_API DiskReader : public DiskIOProcessor float buffer_load() const; - void move_processor_automation (boost::weak_ptr<Processor>, std::list<Evoral::RangeMove<framepos_t> > const &); + void move_processor_automation (boost::weak_ptr<Processor>, std::list<Evoral::RangeMove<samplepos_t> > const &); /* called by the Butler in a non-realtime context */ @@ -88,16 +88,16 @@ class LIBARDOUR_API DiskReader : public DiskIOProcessor void adjust_buffering (); - int can_internal_playback_seek (framecnt_t distance); - int internal_playback_seek (framecnt_t distance); - int seek (framepos_t frame, bool complete_refill = false); + int can_internal_playback_seek (samplecnt_t distance); + int internal_playback_seek (samplecnt_t distance); + int seek (samplepos_t sample, bool complete_refill = false); static PBD::Signal0<void> Underrun; void playlist_modified (); void reset_tracker (); - static void set_midi_readahead_frames (framecnt_t frames_ahead) { midi_readahead = frames_ahead; } + static void set_midi_readahead_samples (samplecnt_t samples_ahead) { midi_readahead = samples_ahead; } static void set_no_disk_output (bool yn); static bool no_disk_output() { return _no_disk_output; } @@ -106,29 +106,29 @@ class LIBARDOUR_API DiskReader : public DiskIOProcessor friend class Track; friend class MidiTrack; - void resolve_tracker (Evoral::EventSink<framepos_t>& buffer, framepos_t time); + void resolve_tracker (Evoral::EventSink<samplepos_t>& buffer, samplepos_t time); boost::shared_ptr<MidiBuffer> get_gui_feed_buffer () const; void playlist_changed (const PBD::PropertyChange&); int use_playlist (DataType, boost::shared_ptr<Playlist>); - void playlist_ranges_moved (std::list< Evoral::RangeMove<framepos_t> > const &, bool); + void playlist_ranges_moved (std::list< Evoral::RangeMove<samplepos_t> > const &, bool); private: - /** The number of frames by which this diskstream's output should be delayed - with respect to the transport frame. This is used for latency compensation. + /** The number of samples by which this diskstream's output should be delayed + with respect to the transport sample. This is used for latency compensation. */ - framecnt_t _roll_delay; - framepos_t overwrite_frame; + samplecnt_t _roll_delay; + samplepos_t overwrite_sample; off_t overwrite_offset; bool _pending_overwrite; bool overwrite_queued; IOChange input_change_pending; - framepos_t file_frame[DataType::num_types]; + samplepos_t file_sample[DataType::num_types]; int _do_refill_with_alloc (bool partial_fill); - static framecnt_t _chunk_frames; - static framecnt_t midi_readahead; + static samplecnt_t _chunk_samples; + static samplecnt_t midi_readahead; static bool _no_disk_output; /* The MIDI stuff */ @@ -140,20 +140,20 @@ class LIBARDOUR_API DiskReader : public DiskIOProcessor mutable Glib::Threads::Mutex _gui_feed_buffer_mutex; int audio_read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer, - framepos_t& start, framecnt_t cnt, + samplepos_t& start, samplecnt_t cnt, int channel, bool reversed); - int midi_read (framepos_t& start, framecnt_t cnt, bool reversed); + int midi_read (samplepos_t& start, samplecnt_t cnt, bool reversed); static Sample* _mixdown_buffer; static gain_t* _gain_buffer; - int refill (Sample* mixdown_buffer, float* gain_buffer, framecnt_t fill_level); - int refill_audio (Sample *mixdown_buffer, float *gain_buffer, framecnt_t fill_level); + int refill (Sample* mixdown_buffer, float* gain_buffer, samplecnt_t fill_level); + int refill_audio (Sample *mixdown_buffer, float *gain_buffer, samplecnt_t fill_level); int refill_midi (); - frameoffset_t calculate_playback_distance (pframes_t); + sampleoffset_t calculate_playback_distance (pframes_t); - void get_midi_playback (MidiBuffer& dst, framecnt_t nframes, MonitorState, BufferSet&, double speed, framecnt_t distance); + void get_midi_playback (MidiBuffer& dst, samplecnt_t nframes, MonitorState, BufferSet&, double speed, samplecnt_t distance); }; } // namespace diff --git a/libs/ardour/ardour/disk_writer.h b/libs/ardour/ardour/disk_writer.h index 45fc37bdcf..d5446d0ab6 100644 --- a/libs/ardour/ardour/disk_writer.h +++ b/libs/ardour/ardour/disk_writer.h @@ -48,12 +48,12 @@ class LIBARDOUR_API DiskWriter : public DiskIOProcessor bool recordable() const { return _flags & Recordable; } - static framecnt_t chunk_frames() { return _chunk_frames; } - static framecnt_t default_chunk_frames (); - static void set_chunk_frames (framecnt_t n) { _chunk_frames = n; } + static samplecnt_t chunk_samples() { return _chunk_samples; } + static samplecnt_t default_chunk_samples (); + static void set_chunk_samples (samplecnt_t n) { _chunk_samples = n; } - void run (BufferSet& /*bufs*/, framepos_t /*start_frame*/, framepos_t /*end_frame*/, double speed, pframes_t /*nframes*/, bool /*result_required*/); - void non_realtime_locate (framepos_t); + void run (BufferSet& /*bufs*/, samplepos_t /*start_sample*/, samplepos_t /*end_sample*/, double speed, pframes_t /*nframes*/, bool /*result_required*/); + void non_realtime_locate (samplepos_t); void realtime_handle_transport_stopped (); virtual XMLNode& state (bool full); @@ -89,7 +89,7 @@ class LIBARDOUR_API DiskWriter : public DiskIOProcessor PBD::Signal0<void> AlignmentStyleChanged; - void set_input_latency (framecnt_t); + void set_input_latency (samplecnt_t); bool configure_io (ChanCount in, ChanCount out); @@ -105,21 +105,21 @@ class LIBARDOUR_API DiskWriter : public DiskIOProcessor int set_non_layered (bool yn); bool can_become_destructive (bool& requires_bounce) const; - /** @return Start position of currently-running capture (in session frames) */ - framepos_t current_capture_start() const { return capture_start_frame; } - framepos_t current_capture_end() const { return capture_start_frame + capture_captured; } - framepos_t get_capture_start_frame (uint32_t n = 0) const; - framecnt_t get_captured_frames (uint32_t n = 0) const; + /** @return Start position of currently-running capture (in session samples) */ + samplepos_t current_capture_start() const { return capture_start_sample; } + samplepos_t current_capture_end() const { return capture_start_sample + capture_captured; } + samplepos_t get_capture_start_sample (uint32_t n = 0) const; + samplecnt_t get_captured_samples (uint32_t n = 0) const; float buffer_load() const; virtual void request_input_monitoring (bool) {} virtual void ensure_input_monitoring (bool) {} - framecnt_t capture_offset() const { return _capture_offset; } + samplecnt_t capture_offset() const { return _capture_offset; } virtual void set_capture_offset (); - int seek (framepos_t frame, bool complete_refill); + int seek (samplepos_t sample, bool complete_refill); static PBD::Signal0<void> Overrun; @@ -134,9 +134,9 @@ class LIBARDOUR_API DiskWriter : public DiskIOProcessor PBD::Signal0<void> RecordEnableChanged; PBD::Signal0<void> RecordSafeChanged; - void check_record_status (framepos_t transport_frame, bool can_record); + void check_record_status (samplepos_t transport_sample, bool can_record); - void transport_looped (framepos_t transport_frame); + void transport_looped (samplepos_t transport_sample); void transport_stopped_wallclock (struct tm&, time_t, bool abort); void adjust_buffering (); @@ -146,11 +146,11 @@ class LIBARDOUR_API DiskWriter : public DiskIOProcessor int do_flush (RunContext context, bool force = false); void get_input_sources (); - void prepare_record_status (framepos_t /*capture_start_frame*/); + void prepare_record_status (samplepos_t /*capture_start_sample*/); void set_align_style_from_io(); void setup_destructive_playlist (); void use_destructive_playlist (); - void prepare_to_stop (framepos_t transport_pos, framepos_t audible_frame); + void prepare_to_stop (samplepos_t transport_pos, samplepos_t audible_sample); void engage_record_enable (); void disengage_record_enable (); @@ -161,8 +161,8 @@ class LIBARDOUR_API DiskWriter : public DiskIOProcessor bool prep_record_disable (); void calculate_record_range ( - Evoral::OverlapType ot, framepos_t transport_frame, framecnt_t nframes, - framecnt_t& rec_nframes, framecnt_t& rec_offset + Evoral::OverlapType ot, samplepos_t transport_sample, samplecnt_t nframes, + samplecnt_t& rec_nframes, samplecnt_t& rec_offset ); mutable Glib::Threads::Mutex capture_info_lock; @@ -171,13 +171,13 @@ class LIBARDOUR_API DiskWriter : public DiskIOProcessor private: gint _record_enabled; gint _record_safe; - framepos_t capture_start_frame; - framecnt_t capture_captured; + samplepos_t capture_start_sample; + samplecnt_t capture_captured; bool was_recording; - framecnt_t adjust_capture_position; - framecnt_t _capture_offset; - framepos_t first_recordable_frame; - framepos_t last_recordable_frame; + samplecnt_t adjust_capture_position; + samplecnt_t _capture_offset; + samplepos_t first_recordable_sample; + samplepos_t last_recordable_sample; int last_possibly_recording; AlignStyle _alignment_style; AlignChoice _alignment_choice; @@ -187,12 +187,12 @@ class LIBARDOUR_API DiskWriter : public DiskIOProcessor std::list<boost::shared_ptr<Source> > _last_capture_sources; std::vector<boost::shared_ptr<AudioFileSource> > capturing_sources; - static framecnt_t _chunk_frames; + static samplecnt_t _chunk_samples; NoteMode _note_mode; - volatile gint _frames_pending_write; + volatile gint _samples_pending_write; volatile gint _num_captured_loops; - framepos_t _accumulated_capture_offset; + samplepos_t _accumulated_capture_offset; /** A buffer that we use to put newly-arrived MIDI data in for the GUI to read (so that it can update itself). diff --git a/libs/ardour/ardour/dsp_filter.h b/libs/ardour/ardour/dsp_filter.h index b7be410950..f54eeac302 100644 --- a/libs/ardour/ardour/dsp_filter.h +++ b/libs/ardour/ardour/dsp_filter.h @@ -169,7 +169,7 @@ namespace ARDOUR { namespace DSP { void process_map (BufferSet* bufs, const ChanMapping& in, const ChanMapping& out, - pframes_t nframes, framecnt_t offset, + pframes_t nframes, samplecnt_t offset, const DataType&); /** 1st order Low Pass filter */ diff --git a/libs/ardour/ardour/element_importer.h b/libs/ardour/ardour/element_importer.h index b6d6ff7166..5e107a29f8 100644 --- a/libs/ardour/ardour/element_importer.h +++ b/libs/ardour/ardour/element_importer.h @@ -110,13 +110,13 @@ class LIBARDOUR_API ElementImporter std::string name; /// The sample rate of the session from which we are importing - framecnt_t sample_rate; + samplecnt_t sample_rate; /// Converts timecode time to a string std::string timecode_to_string (Timecode::Time & time) const; /// Converts samples so that times match the sessions sample rate - framecnt_t rate_convert_samples (framecnt_t samples) const; + samplecnt_t rate_convert_samples (samplecnt_t samples) const; /// Converts samples so that times match the sessions sample rate (for straight use in XML) std::string rate_convert_samples (std::string const & samples) const; diff --git a/libs/ardour/ardour/engine_state_controller.h b/libs/ardour/ardour/engine_state_controller.h index 7cf4e057dc..f485dbbe5e 100644 --- a/libs/ardour/ardour/engine_state_controller.h +++ b/libs/ardour/ardour/engine_state_controller.h @@ -146,13 +146,13 @@ class EngineStateController * * @return current sample rate */ - ARDOUR::framecnt_t get_current_sample_rate () const; + ARDOUR::samplecnt_t get_current_sample_rate () const; /** Get default sample rate for current backend. * * @return default sample rate for current backend */ - ARDOUR::framecnt_t get_default_sample_rate () const; + ARDOUR::samplecnt_t get_default_sample_rate () const; /** Get sample rates which are supported by current device and current backend. * @@ -369,7 +369,7 @@ class EngineStateController * @note Use push_state_to_backend() method to update backend/device state with the most recent controller state * @param sample_rate - new sample rate */ - bool set_new_sample_rate_in_controller(framecnt_t sample_rate); + bool set_new_sample_rate_in_controller(samplecnt_t sample_rate); /** Set new buffer size for current device in EngineStateController database * @note Use push_state_to_backend() method to update backend/device state with the most recent controller state * @param buffer_size - new buffer size @@ -470,7 +470,7 @@ class EngineStateController struct State { std::string backend_name; ///< state backend name std::string device_name; ///< state device name - ARDOUR::framecnt_t sample_rate; ///< sample rate used by the device in this state + ARDOUR::samplecnt_t sample_rate; ///< sample rate used by the device in this state ARDOUR::pframes_t buffer_size; ///< buffer size used by the device in this state PortStateList input_channel_states; ///< states of device Audio inputs @@ -609,7 +609,7 @@ class EngineStateController void _on_device_error(); /** Invoked when current device changes sample rate */ - void _on_sample_rate_change(ARDOUR::framecnt_t); + void _on_sample_rate_change(ARDOUR::samplecnt_t); /** Invoked when current device changes buffer size */ void _on_buffer_size_change(ARDOUR::pframes_t); diff --git a/libs/ardour/ardour/export_analysis.h b/libs/ardour/ardour/export_analysis.h index c911acf9f0..5930784ba2 100644 --- a/libs/ardour/ardour/export_analysis.h +++ b/libs/ardour/ardour/export_analysis.h @@ -83,7 +83,7 @@ namespace ARDOUR { PeakData peaks[2][800]; float spectrum[800][200]; - std::set<framecnt_t> truepeakpos[2]; // bins with >= -1dBTB + std::set<samplecnt_t> truepeakpos[2]; // bins with >= -1dBTB }; typedef boost::shared_ptr<ExportAnalysis> ExportAnalysisPtr; diff --git a/libs/ardour/ardour/export_channel.h b/libs/ardour/ardour/export_channel.h index 894406874e..a94d65fbdc 100644 --- a/libs/ardour/ardour/export_channel.h +++ b/libs/ardour/ardour/export_channel.h @@ -46,9 +46,9 @@ class LIBARDOUR_API ExportChannel : public boost::less_than_comparable<ExportCha virtual ~ExportChannel () {} - virtual void set_max_buffer_size(framecnt_t) { } + virtual void set_max_buffer_size(samplecnt_t) { } - virtual void read (Sample const *& data, framecnt_t frames) const = 0; + virtual void read (Sample const *& data, samplecnt_t samples) const = 0; virtual bool empty () const = 0; /// Adds state to node passed @@ -68,9 +68,9 @@ class LIBARDOUR_API PortExportChannel : public ExportChannel typedef std::set<boost::weak_ptr<AudioPort> > PortSet; PortExportChannel (); - void set_max_buffer_size(framecnt_t frames); + void set_max_buffer_size(samplecnt_t samples); - void read (Sample const *& data, framecnt_t frames) const; + void read (Sample const *& data, samplecnt_t samples) const; bool empty () const { return ports.empty(); } void get_state (XMLNode * node) const; @@ -84,7 +84,7 @@ class LIBARDOUR_API PortExportChannel : public ExportChannel private: PortSet ports; boost::scoped_array<Sample> buffer; - framecnt_t buffer_size; + samplecnt_t buffer_size; }; @@ -103,23 +103,23 @@ class LIBARDOUR_API RegionExportChannelFactory ~RegionExportChannelFactory (); ExportChannelPtr create (uint32_t channel); - void read (uint32_t channel, Sample const *& data, framecnt_t frames_to_read); + void read (uint32_t channel, Sample const *& data, samplecnt_t samples_to_read); private: - int new_cycle_started (framecnt_t) { buffers_up_to_date = false; return 0; } - void update_buffers (framecnt_t frames); + int new_cycle_started (samplecnt_t) { buffers_up_to_date = false; return 0; } + void update_buffers (samplecnt_t samples); AudioRegion const & region; AudioTrack & track; Type type; - framecnt_t frames_per_cycle; + samplecnt_t samples_per_cycle; size_t n_channels; BufferSet buffers; bool buffers_up_to_date; - framecnt_t region_start; - framecnt_t position; + samplecnt_t region_start; + samplecnt_t position; boost::scoped_array<Sample> mixdown_buffer; boost::scoped_array<Sample> gain_buffer; @@ -133,7 +133,7 @@ class LIBARDOUR_API RegionExportChannel : public ExportChannel friend class RegionExportChannelFactory; public: - void read (Sample const *& data, framecnt_t frames_to_read) const { factory.read (channel, data, frames_to_read); } + void read (Sample const *& data, samplecnt_t samples_to_read) const { factory.read (channel, data, samples_to_read); } void get_state (XMLNode * /*node*/) const {}; void set_state (XMLNode * /*node*/, Session & /*session*/) {}; bool empty () const { return false; } @@ -164,9 +164,9 @@ class LIBARDOUR_API RouteExportChannel : public ExportChannel static void create_from_route(std::list<ExportChannelPtr> & result, boost::shared_ptr<Route> route); public: // ExportChannel interface - void set_max_buffer_size(framecnt_t frames); + void set_max_buffer_size(samplecnt_t samples); - void read (Sample const *& data, framecnt_t frames) const; + void read (Sample const *& data, samplecnt_t samples) const; bool empty () const { return false; } void get_state (XMLNode * node) const; diff --git a/libs/ardour/ardour/export_format_base.h b/libs/ardour/ardour/export_format_base.h index 093913e294..ee2739eee1 100644 --- a/libs/ardour/ardour/export_format_base.h +++ b/libs/ardour/ardour/export_format_base.h @@ -166,7 +166,7 @@ class LIBARDOUR_API ExportFormatBase { void set_extension (std::string const & extension) { _extension = extension; } std::string const & extension () const { return _extension; } - static SampleRate nearest_sample_rate (framecnt_t sample_rate); + static SampleRate nearest_sample_rate (samplecnt_t sample_rate); protected: diff --git a/libs/ardour/ardour/export_format_specification.h b/libs/ardour/ardour/export_format_specification.h index d473d20234..4fdb16961a 100644 --- a/libs/ardour/ardour/export_format_specification.h +++ b/libs/ardour/ardour/export_format_specification.h @@ -48,7 +48,7 @@ class LIBARDOUR_API ExportFormatSpecification : public ExportFormatBase { Time (Session & session) : AnyTime (), session (session) {} Time & operator= (AnyTime const & other); - framecnt_t get_frames_at (framepos_t position, framecnt_t target_rate) const; + samplecnt_t get_samples_at (samplepos_t position, samplecnt_t target_rate) const; /* Serialization */ @@ -174,10 +174,10 @@ class LIBARDOUR_API ExportFormatSpecification : public ExportFormatBase { bool tag () const { return _tag && supports_tagging; } - framecnt_t silence_beginning_at (framepos_t position, framecnt_t samplerate) const - { return _silence_beginning.get_frames_at (position, samplerate); } - framecnt_t silence_end_at (framepos_t position, framecnt_t samplerate) const - { return _silence_end.get_frames_at (position, samplerate); } + samplecnt_t silence_beginning_at (samplepos_t position, samplecnt_t samplerate) const + { return _silence_beginning.get_samples_at (position, samplerate); } + samplecnt_t silence_end_at (samplepos_t position, samplecnt_t samplerate) const + { return _silence_end.get_samples_at (position, samplerate); } AnyTime silence_beginning_time () const { return _silence_beginning; } AnyTime silence_end_time () const { return _silence_end; } diff --git a/libs/ardour/ardour/export_graph_builder.h b/libs/ardour/ardour/export_graph_builder.h index c9671d729b..ebc3fdadfc 100644 --- a/libs/ardour/ardour/export_graph_builder.h +++ b/libs/ardour/ardour/export_graph_builder.h @@ -67,7 +67,7 @@ class LIBARDOUR_API ExportGraphBuilder ExportGraphBuilder (Session const & session); ~ExportGraphBuilder (); - int process (framecnt_t frames, bool last_cycle); + int process (samplecnt_t samples, bool last_cycle); bool post_process (); // returns true when finished bool need_postprocessing () const { return !intermediates.empty(); } bool realtime() const { return _realtime; } @@ -121,7 +121,7 @@ class LIBARDOUR_API ExportGraphBuilder class SFC { public: // This constructor so that this can be constructed like a Normalizer - SFC (ExportGraphBuilder &, FileSpec const & new_config, framecnt_t max_frames); + SFC (ExportGraphBuilder &, FileSpec const & new_config, samplecnt_t max_samples); FloatSinkPtr sink (); void add_child (FileSpec const & new_config); void remove_children (bool remove_out_files); @@ -149,7 +149,7 @@ class LIBARDOUR_API ExportGraphBuilder class Intermediate { public: - Intermediate (ExportGraphBuilder & parent, FileSpec const & new_config, framecnt_t max_frames); + Intermediate (ExportGraphBuilder & parent, FileSpec const & new_config, samplecnt_t max_samples); FloatSinkPtr sink (); void add_child (FileSpec const & new_config); void remove_children (bool remove_out_files); @@ -174,7 +174,7 @@ class LIBARDOUR_API ExportGraphBuilder ExportGraphBuilder & parent; FileSpec config; - framecnt_t max_frames_out; + samplecnt_t max_samples_out; bool use_loudness; bool use_peak; BufferPtr buffer; @@ -191,7 +191,7 @@ class LIBARDOUR_API ExportGraphBuilder // sample rate converter class SRC { public: - SRC (ExportGraphBuilder & parent, FileSpec const & new_config, framecnt_t max_frames); + SRC (ExportGraphBuilder & parent, FileSpec const & new_config, samplecnt_t max_samples); FloatSinkPtr sink (); void add_child (FileSpec const & new_config); void remove_children (bool remove_out_files); @@ -209,13 +209,13 @@ class LIBARDOUR_API ExportGraphBuilder boost::ptr_list<SFC> children; boost::ptr_list<Intermediate> intermediate_children; SRConverterPtr converter; - framecnt_t max_frames_out; + samplecnt_t max_samples_out; }; // Silence trimmer + adder class SilenceHandler { public: - SilenceHandler (ExportGraphBuilder & parent, FileSpec const & new_config, framecnt_t max_frames); + SilenceHandler (ExportGraphBuilder & parent, FileSpec const & new_config, samplecnt_t max_samples); FloatSinkPtr sink (); void add_child (FileSpec const & new_config); void remove_children (bool remove_out_files); @@ -228,7 +228,7 @@ class LIBARDOUR_API ExportGraphBuilder FileSpec config; boost::ptr_list<SRC> children; SilenceTrimmerPtr silence_trimmer; - framecnt_t max_frames_in; + samplecnt_t max_samples_in; }; // channel configuration @@ -248,7 +248,7 @@ class LIBARDOUR_API ExportGraphBuilder boost::ptr_list<SilenceHandler> children; InterleaverPtr interleaver; ChunkerPtr chunker; - framecnt_t max_frames_out; + samplecnt_t max_samples_out; }; Session const & session; @@ -261,7 +261,7 @@ class LIBARDOUR_API ExportGraphBuilder // The sources of all data, each channel is read only once ChannelMap channels; - framecnt_t process_buffer_frames; + samplecnt_t process_buffer_samples; std::list<Intermediate *> intermediates; diff --git a/libs/ardour/ardour/export_handler.h b/libs/ardour/ardour/export_handler.h index 5ed1c0be1c..352451c4a3 100644 --- a/libs/ardour/ardour/export_handler.h +++ b/libs/ardour/ardour/export_handler.h @@ -127,7 +127,7 @@ class LIBARDOUR_API ExportHandler : public ExportElementFactory, public sigc::tr private: void handle_duplicate_format_extensions(); - int process (framecnt_t frames); + int process (samplecnt_t samples); Session & session; boost::shared_ptr<ExportGraphBuilder> graph_builder; @@ -144,7 +144,7 @@ class LIBARDOUR_API ExportHandler : public ExportElementFactory, public sigc::tr /* Timespan management */ void start_timespan (); - int process_timespan (framecnt_t frames); + int process_timespan (samplecnt_t samples); int post_process (); void finish_timespan (); @@ -153,7 +153,7 @@ class LIBARDOUR_API ExportHandler : public ExportElementFactory, public sigc::tr TimespanBounds timespan_bounds; PBD::ScopedConnection process_connection; - framepos_t process_position; + samplepos_t process_position; /* CD Marker stuff */ @@ -168,7 +168,7 @@ class LIBARDOUR_API ExportHandler : public ExportElementFactory, public sigc::tr , track_number (1) , track_position (0) , track_duration (0) - , track_start_frame (0) + , track_start_sample (0) , index_number (1) , index_position (0) {} @@ -192,13 +192,13 @@ class LIBARDOUR_API ExportHandler : public ExportElementFactory, public sigc::tr /* Track info */ uint32_t track_number; - framepos_t track_position; - framepos_t track_duration; - framepos_t track_start_frame; + samplepos_t track_position; + samplepos_t track_duration; + samplepos_t track_start_sample; /* Index info */ uint32_t index_number; - framepos_t index_position; + samplepos_t index_position; }; @@ -217,8 +217,8 @@ class LIBARDOUR_API ExportHandler : public ExportElementFactory, public sigc::tr void write_index_info_toc (CDMarkerStatus & status); void write_index_info_mp4ch (CDMarkerStatus & status); - void frames_to_cd_frames_string (char* buf, framepos_t when); - void frames_to_chapter_marks_string (char* buf, framepos_t when); + void samples_to_cd_samples_string (char* buf, samplepos_t when); + void samples_to_chapter_marks_string (char* buf, samplepos_t when); std::string toc_escape_cdtext (const std::string&); std::string toc_escape_filename (const std::string&); diff --git a/libs/ardour/ardour/export_profile_manager.h b/libs/ardour/ardour/export_profile_manager.h index b0285f8ecc..4f477f65b9 100644 --- a/libs/ardour/ardour/export_profile_manager.h +++ b/libs/ardour/ardour/export_profile_manager.h @@ -118,7 +118,7 @@ class LIBARDOUR_API ExportProfileManager Timecode, BBT, MinSec, - Frames, + Samples, }; struct TimespanState { @@ -140,8 +140,8 @@ class LIBARDOUR_API ExportProfileManager typedef boost::shared_ptr<TimespanState> TimespanStatePtr; typedef std::list<TimespanStatePtr> TimespanStateList; - void set_selection_range (framepos_t start = 0, framepos_t end = 0); - std::string set_single_range (framepos_t start, framepos_t end, std::string name); + void set_selection_range (samplepos_t start = 0, samplepos_t end = 0); + std::string set_single_range (samplepos_t start, samplepos_t end, std::string name); TimespanStateList const & get_timespans () { return check_list (timespans); } private: diff --git a/libs/ardour/ardour/export_status.h b/libs/ardour/ardour/export_status.h index 99642a2d7c..90e6c1b56a 100644 --- a/libs/ardour/ardour/export_status.h +++ b/libs/ardour/ardour/export_status.h @@ -72,11 +72,11 @@ class LIBARDOUR_API ExportStatus { volatile uint32_t timespan; std::string timespan_name; - volatile framecnt_t total_frames; - volatile framecnt_t processed_frames; + volatile samplecnt_t total_samples; + volatile samplecnt_t processed_samples; - volatile framecnt_t total_frames_current_timespan; - volatile framecnt_t processed_frames_current_timespan; + volatile samplecnt_t total_samples_current_timespan; + volatile samplecnt_t processed_samples_current_timespan; volatile uint32_t total_postprocessing_cycles; volatile uint32_t current_postprocessing_cycle; diff --git a/libs/ardour/ardour/export_timespan.h b/libs/ardour/ardour/export_timespan.h index d4631cbccc..4999d893b0 100644 --- a/libs/ardour/ardour/export_timespan.h +++ b/libs/ardour/ardour/export_timespan.h @@ -42,7 +42,7 @@ class LIBARDOUR_API ExportTimespan private: friend class ExportElementFactory; - ExportTimespan (ExportStatusPtr status, framecnt_t frame_rate); + ExportTimespan (ExportStatusPtr status, samplecnt_t sample_rate); public: ~ExportTimespan (); @@ -56,26 +56,26 @@ class LIBARDOUR_API ExportTimespan bool realtime () const { return _realtime; } void set_realtime (bool rt) { _realtime = rt; } - void set_range (framepos_t start, framepos_t end); - framecnt_t get_length () const { return end_frame - start_frame; } - framepos_t get_start () const { return start_frame; } - framepos_t get_end () const { return end_frame; } + void set_range (samplepos_t start, samplepos_t end); + samplecnt_t get_length () const { return end_sample - start_sample; } + samplepos_t get_start () const { return start_sample; } + samplepos_t get_end () const { return end_sample; } /// Primarily compare start time, then end time bool operator< (ExportTimespan const & other) { - if (start_frame < other.start_frame) { return true; } - if (start_frame > other.start_frame) { return false; } - return end_frame < other.end_frame; + if (start_sample < other.start_sample) { return true; } + if (start_sample > other.start_sample) { return false; } + return end_sample < other.end_sample; } private: ExportStatusPtr status; - framepos_t start_frame; - framepos_t end_frame; - framepos_t position; - framecnt_t frame_rate; + samplepos_t start_sample; + samplepos_t end_sample; + samplepos_t position; + samplecnt_t sample_rate; std::string _name; std::string _range_id; diff --git a/libs/ardour/ardour/fixed_delay.h b/libs/ardour/ardour/fixed_delay.h index 21eaa6567e..d73d7e4b63 100644 --- a/libs/ardour/ardour/fixed_delay.h +++ b/libs/ardour/ardour/fixed_delay.h @@ -53,7 +53,7 @@ public: * @param max_delay the maximum number of samples to delay * @param shrink when false already allocated buffers are kept if both channel-count and max-delay requirements are satisified */ - void configure (const ChanCount& count, framecnt_t max_delay, bool shrink = true); + void configure (const ChanCount& count, samplecnt_t max_delay, bool shrink = true); /** set delay time and update active process buffers * @@ -63,7 +63,7 @@ public: * @param count channels to be processed * @param delay number of audio samples to delay */ - void set (const ChanCount& count, framecnt_t delay); + void set (const ChanCount& count, samplecnt_t delay); /** process a channel * @@ -78,15 +78,15 @@ public: * @param dst_offset offset in output buffer to start writing to * @param src_offset offset in input buffer to start reading from */ - void delay (ARDOUR::DataType dt, uint32_t id, Buffer& out, const Buffer& in, pframes_t n_samples, framecnt_t dst_offset = 0, framecnt_t src_offset = 0); + void delay (ARDOUR::DataType dt, uint32_t id, Buffer& out, const Buffer& in, pframes_t n_samples, samplecnt_t dst_offset = 0, samplecnt_t src_offset = 0); /** zero all buffers */ void flush(); private: - framecnt_t _max_delay; - framecnt_t _buf_size; - framecnt_t _delay; + samplecnt_t _max_delay; + samplecnt_t _buf_size; + samplecnt_t _delay; ChanCount _count; struct DelayBuffer { @@ -96,7 +96,7 @@ private: : buf (Buffer::create (dt, capacity)), pos (0) {} ~DelayBuffer () { delete buf; } Buffer * buf; - framepos_t pos; + samplepos_t pos; }; typedef std::vector<DelayBuffer*> BufferVec; diff --git a/libs/ardour/ardour/gain_control.h b/libs/ardour/ardour/gain_control.h index 7fe5cc7bab..a2644582ce 100644 --- a/libs/ardour/ardour/gain_control.h +++ b/libs/ardour/ardour/gain_control.h @@ -43,7 +43,7 @@ class LIBARDOUR_API GainControl : public SlavableAutomationControl { protected: void post_add_master (boost::shared_ptr<AutomationControl>); - bool get_masters_curve_locked (framepos_t, framepos_t, float*, framecnt_t) const; + bool get_masters_curve_locked (samplepos_t, samplepos_t, float*, samplecnt_t) const; }; } /* namespace */ diff --git a/libs/ardour/ardour/graph.h b/libs/ardour/ardour/graph.h index ce915a6ce4..0dc8e164c4 100644 --- a/libs/ardour/ardour/graph.h +++ b/libs/ardour/ardour/graph.h @@ -65,10 +65,10 @@ public: void helper_thread(); - int process_routes (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, + int process_routes (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, int declick, bool& need_butler); - int routes_no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, + int routes_no_roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, bool non_rt_pending, int declick); void process_one_route (Route * route); @@ -121,8 +121,8 @@ private: // parameter caches. pframes_t _process_nframes; - framepos_t _process_start_frame; - framepos_t _process_end_frame; + samplepos_t _process_start_sample; + samplepos_t _process_end_sample; bool _process_can_record; bool _process_non_rt_pending; int _process_declick; diff --git a/libs/ardour/ardour/importable_source.h b/libs/ardour/ardour/importable_source.h index 9463f0b28b..0ca98b401e 100644 --- a/libs/ardour/ardour/importable_source.h +++ b/libs/ardour/ardour/importable_source.h @@ -31,13 +31,13 @@ public: ImportableSource () {} virtual ~ImportableSource() {} - virtual framecnt_t read (Sample* buffer, framecnt_t nframes) = 0; + virtual samplecnt_t read (Sample* buffer, samplecnt_t nframes) = 0; virtual float ratio() const { return 1.0f; } virtual uint32_t channels() const = 0; - virtual framecnt_t length() const = 0; - virtual framecnt_t samplerate() const = 0; - virtual void seek (framepos_t pos) = 0; - virtual framepos_t natural_position() const = 0; + virtual samplecnt_t length() const = 0; + virtual samplecnt_t samplerate() const = 0; + virtual void seek (samplepos_t pos) = 0; + virtual samplepos_t natural_position() const = 0; virtual bool clamped_at_unity () const = 0; }; diff --git a/libs/ardour/ardour/internal_return.h b/libs/ardour/ardour/internal_return.h index 48fcab151e..d2c55b1763 100644 --- a/libs/ardour/ardour/internal_return.h +++ b/libs/ardour/ardour/internal_return.h @@ -37,7 +37,7 @@ class LIBARDOUR_API InternalReturn : public Return XMLNode& state (bool full); XMLNode& get_state (); - void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool); + void run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool); bool configure_io (ChanCount, ChanCount); bool can_support_io_configuration (const ChanCount& in, ChanCount& out); diff --git a/libs/ardour/ardour/internal_send.h b/libs/ardour/ardour/internal_send.h index 8a85fc0f68..c46236c559 100644 --- a/libs/ardour/ardour/internal_send.h +++ b/libs/ardour/ardour/internal_send.h @@ -40,7 +40,7 @@ class LIBARDOUR_API InternalSend : public Send int set_state(const XMLNode& node, int version); void cycle_start (pframes_t); - void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool); + void run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool); bool feeds (boost::shared_ptr<Route> other) const; bool can_support_io_configuration (const ChanCount& in, ChanCount& out); bool configure_io (ChanCount in, ChanCount out); diff --git a/libs/ardour/ardour/interpolation.h b/libs/ardour/ardour/interpolation.h index 3c661d8592..4b6a66d54b 100644 --- a/libs/ardour/ardour/interpolation.h +++ b/libs/ardour/ardour/interpolation.h @@ -60,19 +60,19 @@ public: class LIBARDOUR_API LinearInterpolation : public Interpolation { public: - framecnt_t interpolate (int channel, framecnt_t nframes, Sample* input, Sample* output); + samplecnt_t interpolate (int channel, samplecnt_t nframes, Sample* input, Sample* output); }; class LIBARDOUR_API CubicInterpolation : public Interpolation { public: - framecnt_t interpolate (int channel, framecnt_t nframes, Sample* input, Sample* output); + samplecnt_t interpolate (int channel, samplecnt_t nframes, Sample* input, Sample* output); }; class BufferSet; class LIBARDOUR_API CubicMidiInterpolation : public Interpolation { public: - framecnt_t distance (framecnt_t nframes, bool roll = true); + samplecnt_t distance (samplecnt_t nframes, bool roll = true); }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h index 571737e5a9..6f62e4ca74 100644 --- a/libs/ardour/ardour/io.h +++ b/libs/ardour/ardour/io.h @@ -92,7 +92,7 @@ class LIBARDOUR_API IO : public SessionObject, public Latent void set_pretty_name (const std::string& str); std::string pretty_name () const { return _pretty_name_prefix; } - virtual void silence (framecnt_t); + virtual void silence (samplecnt_t); void increment_port_buffer_offset (pframes_t offset); int ensure_io (ChanCount cnt, bool clear, void *src); @@ -115,8 +115,8 @@ class LIBARDOUR_API IO : public SessionObject, public Latent bool connected () const; bool physically_connected () const; - framecnt_t signal_latency () const { return 0; } - framecnt_t latency () const; + samplecnt_t signal_latency () const { return 0; } + samplecnt_t latency () const; PortSet& ports() { return _ports; } const PortSet& ports() const { return _ports; } @@ -196,8 +196,8 @@ class LIBARDOUR_API IO : public SessionObject, public Latent /* three utility functions - this just seems to be simplest place to put them */ void collect_input (BufferSet& bufs, pframes_t nframes, ChanCount offset); - void process_input (boost::shared_ptr<Processor>, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes); - void copy_to_outputs (BufferSet& bufs, DataType type, pframes_t nframes, framecnt_t offset); + void process_input (boost::shared_ptr<Processor>, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes); + void copy_to_outputs (BufferSet& bufs, DataType type, pframes_t nframes, samplecnt_t offset); /* AudioTrack::deprecated_use_diskstream_connections() needs these */ diff --git a/libs/ardour/ardour/io_processor.h b/libs/ardour/ardour/io_processor.h index 15bd74d122..f17c338155 100644 --- a/libs/ardour/ardour/io_processor.h +++ b/libs/ardour/ardour/io_processor.h @@ -64,7 +64,7 @@ class LIBARDOUR_API IOProcessor : public Processor void set_input (boost::shared_ptr<IO>); void set_output (boost::shared_ptr<IO>); - void silence (framecnt_t nframes, framepos_t start_frame); + void silence (samplecnt_t nframes, samplepos_t start_sample); void disconnect (); void increment_port_buffer_offset (pframes_t); diff --git a/libs/ardour/ardour/ladspa_plugin.h b/libs/ardour/ardour/ladspa_plugin.h index dbb635fd91..0dca9bd5a6 100644 --- a/libs/ardour/ardour/ladspa_plugin.h +++ b/libs/ardour/ardour/ladspa_plugin.h @@ -38,7 +38,7 @@ class Session; class LIBARDOUR_API LadspaPlugin : public ARDOUR::Plugin { public: - LadspaPlugin (std::string module_path, ARDOUR::AudioEngine&, ARDOUR::Session&, uint32_t index, framecnt_t sample_rate); + LadspaPlugin (std::string module_path, ARDOUR::AudioEngine&, ARDOUR::Session&, uint32_t index, samplecnt_t sample_rate); LadspaPlugin (const LadspaPlugin &); ~LadspaPlugin (); @@ -50,7 +50,7 @@ class LIBARDOUR_API LadspaPlugin : public ARDOUR::Plugin const char* maker() const { return _descriptor->Maker; } uint32_t parameter_count() const { return _descriptor->PortCount; } float default_value (uint32_t port) { return _default_value (port); } - framecnt_t signal_latency() const; + samplecnt_t signal_latency() const; void set_parameter (uint32_t port, float val); float get_parameter (uint32_t port) const; int get_parameter_descriptor (uint32_t which, ParameterDescriptor&) const; @@ -83,9 +83,9 @@ class LIBARDOUR_API LadspaPlugin : public ARDOUR::Plugin int set_block_size (pframes_t /*nframes*/) { return 0; } int connect_and_run (BufferSet& bufs, - framepos_t start, framepos_t end, double speed, + samplepos_t start, samplepos_t end, double speed, ChanMapping in, ChanMapping out, - pframes_t nframes, framecnt_t offset); + pframes_t nframes, samplecnt_t offset); std::string describe_parameter (Evoral::Parameter); std::string state_node_name() const { return "ladspa"; } @@ -125,7 +125,7 @@ class LIBARDOUR_API LadspaPlugin : public ARDOUR::Plugin Glib::Module* _module; const LADSPA_Descriptor* _descriptor; LADSPA_Handle _handle; - framecnt_t _sample_rate; + samplecnt_t _sample_rate; LADSPA_Data* _control_data; LADSPA_Data* _shadow_data; LADSPA_Data* _latency_control_port; @@ -134,7 +134,7 @@ class LIBARDOUR_API LadspaPlugin : public ARDOUR::Plugin void find_presets (); - void init (std::string module_path, uint32_t index, framecnt_t rate); + void init (std::string module_path, uint32_t index, samplecnt_t rate); void run_in_place (pframes_t nsamples); void latency_compute_run (); int set_state_2X (const XMLNode&, int version); diff --git a/libs/ardour/ardour/latent.h b/libs/ardour/ardour/latent.h index bd639a8651..c4464f7ba4 100644 --- a/libs/ardour/ardour/latent.h +++ b/libs/ardour/ardour/latent.h @@ -30,10 +30,10 @@ class LIBARDOUR_API Latent { Latent() : _user_latency (0) {} virtual ~Latent() {} - virtual framecnt_t signal_latency() const = 0; - framecnt_t user_latency () const { return _user_latency; } + virtual samplecnt_t signal_latency() const = 0; + samplecnt_t user_latency () const { return _user_latency; } - framecnt_t effective_latency() const { + samplecnt_t effective_latency() const { if (_user_latency) { return _user_latency; } else { @@ -41,10 +41,10 @@ class LIBARDOUR_API Latent { } } - virtual void set_user_latency (framecnt_t val) { _user_latency = val; } + virtual void set_user_latency (samplecnt_t val) { _user_latency = val; } protected: - framecnt_t _user_latency; + samplecnt_t _user_latency; }; } diff --git a/libs/ardour/ardour/location.h b/libs/ardour/ardour/location.h index 24ee563915..7015047b77 100644 --- a/libs/ardour/ardour/location.h +++ b/libs/ardour/ardour/location.h @@ -58,7 +58,7 @@ class LIBARDOUR_API Location : public SessionHandleRef, public PBD::StatefulDest }; Location (Session &); - Location (Session &, framepos_t, framepos_t, const std::string &, Flags bits = Flags(0), const uint32_t sub_num = 0); + Location (Session &, samplepos_t, samplepos_t, const std::string &, Flags bits = Flags(0), const uint32_t sub_num = 0); Location (const Location& other); Location (Session &, const XMLNode&); Location* operator= (const Location& other); @@ -69,15 +69,15 @@ class LIBARDOUR_API Location : public SessionHandleRef, public PBD::StatefulDest void lock (); void unlock (); - framepos_t start() const { return _start; } - framepos_t end() const { return _end; } - framecnt_t length() const { return _end - _start; } + samplepos_t start() const { return _start; } + samplepos_t end() const { return _end; } + samplecnt_t length() const { return _end - _start; } - int set_start (framepos_t s, bool force = false, bool allow_beat_recompute = true, const uint32_t sub_num = 0); - int set_end (framepos_t e, bool force = false, bool allow_beat_recompute = true, const uint32_t sub_num = 0); - int set (framepos_t start, framepos_t end, bool allow_beat_recompute = true, const uint32_t sub_num = 0); + int set_start (samplepos_t s, bool force = false, bool allow_beat_recompute = true, const uint32_t sub_num = 0); + int set_end (samplepos_t e, bool force = false, bool allow_beat_recompute = true, const uint32_t sub_num = 0); + int set (samplepos_t start, samplepos_t end, bool allow_beat_recompute = true, const uint32_t sub_num = 0); - int move_to (framepos_t pos, const uint32_t sub_num); + int move_to (samplepos_t pos, const uint32_t sub_num); const std::string& name() const { return _name; } void set_name (const std::string &str); @@ -143,16 +143,16 @@ class LIBARDOUR_API Location : public SessionHandleRef, public PBD::StatefulDest PositionLockStyle position_lock_style() const { return _position_lock_style; } void set_position_lock_style (PositionLockStyle ps); - void recompute_frames_from_beat (); + void recompute_samples_from_beat (); static PBD::Signal0<void> scene_changed; /* for use by backend scene change management, class level */ PBD::Signal0<void> SceneChangeChanged; /* for use by objects interested in this object */ private: std::string _name; - framepos_t _start; + samplepos_t _start; double _start_beat; - framepos_t _end; + samplepos_t _end; double _end_beat; Flags _flags; bool _locked; @@ -161,7 +161,7 @@ class LIBARDOUR_API Location : public SessionHandleRef, public PBD::StatefulDest void set_mark (bool yn); bool set_flag_internal (bool yn, Flags flag); - void recompute_beat_from_frames (const uint32_t sub_num); + void recompute_beat_from_samples (const uint32_t sub_num); }; /** A collection of session locations including unique dedicated locations (loop, punch, etc) */ @@ -196,14 +196,14 @@ class LIBARDOUR_API Locations : public SessionHandleRef, public PBD::StatefulDes int set_current (Location *, bool want_lock = true); Location *current () const { return current_location; } - Location* mark_at (framepos_t, framecnt_t slop = 0) const; + Location* mark_at (samplepos_t, samplecnt_t slop = 0) const; - framepos_t first_mark_before (framepos_t, bool include_special_ranges = false); - framepos_t first_mark_after (framepos_t, bool include_special_ranges = false); + samplepos_t first_mark_before (samplepos_t, bool include_special_ranges = false); + samplepos_t first_mark_after (samplepos_t, bool include_special_ranges = false); - void marks_either_side (framepos_t const, framepos_t &, framepos_t &) const; + void marks_either_side (samplepos_t const, samplepos_t &, samplepos_t &) const; - void find_all_between (framepos_t start, framepos_t, LocationList&, Location::Flags); + void find_all_between (samplepos_t start, samplepos_t, LocationList&, Location::Flags); PBD::Signal1<void,Location*> current_changed; diff --git a/libs/ardour/ardour/ltc_file_reader.h b/libs/ardour/ardour/ltc_file_reader.h index 92ea07f87f..6ced83951e 100644 --- a/libs/ardour/ardour/ltc_file_reader.h +++ b/libs/ardour/ardour/ltc_file_reader.h @@ -63,7 +63,7 @@ private: LTCDecoder* decoder; float* _interleaved_audio_buffer; uint32_t _frames_decoded; - framecnt_t _samples_read; + samplecnt_t _samples_read; }; diff --git a/libs/ardour/ardour/lua_api.h b/libs/ardour/ardour/lua_api.h index bd71576e7c..797577df00 100644 --- a/libs/ardour/ardour/lua_api.h +++ b/libs/ardour/ardour/lua_api.h @@ -292,8 +292,8 @@ namespace ARDOUR { namespace LuaAPI { private: ::Vamp::Plugin* _plugin; float _sample_rate; - framecnt_t _bufsize; - framecnt_t _stepsize; + samplecnt_t _bufsize; + samplecnt_t _stepsize; bool _initialized; }; diff --git a/libs/ardour/ardour/luaproc.h b/libs/ardour/ardour/luaproc.h index 2c4f798945..6404944fbb 100644 --- a/libs/ardour/ardour/luaproc.h +++ b/libs/ardour/ardour/luaproc.h @@ -85,12 +85,12 @@ public: void cleanup () { } int set_block_size (pframes_t /*nframes*/) { return 0; } - framecnt_t signal_latency() const { return 0; } + samplecnt_t signal_latency() const { return 0; } int connect_and_run (BufferSet& bufs, - framepos_t start, framepos_t end, double speed, + samplepos_t start, samplepos_t end, double speed, ChanMapping in, ChanMapping out, - pframes_t nframes, framecnt_t offset); + pframes_t nframes, samplecnt_t offset); std::string describe_parameter (Evoral::Parameter); void print_parameter (uint32_t, char*, uint32_t len) const; diff --git a/libs/ardour/ardour/lv2_plugin.h b/libs/ardour/ardour/lv2_plugin.h index ee4a17d9a9..9e432c1180 100644 --- a/libs/ardour/ardour/lv2_plugin.h +++ b/libs/ardour/ardour/lv2_plugin.h @@ -59,7 +59,7 @@ class LIBARDOUR_API LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee LV2Plugin (ARDOUR::AudioEngine& engine, ARDOUR::Session& session, const void* c_plugin, - framecnt_t sample_rate); + samplecnt_t sample_rate); LV2Plugin (const LV2Plugin &); ~LV2Plugin (); @@ -74,8 +74,8 @@ class LIBARDOUR_API LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee uint32_t num_ports () const; uint32_t parameter_count () const; float default_value (uint32_t port); - framecnt_t max_latency () const; - framecnt_t signal_latency () const; + samplecnt_t max_latency () const; + samplecnt_t signal_latency () const; void set_parameter (uint32_t port, float val); float get_parameter (uint32_t port) const; std::string get_docs() const; @@ -112,9 +112,9 @@ class LIBARDOUR_API LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee bool requires_fixed_sized_buffers () const; int connect_and_run (BufferSet& bufs, - framepos_t start, framepos_t end, double speed, + samplepos_t start, samplepos_t end, double speed, ChanMapping in, ChanMapping out, - pframes_t nframes, framecnt_t offset); + pframes_t nframes, samplecnt_t offset); std::string describe_parameter (Evoral::Parameter); std::string state_node_name () const { return "lv2"; } @@ -181,7 +181,7 @@ class LIBARDOUR_API LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee LV2_Feature** _features; Worker* _worker; Worker* _state_worker; - framecnt_t _sample_rate; + samplecnt_t _sample_rate; float* _control_data; float* _shadow_data; float* _defaults; @@ -190,8 +190,8 @@ class LIBARDOUR_API LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee float* _bpm_control_port; ///< Special input set by ardour float* _freewheel_control_port; ///< Special input set by ardour float* _latency_control_port; ///< Special output set by ardour - framepos_t _next_cycle_start; ///< Expected start frame of next run cycle - double _next_cycle_speed; ///< Expected start frame of next run cycle + samplepos_t _next_cycle_start; ///< Expected start sample of next run cycle + double _next_cycle_speed; ///< Expected start sample of next run cycle double _next_cycle_beat; ///< Expected bar_beat of next run cycle double _current_bpm; PBD::ID _insert_id; @@ -201,8 +201,8 @@ class LIBARDOUR_API LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee URIMap& _uri_map; bool _no_sample_accurate_ctrl; bool _can_write_automation; - framecnt_t _max_latency; - framecnt_t _current_latency; + samplecnt_t _max_latency; + samplecnt_t _current_latency; friend const void* lv2plugin_get_port_value(const char* port_symbol, void* user_data, @@ -330,7 +330,7 @@ class LIBARDOUR_API LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee static char* lv2_state_make_path (void* host_data, const char* path); - void init (const void* c_plugin, framecnt_t rate); + void init (const void* c_plugin, samplecnt_t rate); void allocate_atom_event_buffers (); void run (pframes_t nsamples, bool sync_work = false); diff --git a/libs/ardour/ardour/meter.h b/libs/ardour/ardour/meter.h index ddc1e5e48f..52ca751932 100644 --- a/libs/ardour/ardour/meter.h +++ b/libs/ardour/ardour/meter.h @@ -64,7 +64,7 @@ public: void emit_configuration_changed (); /** Compute peaks */ - void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool); + void run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool); void activate () { } void deactivate () { } diff --git a/libs/ardour/ardour/midi_buffer.h b/libs/ardour/ardour/midi_buffer.h index cc48e28d61..509b60f12d 100644 --- a/libs/ardour/ardour/midi_buffer.h +++ b/libs/ardour/ardour/midi_buffer.h @@ -33,17 +33,17 @@ namespace ARDOUR { /** Buffer containing 8-bit unsigned char (MIDI) data. */ -class LIBARDOUR_API MidiBuffer : public Buffer, public Evoral::EventSink<framepos_t> +class LIBARDOUR_API MidiBuffer : public Buffer, public Evoral::EventSink<samplepos_t> { public: - typedef framepos_t TimeType; + typedef samplepos_t TimeType; MidiBuffer(size_t capacity); ~MidiBuffer(); - void silence (framecnt_t nframes, framecnt_t offset = 0); - void read_from (const Buffer& src, framecnt_t nframes, frameoffset_t dst_offset = 0, frameoffset_t src_offset = 0); - void merge_from (const Buffer& src, framecnt_t nframes, frameoffset_t dst_offset = 0, frameoffset_t src_offset = 0); + void silence (samplecnt_t nframes, samplecnt_t offset = 0); + void read_from (const Buffer& src, samplecnt_t nframes, sampleoffset_t dst_offset = 0, sampleoffset_t src_offset = 0); + void merge_from (const Buffer& src, samplecnt_t nframes, sampleoffset_t dst_offset = 0, sampleoffset_t src_offset = 0); void copy(const MidiBuffer& copy); void copy(MidiBuffer const * const); @@ -67,7 +67,7 @@ public: class iterator_base { public: - iterator_base<BufferType, EventType>(BufferType& b, framecnt_t o) + iterator_base<BufferType, EventType>(BufferType& b, samplecnt_t o) : buffer(&b), offset(o) {} iterator_base<BufferType, EventType>(const iterator_base<BufferType,EventType>& o) diff --git a/libs/ardour/ardour/midi_cursor.h b/libs/ardour/ardour/midi_cursor.h index 5cb89c87f5..6748a48971 100644 --- a/libs/ardour/ardour/midi_cursor.h +++ b/libs/ardour/ardour/midi_cursor.h @@ -47,7 +47,7 @@ struct MidiCursor : public boost::noncopyable { Evoral::Sequence<Evoral::Beats>::const_iterator iter; std::set<Evoral::Sequence<Evoral::Beats>::WeakNotePtr> active_notes; - framepos_t last_read_end; + samplepos_t last_read_end; PBD::ScopedConnectionList connections; }; diff --git a/libs/ardour/ardour/midi_playlist.h b/libs/ardour/ardour/midi_playlist.h index 722808b2a4..952b0ab00f 100644 --- a/libs/ardour/ardour/midi_playlist.h +++ b/libs/ardour/ardour/midi_playlist.h @@ -42,7 +42,7 @@ class Beats; namespace ARDOUR { -class BeatsFramesConverter; +class BeatsSamplesConverter; class MidiChannelFilter; class MidiRegion; class Session; @@ -59,8 +59,8 @@ public: /** This constructor does NOT notify others (session) */ MidiPlaylist (boost::shared_ptr<const MidiPlaylist> other, - framepos_t start, - framecnt_t cnt, + samplepos_t start, + samplecnt_t cnt, std::string name, bool hidden = false); @@ -69,25 +69,25 @@ public: /** Read a range from the playlist into an event sink. * * @param buf Destination for events. - * @param start First frame of read range. - * @param cnt Number of frames in read range. + * @param start First sample of read range. + * @param cnt Number of samples in read range. * @param loop_range If non-null, all event times will be mapped into this loop range. * @param chan_n Must be 0 (this is the audio-style "channel", where each * channel is backed by a separate region, not MIDI channels, which all * exist in the same region and are not handled here). - * @return The number of frames read (time, not an event count). + * @return The number of samples read (time, not an event count). */ - framecnt_t read (Evoral::EventSink<framepos_t>& buf, - framepos_t start, - framecnt_t cnt, - Evoral::Range<framepos_t>* loop_range, + samplecnt_t read (Evoral::EventSink<samplepos_t>& buf, + samplepos_t start, + samplecnt_t cnt, + Evoral::Range<samplepos_t>* loop_range, uint32_t chan_n = 0, MidiChannelFilter* filter = NULL); int set_state (const XMLNode&, int version); bool destroy_region (boost::shared_ptr<Region>); - void _split_region (boost::shared_ptr<Region>, const MusicFrame& position); + void _split_region (boost::shared_ptr<Region>, const MusicSample& position); void set_note_mode (NoteMode m) { _note_mode = m; } @@ -110,7 +110,7 @@ public: * @param dst Sink to write note offs to. * @param time Time stamp of all written note offs. */ - void resolve_note_trackers (Evoral::EventSink<framepos_t>& dst, framepos_t time); + void resolve_note_trackers (Evoral::EventSink<samplepos_t>& dst, samplepos_t time); protected: void remove_dependents (boost::shared_ptr<Region> region); @@ -118,7 +118,7 @@ protected: private: typedef Evoral::Note<Evoral::Beats> Note; - typedef Evoral::Event<framepos_t> Event; + typedef Evoral::Event<samplepos_t> Event; struct RegionTracker : public boost::noncopyable { MidiCursor cursor; ///< Cursor (iterator and read state) @@ -132,7 +132,7 @@ private: NoteTrackers _note_trackers; NoteMode _note_mode; - framepos_t _read_end; + samplepos_t _read_end; }; } /* namespace ARDOUR */ diff --git a/libs/ardour/ardour/midi_playlist_source.h b/libs/ardour/ardour/midi_playlist_source.h index 7e54cde788..0d140a9855 100644 --- a/libs/ardour/ardour/midi_playlist_source.h +++ b/libs/ardour/ardour/midi_playlist_source.h @@ -37,16 +37,16 @@ public: virtual ~MidiPlaylistSource (); bool empty() const; - framecnt_t length (framepos_t) const; + samplecnt_t length (samplepos_t) const; - framecnt_t read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) const; - framecnt_t write_unlocked (Sample *src, framecnt_t cnt); + samplecnt_t read_unlocked (Sample *dst, samplepos_t start, samplecnt_t cnt) const; + samplecnt_t write_unlocked (Sample *src, samplecnt_t cnt); XMLNode& get_state (); int set_state (const XMLNode&, int version); void append_event_beats(const Glib::Threads::Mutex::Lock& lock, const Evoral::Event<Evoral::Beats>& ev); - void append_event_frames(const Glib::Threads::Mutex::Lock& lock, const Evoral::Event<framepos_t>& ev, framepos_t source_start); + void append_event_samples(const Glib::Threads::Mutex::Lock& lock, const Evoral::Event<samplepos_t>& ev, samplepos_t source_start); void load_model(const Glib::Threads::Mutex::Lock& lock, bool force_reload=false); void destroy_model(const Glib::Threads::Mutex::Lock& lock); @@ -54,29 +54,29 @@ protected: friend class SourceFactory; MidiPlaylistSource (Session&, const PBD::ID& orig, const std::string& name, boost::shared_ptr<MidiPlaylist>, uint32_t chn, - frameoffset_t begin, framecnt_t len, Source::Flag flags); + sampleoffset_t begin, samplecnt_t len, Source::Flag flags); MidiPlaylistSource (Session&, const XMLNode&); void flush_midi(const Lock& lock); - framecnt_t read_unlocked (const Lock& lock, - Evoral::EventSink<framepos_t>& dst, - framepos_t position, - framepos_t start, - framecnt_t cnt, - Evoral::Range<framepos_t>* loop_range, + samplecnt_t read_unlocked (const Lock& lock, + Evoral::EventSink<samplepos_t>& dst, + samplepos_t position, + samplepos_t start, + samplecnt_t cnt, + Evoral::Range<samplepos_t>* loop_range, MidiStateTracker* tracker, MidiChannelFilter* filter) const; - framecnt_t write_unlocked (const Lock& lock, - MidiRingBuffer<framepos_t>& dst, - framepos_t position, - framecnt_t cnt); + samplecnt_t write_unlocked (const Lock& lock, + MidiRingBuffer<samplepos_t>& dst, + samplepos_t position, + samplecnt_t cnt); private: int set_state (const XMLNode&, int version, bool with_descendants); - framecnt_t _length; + samplecnt_t _length; }; } /* namespace */ diff --git a/libs/ardour/ardour/midi_port.h b/libs/ardour/ardour/midi_port.h index 3856d11ac5..e23914c4ce 100644 --- a/libs/ardour/ardour/midi_port.h +++ b/libs/ardour/ardour/midi_port.h @@ -94,7 +94,7 @@ class LIBARDOUR_API MidiPort : public Port { MIDI::Parser _self_parser; - void resolve_notes (void* buffer, framepos_t when); + void resolve_notes (void* buffer, samplepos_t when); }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/midi_region.h b/libs/ardour/ardour/midi_region.h index 36c9125a84..00a5f28a5e 100644 --- a/libs/ardour/ardour/midi_region.h +++ b/libs/ardour/ardour/midi_region.h @@ -73,23 +73,23 @@ class LIBARDOUR_API MidiRegion : public Region boost::shared_ptr<MidiSource> midi_source (uint32_t n=0) const; /* Stub Readable interface */ - virtual framecnt_t read (Sample*, framepos_t /*pos*/, framecnt_t /*cnt*/, int /*channel*/) const { return 0; } - virtual framecnt_t readable_length() const { return length(); } + virtual samplecnt_t read (Sample*, samplepos_t /*pos*/, samplecnt_t /*cnt*/, int /*channel*/) const { return 0; } + virtual samplecnt_t readable_length() const { return length(); } - framecnt_t read_at (Evoral::EventSink<framepos_t>& dst, - framepos_t position, - framecnt_t dur, - Evoral::Range<framepos_t>* loop_range, + samplecnt_t read_at (Evoral::EventSink<samplepos_t>& dst, + samplepos_t position, + samplecnt_t dur, + Evoral::Range<samplepos_t>* loop_range, MidiCursor& cursor, uint32_t chan_n = 0, NoteMode mode = Sustained, MidiStateTracker* tracker = 0, MidiChannelFilter* filter = 0) const; - framecnt_t master_read_at (MidiRingBuffer<framepos_t>& dst, - framepos_t position, - framecnt_t dur, - Evoral::Range<framepos_t>* loop_range, + samplecnt_t master_read_at (MidiRingBuffer<samplepos_t>& dst, + samplepos_t position, + samplecnt_t dur, + Evoral::Range<samplepos_t>* loop_range, MidiCursor& cursor, uint32_t chan_n = 0, NoteMode mode = Sustained) const; @@ -129,12 +129,12 @@ class LIBARDOUR_API MidiRegion : public Region MidiRegion (const SourceList&); MidiRegion (boost::shared_ptr<const MidiRegion>); - MidiRegion (boost::shared_ptr<const MidiRegion>, ARDOUR::MusicFrame offset); + MidiRegion (boost::shared_ptr<const MidiRegion>, ARDOUR::MusicSample offset); - framecnt_t _read_at (const SourceList&, Evoral::EventSink<framepos_t>& dst, - framepos_t position, - framecnt_t dur, - Evoral::Range<framepos_t>* loop_range, + samplecnt_t _read_at (const SourceList&, Evoral::EventSink<samplepos_t>& dst, + samplepos_t position, + samplecnt_t dur, + Evoral::Range<samplepos_t>* loop_range, MidiCursor& cursor, uint32_t chan_n = 0, NoteMode mode = Sustained, @@ -147,18 +147,18 @@ class LIBARDOUR_API MidiRegion : public Region void recompute_at_start (); void recompute_at_end (); - void set_position_internal (framepos_t pos, bool allow_bbt_recompute, const int32_t sub_num); + void set_position_internal (samplepos_t pos, bool allow_bbt_recompute, const int32_t sub_num); void set_position_music_internal (double qn); - void set_length_internal (framecnt_t len, const int32_t sub_num); - void set_start_internal (framecnt_t, const int32_t sub_num); - void trim_to_internal (framepos_t position, framecnt_t length, const int32_t sub_num); + void set_length_internal (samplecnt_t len, const int32_t sub_num); + void set_start_internal (samplecnt_t, const int32_t sub_num); + void trim_to_internal (samplepos_t position, samplecnt_t length, const int32_t sub_num); void update_length_beats (const int32_t sub_num); void model_changed (); void model_shifted (double qn_distance); void model_automation_state_changed (Evoral::Parameter const &); - void set_start_beats_from_start_frames (); + void set_start_beats_from_start_samples (); void update_after_tempo_map_change (bool send_change = true); std::set<Evoral::Parameter> _filtered_parameters; ///< parameters that we ask our source not to return when reading diff --git a/libs/ardour/ardour/midi_ring_buffer.h b/libs/ardour/ardour/midi_ring_buffer.h index 652f1c49cf..05205d264f 100644 --- a/libs/ardour/ardour/midi_ring_buffer.h +++ b/libs/ardour/ardour/midi_ring_buffer.h @@ -48,15 +48,15 @@ public: inline bool read_prefix(T* time, Evoral::EventType* type, uint32_t* size); inline bool read_contents(uint32_t size, uint8_t* buf); - size_t read(MidiBuffer& dst, framepos_t start, framepos_t end, framecnt_t offset=0, bool stop_on_overflow_in_destination=false); - size_t skip_to(framepos_t start); + size_t read(MidiBuffer& dst, samplepos_t start, samplepos_t end, samplecnt_t offset=0, bool stop_on_overflow_in_destination=false); + size_t skip_to(samplepos_t start); void dump(std::ostream& dst); - void flush (framepos_t start, framepos_t end); + void flush (samplepos_t start, samplepos_t end); void reset_tracker (); - void resolve_tracker (MidiBuffer& dst, framepos_t); - void resolve_tracker (Evoral::EventSink<framepos_t>& dst, framepos_t); + void resolve_tracker (MidiBuffer& dst, samplepos_t); + void resolve_tracker (Evoral::EventSink<samplepos_t>& dst, samplepos_t); private: MidiStateTracker _tracker; diff --git a/libs/ardour/ardour/midi_scene_changer.h b/libs/ardour/ardour/midi_scene_changer.h index 792f4fb74f..cc9553aab8 100644 --- a/libs/ardour/ardour/midi_scene_changer.h +++ b/libs/ardour/ardour/midi_scene_changer.h @@ -35,15 +35,15 @@ class MIDISceneChanger : public SceneChanger MIDISceneChanger (Session&); ~MIDISceneChanger (); - void run (framepos_t start, framepos_t end); + void run (samplepos_t start, samplepos_t end); void set_input_port (boost::shared_ptr<MidiPort>); void set_output_port (boost::shared_ptr<MidiPort>); - uint8_t bank_at (framepos_t, uint8_t channel); - uint8_t program_at (framepos_t, uint8_t channel); + uint8_t bank_at (samplepos_t, uint8_t channel); + uint8_t program_at (samplepos_t, uint8_t channel); void set_recording (bool); - void locate (framepos_t); + void locate (samplepos_t); /** Signal emitted whenever any relevant MIDI input is detected. */ @@ -54,7 +54,7 @@ class MIDISceneChanger : public SceneChanger PBD::Signal0<void> MIDIOutputActivity; private: - typedef std::multimap<framepos_t,boost::shared_ptr<MIDISceneChange> > Scenes; + typedef std::multimap<samplepos_t,boost::shared_ptr<MIDISceneChange> > Scenes; boost::shared_ptr<MidiPort> input_port; boost::shared_ptr<MidiPort> output_port; @@ -62,7 +62,7 @@ class MIDISceneChanger : public SceneChanger Scenes scenes; bool _recording; bool have_seen_bank_changes; - framepos_t last_program_message_time; + samplepos_t last_program_message_time; unsigned short current_bank; int last_delivered_program; int last_delivered_bank; @@ -70,7 +70,7 @@ class MIDISceneChanger : public SceneChanger void gather (const Locations::LocationList&); bool recording () const; void jump_to (int bank, int program); - void rt_deliver (MidiBuffer&, framepos_t, boost::shared_ptr<MIDISceneChange>); + void rt_deliver (MidiBuffer&, samplepos_t, boost::shared_ptr<MIDISceneChange>); void non_rt_deliver (boost::shared_ptr<MIDISceneChange>); void bank_change_input (MIDI::Parser&, unsigned short, int channel); diff --git a/libs/ardour/ardour/midi_source.h b/libs/ardour/ardour/midi_source.h index f1d9473a13..5f59baab22 100644 --- a/libs/ardour/ardour/midi_source.h +++ b/libs/ardour/ardour/midi_source.h @@ -32,7 +32,7 @@ #include "ardour/buffer.h" #include "ardour/midi_cursor.h" #include "ardour/source.h" -#include "ardour/beats_frames_converter.h" +#include "ardour/beats_samples_converter.h" namespace ARDOUR { @@ -79,21 +79,21 @@ class LIBARDOUR_API MidiSource : virtual public Source, public boost::enable_sha Evoral::Beats end); /** Read the data in a given time range from the MIDI source. - * All time stamps in parameters are in audio frames (even if the source has tempo time). + * All time stamps in parameters are in audio samples (even if the source has tempo time). * \param dst Ring buffer where read events are written. * \param source_start Start position of the SOURCE in this read context. * \param start Start of range to be read. - * \param cnt Length of range to be read (in audio frames). + * \param cnt Length of range to be read (in audio samples). * \param loop_range If non-null, all event times will be mapped into this loop range. * \param tracker an optional pointer to MidiStateTracker object, for note on/off tracking. * \param filtered Parameters whose MIDI messages will not be returned. */ - virtual framecnt_t midi_read (const Lock& lock, - Evoral::EventSink<framepos_t>& dst, - framepos_t source_start, - framepos_t start, - framecnt_t cnt, - Evoral::Range<framepos_t>* loop_range, + virtual samplecnt_t midi_read (const Lock& lock, + Evoral::EventSink<samplepos_t>& dst, + samplepos_t source_start, + samplepos_t start, + samplecnt_t cnt, + Evoral::Range<samplepos_t>* loop_range, MidiCursor& cursor, MidiStateTracker* tracker, MidiChannelFilter* filter, @@ -103,13 +103,13 @@ class LIBARDOUR_API MidiSource : virtual public Source, public boost::enable_sha /** Write data from a MidiRingBuffer to this source. * @param source Source to read from. - * @param source_start This source's start position in session frames. + * @param source_start This source's start position in session samples. * @param cnt The length of time to write. */ - virtual framecnt_t midi_write (const Lock& lock, - MidiRingBuffer<framepos_t>& src, - framepos_t source_start, - framecnt_t cnt); + virtual samplecnt_t midi_write (const Lock& lock, + MidiRingBuffer<samplepos_t>& src, + samplepos_t source_start, + samplecnt_t cnt); /** Append a single event with a timestamp in beats. * @@ -118,17 +118,17 @@ class LIBARDOUR_API MidiSource : virtual public Source, public boost::enable_sha virtual void append_event_beats(const Lock& lock, const Evoral::Event<Evoral::Beats>& ev) = 0; - /** Append a single event with a timestamp in frames. + /** Append a single event with a timestamp in samples. * * Caller must ensure that the event is later than the last written event. */ - virtual void append_event_frames(const Lock& lock, - const Evoral::Event<framepos_t>& ev, - framepos_t source_start) = 0; + virtual void append_event_samples(const Lock& lock, + const Evoral::Event<samplepos_t>& ev, + samplepos_t source_start) = 0; virtual bool empty () const; - virtual framecnt_t length (framepos_t pos) const; - virtual void update_length (framecnt_t); + virtual samplecnt_t length (samplepos_t pos) const; + virtual void update_length (samplecnt_t); virtual void mark_streaming_midi_write_started (const Lock& lock, NoteMode mode); virtual void mark_streaming_write_started (const Lock& lock); @@ -144,9 +144,9 @@ class LIBARDOUR_API MidiSource : virtual public Source, public boost::enable_sha * be zero if record is armed while rolling. * @param loop_length The loop length if looping, otherwise zero. */ - void mark_write_starting_now (framecnt_t position, - framecnt_t capture_length, - framecnt_t loop_length); + void mark_write_starting_now (samplecnt_t position, + samplecnt_t capture_length, + samplecnt_t loop_length); /* like ::mark_streaming_write_completed() but with more arguments to * allow control over MIDI-specific behaviour. Expected to be used only @@ -208,24 +208,24 @@ class LIBARDOUR_API MidiSource : virtual public Source, public boost::enable_sha protected: virtual void flush_midi(const Lock& lock) = 0; - virtual framecnt_t read_unlocked (const Lock& lock, - Evoral::EventSink<framepos_t>& dst, - framepos_t position, - framepos_t start, - framecnt_t cnt, - Evoral::Range<framepos_t>* loop_range, + virtual samplecnt_t read_unlocked (const Lock& lock, + Evoral::EventSink<samplepos_t>& dst, + samplepos_t position, + samplepos_t start, + samplecnt_t cnt, + Evoral::Range<samplepos_t>* loop_range, MidiStateTracker* tracker, MidiChannelFilter* filter) const = 0; /** Write data to this source from a MidiRingBuffer. * @param source Buffer to read from. - * @param position This source's start position in session frames. + * @param position This source's start position in session samples. * @param cnt The duration of this block to write for. */ - virtual framecnt_t write_unlocked (const Lock& lock, - MidiRingBuffer<framepos_t>& source, - framepos_t position, - framecnt_t cnt) = 0; + virtual samplecnt_t write_unlocked (const Lock& lock, + MidiRingBuffer<samplepos_t>& source, + samplepos_t position, + samplecnt_t cnt) = 0; std::string _captured_for; @@ -235,10 +235,10 @@ class LIBARDOUR_API MidiSource : virtual public Source, public boost::enable_sha Evoral::Beats _length_beats; /** The total duration of the current capture. */ - framepos_t _capture_length; + samplepos_t _capture_length; /** Length of transport loop during current capture, or zero. */ - framepos_t _capture_loop_length; + samplepos_t _capture_loop_length; /** Map of interpolation styles to use for Parameters; if they are not in this map, * the correct interpolation style can be obtained from EventTypeMap::interpolation_of () diff --git a/libs/ardour/ardour/midi_state_tracker.h b/libs/ardour/ardour/midi_state_tracker.h index 6690931422..7843ff7e1d 100644 --- a/libs/ardour/ardour/midi_state_tracker.h +++ b/libs/ardour/ardour/midi_state_tracker.h @@ -44,8 +44,8 @@ public: void track (const uint8_t* evbuf); void add (uint8_t note, uint8_t chn); void remove (uint8_t note, uint8_t chn); - void resolve_notes (MidiBuffer& buffer, framepos_t time); - void resolve_notes (Evoral::EventSink<framepos_t>& buffer, framepos_t time); + void resolve_notes (MidiBuffer& buffer, samplepos_t time); + void resolve_notes (Evoral::EventSink<samplepos_t>& buffer, samplepos_t time); void resolve_notes (MidiSource& src, const Glib::Threads::Mutex::Lock& lock, Evoral::Beats time); void dump (std::ostream&); void reset (); diff --git a/libs/ardour/ardour/midi_track.h b/libs/ardour/ardour/midi_track.h index f08af83aaa..54a04d8ed3 100644 --- a/libs/ardour/ardour/midi_track.h +++ b/libs/ardour/ardour/midi_track.h @@ -42,10 +42,10 @@ public: int init (); - int roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool& need_butler); + int roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, int declick, bool& need_butler); void realtime_locate (); - void non_realtime_locate (framepos_t); + void non_realtime_locate (samplepos_t); bool can_be_record_enabled (); bool can_be_record_safe (); @@ -55,15 +55,15 @@ public: bool bounceable (boost::shared_ptr<Processor>, bool) const { return false; } boost::shared_ptr<Region> bounce (InterThreadInfo&); - boost::shared_ptr<Region> bounce_range (framepos_t start, - framepos_t end, + boost::shared_ptr<Region> bounce_range (samplepos_t start, + samplepos_t end, InterThreadInfo& iti, boost::shared_ptr<Processor> endpoint, bool include_endpoint); int export_stuff (BufferSet& bufs, - framepos_t start_frame, - framecnt_t end_frame, + samplepos_t start_sample, + samplecnt_t end_sample, boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, @@ -100,7 +100,7 @@ public: bool step_editing() const { return _step_editing; } void set_step_editing (bool yn); - MidiRingBuffer<framepos_t>& step_edit_ring_buffer() { return _step_edit_ring_buffer; } + MidiRingBuffer<samplepos_t>& step_edit_ring_buffer() { return _step_edit_ring_buffer; } PBD::Signal1<void,bool> StepEditStatusChange; @@ -138,21 +138,21 @@ protected: void monitoring_changed (bool, PBD::Controllable::GroupControlDisposition); private: - MidiRingBuffer<framepos_t> _immediate_events; - MidiRingBuffer<framepos_t> _step_edit_ring_buffer; + MidiRingBuffer<samplepos_t> _immediate_events; + MidiRingBuffer<samplepos_t> _step_edit_ring_buffer; NoteMode _note_mode; bool _step_editing; bool _input_active; MidiChannelFilter _playback_filter; MidiChannelFilter _capture_filter; - void write_out_of_band_data (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, framecnt_t nframes); + void write_out_of_band_data (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, samplecnt_t nframes); void set_state_part_two (); void set_state_part_three (); - int no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, bool state_changing); - void push_midi_input_to_step_edit_ringbuffer (framecnt_t nframes); + int no_roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, bool state_changing); + void push_midi_input_to_step_edit_ringbuffer (samplecnt_t nframes); void track_input_active (IOChange, void*); void map_input_active (bool); diff --git a/libs/ardour/ardour/mididm.h b/libs/ardour/ardour/mididm.h index 5ee964c8e0..e16bb833e6 100644 --- a/libs/ardour/ardour/mididm.h +++ b/libs/ardour/ardour/mididm.h @@ -30,12 +30,12 @@ class LIBARDOUR_API MIDIDM { public: - MIDIDM (framecnt_t sample_rate); + MIDIDM (samplecnt_t sample_rate); int process (pframes_t nframes, PortEngine &pe, void *midi_in, void *midi_out); - framecnt_t latency (void) { return _cnt_total > 10 ? _avg_delay : 0; } - framecnt_t processed (void) { return _cnt_total; } + samplecnt_t latency (void) { return _cnt_total > 10 ? _avg_delay : 0; } + samplecnt_t processed (void) { return _cnt_total; } double deviation (void) { return _cnt_total > 1 ? sqrt(_var_s / ((double)(_cnt_total - 1))) : 0; } bool ok (void) { return _cnt_total > 200; } bool have_signal (void) { return (_monotonic_cnt - _last_signal_tme) < (uint64_t) _sample_rate ; } @@ -44,7 +44,7 @@ private: int64_t parse_mclk (uint8_t const * const buf, pframes_t timestamp) const; int64_t parse_mtc (uint8_t const * const buf, pframes_t timestamp) const; - framecnt_t _sample_rate; + samplecnt_t _sample_rate; uint64_t _monotonic_cnt; uint64_t _last_signal_tme; diff --git a/libs/ardour/ardour/monitor_processor.h b/libs/ardour/ardour/monitor_processor.h index 70f0761a49..1d537c0937 100644 --- a/libs/ardour/ardour/monitor_processor.h +++ b/libs/ardour/ardour/monitor_processor.h @@ -124,7 +124,7 @@ public: bool display_to_user() const; - void run (BufferSet& /*bufs*/, framepos_t /*start_frame*/, framepos_t /*end_frame*/, double /*speed*/, pframes_t /*nframes*/, bool /*result_required*/); + void run (BufferSet& /*bufs*/, samplepos_t /*start_sample*/, samplepos_t /*end_sample*/, double /*speed*/, pframes_t /*nframes*/, bool /*result_required*/); XMLNode& state (bool full); int set_state (const XMLNode&, int /* version */); diff --git a/libs/ardour/ardour/mute_control.h b/libs/ardour/ardour/mute_control.h index d54ff2dc34..494b554342 100644 --- a/libs/ardour/ardour/mute_control.h +++ b/libs/ardour/ardour/mute_control.h @@ -68,7 +68,7 @@ public: void set_mute_points (MuteMaster::MutePoint); MuteMaster::MutePoint mute_points () const; - void automation_run (framepos_t start, pframes_t nframes); + void automation_run (samplepos_t start, pframes_t nframes); protected: bool handle_master_change (boost::shared_ptr<AutomationControl>); diff --git a/libs/ardour/ardour/note_fixer.h b/libs/ardour/ardour/note_fixer.h index 09f45cdec7..34582497d0 100644 --- a/libs/ardour/ardour/note_fixer.h +++ b/libs/ardour/ardour/note_fixer.h @@ -33,7 +33,7 @@ namespace Evoral { template<typename Time> class EventSink; } namespace ARDOUR { -class BeatsFramesConverter; +class BeatsSamplesConverter; class MidiStateTracker; class TempoMap; @@ -65,8 +65,8 @@ public: */ void prepare(TempoMap& tempo_map, const MidiModel::NoteDiffCommand* cmd, - framepos_t origin, - framepos_t pos, + samplepos_t origin, + samplepos_t pos, std::set< boost::weak_ptr<Note> >& active_notes); /** Emit any pending edit compensation events. @@ -76,21 +76,21 @@ public: * the read block immediately following any calls to prepare(). * @param tracker Tracker to update with emitted events. */ - void emit(Evoral::EventSink<framepos_t>& dst, - framepos_t pos, + void emit(Evoral::EventSink<samplepos_t>& dst, + samplepos_t pos, MidiStateTracker& tracker); private: - typedef Evoral::Event<framepos_t> Event; + typedef Evoral::Event<samplepos_t> Event; typedef std::list<Event*> Events; - /** Copy a beats event to a frames event with the given time stamp. */ - Event* copy_event(framepos_t time, const Evoral::Event<Evoral::Beats>& ev); + /** Copy a beats event to a samples event with the given time stamp. */ + Event* copy_event(samplepos_t time, const Evoral::Event<Evoral::Beats>& ev); /** Return true iff `note` is active at `pos`. */ - bool note_is_active(const BeatsFramesConverter& converter, + bool note_is_active(const BeatsSamplesConverter& converter, boost::shared_ptr<Note> note, - framepos_t pos); + samplepos_t pos); Events _events; }; diff --git a/libs/ardour/ardour/panner.h b/libs/ardour/ardour/panner.h index 0773250094..947baca733 100644 --- a/libs/ardour/ardour/panner.h +++ b/libs/ardour/ardour/panner.h @@ -140,7 +140,7 @@ public: * @param ibufs Input buffers (one per panner input) * @param obufs Output buffers (one per panner output). * @param gain_coeff fixed, additional gain coefficient to apply to output samples. - * @param nframes Number of frames in the input. + * @param nframes Number of samples in the input. * * Derived panners can choose to implement these if they need to gain more * control over the panning algorithm. The default is to call @@ -152,7 +152,7 @@ public: */ virtual void distribute (BufferSet& ibufs, BufferSet& obufs, gain_t gain_coeff, pframes_t nframes); virtual void distribute_automated (BufferSet& ibufs, BufferSet& obufs, - framepos_t start, framepos_t end, pframes_t nframes, + samplepos_t start, samplepos_t end, pframes_t nframes, pan_t** buffers); int set_state (const XMLNode&, int version); @@ -177,7 +177,7 @@ protected: virtual void distribute_one (AudioBuffer&, BufferSet& obufs, gain_t gain_coeff, pframes_t nframes, uint32_t which) = 0; virtual void distribute_one_automated (AudioBuffer&, BufferSet& obufs, - framepos_t start, framepos_t end, pframes_t nframes, + samplepos_t start, samplepos_t end, pframes_t nframes, pan_t** buffers, uint32_t which) = 0; int32_t _frozen; diff --git a/libs/ardour/ardour/panner_shell.h b/libs/ardour/ardour/panner_shell.h index f344afd54a..59b0e7da81 100644 --- a/libs/ardour/ardour/panner_shell.h +++ b/libs/ardour/ardour/panner_shell.h @@ -59,7 +59,7 @@ public: void configure_io (ChanCount in, ChanCount out); /// The fundamental Panner function - void run (BufferSet& src, BufferSet& dest, framepos_t start_frame, framepos_t end_frames, pframes_t nframes); + void run (BufferSet& src, BufferSet& dest, samplepos_t start_sample, samplepos_t end_samples, pframes_t nframes); XMLNode& get_state (); int set_state (const XMLNode&, int version); diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h index 26c664b0f2..91ddecb711 100644 --- a/libs/ardour/ardour/playlist.h +++ b/libs/ardour/ardour/playlist.h @@ -86,7 +86,7 @@ public: Playlist (Session&, const XMLNode&, DataType type, bool hidden = false); Playlist (Session&, std::string name, DataType type, bool hidden = false); Playlist (boost::shared_ptr<const Playlist>, std::string name, bool hidden = false); - Playlist (boost::shared_ptr<const Playlist>, framepos_t start, framecnt_t cnt, std::string name, bool hidden = false); + Playlist (boost::shared_ptr<const Playlist>, samplepos_t start, samplecnt_t cnt, std::string name, bool hidden = false); virtual ~Playlist (); @@ -126,8 +126,8 @@ public: uint32_t n_regions() const; bool all_regions_empty() const; - std::pair<framepos_t, framepos_t> get_extent () const; - std::pair<framepos_t, framepos_t> get_extent_with_endspace() const; + std::pair<samplepos_t, samplepos_t> get_extent () const; + std::pair<samplepos_t, samplepos_t> get_extent_with_endspace() const; layer_t top_layer() const; EditMode get_edit_mode() const { return _edit_mode; } @@ -135,29 +135,29 @@ public: /* Editing operations */ - void add_region (boost::shared_ptr<Region>, framepos_t position, float times = 1, bool auto_partition = false, int32_t sub_num = 0, double quarter_note = 0.0, bool for_music = false); + void add_region (boost::shared_ptr<Region>, samplepos_t position, float times = 1, bool auto_partition = false, int32_t sub_num = 0, double quarter_note = 0.0, bool for_music = false); void remove_region (boost::shared_ptr<Region>); void get_equivalent_regions (boost::shared_ptr<Region>, std::vector<boost::shared_ptr<Region> >&); void get_region_list_equivalent_regions (boost::shared_ptr<Region>, std::vector<boost::shared_ptr<Region> >&); void get_source_equivalent_regions (boost::shared_ptr<Region>, std::vector<boost::shared_ptr<Region> >&); - void replace_region (boost::shared_ptr<Region> old, boost::shared_ptr<Region> newr, framepos_t pos); - void split_region (boost::shared_ptr<Region>, const MusicFrame& position); - void split (const MusicFrame& at); - void shift (framepos_t at, frameoffset_t distance, bool move_intersected, bool ignore_music_glue); - void partition (framepos_t start, framepos_t end, bool cut = false); - void duplicate (boost::shared_ptr<Region>, framepos_t position, float times); - void duplicate (boost::shared_ptr<Region>, framepos_t position, framecnt_t gap, float times); - void duplicate_until (boost::shared_ptr<Region>, framepos_t position, framecnt_t gap, framepos_t end); + void replace_region (boost::shared_ptr<Region> old, boost::shared_ptr<Region> newr, samplepos_t pos); + void split_region (boost::shared_ptr<Region>, const MusicSample& position); + void split (const MusicSample& at); + void shift (samplepos_t at, sampleoffset_t distance, bool move_intersected, bool ignore_music_glue); + void partition (samplepos_t start, samplepos_t end, bool cut = false); + void duplicate (boost::shared_ptr<Region>, samplepos_t position, float times); + void duplicate (boost::shared_ptr<Region>, samplepos_t position, samplecnt_t gap, float times); + void duplicate_until (boost::shared_ptr<Region>, samplepos_t position, samplecnt_t gap, samplepos_t end); void duplicate_range (AudioRange&, float times); void duplicate_ranges (std::list<AudioRange>&, float times); - void nudge_after (framepos_t start, framecnt_t distance, bool forwards); + void nudge_after (samplepos_t start, samplecnt_t distance, bool forwards); boost::shared_ptr<Region> combine (const RegionList&); void uncombine (boost::shared_ptr<Region>); void fade_range (std::list<AudioRange>&); void shuffle (boost::shared_ptr<Region>, int dir); - void ripple (framepos_t at, framecnt_t distance, RegionList *exclude); - void ripple (framepos_t at, framecnt_t distance, boost::shared_ptr<Region> exclude) { + void ripple (samplepos_t at, samplecnt_t distance, RegionList *exclude); + void ripple (samplepos_t at, samplecnt_t distance, boost::shared_ptr<Region> exclude) { RegionList el; if (exclude) el.push_back (exclude); @@ -168,29 +168,29 @@ public: boost::shared_ptr<Playlist> cut (std::list<AudioRange>&, bool result_is_hidden = true); boost::shared_ptr<Playlist> copy (std::list<AudioRange>&, bool result_is_hidden = true); - int paste (boost::shared_ptr<Playlist>, framepos_t position, float times, const int32_t sub_num); + int paste (boost::shared_ptr<Playlist>, samplepos_t position, float times, const int32_t sub_num); const RegionListProperty& region_list_property () const { return regions; } boost::shared_ptr<RegionList> region_list(); - boost::shared_ptr<RegionList> regions_at (framepos_t frame); - uint32_t count_regions_at (framepos_t) const; - boost::shared_ptr<RegionList> regions_touched (framepos_t start, framepos_t end); - boost::shared_ptr<RegionList> regions_with_start_within (Evoral::Range<framepos_t>); - boost::shared_ptr<RegionList> regions_with_end_within (Evoral::Range<framepos_t>); + boost::shared_ptr<RegionList> regions_at (samplepos_t sample); + uint32_t count_regions_at (samplepos_t) const; + boost::shared_ptr<RegionList> regions_touched (samplepos_t start, samplepos_t end); + boost::shared_ptr<RegionList> regions_with_start_within (Evoral::Range<samplepos_t>); + boost::shared_ptr<RegionList> regions_with_end_within (Evoral::Range<samplepos_t>); uint32_t region_use_count (boost::shared_ptr<Region>) const; boost::shared_ptr<Region> find_region (const PBD::ID&) const; - boost::shared_ptr<Region> top_region_at (framepos_t frame); - boost::shared_ptr<Region> top_unmuted_region_at (framepos_t frame); - boost::shared_ptr<Region> find_next_region (framepos_t frame, RegionPoint point, int dir); - framepos_t find_next_region_boundary (framepos_t frame, int dir); + boost::shared_ptr<Region> top_region_at (samplepos_t sample); + boost::shared_ptr<Region> top_unmuted_region_at (samplepos_t sample); + boost::shared_ptr<Region> find_next_region (samplepos_t sample, RegionPoint point, int dir); + samplepos_t find_next_region_boundary (samplepos_t sample, int dir); bool region_is_shuffle_constrained (boost::shared_ptr<Region>); - bool has_region_at (framepos_t const) const; + bool has_region_at (samplepos_t const) const; bool uses_source (boost::shared_ptr<const Source> src, bool shallow = false) const; void deep_sources (std::set<boost::shared_ptr<Source> >&) const; - framepos_t find_next_transient (framepos_t position, int dir); + samplepos_t find_next_transient (samplepos_t position, int dir); void foreach_region (boost::function<void (boost::shared_ptr<Region>)>); @@ -206,12 +206,12 @@ public: PBD::Signal0<void> LayeringChanged; /** Emitted when regions have moved (not when regions have only been trimmed) */ - PBD::Signal2<void,std::list< Evoral::RangeMove<framepos_t> > const &, bool> RangesMoved; + PBD::Signal2<void,std::list< Evoral::RangeMove<samplepos_t> > const &, bool> RangesMoved; /** Emitted when regions are extended; the ranges passed are the new extra time ranges that these regions now occupy. */ - PBD::Signal1<void,std::list< Evoral::Range<framepos_t> > const &> RegionsExtended; + PBD::Signal1<void,std::list< Evoral::Range<samplepos_t> > const &> RegionsExtended; static std::string bump_name (std::string old_name, Session&); @@ -242,7 +242,7 @@ public: return boost::shared_ptr<Crossfade> (); } - framepos_t find_next_top_layer_position (framepos_t) const; + samplepos_t find_next_top_layer_position (samplepos_t) const; uint32_t combine_ops() const { return _combine_ops; } void set_layer (boost::shared_ptr<Region>, double); @@ -298,9 +298,9 @@ public: * region trims are not included in this list; it is used to * do automation-follows-regions. */ - std::list< Evoral::RangeMove<framepos_t> > pending_range_moves; + std::list< Evoral::RangeMove<samplepos_t> > pending_range_moves; /** Extra sections added to regions during trims */ - std::list< Evoral::Range<framepos_t> > pending_region_extensions; + std::list< Evoral::Range<samplepos_t> > pending_region_extensions; uint32_t in_set_state; bool in_undo; bool first_set_state; @@ -334,7 +334,7 @@ public: void _set_sort_id (); - boost::shared_ptr<RegionList> regions_touched_locked (framepos_t start, framepos_t end); + boost::shared_ptr<RegionList> regions_touched_locked (samplepos_t start, samplepos_t end); void notify_region_removed (boost::shared_ptr<Region>); void notify_region_added (boost::shared_ptr<Region>); @@ -355,16 +355,16 @@ public: void sort_regions (); - void possibly_splice (framepos_t at, framecnt_t distance, boost::shared_ptr<Region> exclude = boost::shared_ptr<Region>()); - void possibly_splice_unlocked(framepos_t at, framecnt_t distance, boost::shared_ptr<Region> exclude = boost::shared_ptr<Region>()); + void possibly_splice (samplepos_t at, samplecnt_t distance, boost::shared_ptr<Region> exclude = boost::shared_ptr<Region>()); + void possibly_splice_unlocked(samplepos_t at, samplecnt_t distance, boost::shared_ptr<Region> exclude = boost::shared_ptr<Region>()); - void core_splice (framepos_t at, framecnt_t distance, boost::shared_ptr<Region> exclude); - void splice_locked (framepos_t at, framecnt_t distance, boost::shared_ptr<Region> exclude); - void splice_unlocked (framepos_t at, framecnt_t distance, boost::shared_ptr<Region> exclude); + void core_splice (samplepos_t at, samplecnt_t distance, boost::shared_ptr<Region> exclude); + void splice_locked (samplepos_t at, samplecnt_t distance, boost::shared_ptr<Region> exclude); + void splice_unlocked (samplepos_t at, samplecnt_t distance, boost::shared_ptr<Region> exclude); - void core_ripple (framepos_t at, framecnt_t distance, RegionList *exclude); - void ripple_locked (framepos_t at, framecnt_t distance, RegionList *exclude); - void ripple_unlocked (framepos_t at, framecnt_t distance, RegionList *exclude); + void core_ripple (samplepos_t at, samplecnt_t distance, RegionList *exclude); + void ripple_locked (samplepos_t at, samplecnt_t distance, RegionList *exclude); + void ripple_unlocked (samplepos_t at, samplecnt_t distance, RegionList *exclude); virtual void remove_dependents (boost::shared_ptr<Region> /*region*/) {} @@ -372,25 +372,25 @@ public: virtual XMLNode& state (bool); - bool add_region_internal (boost::shared_ptr<Region>, framepos_t position, int32_t sub_num = 0, double quarter_note = 0.0, bool for_music = false); + bool add_region_internal (boost::shared_ptr<Region>, samplepos_t position, int32_t sub_num = 0, double quarter_note = 0.0, bool for_music = false); int remove_region_internal (boost::shared_ptr<Region>); void copy_regions (RegionList&) const; - void partition_internal (framepos_t start, framepos_t end, bool cutting, RegionList& thawlist); + void partition_internal (samplepos_t start, samplepos_t end, bool cutting, RegionList& thawlist); - std::pair<framepos_t, framepos_t> _get_extent() const; + std::pair<samplepos_t, samplepos_t> _get_extent() const; - boost::shared_ptr<Playlist> cut_copy (boost::shared_ptr<Playlist> (Playlist::*pmf)(framepos_t, framecnt_t, bool), + boost::shared_ptr<Playlist> cut_copy (boost::shared_ptr<Playlist> (Playlist::*pmf)(samplepos_t, samplecnt_t, bool), std::list<AudioRange>& ranges, bool result_is_hidden); - boost::shared_ptr<Playlist> cut (framepos_t start, framecnt_t cnt, bool result_is_hidden); - boost::shared_ptr<Playlist> copy (framepos_t start, framecnt_t cnt, bool result_is_hidden); + boost::shared_ptr<Playlist> cut (samplepos_t start, samplecnt_t cnt, bool result_is_hidden); + boost::shared_ptr<Playlist> copy (samplepos_t start, samplecnt_t cnt, bool result_is_hidden); void relayer (); void begin_undo (); void end_undo (); - virtual void _split_region (boost::shared_ptr<Region>, const MusicFrame& position); + virtual void _split_region (boost::shared_ptr<Region>, const MusicSample& position); typedef std::pair<boost::shared_ptr<Region>, boost::shared_ptr<Region> > TwoRegions; @@ -410,10 +410,10 @@ public: private: void setup_layering_indices (RegionList const &); - void coalesce_and_check_crossfades (std::list<Evoral::Range<framepos_t> >); - boost::shared_ptr<RegionList> find_regions_at (framepos_t); + void coalesce_and_check_crossfades (std::list<Evoral::Range<samplepos_t> >); + boost::shared_ptr<RegionList> find_regions_at (samplepos_t); - framepos_t _end_space; //this is used when we are pasting a range with extra space at the end + samplepos_t _end_space; //this is used when we are pasting a range with extra space at the end }; } /* namespace ARDOUR */ diff --git a/libs/ardour/ardour/playlist_factory.h b/libs/ardour/ardour/playlist_factory.h index 505836234b..4fbef45be2 100644 --- a/libs/ardour/ardour/playlist_factory.h +++ b/libs/ardour/ardour/playlist_factory.h @@ -36,7 +36,7 @@ class LIBARDOUR_API PlaylistFactory { static boost::shared_ptr<Playlist> create (Session&, const XMLNode&, bool hidden = false, bool unused = false); static boost::shared_ptr<Playlist> create (DataType type, Session&, std::string name, bool hidden = false); static boost::shared_ptr<Playlist> create (boost::shared_ptr<const Playlist>, std::string name, bool hidden = false); - static boost::shared_ptr<Playlist> create (boost::shared_ptr<const Playlist>, framepos_t start, framecnt_t cnt, std::string name, bool hidden = false); + static boost::shared_ptr<Playlist> create (boost::shared_ptr<const Playlist>, samplepos_t start, samplecnt_t cnt, std::string name, bool hidden = false); }; } diff --git a/libs/ardour/ardour/playlist_source.h b/libs/ardour/ardour/playlist_source.h index 55cc1f6b59..6316b4dcdd 100644 --- a/libs/ardour/ardour/playlist_source.h +++ b/libs/ardour/ardour/playlist_source.h @@ -42,11 +42,11 @@ public: protected: boost::shared_ptr<Playlist> _playlist; PBD::ID _original; - frameoffset_t _playlist_offset; - framecnt_t _playlist_length; + sampleoffset_t _playlist_offset; + samplecnt_t _playlist_length; PlaylistSource (Session&, const PBD::ID&, const std::string& name, boost::shared_ptr<Playlist>, DataType, - frameoffset_t begin, framecnt_t len, Source::Flag flags); + sampleoffset_t begin, samplecnt_t len, Source::Flag flags); PlaylistSource (Session&, const XMLNode&); void add_state (XMLNode&); diff --git a/libs/ardour/ardour/plugin.h b/libs/ardour/ardour/plugin.h index f51f34b099..e9738a61f1 100644 --- a/libs/ardour/ardour/plugin.h +++ b/libs/ardour/ardour/plugin.h @@ -114,9 +114,9 @@ class LIBARDOUR_API Plugin : public PBD::StatefulDestructible, public Latent virtual bool inplace_broken() const { return false; } virtual int connect_and_run (BufferSet& bufs, - framepos_t start, framepos_t end, double speed, + samplepos_t start, samplepos_t end, double speed, ChanMapping in, ChanMapping out, - pframes_t nframes, framecnt_t offset); + pframes_t nframes, samplecnt_t offset); virtual std::set<Evoral::Parameter> automatable() const = 0; virtual std::string describe_parameter (Evoral::Parameter) = 0; @@ -249,7 +249,7 @@ class LIBARDOUR_API Plugin : public PBD::StatefulDestructible, public Latent } /** the max possible latency a plugin will have */ - virtual framecnt_t max_latency () const { return 0; } // TODO = 0, require implementation + virtual samplecnt_t max_latency () const { return 0; } // TODO = 0, require implementation /** Emitted when a preset is added or removed, respectively */ PBD::Signal0<void> PresetAdded; @@ -383,7 +383,7 @@ private: PBD::ScopedConnection _preset_connection; - MidiRingBuffer<framepos_t> _immediate_events; + MidiRingBuffer<samplepos_t> _immediate_events; void resolve_midi (); }; diff --git a/libs/ardour/ardour/plugin_insert.h b/libs/ardour/ardour/plugin_insert.h index a40cdc1bea..1076c5198f 100644 --- a/libs/ardour/ardour/plugin_insert.h +++ b/libs/ardour/ardour/plugin_insert.h @@ -63,8 +63,8 @@ class LIBARDOUR_API PluginInsert : public Processor void set_owner (SessionObject*); void set_state_dir (const std::string& d = ""); - void run (BufferSet& in, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool); - void silence (framecnt_t nframes, framepos_t start_frame); + void run (BufferSet& in, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool); + void silence (samplecnt_t nframes, samplepos_t start_sample); void activate (); void deactivate (); @@ -231,7 +231,7 @@ class LIBARDOUR_API PluginInsert : public Processor } } - framecnt_t plugin_latency () const; + samplecnt_t plugin_latency () const; bool has_sidechain () const { return _sidechain ? true : false; @@ -250,11 +250,11 @@ class LIBARDOUR_API PluginInsert : public Processor std::string describe_parameter (Evoral::Parameter param); - framecnt_t signal_latency () const; + samplecnt_t signal_latency () const; boost::shared_ptr<Plugin> get_impulse_analysis_plugin(); - void collect_signal_for_analysis (framecnt_t nframes); + void collect_signal_for_analysis (samplecnt_t nframes); bool strict_io_configured () const { return _match.strict_io; @@ -321,8 +321,8 @@ class LIBARDOUR_API PluginInsert : public Processor boost::weak_ptr<Plugin> _impulseAnalysisPlugin; - framecnt_t _signal_analysis_collected_nframes; - framecnt_t _signal_analysis_collect_nframes_max; + samplecnt_t _signal_analysis_collected_nframes; + samplecnt_t _signal_analysis_collect_nframes_max; BufferSet _signal_analysis_inputs; BufferSet _signal_analysis_outputs; @@ -357,10 +357,10 @@ class LIBARDOUR_API PluginInsert : public Processor PinMappings _out_map; ChanMapping _thru_map; // out-idx <= in-idx - void automate_and_run (BufferSet& bufs, framepos_t start, framepos_t end, double speed, pframes_t nframes); - void connect_and_run (BufferSet& bufs, framepos_t start, framecnt_t end, double speed, pframes_t nframes, framecnt_t offset, bool with_auto); + void automate_and_run (BufferSet& bufs, samplepos_t start, samplepos_t end, double speed, pframes_t nframes); + void connect_and_run (BufferSet& bufs, samplepos_t start, samplecnt_t end, double speed, pframes_t nframes, samplecnt_t offset, bool with_auto); void bypass (BufferSet& bufs, pframes_t nframes); - void inplace_silence_unconnected (BufferSet&, const PinMappings&, framecnt_t nframes, framecnt_t offset) const; + void inplace_silence_unconnected (BufferSet&, const PinMappings&, samplecnt_t nframes, samplecnt_t offset) const; void create_automatable_parameters (); void control_list_automation_state_changed (Evoral::Parameter, AutoState); diff --git a/libs/ardour/ardour/port.h b/libs/ardour/ardour/port.h index 288dddee43..e59df0cb03 100644 --- a/libs/ardour/ardour/port.h +++ b/libs/ardour/ardour/port.h @@ -127,10 +127,10 @@ public: static PBD::Signal0<void> PortDrop; static PBD::Signal0<void> PortSignalDrop; - static void set_cycle_framecnt (pframes_t n) { + static void set_cycle_samplecnt (pframes_t n) { _cycle_nframes = n; } - static framecnt_t port_offset() { return _global_port_buffer_offset; } + 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; } @@ -155,7 +155,7 @@ protected: static pframes_t _global_port_buffer_offset; /* access only from process() tree */ static pframes_t _cycle_nframes; /* access only from process() tree */ - framecnt_t _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; diff --git a/libs/ardour/ardour/port_engine.h b/libs/ardour/ardour/port_engine.h index 647253baea..88935671a2 100644 --- a/libs/ardour/ardour/port_engine.h +++ b/libs/ardour/ardour/port_engine.h @@ -366,7 +366,7 @@ class LIBARDOUR_API PortEngine { * * XXX to be removed after some more design cleanup. */ - virtual framepos_t sample_time_at_cycle_start () = 0; + virtual samplepos_t sample_time_at_cycle_start () = 0; protected: PortManager& manager; diff --git a/libs/ardour/ardour/port_insert.h b/libs/ardour/ardour/port_insert.h index 0b1b3fbc00..2461f8a90f 100644 --- a/libs/ardour/ardour/port_insert.h +++ b/libs/ardour/ardour/port_insert.h @@ -53,13 +53,13 @@ class LIBARDOUR_API PortInsert : public IOProcessor XMLNode& get_state(void); int set_state (const XMLNode&, int version); - void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool); + void run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool); - void flush_buffers (framecnt_t nframes) { + void flush_buffers (samplecnt_t nframes) { _out->flush_buffers (nframes); } - framecnt_t signal_latency () const; + samplecnt_t signal_latency () const; bool set_name (const std::string& name); @@ -77,8 +77,8 @@ class LIBARDOUR_API PortInsert : public IOProcessor void stop_latency_detection (); MTDM* mtdm () const { return _mtdm; } - void set_measured_latency (framecnt_t); - framecnt_t latency () const; + void set_measured_latency (samplecnt_t); + samplecnt_t latency () const; static std::string name_and_id_new_insert (Session&, uint32_t&); @@ -91,8 +91,8 @@ class LIBARDOUR_API PortInsert : public IOProcessor uint32_t _bitslot; MTDM* _mtdm; bool _latency_detect; - framecnt_t _latency_flush_frames; - framecnt_t _measured_latency; + samplecnt_t _latency_flush_samples; + samplecnt_t _measured_latency; }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/processor.h b/libs/ardour/ardour/processor.h index 095ab7fadf..fb77943a34 100644 --- a/libs/ardour/ardour/processor.h +++ b/libs/ardour/ardour/processor.h @@ -68,10 +68,10 @@ class LIBARDOUR_API Processor : public SessionObject, public Automatable, public bool get_next_ab_is_active () const { return _next_ab_is_active; } void set_next_ab_is_active (bool yn) { _next_ab_is_active = yn; } - virtual framecnt_t signal_latency() const { return 0; } + virtual samplecnt_t signal_latency() const { return 0; } - virtual void set_input_latency (framecnt_t); - framecnt_t input_latency () const { return _input_latency; } + virtual void set_input_latency (samplecnt_t); + samplecnt_t input_latency () const { return _input_latency; } virtual int set_block_size (pframes_t /*nframes*/) { return 0; } virtual bool requires_fixed_sized_buffers() const { return false; } @@ -79,8 +79,8 @@ class LIBARDOUR_API Processor : public SessionObject, public Automatable, public /** @param result_required true if, on return from this method, @a bufs is required to contain valid data; * if false, the method need not bother writing to @a bufs if it doesn't want to. */ - virtual void run (BufferSet& /*bufs*/, framepos_t /*start_frame*/, framepos_t /*end_frame*/, double speed, pframes_t /*nframes*/, bool /*result_required*/) {} - virtual void silence (framecnt_t nframes, framepos_t start_frame) { automation_run (start_frame, nframes); } + virtual void run (BufferSet& /*bufs*/, samplepos_t /*start_sample*/, samplepos_t /*end_sample*/, double speed, pframes_t /*nframes*/, bool /*result_required*/) {} + virtual void silence (samplecnt_t nframes, samplepos_t start_sample) { automation_run (start_sample, nframes); } virtual void activate () { _pending_active = true; ActiveChanged(); } virtual void deactivate () { _pending_active = false; ActiveChanged(); } @@ -152,7 +152,7 @@ protected: ProcessorWindowProxy *_window_proxy; PluginPinWindowProxy *_pinmgr_proxy; SessionObject* _owner; - framecnt_t _input_latency; + samplecnt_t _input_latency; }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/rc_configuration_vars.h b/libs/ardour/ardour/rc_configuration_vars.h index b0d8cf192e..fd4d014c59 100644 --- a/libs/ardour/ardour/rc_configuration_vars.h +++ b/libs/ardour/ardour/rc_configuration_vars.h @@ -58,7 +58,7 @@ CONFIG_VARIABLE (int32_t, mmc_receive_device_id, "mmc-receive-device-id", 0x7f) CONFIG_VARIABLE (int32_t, mmc_send_device_id, "mmc-send-device-id", 0) CONFIG_VARIABLE (int32_t, initial_program_change, "initial-program-change", -1) CONFIG_VARIABLE (bool, first_midi_bank_is_zero, "display-first-midi-bank-as-zero", false) -CONFIG_VARIABLE (int32_t, inter_scene_gap_frames, "inter-scene-gap-frames", 1) +CONFIG_VARIABLE (int32_t, inter_scene_gap_samples, "inter-scene-gap-samples", 1) CONFIG_VARIABLE (bool, midi_input_follows_selection, "midi-input-follows-selection", 1) /* Timecode and related */ @@ -89,8 +89,8 @@ CONFIG_VARIABLE (bool, use_tranzport, "use-tranzport", false) /* disk operations */ - CONFIG_VARIABLE (uint32_t, minimum_disk_read_bytes, "minimum-disk-read-bytes", ARDOUR::DiskReader::default_chunk_frames() * sizeof (ARDOUR::Sample)) -CONFIG_VARIABLE (uint32_t, minimum_disk_write_bytes, "minimum-disk-write-bytes", ARDOUR::DiskWriter::default_chunk_frames() * sizeof (ARDOUR::Sample)) + CONFIG_VARIABLE (uint32_t, minimum_disk_read_bytes, "minimum-disk-read-bytes", ARDOUR::DiskReader::default_chunk_samples() * sizeof (ARDOUR::Sample)) +CONFIG_VARIABLE (uint32_t, minimum_disk_write_bytes, "minimum-disk-write-bytes", ARDOUR::DiskWriter::default_chunk_samples() * sizeof (ARDOUR::Sample)) CONFIG_VARIABLE (float, midi_readahead, "midi-readahead", 1.0) CONFIG_VARIABLE (BufferingPreset, buffering_preset, "buffering-preset", Medium) CONFIG_VARIABLE (float, audio_capture_buffer_seconds, "capture-buffer-seconds", 5.0) @@ -170,8 +170,8 @@ CONFIG_VARIABLE (bool, loop_is_mode, "loop-is-mode", true) #else CONFIG_VARIABLE (bool, loop_is_mode, "loop-is-mode", false) #endif -CONFIG_VARIABLE (framecnt_t, preroll, "preroll", 0) -CONFIG_VARIABLE (framecnt_t, postroll, "postroll", 0) +CONFIG_VARIABLE (samplecnt_t, preroll, "preroll", 0) +CONFIG_VARIABLE (samplecnt_t, postroll, "postroll", 0) CONFIG_VARIABLE (float, rf_speed, "rf-speed", 2.0f) CONFIG_VARIABLE (float, shuttle_speed_factor, "shuttle-speed-factor", 1.0f) // used for MMC shuttle CONFIG_VARIABLE (float, shuttle_speed_threshold, "shuttle-speed-threshold", 5.0f) // used for MMC shuttle @@ -230,7 +230,7 @@ CONFIG_VARIABLE (uint32_t, max_recent_sessions, "max-recent-sessions", 10) CONFIG_VARIABLE (uint32_t, max_recent_templates, "max-recent-templates", 10) CONFIG_VARIABLE (double, automation_thinning_factor, "automation-thinning-factor", 20.0) CONFIG_VARIABLE (std::string, freesound_download_dir, "freesound-download-dir", Glib::get_home_dir() + "/Freesound/snd") -CONFIG_VARIABLE (framecnt_t, range_location_minimum, "range-location-minimum", 128) /* samples */ +CONFIG_VARIABLE (samplecnt_t, range_location_minimum, "range-location-minimum", 128) /* samples */ CONFIG_VARIABLE (EditMode, edit_mode, "edit-mode", Slide) /* plugin related */ diff --git a/libs/ardour/ardour/readable.h b/libs/ardour/ardour/readable.h index 4098e26e40..2c84fc0431 100644 --- a/libs/ardour/ardour/readable.h +++ b/libs/ardour/ardour/readable.h @@ -30,8 +30,8 @@ class LIBARDOUR_API Readable { Readable () {} virtual ~Readable() {} - virtual framecnt_t read (Sample*, framepos_t pos, framecnt_t cnt, int channel) const = 0; - virtual framecnt_t readable_length() const = 0; + virtual samplecnt_t read (Sample*, samplepos_t pos, samplecnt_t cnt, int channel) const = 0; + virtual samplecnt_t readable_length() const = 0; virtual uint32_t n_channels () const = 0; }; diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h index c49d8c86cb..1ae75d1469 100644 --- a/libs/ardour/ardour/region.h +++ b/libs/ardour/ardour/region.h @@ -55,14 +55,14 @@ namespace Properties { LIBARDOUR_API extern PBD::PropertyDescriptor<bool> hidden; LIBARDOUR_API extern PBD::PropertyDescriptor<bool> position_locked; LIBARDOUR_API extern PBD::PropertyDescriptor<bool> valid_transients; - LIBARDOUR_API extern PBD::PropertyDescriptor<framepos_t> start; - LIBARDOUR_API extern PBD::PropertyDescriptor<framecnt_t> length; - LIBARDOUR_API extern PBD::PropertyDescriptor<framepos_t> position; + LIBARDOUR_API extern PBD::PropertyDescriptor<samplepos_t> start; + LIBARDOUR_API extern PBD::PropertyDescriptor<samplecnt_t> length; + LIBARDOUR_API extern PBD::PropertyDescriptor<samplepos_t> position; LIBARDOUR_API extern PBD::PropertyDescriptor<double> beat; - LIBARDOUR_API extern PBD::PropertyDescriptor<framecnt_t> sync_position; + LIBARDOUR_API extern PBD::PropertyDescriptor<samplecnt_t> sync_position; LIBARDOUR_API extern PBD::PropertyDescriptor<layer_t> layer; - LIBARDOUR_API extern PBD::PropertyDescriptor<framepos_t> ancestral_start; - LIBARDOUR_API extern PBD::PropertyDescriptor<framecnt_t> ancestral_length; + LIBARDOUR_API extern PBD::PropertyDescriptor<samplepos_t> ancestral_start; + LIBARDOUR_API extern PBD::PropertyDescriptor<samplecnt_t> ancestral_length; LIBARDOUR_API extern PBD::PropertyDescriptor<float> stretch; LIBARDOUR_API extern PBD::PropertyDescriptor<float> shift; LIBARDOUR_API extern PBD::PropertyDescriptor<PositionLockStyle> position_lock_style; @@ -104,56 +104,56 @@ class LIBARDOUR_API Region /** How the region parameters play together: * - * POSITION: first frame of the region along the timeline - * START: first frame of the region within its source(s) - * LENGTH: number of frames the region represents + * POSITION: first sample of the region along the timeline + * START: first sample of the region within its source(s) + * LENGTH: number of samples the region represents */ - framepos_t position () const { return _position; } - framepos_t start () const { return _start; } - framecnt_t length () const { return _length; } + samplepos_t position () const { return _position; } + samplepos_t start () const { return _start; } + samplecnt_t length () const { return _length; } layer_t layer () const { return _layer; } - framecnt_t source_length(uint32_t n) const; + samplecnt_t source_length(uint32_t n) const; uint32_t max_source_level () const; /* these two are valid ONLY during a StateChanged signal handler */ - framepos_t last_position () const { return _last_position; } - framecnt_t last_length () const { return _last_length; } + samplepos_t last_position () const { return _last_position; } + samplecnt_t last_length () const { return _last_length; } - framepos_t ancestral_start () const { return _ancestral_start; } - framecnt_t ancestral_length () const { return _ancestral_length; } + samplepos_t ancestral_start () const { return _ancestral_start; } + samplecnt_t ancestral_length () const { return _ancestral_length; } float stretch () const { return _stretch; } float shift () const { return _shift; } - void set_ancestral_data (framepos_t start, framecnt_t length, float stretch, float shift); + void set_ancestral_data (samplepos_t start, samplecnt_t length, float stretch, float shift); - frameoffset_t sync_offset (int& dir) const; - framepos_t sync_position () const; + sampleoffset_t sync_offset (int& dir) const; + samplepos_t sync_position () const; - framepos_t adjust_to_sync (framepos_t) const; + samplepos_t adjust_to_sync (samplepos_t) const; - /* first_frame() is an alias; last_frame() just hides some math */ + /* first_sample() is an alias; last_sample() just hides some math */ - framepos_t first_frame () const { return _position; } - framepos_t last_frame () const { return _position + _length - 1; } + samplepos_t first_sample () const { return _position; } + samplepos_t last_sample () const { return _position + _length - 1; } /** Return the earliest possible value of _position given the * value of _start within the region's sources */ - framepos_t earliest_possible_position () const; - /** Return the last possible value of _last_frame given the + samplepos_t earliest_possible_position () const; + /** Return the last possible value of _last_sample given the * value of _startin the regions's sources */ - framepos_t latest_possible_frame () const; + samplepos_t latest_possible_sample () const; - Evoral::Range<framepos_t> last_range () const { - return Evoral::Range<framepos_t> (_last_position, _last_position + _last_length - 1); + Evoral::Range<samplepos_t> last_range () const { + return Evoral::Range<samplepos_t> (_last_position, _last_position + _last_length - 1); } - Evoral::Range<framepos_t> range () const { - return Evoral::Range<framepos_t> (first_frame(), last_frame()); + Evoral::Range<samplepos_t> range () const { + return Evoral::Range<samplepos_t> (first_sample(), last_sample()); } bool hidden () const { return _hidden; } @@ -185,8 +185,8 @@ class LIBARDOUR_API Region void suspend_property_changes (); - bool covers (framepos_t frame) const { - return first_frame() <= frame && frame <= last_frame(); + bool covers (samplepos_t sample) const { + return first_sample() <= sample && sample <= last_sample(); } /** @return coverage of this region with the given range; @@ -195,8 +195,8 @@ class LIBARDOUR_API Region * OverlapEnd: the range overlaps the end of this region. * OverlapExternal: the range overlaps all of this region. */ - Evoral::OverlapType coverage (framepos_t start, framepos_t end) const { - return Evoral::coverage (first_frame(), last_frame(), start, end); + Evoral::OverlapType coverage (samplepos_t start, samplepos_t end) const { + return Evoral::coverage (first_sample(), last_sample(), start, end); } bool equivalent (boost::shared_ptr<const Region>) const; @@ -213,27 +213,27 @@ class LIBARDOUR_API Region /* EDITING OPERATIONS */ - void set_length (framecnt_t, const int32_t sub_num); - void set_start (framepos_t); - void set_position (framepos_t, int32_t sub_num = 0); + void set_length (samplecnt_t, const int32_t sub_num); + void set_start (samplepos_t); + void set_position (samplepos_t, int32_t sub_num = 0); void set_position_music (double qn); - void set_initial_position (framepos_t); - void special_set_position (framepos_t); + void set_initial_position (samplepos_t); + void special_set_position (samplepos_t); virtual void update_after_tempo_map_change (bool send_change = true); - void nudge_position (frameoffset_t); + void nudge_position (sampleoffset_t); bool at_natural_position () const; void move_to_natural_position (); - void move_start (frameoffset_t distance, const int32_t sub_num = 0); - void trim_front (framepos_t new_position, const int32_t sub_num = 0); - void trim_end (framepos_t new_position, const int32_t sub_num = 0); - void trim_to (framepos_t position, framecnt_t length, const int32_t sub_num = 0); + void move_start (sampleoffset_t distance, const int32_t sub_num = 0); + void trim_front (samplepos_t new_position, const int32_t sub_num = 0); + void trim_end (samplepos_t new_position, const int32_t sub_num = 0); + void trim_to (samplepos_t position, samplecnt_t length, const int32_t sub_num = 0); - virtual void fade_range (framepos_t, framepos_t) {} + virtual void fade_range (samplepos_t, samplepos_t) {} - void cut_front (framepos_t new_position, const int32_t sub_num = 0); - void cut_end (framepos_t new_position, const int32_t sub_num = 0); + void cut_front (samplepos_t new_position, const int32_t sub_num = 0); + void cut_end (samplepos_t new_position, const int32_t sub_num = 0); void set_layer (layer_t l); /* ONLY Playlist can call this */ void raise (); @@ -241,7 +241,7 @@ class LIBARDOUR_API Region void raise_to_top (); void lower_to_bottom (); - void set_sync_position (framepos_t n); + void set_sync_position (samplepos_t n); void clear_sync_position (); void set_hidden (bool yn); void set_muted (bool yn); @@ -292,7 +292,7 @@ class LIBARDOUR_API Region virtual bool is_dependent() const { return false; } virtual bool depends_on (boost::shared_ptr<Region> /*other*/) const { return false; } - virtual void add_transient (framepos_t) { + virtual void add_transient (samplepos_t) { // no transients, but its OK } @@ -300,11 +300,11 @@ class LIBARDOUR_API Region // no transients, but its OK } - virtual void update_transient (framepos_t /* old_position */, framepos_t /* new_position */) { + virtual void update_transient (samplepos_t /* old_position */, samplepos_t /* new_position */) { // no transients, but its OK } - virtual void remove_transient (framepos_t /* where */) { + virtual void remove_transient (samplepos_t /* where */) { // no transients, but its OK } @@ -354,13 +354,13 @@ class LIBARDOUR_API Region Region (boost::shared_ptr<const Region>); /** Construct a region from another region, at an offset within that region */ - Region (boost::shared_ptr<const Region>, ARDOUR::MusicFrame start_offset); + Region (boost::shared_ptr<const Region>, ARDOUR::MusicSample start_offset); /** Construct a region as a copy of another region, but with different sources */ Region (boost::shared_ptr<const Region>, const SourceList&); /** Constructor for derived types only */ - Region (Session& s, framepos_t start, framecnt_t length, const std::string& name, DataType); + Region (Session& s, samplepos_t start, samplecnt_t length, const std::string& name, DataType); virtual bool can_trim_start_before_source_start () const { return false; @@ -371,11 +371,11 @@ class LIBARDOUR_API Region void send_change (const PBD::PropertyChange&); virtual int _set_state (const XMLNode&, int version, PBD::PropertyChange& what_changed, bool send_signal); void post_set (const PBD::PropertyChange&); - virtual void set_position_internal (framepos_t pos, bool allow_bbt_recompute, const int32_t sub_num); + virtual void set_position_internal (samplepos_t pos, bool allow_bbt_recompute, const int32_t sub_num); virtual void set_position_music_internal (double qn); - virtual void set_length_internal (framecnt_t, const int32_t sub_num); - virtual void set_start_internal (framecnt_t, const int32_t sub_num = 0); - bool verify_start_and_length (framepos_t, framecnt_t&); + virtual void set_length_internal (samplecnt_t, const int32_t sub_num); + virtual void set_start_internal (samplecnt_t, const int32_t sub_num = 0); + bool verify_start_and_length (samplepos_t, samplecnt_t&); void first_edit (); DataType _type; @@ -384,12 +384,12 @@ class LIBARDOUR_API Region PBD::Property<bool> _left_of_split; PBD::Property<bool> _right_of_split; PBD::Property<bool> _valid_transients; - PBD::Property<framepos_t> _start; - PBD::Property<framecnt_t> _length; - PBD::Property<framepos_t> _position; + PBD::Property<samplepos_t> _start; + PBD::Property<samplecnt_t> _length; + PBD::Property<samplepos_t> _position; PBD::Property<double> _beat; /** Sync position relative to the start of our file */ - PBD::Property<framepos_t> _sync_position; + PBD::Property<samplepos_t> _sync_position; double _quarter_note; @@ -399,31 +399,31 @@ class LIBARDOUR_API Region boost::weak_ptr<ARDOUR::Playlist> _playlist; - void merge_features (AnalysisFeatureList&, const AnalysisFeatureList&, const frameoffset_t) const; + void merge_features (AnalysisFeatureList&, const AnalysisFeatureList&, const sampleoffset_t) const; AnalysisFeatureList _onsets; // used by the Ferret (Aubio OnsetDetector) // _transient_user_start is covered by _valid_transients AnalysisFeatureList _user_transients; // user added - framepos_t _transient_user_start; // region's _start relative to user_transients + samplepos_t _transient_user_start; // region's _start relative to user_transients // these are used by Playlist::find_next_transient() in absence of onsets AnalysisFeatureList _transients; // Source Analysis (QM Transient), user read-only - framepos_t _transient_analysis_start; - framepos_t _transient_analysis_end; + samplepos_t _transient_analysis_start; + samplepos_t _transient_analysis_end; private: void mid_thaw (const PBD::PropertyChange&); - virtual void trim_to_internal (framepos_t position, framecnt_t length, const int32_t sub_num); - void modify_front (framepos_t new_position, bool reset_fade, const int32_t sub_num); - void modify_end (framepos_t new_position, bool reset_fade, const int32_t sub_num); + virtual void trim_to_internal (samplepos_t position, samplecnt_t length, const int32_t sub_num); + void modify_front (samplepos_t new_position, bool reset_fade, const int32_t sub_num); + void modify_end (samplepos_t new_position, bool reset_fade, const int32_t sub_num); void maybe_uncopy (); - bool verify_start (framepos_t); - bool verify_start_mutable (framepos_t&_start); - bool verify_length (framecnt_t&); + bool verify_start (samplepos_t); + bool verify_start_mutable (samplepos_t&_start); + bool verify_length (samplecnt_t&); virtual void recompute_at_start () = 0; virtual void recompute_at_end () = 0; @@ -438,15 +438,15 @@ class LIBARDOUR_API Region PBD::Property<bool> _external; PBD::Property<bool> _hidden; PBD::Property<bool> _position_locked; - PBD::Property<framepos_t> _ancestral_start; - PBD::Property<framecnt_t> _ancestral_length; + PBD::Property<samplepos_t> _ancestral_start; + PBD::Property<samplecnt_t> _ancestral_length; PBD::Property<float> _stretch; PBD::Property<float> _shift; PBD::EnumProperty<PositionLockStyle> _position_lock_style; PBD::Property<uint64_t> _layering_index; - framecnt_t _last_length; - framepos_t _last_position; + samplecnt_t _last_length; + samplepos_t _last_position; mutable RegionEditState _first_edit; layer_t _layer; diff --git a/libs/ardour/ardour/region_factory.h b/libs/ardour/ardour/region_factory.h index edfbfba6f0..c661fed019 100644 --- a/libs/ardour/ardour/region_factory.h +++ b/libs/ardour/ardour/region_factory.h @@ -75,7 +75,7 @@ public: static boost::shared_ptr<Region> create (boost::shared_ptr<Region> other, const PBD::PropertyList&, bool announce = true); /** create a copy of @param other starting at @param offset within @param other */ - static boost::shared_ptr<Region> create (boost::shared_ptr<Region> other, ARDOUR::MusicFrame offset, + static boost::shared_ptr<Region> create (boost::shared_ptr<Region> other, ARDOUR::MusicSample offset, const PBD::PropertyList&, bool announce = true); /** create a "copy" of @param other but using a different set of sources @param srcs */ static boost::shared_ptr<Region> create (boost::shared_ptr<Region> other, const SourceList& srcs, diff --git a/libs/ardour/ardour/resampled_source.h b/libs/ardour/ardour/resampled_source.h index 0c90581a29..2bf002befe 100644 --- a/libs/ardour/ardour/resampled_source.h +++ b/libs/ardour/ardour/resampled_source.h @@ -31,17 +31,17 @@ namespace ARDOUR { class LIBARDOUR_API ResampledImportableSource : public ImportableSource { public: - ResampledImportableSource (boost::shared_ptr<ImportableSource>, framecnt_t rate, SrcQuality); + ResampledImportableSource (boost::shared_ptr<ImportableSource>, samplecnt_t rate, SrcQuality); ~ResampledImportableSource (); - framecnt_t read (Sample* buffer, framecnt_t nframes); + samplecnt_t read (Sample* buffer, samplecnt_t nframes); float ratio() const { return _src_data.src_ratio; } uint32_t channels() const { return source->channels(); } - framecnt_t length() const { return source->length(); } - framecnt_t samplerate() const { return source->samplerate(); } - void seek (framepos_t); - framepos_t natural_position() const; + samplecnt_t length() const { return source->length(); } + samplecnt_t samplerate() const { return source->samplerate(); } + void seek (samplepos_t); + samplepos_t natural_position() const; bool clamped_at_unity () const { /* resampling may generate inter-sample peaks with magnitude > 1 */ diff --git a/libs/ardour/ardour/return.h b/libs/ardour/ardour/return.h index d42a280ffb..18845f9815 100644 --- a/libs/ardour/ardour/return.h +++ b/libs/ardour/ardour/return.h @@ -42,7 +42,7 @@ public: uint32_t bit_slot() const { return _bitslot; } - void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool); + void run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool); boost::shared_ptr<Amp> amp() const { return _amp; } boost::shared_ptr<PeakMeter> meter() const { return _meter; } diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index dc693d3a7e..829ebd435b 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -133,26 +133,26 @@ public: /* these are the core of the API of a Route. see the protected sections as well */ - virtual int roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, + virtual int roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, int declick, bool& need_butler); - virtual int no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, + virtual int no_roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, bool state_changing); - virtual int silent_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, + virtual int silent_roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, bool& need_butler); virtual bool can_record() { return false; } - virtual void non_realtime_transport_stop (framepos_t now, bool flush); + virtual void non_realtime_transport_stop (samplepos_t now, bool flush); virtual void realtime_handle_transport_stopped () {} virtual void realtime_locate () {} - virtual void non_realtime_locate (framepos_t); + virtual void non_realtime_locate (samplepos_t); virtual void set_pending_declick (int); /* end of vfunc-based API */ - void shift (framepos_t, framecnt_t); + void shift (samplepos_t, samplecnt_t); void set_trim (gain_t val, PBD::Controllable::GroupControlDisposition); @@ -336,15 +336,15 @@ public: */ bool remove_sidechain (boost::shared_ptr<Processor> proc) { return add_remove_sidechain (proc, false); } - framecnt_t set_private_port_latencies (bool playback) const; - void set_public_port_latencies (framecnt_t, bool playback) const; + samplecnt_t set_private_port_latencies (bool playback) const; + void set_public_port_latencies (samplecnt_t, bool playback) const; - framecnt_t update_signal_latency(); - virtual void set_latency_compensation (framecnt_t); + samplecnt_t update_signal_latency(); + virtual void set_latency_compensation (samplecnt_t); - void set_user_latency (framecnt_t); - framecnt_t initial_delay() const { return _initial_delay; } - framecnt_t signal_latency() const { return _signal_latency; } + void set_user_latency (samplecnt_t); + samplecnt_t initial_delay() const { return _initial_delay; } + samplecnt_t signal_latency() const { return _signal_latency; } PBD::Signal0<void> active_changed; PBD::Signal0<void> denormal_protection_changed; @@ -582,7 +582,7 @@ public: /* can only be executed by a route for which is_monitor() is true * (i.e. the monitor out) */ - void monitor_run (framepos_t start_frame, framepos_t end_frame, + void monitor_run (samplepos_t start_sample, samplepos_t end_sample, pframes_t nframes, int declick); bool slaved_to (boost::shared_ptr<VCA>) const; @@ -599,39 +599,39 @@ public: void curve_reallocate (); virtual void set_block_size (pframes_t nframes); - virtual framecnt_t check_initial_delay (framecnt_t nframes, framepos_t&) { return nframes; } + virtual samplecnt_t check_initial_delay (samplecnt_t nframes, samplepos_t&) { return nframes; } void fill_buffers_with_input (BufferSet& bufs, boost::shared_ptr<IO> io, pframes_t nframes); - void passthru (BufferSet&, framepos_t start_frame, framepos_t end_frame, pframes_t nframes, int declick); + void passthru (BufferSet&, samplepos_t start_sample, samplepos_t end_sample, pframes_t nframes, int declick); - virtual void write_out_of_band_data (BufferSet& /* bufs */, framepos_t /* start_frame */, framepos_t /* end_frame */, - framecnt_t /* nframes */) {} + virtual void write_out_of_band_data (BufferSet& /* bufs */, samplepos_t /* start_sample */, samplepos_t /* end_sample */, + samplecnt_t /* nframes */) {} virtual void process_output_buffers (BufferSet& bufs, - framepos_t start_frame, framepos_t end_frame, + samplepos_t start_sample, samplepos_t end_sample, pframes_t nframes, int declick, bool gain_automation_ok); - void flush_processor_buffers_locked (framecnt_t nframes); + void flush_processor_buffers_locked (samplecnt_t nframes); virtual void bounce_process (BufferSet& bufs, - framepos_t start_frame, framecnt_t nframes, + samplepos_t start_sample, samplecnt_t nframes, boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze); - framecnt_t bounce_get_latency (boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze) const; + samplecnt_t bounce_get_latency (boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze) const; ChanCount bounce_get_output_streams (ChanCount &cc, boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze) const; boost::shared_ptr<IO> _input; boost::shared_ptr<IO> _output; bool _active; - framecnt_t _signal_latency; - framecnt_t _signal_latency_at_amp_position; - framecnt_t _signal_latency_at_trim_position; - framecnt_t _initial_delay; - framecnt_t _roll_delay; + samplecnt_t _signal_latency; + samplecnt_t _signal_latency_at_amp_position; + samplecnt_t _signal_latency_at_trim_position; + samplecnt_t _initial_delay; + samplecnt_t _roll_delay; ProcessorList _processors; mutable Glib::Threads::RWLock _processor_lock; @@ -686,11 +686,11 @@ public: int configure_processors (ProcessorStreams*); - void passthru_silence (framepos_t start_frame, framepos_t end_frame, + void passthru_silence (samplepos_t start_sample, samplepos_t end_sample, pframes_t nframes, int declick); - void silence (framecnt_t); - void silence_unlocked (framecnt_t); + void silence (samplecnt_t); + void silence_unlocked (samplecnt_t); ChanCount processor_max_streams; ChanCount processor_out_streams; @@ -698,7 +698,7 @@ public: uint32_t pans_required() const; ChanCount n_process_buffers (); - virtual void maybe_declick (BufferSet&, framecnt_t, int); + virtual void maybe_declick (BufferSet&, samplecnt_t, int); boost::shared_ptr<GainControl> _gain_control; boost::shared_ptr<Amp> _amp; @@ -746,7 +746,7 @@ private: void set_self_solo (bool yn); void set_processor_positions (); - framecnt_t update_port_latencies (PortSet& ports, PortSet& feeders, bool playback, framecnt_t) const; + samplecnt_t update_port_latencies (PortSet& ports, PortSet& feeders, bool playback, samplecnt_t) const; void setup_invisible_processors (); diff --git a/libs/ardour/ardour/scene_changer.h b/libs/ardour/ardour/scene_changer.h index 4b837f4cdb..86a545af14 100644 --- a/libs/ardour/ardour/scene_changer.h +++ b/libs/ardour/ardour/scene_changer.h @@ -46,8 +46,8 @@ class SceneChanger : public SessionHandleRef SceneChanger (Session& s) : SessionHandleRef (s) {} virtual ~SceneChanger () {}; - virtual void run (framepos_t start, framepos_t end) = 0; - virtual void locate (framepos_t where) = 0; + virtual void run (samplepos_t start, samplepos_t end) = 0; + virtual void locate (samplepos_t where) = 0; }; } /* namespace */ diff --git a/libs/ardour/ardour/send.h b/libs/ardour/ardour/send.h index 002397f0cd..4594d38847 100644 --- a/libs/ardour/ardour/send.h +++ b/libs/ardour/ardour/send.h @@ -61,16 +61,16 @@ class LIBARDOUR_API Send : public Delivery uint32_t pans_required() const { return _configured_input.n_audio(); } - void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool); + void run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool); bool can_support_io_configuration (const ChanCount& in, ChanCount& out); bool configure_io (ChanCount in, ChanCount out); /* latency compensation */ - void set_delay_in (framecnt_t); - void set_delay_out (framecnt_t); - framecnt_t get_delay_in () const { return _delay_in; } - framecnt_t get_delay_out () const { return _delay_out; } + void set_delay_in (samplecnt_t); + void set_delay_out (samplecnt_t); + samplecnt_t get_delay_in () const { return _delay_in; } + samplecnt_t get_delay_out () const { return _delay_out; } void activate (); void deactivate (); @@ -97,8 +97,8 @@ class LIBARDOUR_API Send : public Delivery uint32_t _bitslot; - framecnt_t _delay_in; - framecnt_t _delay_out; + samplecnt_t _delay_in; + samplecnt_t _delay_out; bool _remove_on_disconnect; }; diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 02534c682f..b052ba5b69 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -300,7 +300,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop StripableList get_stripables () const; boost::shared_ptr<RouteList> get_tracks() const; boost::shared_ptr<RouteList> get_routes_with_internal_returns() const; - boost::shared_ptr<RouteList> get_routes_with_regions_at (framepos_t const) const; + boost::shared_ptr<RouteList> get_routes_with_regions_at (samplepos_t const) const; uint32_t nstripables (bool with_monitor = false) const; uint32_t nroutes() const { return routes.reader()->size(); } @@ -385,8 +385,8 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop */ PBD::Signal0<void> TransportStateChange; - PBD::Signal1<void,framepos_t> PositionChanged; /* sent after any non-sequential motion */ - PBD::Signal1<void,framepos_t> Xrun; + PBD::Signal1<void,samplepos_t> PositionChanged; /* sent after any non-sequential motion */ + PBD::Signal1<void,samplepos_t> Xrun; PBD::Signal0<void> TransportLooped; /** emitted when a locate has occurred */ @@ -414,15 +414,15 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop void queue_event (SessionEvent*); - void request_roll_at_and_return (framepos_t start, framepos_t return_to); - void request_bounded_roll (framepos_t start, framepos_t end); + void request_roll_at_and_return (samplepos_t start, samplepos_t return_to); + void request_bounded_roll (samplepos_t start, samplepos_t end); void request_stop (bool abort = false, bool clear_state = false); - void request_locate (framepos_t frame, bool with_roll = false); + void request_locate (samplepos_t sample, bool with_roll = false); void request_play_loop (bool yn, bool leave_rolling = false); bool get_play_loop () const { return play_loop; } - framepos_t last_transport_start () const { return _last_roll_location; } + samplepos_t last_transport_start () const { return _last_roll_location; } void goto_end (); void goto_start (bool and_roll = false); void use_rf_shuttle_speed (); @@ -440,16 +440,16 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop int wipe (); - framepos_t current_end_frame () const; - framepos_t current_start_frame () const; + samplepos_t current_end_sample () const; + samplepos_t current_start_sample () const; /** "actual" sample rate of session, set by current audioengine rate, pullup/down etc. */ - framecnt_t frame_rate () const { return _current_frame_rate; } + samplecnt_t sample_rate () const { return _current_sample_rate; } /** "native" sample rate of session, regardless of current audioengine rate, pullup/down etc */ - framecnt_t nominal_frame_rate () const { return _nominal_frame_rate; } - framecnt_t frames_per_hour () const { return _frames_per_hour; } + samplecnt_t nominal_sample_rate () const { return _nominal_sample_rate; } + samplecnt_t frames_per_hour () const { return _frames_per_hour; } double samples_per_timecode_frame() const { return _samples_per_timecode_frame; } - framecnt_t timecode_frames_per_hour() const { return _timecode_frames_per_hour; } + samplecnt_t timecode_frames_per_hour() const { return _timecode_frames_per_hour; } MIDI::byte get_mtc_timecode_bits() const { return mtc_timecode_bits; /* encoding of SMTPE type for MTC */ @@ -468,16 +468,16 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop void set_auto_punch_location (Location *); void set_auto_loop_location (Location *); - void set_session_extents (framepos_t start, framepos_t end); + void set_session_extents (samplepos_t start, samplepos_t end); bool end_is_free () const { return _session_range_end_is_free; } void set_end_is_free (bool); int location_name(std::string& result, std::string base = std::string("")); pframes_t get_block_size() const { return current_block_size; } - framecnt_t worst_output_latency () const { return _worst_output_latency; } - framecnt_t worst_input_latency () const { return _worst_input_latency; } - framecnt_t worst_track_latency () const { return _worst_track_latency; } - framecnt_t worst_playback_latency () const { return _worst_output_latency + _worst_track_latency; } + samplecnt_t worst_output_latency () const { return _worst_output_latency; } + samplecnt_t worst_input_latency () const { return _worst_input_latency; } + samplecnt_t worst_track_latency () const { return _worst_track_latency; } + samplecnt_t worst_playback_latency () const { return _worst_output_latency + _worst_track_latency; } struct SaveAs { std::string new_parent_folder; /* parent folder where new session folder will be created */ @@ -677,11 +677,11 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop /* Time */ - framepos_t transport_frame () const {return _transport_frame; } - framepos_t record_location () const {return _last_record_location; } - framepos_t audible_frame (bool* latent_locate = NULL) const; - framepos_t requested_return_frame() const { return _requested_return_frame; } - void set_requested_return_frame(framepos_t return_to); + samplepos_t transport_sample () const {return _transport_sample; } + samplepos_t record_location () const {return _last_record_location; } + samplepos_t audible_sample (bool* latent_locate = NULL) const; + samplepos_t requested_return_sample() const { return _requested_return_sample; } + void set_requested_return_sample(samplepos_t return_to); enum PullupFormat { pullup_Plus4Plus1, @@ -697,21 +697,21 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop void sync_time_vars(); - void bbt_time (framepos_t when, Timecode::BBT_Time&); - void timecode_to_sample(Timecode::Time& timecode, framepos_t& sample, bool use_offset, bool use_subframes) const; - void sample_to_timecode(framepos_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const; + void bbt_time (samplepos_t when, Timecode::BBT_Time&); + void timecode_to_sample(Timecode::Time& timecode, samplepos_t& sample, bool use_offset, bool use_subframes) const; + void sample_to_timecode(samplepos_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const; void timecode_time (Timecode::Time &); - void timecode_time (framepos_t when, Timecode::Time&); - void timecode_time_subframes (framepos_t when, Timecode::Time&); + void timecode_time (samplepos_t when, Timecode::Time&); + void timecode_time_subframes (samplepos_t when, Timecode::Time&); - void timecode_duration (framecnt_t, Timecode::Time&) const; - void timecode_duration_string (char *, size_t len, framecnt_t) const; + void timecode_duration (samplecnt_t, Timecode::Time&) const; + void timecode_duration_string (char *, size_t len, samplecnt_t) const; - framecnt_t convert_to_frames (AnyTime const & position); - framecnt_t any_duration_to_frames (framepos_t position, AnyTime const & duration); + samplecnt_t convert_to_samples (AnyTime const & position); + samplecnt_t any_duration_to_samples (samplepos_t position, AnyTime const & duration); - static PBD::Signal1<void, framepos_t> StartTimeChanged; - static PBD::Signal1<void, framepos_t> EndTimeChanged; + static PBD::Signal1<void, samplepos_t> StartTimeChanged; + static PBD::Signal1<void, samplepos_t> EndTimeChanged; void request_sync_source (Slave*); bool synced_to_engine() const { return _slave && config.get_external_sync() && Config->get_sync_source() == Engine; } @@ -747,9 +747,9 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop boost::shared_ptr<ExportHandler> get_export_handler (); boost::shared_ptr<ExportStatus> get_export_status (); - int start_audio_export (framepos_t position, bool realtime = false, bool region_export = false, bool comensate_master_latency = false); + int start_audio_export (samplepos_t position, bool realtime = false, bool region_export = false, bool comensate_master_latency = false); - PBD::Signal1<int, framecnt_t> ProcessExport; + PBD::Signal1<int, samplecnt_t> ProcessExport; static PBD::Signal2<void,std::string, std::string> Exported; void add_source (boost::shared_ptr<Source>); @@ -779,10 +779,10 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop /** handlers should return 0 for "ignore the rate mismatch", !0 for "do not use this session" */ - static PBD::Signal2<int, framecnt_t, framecnt_t> AskAboutSampleRateMismatch; + static PBD::Signal2<int, samplecnt_t, samplecnt_t> AskAboutSampleRateMismatch; /** non interactive message */ - static PBD::Signal2<void, framecnt_t, framecnt_t> NotifyAboutSampleRateMismatch; + static PBD::Signal2<void, samplecnt_t, samplecnt_t> NotifyAboutSampleRateMismatch; /** handlers should return !0 for use pending state, 0 for ignore it. */ @@ -825,7 +825,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop /* flattening stuff */ - boost::shared_ptr<Region> write_one_track (Track&, framepos_t start, framepos_t end, + boost::shared_ptr<Region> write_one_track (Track&, samplepos_t start, samplepos_t end, bool overwrite, std::vector<boost::shared_ptr<Source> >&, InterThreadInfo& wot, boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze); @@ -910,7 +910,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop /* s/w "RAID" management */ - boost::optional<framecnt_t> available_capture_duration(); + boost::optional<samplecnt_t> available_capture_duration(); /* I/O bundles */ @@ -1004,25 +1004,25 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop void request_cancel_play_range (); bool get_play_range () const { return _play_range; } - void maybe_update_session_range (framepos_t, framepos_t); + void maybe_update_session_range (samplepos_t, samplepos_t); /* preroll */ - framecnt_t preroll_samples (framepos_t) const; + samplecnt_t preroll_samples (samplepos_t) const; - void request_preroll_record_punch (framepos_t start, framecnt_t preroll); - void request_preroll_record_trim (framepos_t start, framecnt_t preroll); + void request_preroll_record_punch (samplepos_t start, samplecnt_t preroll); + void request_preroll_record_trim (samplepos_t start, samplecnt_t preroll); void request_count_in_record (); - framepos_t preroll_record_punch_pos () const { return _preroll_record_punch_pos; } + samplepos_t preroll_record_punch_pos () const { return _preroll_record_punch_pos; } bool preroll_record_punch_enabled () const { return _preroll_record_punch_pos >= 0; } - framecnt_t preroll_record_trim_len () const { return _preroll_record_trim_len; } + samplecnt_t preroll_record_trim_len () const { return _preroll_record_trim_len; } /* temporary hacks to allow selection to be pushed from GUI into backend. Whenever we move the selection object into libardour, these will go away. */ - void set_range_selection (framepos_t start, framepos_t end); - void set_object_selection (framepos_t start, framepos_t end); + void set_range_selection (samplepos_t start, samplepos_t end); + void set_object_selection (samplepos_t start, samplepos_t end); void clear_range_selection (); void clear_object_selection (); @@ -1115,7 +1115,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop boost::shared_ptr<SessionPlaylists> playlists; - void send_mmc_locate (framepos_t); + void send_mmc_locate (samplepos_t); void queue_full_time_code () { _send_timecode_update = true; } void queue_song_position_pointer () { /* currently does nothing */ } @@ -1206,7 +1206,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop protected: friend class AudioEngine; void set_block_size (pframes_t nframes); - void set_frame_rate (framecnt_t nframes); + void set_sample_rate (samplecnt_t nframes); #ifdef USE_TRACKS_CODE_FEATURES void reconnect_existing_routes (bool withLock, bool reconnect_master = true, bool reconnect_inputs = true, bool reconnect_outputs = true); #endif @@ -1236,12 +1236,12 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop process_function_type last_process_function; bool _bounce_processing_active; bool waiting_for_sync_offset; - framecnt_t _base_frame_rate; // sample-rate of the session at creation time, "native" SR - framecnt_t _nominal_frame_rate; // overridden by audioengine setting - framecnt_t _current_frame_rate; // this includes video pullup offset + samplecnt_t _base_sample_rate; // sample-rate of the session at creation time, "native" SR + samplecnt_t _nominal_sample_rate; // overridden by audioengine setting + samplecnt_t _current_sample_rate; // this includes video pullup offset int transport_sub_state; mutable gint _record_status; - framepos_t _transport_frame; + samplepos_t _transport_sample; gint _seek_counter; Location* _session_range_location; ///< session range, or 0 if there is nothing in the session yet bool _session_range_end_is_free; @@ -1257,13 +1257,13 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop CubicInterpolation interpolation; bool auto_play_legal; - framepos_t _last_slave_transport_frame; - framecnt_t maximum_output_latency; - framepos_t _requested_return_frame; + samplepos_t _last_slave_transport_sample; + samplecnt_t maximum_output_latency; + samplepos_t _requested_return_sample; pframes_t current_block_size; - framecnt_t _worst_output_latency; - framecnt_t _worst_input_latency; - framecnt_t _worst_track_latency; + samplecnt_t _worst_output_latency; + samplecnt_t _worst_input_latency; + samplecnt_t _worst_track_latency; bool _have_captured; bool _non_soloed_outs_muted; bool _listening; @@ -1306,7 +1306,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop void unblock_processing() { g_atomic_int_set (&processing_prohibited, 0); } bool processing_blocked() const { return g_atomic_int_get (&processing_prohibited); } - static const framecnt_t bounce_chunk_size; + static const samplecnt_t bounce_chunk_size; /* slave tracking */ @@ -1320,26 +1320,26 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop SlaveState _slave_state; gint _mtc_active; gint _ltc_active; - framepos_t slave_wait_end; + samplepos_t slave_wait_end; void reset_slave_state (); bool follow_slave (pframes_t); - void calculate_moving_average_of_slave_delta (int dir, framecnt_t this_delta); - void track_slave_state (float slave_speed, framepos_t slave_transport_frame, framecnt_t this_delta); + void calculate_moving_average_of_slave_delta (int dir, samplecnt_t this_delta); + void track_slave_state (float slave_speed, samplepos_t slave_transport_sample, samplecnt_t this_delta); void switch_to_sync_source (SyncSource); /* !RT context */ void drop_sync_source (); /* !RT context */ void use_sync_source (Slave*); /* RT context */ bool post_export_sync; - framepos_t post_export_position; + samplepos_t post_export_position; bool _exporting; bool _export_rolling; bool _realtime_export; bool _region_export; - framepos_t _export_preroll; - framepos_t _export_latency; + samplepos_t _export_preroll; + samplepos_t _export_latency; boost::shared_ptr<ExportHandler> export_handler; boost::shared_ptr<ExportStatus> export_status; @@ -1380,7 +1380,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop } } - bool maybe_stop (framepos_t limit); + bool maybe_stop (samplepos_t limit); bool maybe_sync_start (pframes_t &); void check_declick_out (); @@ -1389,13 +1389,13 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop std::string _name; bool _is_new; bool _send_qf_mtc; - /** Number of process frames since the last MTC output (when sending MTC); used to + /** Number of process samples since the last MTC output (when sending MTC); used to * know when to send full MTC messages every so often. */ pframes_t _pframes_since_last_mtc; bool play_loop; bool loop_changing; - framepos_t last_loopend; + samplepos_t last_loopend; boost::scoped_ptr<SessionDirectory> _session_dir; @@ -1421,13 +1421,13 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop int load_state (std::string snapshot_name); static int parse_stateful_loading_version (const std::string&); - framepos_t _last_roll_location; - /** the session frame time at which we last rolled, located, or changed transport direction */ - framepos_t _last_roll_or_reversal_location; - framepos_t _last_record_location; + samplepos_t _last_roll_location; + /** the session sample time at which we last rolled, located, or changed transport direction */ + samplepos_t _last_roll_or_reversal_location; + samplepos_t _last_record_location; bool pending_locate_roll; - framepos_t pending_locate_frame; + samplepos_t pending_locate_sample; bool pending_locate_flush; bool pending_abort; bool pending_auto_loop; @@ -1470,7 +1470,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop uint32_t rf_scale; void set_rf_speed (float speed); - void reset_rf_scale (framecnt_t frames_moved); + void reset_rf_scale (samplecnt_t samples_moved); Locations* _locations; void location_added (Location*); @@ -1494,7 +1494,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop PBD::ScopedConnectionList loop_connections; void auto_loop_changed (Location *); - void auto_loop_declick_range (Location *, framepos_t &, framepos_t &); + void auto_loop_declick_range (Location *, samplepos_t &, samplepos_t &); int ensure_engine (uint32_t desired_sample_rate, bool); void pre_engine_init (std::string path); @@ -1509,19 +1509,19 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop void enable_record (); - void increment_transport_position (framecnt_t val) { - if (max_framepos - val < _transport_frame) { - _transport_frame = max_framepos; + void increment_transport_position (samplecnt_t val) { + if (max_samplepos - val < _transport_sample) { + _transport_sample = max_samplepos; } else { - _transport_frame += val; + _transport_sample += val; } } - void decrement_transport_position (framecnt_t val) { - if (val < _transport_frame) { - _transport_frame -= val; + void decrement_transport_position (samplecnt_t val) { + if (val < _transport_sample) { + _transport_sample -= val; } else { - _transport_frame = 0; + _transport_sample = 0; } } @@ -1633,19 +1633,19 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop Timecode::Time transmitting_timecode_time; int next_quarter_frame_to_send; - double _samples_per_timecode_frame; /* has to be floating point because of drop frame */ - framecnt_t _frames_per_hour; - framecnt_t _timecode_frames_per_hour; + double _samples_per_timecode_frame; /* has to be floating point because of drop sample */ + samplecnt_t _frames_per_hour; + samplecnt_t _timecode_frames_per_hour; /* cache the most-recently requested time conversions. This helps when we - * have multiple clocks showing the same time (e.g. the transport frame) */ + * have multiple clocks showing the same time (e.g. the transport sample) */ bool last_timecode_valid; - framepos_t last_timecode_when; + samplepos_t last_timecode_when; Timecode::Time last_timecode; - bool _send_timecode_update; ///< Flag to send a full frame (Timecode) MTC message this cycle + bool _send_timecode_update; ///< Flag to send a full sample (Timecode) MTC message this cycle - int send_midi_time_code_for_cycle (framepos_t, framepos_t, pframes_t nframes); + int send_midi_time_code_for_cycle (samplepos_t, samplepos_t, pframes_t nframes); LTCEncoder* ltc_encoder; ltcsnd_sample_t* ltc_enc_buf; @@ -1656,13 +1656,13 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop double ltc_speed; int32_t ltc_enc_byte; - framepos_t ltc_enc_pos; + samplepos_t ltc_enc_pos; double ltc_enc_cnt; - framepos_t ltc_enc_off; + samplepos_t ltc_enc_off; bool restarting; - framepos_t ltc_prev_cycle; + samplepos_t ltc_prev_cycle; - framepos_t ltc_timecode_offset; + samplepos_t ltc_timecode_offset; bool ltc_timecode_negative_offset; LatencyRange ltc_out_latency; @@ -1673,7 +1673,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop void ltc_tx_resync_latency(); void ltc_tx_recalculate_position(); void ltc_tx_parse_offset(); - void ltc_tx_send_time_code_for_cycle (framepos_t, framepos_t, double, double, pframes_t nframes); + void ltc_tx_send_time_code_for_cycle (samplepos_t, samplepos_t, double, double, pframes_t nframes); PBD::ScopedConnectionList ltc_tx_connections; @@ -1693,11 +1693,11 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop void unset_play_loop (); void overwrite_some_buffers (Track *); void flush_all_inserts (); - int micro_locate (framecnt_t distance); - void locate (framepos_t, bool with_roll, bool with_flush, bool with_loop=false, bool force=false, bool with_mmc=true); - void start_locate (framepos_t, bool with_roll, bool with_flush, bool for_loop_enabled=false, bool force=false); - void force_locate (framepos_t frame, bool with_roll = false); - void set_transport_speed (double speed, framepos_t destination_frame, bool abort = false, bool clear_state = false, bool as_default = false); + int micro_locate (samplecnt_t distance); + void locate (samplepos_t, bool with_roll, bool with_flush, bool with_loop=false, bool force=false, bool with_mmc=true); + void start_locate (samplepos_t, bool with_roll, bool with_flush, bool for_loop_enabled=false, bool force=false); + void force_locate (samplepos_t sample, bool with_roll = false); + void set_transport_speed (double speed, samplepos_t destination_sample, bool abort = false, bool clear_state = false, bool as_default = false); void stop_transport (bool abort = false, bool clear_state = false); void start_transport (); void realtime_stop (bool abort, bool clear_state); @@ -1711,15 +1711,15 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop void engine_halted (); void xrun_recovery (); void set_track_loop (bool); - bool select_playhead_priority_target (framepos_t&); + bool select_playhead_priority_target (samplepos_t&); void follow_playhead_priority (); /* These are synchronous and so can only be called from within the process * cycle */ - int send_full_time_code (framepos_t, pframes_t nframes); - void send_song_position_pointer (framepos_t); + int send_full_time_code (samplepos_t, pframes_t nframes); + void send_song_position_pointer (samplepos_t); TempoMap *_tempo_map; void tempo_map_changed (const PBD::PropertyChange&); @@ -1807,8 +1807,8 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop void remove_playlist (boost::weak_ptr<Playlist>); void track_playlist_changed (boost::weak_ptr<Track>); void playlist_region_added (boost::weak_ptr<Region>); - void playlist_ranges_moved (std::list<Evoral::RangeMove<framepos_t> > const &); - void playlist_regions_extended (std::list<Evoral::Range<framepos_t> > const &); + void playlist_ranges_moved (std::list<Evoral::RangeMove<samplepos_t> > const &); + void playlist_regions_extended (std::list<Evoral::Range<samplepos_t> > const &); /* CURVES and AUTOMATION LISTS */ std::map<PBD::ID, AutomationList*> automation_lists; @@ -1829,7 +1829,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop /* FLATTEN */ - int flatten_one_track (AudioTrack&, framepos_t start, framecnt_t cnt); + int flatten_one_track (AudioTrack&, samplepos_t start, samplecnt_t cnt); /* INSERT AND SEND MANAGEMENT */ @@ -1894,7 +1894,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop */ std::list<GQuark> _current_trans_quarks; - int backend_sync_callback (TransportState, framepos_t); + int backend_sync_callback (TransportState, samplepos_t); void process_rtop (SessionEvent*); @@ -1917,24 +1917,24 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop boost::shared_ptr<Amp> _click_gain; Sample* click_data; Sample* click_emphasis_data; - framecnt_t click_length; - framecnt_t click_emphasis_length; + samplecnt_t click_length; + samplecnt_t click_emphasis_length; mutable Glib::Threads::RWLock click_lock; static const Sample default_click[]; - static const framecnt_t default_click_length; + static const samplecnt_t default_click_length; static const Sample default_click_emphasis[]; - static const framecnt_t default_click_emphasis_length; + static const samplecnt_t default_click_emphasis_length; Click *get_click(); - framepos_t _clicks_cleared; + samplepos_t _clicks_cleared; void setup_click_sounds (int which); - void setup_click_sounds (Sample**, Sample const *, framecnt_t*, framecnt_t, std::string const &); + void setup_click_sounds (Sample**, Sample const *, samplecnt_t*, samplecnt_t, std::string const &); void clear_clicks (); - void click (framepos_t start, framecnt_t nframes); - void run_click (framepos_t start, framecnt_t nframes); - void add_click (framepos_t pos, bool emphasis); - framecnt_t _count_in_samples; + void click (samplepos_t start, samplecnt_t nframes); + void run_click (samplepos_t start, samplecnt_t nframes); + void add_click (samplepos_t pos, bool emphasis); + samplecnt_t _count_in_samples; /* range playback */ @@ -1946,14 +1946,14 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop /* temporary hacks to allow selection to be pushed from GUI into backend Whenever we move the selection object into libardour, these will go away. */ - Evoral::Range<framepos_t> _range_selection; - Evoral::Range<framepos_t> _object_selection; + Evoral::Range<samplepos_t> _range_selection; + Evoral::Range<samplepos_t> _object_selection; void unset_preroll_record_punch (); void unset_preroll_record_trim (); - framepos_t _preroll_record_punch_pos; - framecnt_t _preroll_record_trim_len; + samplepos_t _preroll_record_punch_pos; + samplecnt_t _preroll_record_trim_len; bool _count_in_once; /* main outs */ @@ -1986,7 +1986,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop static bool _disable_all_loaded_plugins; static bool _bypass_all_loaded_plugins; - mutable bool have_looped; ///< Used in ::audible_frame(*) + mutable bool have_looped; ///< Used in ::audible_sample(*) void update_route_record_state (); gint _have_rec_enabled_track; @@ -2031,7 +2031,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop void rt_set_controls (boost::shared_ptr<ControlList>, double val, PBD::Controllable::GroupControlDisposition group_override); void rt_clear_all_solo_state (boost::shared_ptr<RouteList>, bool yn, PBD::Controllable::GroupControlDisposition group_override); - void set_session_range_location (framepos_t, framepos_t); + void set_session_range_location (samplepos_t, samplepos_t); void setup_midi_machine_control (); @@ -2043,11 +2043,11 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop void update_locations_after_tempo_map_change (const Locations::LocationList &); - void start_time_changed (framepos_t); - void end_time_changed (framepos_t); + void start_time_changed (samplepos_t); + void end_time_changed (samplepos_t); void set_track_monitor_input_status (bool); - framepos_t compute_stop_limit () const; + samplepos_t compute_stop_limit () const; boost::shared_ptr<Speakers> _speakers; void load_nested_sources (const XMLNode& node); diff --git a/libs/ardour/ardour/session_configuration_vars.h b/libs/ardour/ardour/session_configuration_vars.h index 2f8d52b2b2..90d8874df4 100644 --- a/libs/ardour/ardour/session_configuration_vars.h +++ b/libs/ardour/ardour/session_configuration_vars.h @@ -41,7 +41,7 @@ CONFIG_VARIABLE (MonitorChoice, session_monitoring, "session-monitoring", Monito CONFIG_VARIABLE (bool, layered_record_mode, "layered-record-mode", false) CONFIG_VARIABLE (uint32_t, subframes_per_frame, "subframes-per-frame", 100) CONFIG_VARIABLE (Timecode::TimecodeFormat, timecode_format, "timecode-format", Timecode::timecode_30) -CONFIG_VARIABLE (framecnt_t, minitimeline_span, "minitimeline-span", 120) // seconds +CONFIG_VARIABLE (samplecnt_t, minitimeline_span, "minitimeline-span", 120) // seconds CONFIG_VARIABLE_SPECIAL(std::string, raid_path, "raid-path", "", PBD::path_expand) CONFIG_VARIABLE_SPECIAL(std::string, audio_search_path, "audio-search-path", "", PBD::search_path_expand) CONFIG_VARIABLE_SPECIAL(std::string, midi_search_path, "midi-search-path", "", PBD::search_path_expand) @@ -53,7 +53,7 @@ CONFIG_VARIABLE (bool, use_video_sync, "use-video-sync", false) CONFIG_VARIABLE (float, video_pullup, "video-pullup", 0.0f) CONFIG_VARIABLE (bool, external_sync, "external-sync", false) CONFIG_VARIABLE (InsertMergePolicy, insert_merge_policy, "insert-merge-policy", InsertMergeRelax) -CONFIG_VARIABLE (framecnt_t, timecode_offset, "timecode-offset", 0) +CONFIG_VARIABLE (samplecnt_t, timecode_offset, "timecode-offset", 0) CONFIG_VARIABLE (bool, timecode_offset_negative, "timecode-offset-negative", true) CONFIG_VARIABLE (std::string, slave_timecode_offset, "slave-timecode-offset", " 00:00:00:00") CONFIG_VARIABLE (std::string, timecode_generator_offset, "timecode-generator-offset", " 00:00:00:00") diff --git a/libs/ardour/ardour/session_event.h b/libs/ardour/ardour/session_event.h index 7649960ee1..86ea425645 100644 --- a/libs/ardour/ardour/session_event.h +++ b/libs/ardour/ardour/session_event.h @@ -76,14 +76,14 @@ public: Type type; Action action; - framepos_t action_frame; - framepos_t target_frame; + samplepos_t action_sample; + samplepos_t target_sample; double speed; union { void* ptr; bool yes_or_no; - framepos_t target2_frame; + samplepos_t target2_sample; Slave* slave; Route* route; }; @@ -112,18 +112,18 @@ public: boost::shared_ptr<Region> region; - SessionEvent (Type t, Action a, framepos_t when, framepos_t where, double spd, bool yn = false, bool yn2 = false, bool yn3 = false); + SessionEvent (Type t, Action a, samplepos_t when, samplepos_t where, double spd, bool yn = false, bool yn2 = false, bool yn3 = false); void set_ptr (void* p) { ptr = p; } bool before (const SessionEvent& other) const { - return action_frame < other.action_frame; + return action_sample < other.action_sample; } bool after (const SessionEvent& other) const { - return action_frame > other.action_frame; + return action_sample > other.action_sample; } static bool compare (const SessionEvent *e1, const SessionEvent *e2) { @@ -133,7 +133,7 @@ public: void* operator new (size_t); void operator delete (void *ptr, size_t /*size*/); - static const framepos_t Immediate = -1; + static const samplepos_t Immediate = -1; static bool has_per_thread_pool (); static void create_per_thread_pool (const std::string& n, uint32_t nitems); @@ -175,13 +175,13 @@ protected: void dump_events () const; void merge_event (SessionEvent*); - void replace_event (SessionEvent::Type, framepos_t action_frame, framepos_t target = 0); + void replace_event (SessionEvent::Type, samplepos_t action_sample, samplepos_t target = 0); bool _replace_event (SessionEvent*); bool _remove_event (SessionEvent *); void _clear_event_type (SessionEvent::Type); - void add_event (framepos_t action_frame, SessionEvent::Type type, framepos_t target_frame = 0); - void remove_event (framepos_t frame, SessionEvent::Type type); + void add_event (samplepos_t action_sample, SessionEvent::Type type, samplepos_t target_sample = 0); + void remove_event (samplepos_t sample, SessionEvent::Type type); virtual void process_event(SessionEvent*) = 0; virtual void set_next_event () = 0; diff --git a/libs/ardour/ardour/sidechain.h b/libs/ardour/ardour/sidechain.h index 9d44c3efa2..f3755496c2 100644 --- a/libs/ardour/ardour/sidechain.h +++ b/libs/ardour/ardour/sidechain.h @@ -34,7 +34,7 @@ public: SideChain (Session&, const std::string&); virtual ~SideChain (); - void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, double speed, pframes_t nframes, bool); + void run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool); bool can_support_io_configuration (const ChanCount& in, ChanCount& out); bool configure_io (ChanCount in, ChanCount out); diff --git a/libs/ardour/ardour/silentfilesource.h b/libs/ardour/ardour/silentfilesource.h index 80f4b361b2..a0bd51cc38 100644 --- a/libs/ardour/ardour/silentfilesource.h +++ b/libs/ardour/ardour/silentfilesource.h @@ -27,11 +27,11 @@ namespace ARDOUR { class LIBARDOUR_API SilentFileSource : public AudioFileSource { public: - int update_header (framepos_t /*when*/, struct tm&, time_t) { return 0; } + int update_header (samplepos_t /*when*/, struct tm&, time_t) { return 0; } int flush_header () { return 0; } float sample_rate () const { return _sample_rate; } - void set_length (framecnt_t len) { _length = len; } + void set_length (samplecnt_t len) { _length = len; } void flush () {} bool destructive() const { return false; } @@ -43,7 +43,7 @@ protected: void close() {} friend class SourceFactory; - SilentFileSource (Session& s, const XMLNode& x, framecnt_t len, float srate) + SilentFileSource (Session& s, const XMLNode& x, samplecnt_t len, float srate) : Source (s, x) , AudioFileSource (s, x, false) , _sample_rate(srate) @@ -51,17 +51,17 @@ protected: _length = len; } - framecnt_t read_unlocked (Sample *dst, framepos_t /*start*/, framecnt_t cnt) const { + samplecnt_t read_unlocked (Sample *dst, samplepos_t /*start*/, samplecnt_t cnt) const { memset (dst, 0, sizeof (Sample) * cnt); return cnt; } - framecnt_t write_unlocked (Sample */*dst*/, framecnt_t /*cnt*/) { return 0; } + samplecnt_t write_unlocked (Sample */*dst*/, samplecnt_t /*cnt*/) { return 0; } void set_header_timeline_position () {} - int read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t /*start*/, framecnt_t /*cnt*/, - double /*frames_per_pixel*/, framecnt_t /*fpp*/) const { + int read_peaks_with_fpp (PeakData *peaks, samplecnt_t npeaks, samplepos_t /*start*/, samplecnt_t /*cnt*/, + double /*samples_per_pixel*/, samplecnt_t /*fpp*/) const { memset (peaks, 0, sizeof (PeakData) * npeaks); return 0; } diff --git a/libs/ardour/ardour/slavable_automation_control.h b/libs/ardour/ardour/slavable_automation_control.h index 091d55b989..9cc1442bfb 100644 --- a/libs/ardour/ardour/slavable_automation_control.h +++ b/libs/ardour/ardour/slavable_automation_control.h @@ -46,7 +46,7 @@ public: bool slaved_to (boost::shared_ptr<AutomationControl>) const; bool slaved () const; - virtual void automation_run (framepos_t start, pframes_t nframes); + virtual void automation_run (samplepos_t start, pframes_t nframes); double get_masters_value () const { Glib::Threads::RWLock::ReaderLock lm (master_lock); @@ -59,7 +59,7 @@ public: return reduce_by_masters_locked (val, ignore_automation_state); } - bool get_masters_curve (framepos_t s, framepos_t e, float* v, framecnt_t l) const { + bool get_masters_curve (samplepos_t s, samplepos_t e, float* v, samplecnt_t l) const { Glib::Threads::RWLock::ReaderLock lm (master_lock); return get_masters_curve_locked (s, e, v, l); } @@ -137,15 +137,15 @@ protected: void actually_set_value (double value, PBD::Controllable::GroupControlDisposition); void update_boolean_masters_records (boost::shared_ptr<AutomationControl>); - virtual bool get_masters_curve_locked (framepos_t, framepos_t, float*, framecnt_t) const; - bool masters_curve_multiply (framepos_t, framepos_t, float*, framecnt_t) const; + virtual bool get_masters_curve_locked (samplepos_t, samplepos_t, float*, samplecnt_t) const; + bool masters_curve_multiply (samplepos_t, samplepos_t, float*, samplecnt_t) const; virtual double reduce_by_masters_locked (double val, bool) const; virtual double scale_automation_callback (double val, double ratio) const; virtual bool handle_master_change (boost::shared_ptr<AutomationControl>); - virtual bool boolean_automation_run_locked (framepos_t start, pframes_t len); - bool boolean_automation_run (framepos_t start, pframes_t len); + virtual bool boolean_automation_run_locked (samplepos_t start, pframes_t len); + bool boolean_automation_run (samplepos_t start, pframes_t len); virtual void master_changed (bool from_self, GroupControlDisposition gcd, boost::weak_ptr<AutomationControl>); virtual double get_masters_value_locked () const; diff --git a/libs/ardour/ardour/slave.h b/libs/ardour/ardour/slave.h index 80ff208572..3c0f52d5ae 100644 --- a/libs/ardour/ardour/slave.h +++ b/libs/ardour/ardour/slave.h @@ -116,7 +116,7 @@ class LIBARDOUR_API Slave { * @param position - The transport position requested * @return - The return value is currently ignored (see Session::follow_slave) */ - virtual bool speed_and_position (double& speed, framepos_t& position) = 0; + virtual bool speed_and_position (double& speed, samplepos_t& position) = 0; /** * reports to ARDOUR whether the Slave is currently synced to its external @@ -146,7 +146,7 @@ class LIBARDOUR_API Slave { * @return - the timing resolution of the Slave - If the distance of ARDOURs transport * to the slave becomes greater than the resolution, sound will stop */ - virtual framecnt_t resolution() const = 0; + virtual samplecnt_t resolution() const = 0; /** * @return - when returning true, ARDOUR will wait for seekahead_distance() before transport @@ -155,11 +155,11 @@ class LIBARDOUR_API Slave { virtual bool requires_seekahead () const = 0; /** - * @return the number of frames that this slave wants to seek ahead. Relevant + * @return the number of samples that this slave wants to seek ahead. Relevant * only if requires_seekahead() returns true. */ - virtual framecnt_t seekahead_distance() const { return 0; } + virtual samplecnt_t seekahead_distance() const { return 0; } /** * @return - when returning true, ARDOUR will use transport speed 1.0 no matter what @@ -184,15 +184,15 @@ class LIBARDOUR_API ISlaveSessionProxy { public: virtual ~ISlaveSessionProxy() {} virtual TempoMap& tempo_map() const { return *((TempoMap *) 0); } - virtual framecnt_t frame_rate() const { return 0; } - virtual pframes_t frames_per_cycle() const { return 0; } - virtual framepos_t audible_frame () const { return 0; } - virtual framepos_t transport_frame () const { return 0; } - virtual pframes_t frames_since_cycle_start () const { return 0; } - virtual framepos_t sample_time_at_cycle_start() const { return 0; } - virtual framepos_t frame_time () const { return 0; } - - virtual void request_locate (framepos_t /*frame*/, bool with_roll = false) { + virtual samplecnt_t sample_rate() const { return 0; } + virtual pframes_t samples_per_cycle() const { return 0; } + virtual samplepos_t audible_sample () const { return 0; } + virtual samplepos_t transport_sample () const { return 0; } + virtual pframes_t samples_since_cycle_start () const { return 0; } + virtual samplepos_t sample_time_at_cycle_start() const { return 0; } + virtual samplepos_t sample_time () const { return 0; } + + virtual void request_locate (samplepos_t /*sample*/, bool with_roll = false) { (void) with_roll; } virtual void request_transport_speed (double /*speed*/) {} @@ -207,22 +207,22 @@ class LIBARDOUR_API SlaveSessionProxy : public ISlaveSessionProxy { SlaveSessionProxy(Session &s) : session(s) {} TempoMap& tempo_map() const; - framecnt_t frame_rate() const; - pframes_t frames_per_cycle() const; - framepos_t audible_frame () const; - framepos_t transport_frame () const; - pframes_t frames_since_cycle_start () const; - framepos_t sample_time_at_cycle_start() const; - framepos_t frame_time () const; - - void request_locate (framepos_t frame, bool with_roll = false); + samplecnt_t sample_rate() const; + pframes_t samples_per_cycle() const; + samplepos_t audible_sample () const; + samplepos_t transport_sample () const; + pframes_t samples_since_cycle_start () const; + samplepos_t sample_time_at_cycle_start() const; + samplepos_t sample_time () const; + + void request_locate (samplepos_t sample, bool with_roll = false); void request_transport_speed (double speed); }; struct LIBARDOUR_API SafeTime { volatile int guard1; - framepos_t position; - framepos_t timestamp; + samplepos_t position; + samplepos_t timestamp; double speed; volatile int guard2; @@ -248,7 +248,7 @@ class LIBARDOUR_API TimecodeSlave : public Slave { */ virtual std::string approximate_current_position() const = 0; - framepos_t timecode_offset; + samplepos_t timecode_offset; bool timecode_negative_offset; PBD::Signal1<void, bool> ActiveChanged; @@ -260,15 +260,15 @@ class LIBARDOUR_API MTC_Slave : public TimecodeSlave { ~MTC_Slave (); void rebind (MidiPort&); - bool speed_and_position (double&, framepos_t&); + bool speed_and_position (double&, samplepos_t&); bool locked() const; bool ok() const; void handle_locate (const MIDI::byte*); - framecnt_t resolution () const; + samplecnt_t resolution () const; bool requires_seekahead () const { return false; } - framecnt_t seekahead_distance() const; + samplecnt_t seekahead_distance() const; bool give_slave_full_control_over_transport_speed() const; Timecode::TimecodeFormat apparent_timecode_format() const; @@ -282,16 +282,16 @@ class LIBARDOUR_API MTC_Slave : public TimecodeSlave { PBD::ScopedConnection config_connection; bool can_notify_on_unknown_rate; - static const int frame_tolerance; + static const int sample_tolerance; SafeTime current; - framepos_t mtc_frame; /* current time */ + samplepos_t mtc_frame; /* current time */ double mtc_frame_dll; - framepos_t last_inbound_frame; /* when we got it; audio clocked */ + samplepos_t last_inbound_frame; /* when we got it; audio clocked */ MIDI::byte last_mtc_fps_byte; - framepos_t window_begin; - framepos_t window_end; - framepos_t first_mtc_timestamp; + samplepos_t window_begin; + samplepos_t window_end; + samplepos_t first_mtc_timestamp; bool did_reset_tc_format; Timecode::TimecodeFormat saved_tc_format; Glib::Threads::Mutex reset_lock; @@ -307,11 +307,11 @@ class LIBARDOUR_API MTC_Slave : public TimecodeSlave { Timecode::TimecodeFormat a3e_timecode; Timecode::Time timecode; bool printed_timecode_warning; - frameoffset_t current_delta; + sampleoffset_t current_delta; /* DLL - chase MTC */ - double t0; ///< time at the beginning of the MTC quater frame - double t1; ///< calculated end of the MTC quater frame + double t0; ///< time at the beginning of the MTC quater sample + double t1; ///< calculated end of the MTC quater sample double e2; ///< second order loop error double b, c, omega; ///< DLL filter coefficients @@ -326,14 +326,14 @@ class LIBARDOUR_API MTC_Slave : public TimecodeSlave { void queue_reset (bool with_pos); void maybe_reset (); - void update_mtc_qtr (MIDI::Parser&, int, framepos_t); - void update_mtc_time (const MIDI::byte *, bool, framepos_t); + void update_mtc_qtr (MIDI::Parser&, int, samplepos_t); + void update_mtc_time (const MIDI::byte *, bool, samplepos_t); void update_mtc_status (MIDI::MTC_Status); void read_current (SafeTime *) const; - void reset_window (framepos_t); - bool outside_window (framepos_t) const; - void init_mtc_dll(framepos_t, double); - void init_engine_dll (framepos_t, framepos_t); + void reset_window (samplepos_t); + bool outside_window (samplepos_t) const; + void init_mtc_dll(samplepos_t, double); + void init_engine_dll (samplepos_t, samplepos_t); void parse_timecode_offset(); void parameter_changed(std::string const & p); }; @@ -343,14 +343,14 @@ public: LTC_Slave (Session&); ~LTC_Slave (); - bool speed_and_position (double&, framepos_t&); + bool speed_and_position (double&, samplepos_t&); bool locked() const; bool ok() const; - framecnt_t resolution () const; + samplecnt_t resolution () const; bool requires_seekahead () const { return false; } - framecnt_t seekahead_distance () const { return 0; } + samplecnt_t seekahead_distance () const { return 0; } bool give_slave_full_control_over_transport_speed() const { return true; } Timecode::TimecodeFormat apparent_timecode_format() const; @@ -358,12 +358,12 @@ public: std::string approximate_current_delta() const; private: - void parse_ltc(const pframes_t, const Sample* const, const framecnt_t); - void process_ltc(framepos_t const); - void init_engine_dll (framepos_t, int32_t); + void parse_ltc(const pframes_t, const Sample* const, const samplecnt_t); + void process_ltc(samplepos_t const); + void init_engine_dll (samplepos_t, int32_t); bool detect_discontinuity(LTCFrameExt *, int, bool); bool detect_ltc_fps(int, bool); - bool equal_ltc_frame_time(LTCFrame *a, LTCFrame *b); + bool equal_ltc_sample_time(LTCFrame *a, LTCFrame *b); void reset (bool with_ts = true); void resync_xrun(); void resync_latency(); @@ -375,16 +375,16 @@ public: Timecode::TimecodeFormat saved_tc_format; LTCDecoder * decoder; - double frames_per_ltc_frame; + double samples_per_ltc_frame; Timecode::Time timecode; - LTCFrameExt prev_frame; + LTCFrameExt prev_sample; bool fps_detected; - framecnt_t monotonic_cnt; - framecnt_t last_timestamp; - framecnt_t last_ltc_frame; + samplecnt_t monotonic_cnt; + samplecnt_t last_timestamp; + samplecnt_t last_ltc_sample; double ltc_speed; - frameoffset_t current_delta; + sampleoffset_t current_delta; int delayedlocked; int ltc_detect_fps_cnt; @@ -401,8 +401,8 @@ public: /* DLL - chase LTC */ int transport_direction; int engine_dll_initstate; - double t0; ///< time at the beginning of the MTC quater frame - double t1; ///< calculated end of the MTC quater frame + double t0; ///< time at the beginning of the MTC quater sample + double t1; ///< calculated end of the MTC quater sample double e2; ///< second order loop error double b, c; ///< DLL filter coefficients }; @@ -416,13 +416,13 @@ class LIBARDOUR_API MIDIClock_Slave : public Slave { ~MIDIClock_Slave (); void rebind (MidiPort&); - bool speed_and_position (double&, framepos_t&); + bool speed_and_position (double&, samplepos_t&); bool locked() const; bool ok() const; bool starting() const; - framecnt_t resolution () const; + samplecnt_t resolution () const; bool requires_seekahead () const { return false; } bool give_slave_full_control_over_transport_speed() const { return true; } @@ -433,17 +433,17 @@ class LIBARDOUR_API MIDIClock_Slave : public Slave { ISlaveSessionProxy* session; PBD::ScopedConnectionList port_connections; - /// pulses per quarter note for one MIDI clock frame (default 24) + /// pulses per quarter note for one MIDI clock sample (default 24) int ppqn; - /// the duration of one ppqn in frame time - double one_ppqn_in_frames; + /// the duration of one ppqn in sample time + double one_ppqn_in_samples; /// the timestamp of the first MIDI clock message - framepos_t first_timestamp; + samplepos_t first_timestamp; /// the time stamp and should-be transport position of the last inbound MIDI clock message - framepos_t last_timestamp; + samplepos_t last_timestamp; double should_be_position; /// the number of midi clock messages received (zero-based) @@ -452,10 +452,10 @@ class LIBARDOUR_API MIDIClock_Slave : public Slave { //the delay locked loop (DLL), see www.kokkinizita.net/papers/usingdll.pdf - /// time at the beginning of the MIDI clock frame + /// time at the beginning of the MIDI clock sample double t0; - /// calculated end of the MIDI clock frame + /// calculated end of the MIDI clock sample double t1; /// loop error = real value - expected value @@ -470,20 +470,20 @@ class LIBARDOUR_API MIDIClock_Slave : public Slave { /// DLL filter coefficients double b, c, omega; - frameoffset_t current_delta; + sampleoffset_t current_delta; void reset (); - void start (MIDI::Parser& parser, framepos_t timestamp); - void contineu (MIDI::Parser& parser, framepos_t timestamp); - void stop (MIDI::Parser& parser, framepos_t timestamp); + void start (MIDI::Parser& parser, samplepos_t timestamp); + void contineu (MIDI::Parser& parser, samplepos_t timestamp); + void stop (MIDI::Parser& parser, samplepos_t timestamp); void position (MIDI::Parser& parser, MIDI::byte* message, size_t size); // we can't use continue because it is a C++ keyword - void calculate_one_ppqn_in_frames_at(framepos_t time); - framepos_t calculate_song_position(uint16_t song_position_in_sixteenth_notes); + void calculate_one_ppqn_in_samples_at(samplepos_t time); + samplepos_t calculate_song_position(uint16_t song_position_in_sixteenth_notes); void calculate_filter_coefficients(); - void update_midi_clock (MIDI::Parser& parser, framepos_t timestamp); + void update_midi_clock (MIDI::Parser& parser, samplepos_t timestamp); void read_current (SafeTime *) const; - bool stop_if_no_more_clock_events(framepos_t& pos, framepos_t now); + bool stop_if_no_more_clock_events(samplepos_t& pos, samplepos_t now); /// whether transport should be rolling bool _started; @@ -499,12 +499,12 @@ class LIBARDOUR_API Engine_Slave : public Slave Engine_Slave (AudioEngine&); ~Engine_Slave (); - bool speed_and_position (double& speed, framepos_t& pos); + bool speed_and_position (double& speed, samplepos_t& pos); bool starting() const { return _starting; } bool locked() const; bool ok() const; - framecnt_t resolution () const { return 1; } + samplecnt_t resolution () const { return 1; } bool requires_seekahead () const { return false; } bool is_always_synced() const { return true; } diff --git a/libs/ardour/ardour/smf_source.h b/libs/ardour/ardour/smf_source.h index 9bc6584355..5b121b4a52 100644 --- a/libs/ardour/ardour/smf_source.h +++ b/libs/ardour/ardour/smf_source.h @@ -52,7 +52,7 @@ public: } void append_event_beats (const Lock& lock, const Evoral::Event<Evoral::Beats>& ev); - void append_event_frames (const Lock& lock, const Evoral::Event<framepos_t>& ev, framepos_t source_start); + void append_event_samples (const Lock& lock, const Evoral::Event<samplepos_t>& ev, samplepos_t source_start); void mark_streaming_midi_write_started (const Lock& lock, NoteMode mode); void mark_streaming_write_completed (const Lock& lock); @@ -79,29 +79,29 @@ public: private: bool _open; Evoral::Beats _last_ev_time_beats; - framepos_t _last_ev_time_frames; + samplepos_t _last_ev_time_samples; /** end time (start + duration) of last call to read_unlocked */ - mutable framepos_t _smf_last_read_end; + mutable samplepos_t _smf_last_read_end; /** time (in SMF ticks, 1 tick per _ppqn) of the last event read by read_unlocked */ - mutable framepos_t _smf_last_read_time; + mutable samplepos_t _smf_last_read_time; int open_for_write (); void ensure_disk_file (const Lock& lock); - framecnt_t read_unlocked (const Lock& lock, - Evoral::EventSink<framepos_t>& dst, - framepos_t position, - framepos_t start, - framecnt_t cnt, - Evoral::Range<framepos_t>* loop_range, + samplecnt_t read_unlocked (const Lock& lock, + Evoral::EventSink<samplepos_t>& dst, + samplepos_t position, + samplepos_t start, + samplecnt_t cnt, + Evoral::Range<samplepos_t>* loop_range, MidiStateTracker* tracker, MidiChannelFilter* filter) const; - framecnt_t write_unlocked (const Lock& lock, - MidiRingBuffer<framepos_t>& src, - framepos_t position, - framecnt_t cnt); + samplecnt_t write_unlocked (const Lock& lock, + MidiRingBuffer<samplepos_t>& src, + samplepos_t position, + samplecnt_t cnt); }; diff --git a/libs/ardour/ardour/sndfileimportable.h b/libs/ardour/ardour/sndfileimportable.h index 10c429c545..28e1ccf3cf 100644 --- a/libs/ardour/ardour/sndfileimportable.h +++ b/libs/ardour/ardour/sndfileimportable.h @@ -33,12 +33,12 @@ class LIBARDOUR_API SndFileImportableSource : public ImportableSource { SndFileImportableSource (const std::string& path); virtual ~SndFileImportableSource(); - framecnt_t read (Sample* buffer, framecnt_t nframes); + samplecnt_t read (Sample* buffer, samplecnt_t nframes); uint32_t channels() const; - framecnt_t length() const; - framecnt_t samplerate() const; - void seek (framepos_t pos); - framepos_t natural_position() const; + samplecnt_t length() const; + samplecnt_t samplerate() const; + void seek (samplepos_t pos); + samplepos_t natural_position() const; bool clamped_at_unity () const; protected: @@ -46,7 +46,7 @@ class LIBARDOUR_API SndFileImportableSource : public ImportableSource { boost::shared_ptr<SNDFILE> in; /* these are int64_t so as to be independent of whatever - types Ardour may use for framepos_t, framecnt_t etc. + types Ardour may use for samplepos_t, samplecnt_t etc. */ int64_t timecode; diff --git a/libs/ardour/ardour/sndfilesource.h b/libs/ardour/ardour/sndfilesource.h index 0130765123..218bbd242a 100644 --- a/libs/ardour/ardour/sndfilesource.h +++ b/libs/ardour/ardour/sndfilesource.h @@ -35,7 +35,7 @@ class LIBARDOUR_API SndFileSource : public AudioFileSource { /* Constructor to be called for new in-session files */ SndFileSource (Session&, const std::string& path, const std::string& origin, - SampleFormat samp_format, HeaderFormat hdr_format, framecnt_t rate, + SampleFormat samp_format, HeaderFormat hdr_format, samplecnt_t rate, Flag flags = SndFileSource::default_writable_flags); /* Constructor to be called for recovering files being used for @@ -56,14 +56,14 @@ class LIBARDOUR_API SndFileSource : public AudioFileSource { ~SndFileSource (); float sample_rate () const; - int update_header (framepos_t when, struct tm&, time_t); + int update_header (samplepos_t when, struct tm&, time_t); int flush_header (); void flush (); - framepos_t natural_position () const; + samplepos_t natural_position () const; - framepos_t last_capture_start_frame() const; - void mark_capture_start (framepos_t); + samplepos_t last_capture_start_sample() const; + void mark_capture_start (samplepos_t); void mark_capture_end (); void clear_capture_marks(); @@ -72,7 +72,7 @@ class LIBARDOUR_API SndFileSource : public AudioFileSource { bool clamped_at_unity () const; - static void setup_standard_crossfades (Session const &, framecnt_t sample_rate); + static void setup_standard_crossfades (Session const &, samplecnt_t sample_rate); static const Source::Flag default_writable_flags; static int get_soundfile_info (const std::string& path, SoundFileInfo& _info, std::string& error_msg); @@ -83,9 +83,9 @@ class LIBARDOUR_API SndFileSource : public AudioFileSource { void set_path (const std::string& p); void set_header_timeline_position (); - framecnt_t read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) const; - framecnt_t write_unlocked (Sample *dst, framecnt_t cnt); - framecnt_t write_float (Sample* data, framepos_t pos, framecnt_t cnt); + samplecnt_t read_unlocked (Sample *dst, samplepos_t start, samplecnt_t cnt) const; + samplecnt_t write_unlocked (Sample *dst, samplecnt_t cnt); + samplecnt_t write_float (Sample* data, samplepos_t pos, samplecnt_t cnt); private: SNDFILE* _sndfile; @@ -94,25 +94,25 @@ class LIBARDOUR_API SndFileSource : public AudioFileSource { void init_sndfile (); int open(); - int setup_broadcast_info (framepos_t when, struct tm&, time_t); + int setup_broadcast_info (samplepos_t when, struct tm&, time_t); void file_closed (); /* destructive */ - static framecnt_t xfade_frames; + static samplecnt_t xfade_samples; static gain_t* out_coefficient; static gain_t* in_coefficient; bool _capture_start; bool _capture_end; - framepos_t capture_start_frame; - framepos_t file_pos; // unit is frames + samplepos_t capture_start_sample; + samplepos_t file_pos; // unit is samples Sample* xfade_buf; - framecnt_t crossfade (Sample* data, framecnt_t cnt, int dir); - void set_timeline_position (framepos_t); - framecnt_t destructive_write_unlocked (Sample *dst, framecnt_t cnt); - framecnt_t nondestructive_write_unlocked (Sample *dst, framecnt_t cnt); + samplecnt_t crossfade (Sample* data, samplecnt_t cnt, int dir); + void set_timeline_position (samplepos_t); + samplecnt_t destructive_write_unlocked (Sample *dst, samplecnt_t cnt); + samplecnt_t nondestructive_write_unlocked (Sample *dst, samplecnt_t cnt); void handle_header_position_change (); PBD::ScopedConnection header_position_connection; }; diff --git a/libs/ardour/ardour/soundseq.h b/libs/ardour/ardour/soundseq.h index 02425a71cf..93faa75b9b 100644 --- a/libs/ardour/ardour/soundseq.h +++ b/libs/ardour/ardour/soundseq.h @@ -31,13 +31,13 @@ struct LIBARDOUR_API peak_data_t { peak_datum max; }; -const uint32_t frames_per_peak = 2048; +const uint32_t samples_per_peak = 2048; class LIBARDOUR_API Sound : public EDL::Piece { public: int peak (peak_data_t& pk, uint32_t start, uint32_t cnt); int read_peaks (peak_data_t *, uint32_t npeaks, uint32_t start, uint32_t cnt); - int build_peak (uint32_t first_frame, uint32_t cnt); + int build_peak (uint32_t first_sample, uint32_t cnt); }; class LIBARDOUR_API SoundPlaylist : public EDL::Playlist { diff --git a/libs/ardour/ardour/source.h b/libs/ardour/ardour/source.h index 275fe7c11a..b269f6976d 100644 --- a/libs/ardour/ardour/source.h +++ b/libs/ardour/ardour/source.h @@ -65,10 +65,10 @@ class LIBARDOUR_API Source : public SessionObject void stamp (time_t when) { _timestamp = when; } virtual bool empty () const = 0; - virtual framecnt_t length (framepos_t pos) const = 0; - virtual void update_length (framecnt_t cnt) = 0; + virtual samplecnt_t length (samplepos_t pos) const = 0; + virtual void update_length (samplecnt_t cnt) = 0; - virtual framepos_t natural_position() const { return 0; } + virtual samplepos_t natural_position() const { return 0; } void mark_for_remove(); @@ -98,8 +98,8 @@ class LIBARDOUR_API Source : public SessionObject std::string get_transients_path() const; int load_transients (const std::string&); - framepos_t timeline_position() const { return _timeline_position; } - virtual void set_timeline_position (framepos_t pos); + samplepos_t timeline_position() const { return _timeline_position; } + virtual void set_timeline_position (samplepos_t pos); void set_allow_remove_if_empty (bool yn); @@ -119,7 +119,7 @@ class LIBARDOUR_API Source : public SessionObject DataType _type; Flag _flags; time_t _timestamp; - framepos_t _timeline_position; + samplepos_t _timeline_position; bool _analysed; mutable Glib::Threads::Mutex _lock; mutable Glib::Threads::Mutex _analysis_lock; diff --git a/libs/ardour/ardour/source_factory.h b/libs/ardour/ardour/source_factory.h index b1ee6438f5..0cf934cfaa 100644 --- a/libs/ardour/ardour/source_factory.h +++ b/libs/ardour/ardour/source_factory.h @@ -44,7 +44,7 @@ class LIBARDOUR_API SourceFactory { static boost::shared_ptr<Source> create (Session&, const XMLNode& node, bool async = false); static boost::shared_ptr<Source> createSilent (Session&, const XMLNode& node, - framecnt_t nframes, float sample_rate); + samplecnt_t nframes, float sample_rate); static boost::shared_ptr<Source> createExternal (DataType type, Session&, @@ -54,7 +54,7 @@ class LIBARDOUR_API SourceFactory { static boost::shared_ptr<Source> createWritable (DataType type, Session&, const std::string& path, - bool destructive, framecnt_t rate, bool announce = true, bool async = false); + bool destructive, samplecnt_t rate, bool announce = true, bool async = false); static boost::shared_ptr<Source> createForRecovery @@ -62,7 +62,7 @@ class LIBARDOUR_API SourceFactory { static boost::shared_ptr<Source> createFromPlaylist (DataType type, Session& s, boost::shared_ptr<Playlist> p, const PBD::ID& orig, const std::string& name, - uint32_t chn, frameoffset_t start, framecnt_t len, bool copy, bool defer_peaks); + uint32_t chn, sampleoffset_t start, samplecnt_t len, bool copy, bool defer_peaks); static Glib::Threads::Cond PeaksToBuild; static Glib::Threads::Mutex peak_building_lock; diff --git a/libs/ardour/ardour/srcfilesource.h b/libs/ardour/ardour/srcfilesource.h index 3dc1590dda..a7d23912ec 100644 --- a/libs/ardour/ardour/srcfilesource.h +++ b/libs/ardour/ardour/srcfilesource.h @@ -35,17 +35,17 @@ public: SrcFileSource (Session&, boost::shared_ptr<AudioFileSource>, SrcQuality srcq = SrcQuality(SrcQuick)); ~SrcFileSource (); - int update_header (framepos_t /*when*/, struct tm&, time_t) { return 0; } + int update_header (samplepos_t /*when*/, struct tm&, time_t) { return 0; } int flush_header () { return 0; } void flush () { } void set_header_timeline_position () {}; - void set_length (framecnt_t /*len*/) {}; + void set_length (samplecnt_t /*len*/) {}; - float sample_rate () const { return _session.nominal_frame_rate(); } + float sample_rate () const { return _session.nominal_sample_rate(); } - framepos_t natural_position() const { return _source->natural_position() * _ratio;} - framecnt_t readable_length() const { return _source->readable_length() * _ratio; } - framecnt_t length (framepos_t pos) const { return _source->length(pos) * _ratio; } + samplepos_t natural_position() const { return _source->natural_position() * _ratio;} + samplecnt_t readable_length() const { return _source->readable_length() * _ratio; } + samplecnt_t length (samplepos_t pos) const { return _source->length(pos) * _ratio; } bool destructive() const { return false; } bool can_be_analysed() const { return false; } @@ -53,11 +53,11 @@ public: protected: void close (); - framecnt_t read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) const; - framecnt_t write_unlocked (Sample */*dst*/, framecnt_t /*cnt*/) { return 0; } + samplecnt_t read_unlocked (Sample *dst, samplepos_t start, samplecnt_t cnt) const; + samplecnt_t write_unlocked (Sample */*dst*/, samplecnt_t /*cnt*/) { return 0; } - int read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t /*start*/, framecnt_t /*cnt*/, - double /*samples_per_unit*/, framecnt_t /*fpp*/) const { + int read_peaks_with_fpp (PeakData *peaks, samplecnt_t npeaks, samplepos_t /*start*/, samplecnt_t /*cnt*/, + double /*samples_per_unit*/, samplecnt_t /*fpp*/) const { memset (peaks, 0, sizeof (PeakData) * npeaks); return 0; } @@ -70,12 +70,12 @@ private: mutable SRC_DATA _src_data; mutable Sample* _src_buffer; - mutable framepos_t _source_position; - mutable framepos_t _target_position; + mutable samplepos_t _source_position; + mutable samplepos_t _target_position; mutable double _fract_position; double _ratio; - framecnt_t src_buffer_size; + samplecnt_t src_buffer_size; }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/strip_silence.h b/libs/ardour/ardour/strip_silence.h index 59f4ea0a57..69057ffe51 100644 --- a/libs/ardour/ardour/strip_silence.h +++ b/libs/ardour/ardour/strip_silence.h @@ -25,13 +25,13 @@ namespace ARDOUR { class LIBARDOUR_API StripSilence : public Filter { public: - StripSilence (Session &, const AudioIntervalMap&, framecnt_t fade_length); + StripSilence (Session &, const AudioIntervalMap&, samplecnt_t fade_length); int run (boost::shared_ptr<ARDOUR::Region>, Progress* progress = 0); private: const AudioIntervalMap& _smap; - framecnt_t _fade_length; ///< fade in/out to use on trimmed regions, in samples + samplecnt_t _fade_length; ///< fade in/out to use on trimmed regions, in samples }; } diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h index 78d18dd122..99c28b5748 100644 --- a/libs/ardour/ardour/tempo.h +++ b/libs/ardour/ardour/tempo.h @@ -79,17 +79,17 @@ class LIBARDOUR_API Tempo { double end_pulses_per_minute () const { return end_note_types_per_minute (1.0); } /** audio samples per note type. - * if you want an instantaneous value for this, use TempoMap::frames_per_quarter_note_at() instead. + * if you want an instantaneous value for this, use TempoMap::samples_per_quarter_note_at() instead. * @param sr samplerate */ - double frames_per_note_type (framecnt_t sr) const { + double samples_per_note_type (samplecnt_t sr) const { return (60.0 * sr) / _note_types_per_minute; } /** audio samples per quarter note. - * if you want an instantaneous value for this, use TempoMap::frames_per_quarter_note_at() instead. + * if you want an instantaneous value for this, use TempoMap::samples_per_quarter_note_at() instead. * @param sr samplerate */ - double frames_per_quarter_note (framecnt_t sr) const { + double samples_per_quarter_note (samplecnt_t sr) const { return (60.0 * sr) / quarter_notes_per_minute (); } @@ -108,8 +108,8 @@ class LIBARDOUR_API Meter { double divisions_per_bar () const { return _divisions_per_bar; } double note_divisor() const { return _note_type; } - double frames_per_bar (const Tempo&, framecnt_t sr) const; - double frames_per_grid (const Tempo&, framecnt_t sr) const; + double samples_per_bar (const Tempo&, samplecnt_t sr) const; + double samples_per_grid (const Tempo&, samplecnt_t sr) const; inline bool operator==(const Meter& other) { return _divisions_per_bar == other.divisions_per_bar() && _note_type == other.note_divisor(); } @@ -130,7 +130,7 @@ class LIBARDOUR_API Meter { /** A section of timeline with a certain Tempo or Meter. */ class LIBARDOUR_API MetricSection { public: - MetricSection (double pulse, double minute, PositionLockStyle pls, bool is_tempo, framecnt_t sample_rate) + MetricSection (double pulse, double minute, PositionLockStyle pls, bool is_tempo, samplecnt_t sample_rate) : _pulse (pulse), _minute (minute), _initial (false), _position_lock_style (pls), _is_tempo (is_tempo), _sample_rate (sample_rate) {} virtual ~MetricSection() {} @@ -143,7 +143,7 @@ class LIBARDOUR_API MetricSection { _minute = m; } - framepos_t frame () const { return frame_at_minute (_minute); } + samplepos_t sample () const { return sample_at_minute (_minute); } void set_initial (bool yn) { _initial = yn; } bool initial() const { return _initial; } @@ -160,8 +160,8 @@ class LIBARDOUR_API MetricSection { void set_position_lock_style (PositionLockStyle ps) { _position_lock_style = ps; } bool is_tempo () const { return _is_tempo; } - framepos_t frame_at_minute (const double& time) const; - double minute_at_frame (const framepos_t frame) const; + samplepos_t sample_at_minute (const double& time) const; + double minute_at_sample (const samplepos_t sample) const; protected: void add_state_to_node (XMLNode& node) const; @@ -173,16 +173,16 @@ private: bool _initial; PositionLockStyle _position_lock_style; const bool _is_tempo; - framecnt_t _sample_rate; + samplecnt_t _sample_rate; }; /** A section of timeline with a certain Meter. */ class LIBARDOUR_API MeterSection : public MetricSection, public Meter { public: - MeterSection (double pulse, double minute, double beat, const Timecode::BBT_Time& bbt, double bpb, double note_type, PositionLockStyle pls, framecnt_t sr) + MeterSection (double pulse, double minute, double beat, const Timecode::BBT_Time& bbt, double bpb, double note_type, PositionLockStyle pls, samplecnt_t sr) : MetricSection (pulse, minute, pls, false, sr), Meter (bpb, note_type), _bbt (bbt), _beat (beat) {} - MeterSection (const XMLNode&, const framecnt_t sample_rate); + MeterSection (const XMLNode&, const samplecnt_t sample_rate); static const std::string xml_state_node_name; @@ -210,10 +210,10 @@ class LIBARDOUR_API TempoSection : public MetricSection, public Tempo { Constant, }; - TempoSection (const double& pulse, const double& minute, Tempo tempo, PositionLockStyle pls, framecnt_t sr) + TempoSection (const double& pulse, const double& minute, Tempo tempo, PositionLockStyle pls, samplecnt_t sr) : MetricSection (pulse, minute, pls, true, sr), Tempo (tempo), _c (0.0), _active (true), _locked_to_meter (false), _clamped (false) {} - TempoSection (const XMLNode&, const framecnt_t sample_rate); + TempoSection (const XMLNode&, const samplecnt_t sample_rate); static const std::string xml_state_node_name; @@ -245,8 +245,8 @@ class LIBARDOUR_API TempoSection : public MetricSection, public Tempo { double compute_c_pulse (const double& end_ntpm, const double& end_pulse) const; double compute_c_minute (const double& end_ntpm, const double& end_minute) const; - double pulse_at_frame (const framepos_t frame) const; - framepos_t frame_at_pulse (const double& pulse) const; + double pulse_at_sample (const samplepos_t sample) const; + samplepos_t sample_at_pulse (const double& pulse) const; Timecode::BBT_Time legacy_bbt () { return _legacy_bbt; } @@ -330,7 +330,7 @@ class LIBARDOUR_API TempoMetric { class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible { public: - TempoMap (framecnt_t frame_rate); + TempoMap (samplecnt_t sample_rate); ~TempoMap(); TempoMap& operator= (TempoMap const &); @@ -345,18 +345,18 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible struct BBTPoint { Meter meter; Tempo tempo; - framepos_t frame; + samplepos_t sample; uint32_t bar; uint32_t beat; double qn; - BBTPoint (const MeterSection& m, const Tempo& t, framepos_t f, + BBTPoint (const MeterSection& m, const Tempo& t, samplepos_t f, uint32_t b, uint32_t e, double qnote) - : meter (m), tempo (t), frame (f), bar (b), beat (e), qn (qnote) {} + : meter (m), tempo (t), sample (f), bar (b), beat (e), qn (qnote) {} Timecode::BBT_Time bbt() const { return Timecode::BBT_Time (bar, beat, 0); } operator Timecode::BBT_Time() const { return bbt(); } - operator framepos_t() const { return frame; } + operator samplepos_t() const { return sample; } bool is_bar() const { return beat == 1; } }; @@ -366,17 +366,17 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible } void get_grid (std::vector<BBTPoint>&, - framepos_t start, framepos_t end, uint32_t bar_mod = 0); + samplepos_t start, samplepos_t end, uint32_t bar_mod = 0); static const Tempo& default_tempo() { return _default_tempo; } static const Meter& default_meter() { return _default_meter; } /* because tempi may be ramped, this is only valid for the instant requested.*/ - double frames_per_quarter_note_at (const framepos_t, const framecnt_t sr) const; + double samples_per_quarter_note_at (const samplepos_t, const samplecnt_t sr) const; - const TempoSection& tempo_section_at_frame (framepos_t frame) const; - TempoSection& tempo_section_at_frame (framepos_t frame); - const MeterSection& meter_section_at_frame (framepos_t frame) const; + const TempoSection& tempo_section_at_sample (samplepos_t sample) const; + TempoSection& tempo_section_at_sample (samplepos_t sample); + const MeterSection& meter_section_at_sample (samplepos_t sample) const; const MeterSection& meter_section_at_beat (double beat) const; TempoSection* previous_tempo_section (TempoSection*) const; @@ -384,37 +384,37 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible /** add a tempo section locked to pls. ignored values will be set in recompute_tempi() * @param pulse pulse position of new section. ignored if pls == AudioTime - * @param frame frame position of new section. ignored if pls == MusicTime + * @param sample frame position of new section. ignored if pls == MusicTime * @param type type of new tempo section (Ramp, Constant) */ - TempoSection* add_tempo (const Tempo&, const double& pulse, const framepos_t frame, PositionLockStyle pls); + TempoSection* add_tempo (const Tempo&, const double& pulse, const samplepos_t sample, PositionLockStyle pls); /** add a meter section locked to pls.. ignored values will be set in recompute_meters() * @param meter the Meter to be added * @param where bbt position of new section - * @param frame frame position of new section. ignored if pls == MusicTime - * note that @frame may also be ignored if it would create an un-solvable map - * (previous audio-locked tempi may place the requested beat at an earlier time than frame) + * @param sample frame position of new section. ignored if pls == MusicTime + * note that @sample may also be ignored if it would create an un-solvable map + * (previous audio-locked tempi may place the requested beat at an earlier time than sample) * in which case the new meter will be placed at the specified BBT. * @param pls the position lock style * * adding an audio-locked meter will add a meter-locked tempo section at the meter position. * the meter-locked tempo tempo will be the Tempo at @beat */ - MeterSection* add_meter (const Meter& meter, const Timecode::BBT_Time& where, framepos_t frame, PositionLockStyle pls); + MeterSection* add_meter (const Meter& meter, const Timecode::BBT_Time& where, samplepos_t sample, PositionLockStyle pls); void remove_tempo (const TempoSection&, bool send_signal); void remove_meter (const MeterSection&, bool send_signal); - void replace_tempo (TempoSection&, const Tempo&, const double& pulse, const framepos_t frame, PositionLockStyle pls); + void replace_tempo (TempoSection&, const Tempo&, const double& pulse, const samplepos_t sample, PositionLockStyle pls); - void replace_meter (const MeterSection&, const Meter&, const Timecode::BBT_Time& where, framepos_t frame, PositionLockStyle pls); + void replace_meter (const MeterSection&, const Meter&, const Timecode::BBT_Time& where, samplepos_t sample, PositionLockStyle pls); - MusicFrame round_to_bar (framepos_t frame, RoundMode dir); - MusicFrame round_to_beat (framepos_t frame, RoundMode dir); - MusicFrame round_to_quarter_note_subdivision (framepos_t fr, int sub_num, RoundMode dir); + MusicSample round_to_bar (samplepos_t sample, RoundMode dir); + MusicSample round_to_beat (samplepos_t sample, RoundMode dir); + MusicSample round_to_quarter_note_subdivision (samplepos_t fr, int sub_num, RoundMode dir); - void set_length (framepos_t frames); + void set_length (samplepos_t samples); XMLNode& get_state (void); int set_state (const XMLNode&, int version); @@ -424,27 +424,27 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible TempoMetric metric_at (Timecode::BBT_Time bbt) const; - /** Return the TempoMetric at frame @p t, and point @p last to the latest + /** Return the TempoMetric at sample @p t, and point @p last to the latest * metric change <= t, if it is non-NULL. */ - TempoMetric metric_at (framepos_t, Metrics::const_iterator* last=NULL) const; + TempoMetric metric_at (samplepos_t, Metrics::const_iterator* last=NULL) const; Metrics::const_iterator metrics_end() { return _metrics.end(); } - void change_existing_tempo_at (framepos_t, double bpm, double note_type, double end_ntpm); + void change_existing_tempo_at (samplepos_t, double bpm, double note_type, double end_ntpm); void change_initial_tempo (double ntpm, double note_type, double end_ntpm); - void insert_time (framepos_t, framecnt_t); - bool remove_time (framepos_t where, framecnt_t amount); //returns true if anything was moved + void insert_time (samplepos_t, samplecnt_t); + bool remove_time (samplepos_t where, samplecnt_t amount); //returns true if anything was moved int n_tempos () const; int n_meters () const; - framecnt_t frame_rate () const { return _frame_rate; } + samplecnt_t sample_rate () const { return _sample_rate; } /* TEMPO- AND METER-SENSITIVE FUNCTIONS - bbt_at_frame(), frame_at_bbt(), beat_at_frame(), frame_at_beat() + bbt_at_sample(), sample_at_bbt(), beat_at_sample(), sample_at_beat() and bbt_duration_at() are all sensitive to tempo and meter, and will give answers that align with the grid formed by tempo and meter sections. @@ -453,17 +453,17 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible whose location is canonically defined in Evoral::Beats. */ - double beat_at_frame (const framecnt_t frame) const; - framepos_t frame_at_beat (const double& beat) const; + double beat_at_sample (const samplecnt_t sample) const; + samplepos_t sample_at_beat (const double& beat) const; - const Meter& meter_at_frame (framepos_t) const; + const Meter& meter_at_sample (samplepos_t) const; /* bbt - it's nearly always better to use meter-based beat (above) unless tick resolution is desirable. */ - Timecode::BBT_Time bbt_at_frame (framepos_t when); - Timecode::BBT_Time bbt_at_frame_rt (framepos_t when); - framepos_t frame_at_bbt (const Timecode::BBT_Time&); + Timecode::BBT_Time bbt_at_sample (samplepos_t when); + Timecode::BBT_Time bbt_at_sample_rt (samplepos_t when); + samplepos_t sample_at_bbt (const Timecode::BBT_Time&); double beat_at_bbt (const Timecode::BBT_Time& bbt); Timecode::BBT_Time bbt_at_beat (const double& beats); @@ -472,8 +472,8 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible double quarter_note_at_bbt_rt (const Timecode::BBT_Time& bbt); Timecode::BBT_Time bbt_at_quarter_note (const double& quarter_note); - framecnt_t bbt_duration_at (framepos_t, const Timecode::BBT_Time&, int dir); - framepos_t framepos_plus_bbt (framepos_t pos, Timecode::BBT_Time b) const; + samplecnt_t bbt_duration_at (samplepos_t, const Timecode::BBT_Time&, int dir); + samplepos_t samplepos_plus_bbt (samplepos_t pos, Timecode::BBT_Time b) const; /* TEMPO-SENSITIVE FUNCTIONS @@ -485,46 +485,46 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible whose location is canonically defined in Evoral::Beats. */ - framepos_t framepos_plus_qn (framepos_t, Evoral::Beats) const; - Evoral::Beats framewalk_to_qn (framepos_t pos, framecnt_t distance) const; + samplepos_t samplepos_plus_qn (samplepos_t, Evoral::Beats) const; + Evoral::Beats framewalk_to_qn (samplepos_t pos, samplecnt_t distance) const; /* quarter note related functions are also tempo-sensitive and ignore meter. quarter notes may be compared with and assigned to Evoral::Beats. */ - double quarter_note_at_frame (const framepos_t frame) const; - double quarter_note_at_frame_rt (const framepos_t frame) const; - framepos_t frame_at_quarter_note (const double quarter_note) const; + double quarter_note_at_sample (const samplepos_t sample) const; + double quarter_note_at_sample_rt (const samplepos_t sample) const; + samplepos_t sample_at_quarter_note (const double quarter_note) const; - framecnt_t frames_between_quarter_notes (const double start, const double end) const; - double quarter_notes_between_frames (const framecnt_t start, const framecnt_t end) const; + samplecnt_t samples_between_quarter_notes (const double start, const double end) const; + double quarter_notes_between_samples (const samplecnt_t start, const samplecnt_t end) const; double quarter_note_at_beat (const double beat) const; double beat_at_quarter_note (const double beat) const; - /* obtain a musical subdivision via a frame position and magic note divisor.*/ - double exact_qn_at_frame (const framepos_t frame, const int32_t sub_num) const; - double exact_beat_at_frame (const framepos_t frame, const int32_t sub_num) const; + /* obtain a musical subdivision via a sample position and magic note divisor.*/ + double exact_qn_at_sample (const samplepos_t sample, const int32_t sub_num) const; + double exact_beat_at_sample (const samplepos_t sample, const int32_t sub_num) const; - Tempo tempo_at_frame (const framepos_t frame) const; - framepos_t frame_at_tempo (const Tempo& tempo) const; + Tempo tempo_at_sample (const samplepos_t sample) const; + samplepos_t sample_at_tempo (const Tempo& tempo) const; Tempo tempo_at_quarter_note (const double& beat) const; double quarter_note_at_tempo (const Tempo& tempo) const; - void gui_set_tempo_position (TempoSection*, const framepos_t frame, const int& sub_num); - void gui_set_meter_position (MeterSection*, const framepos_t frame); + void gui_set_tempo_position (TempoSection*, const samplepos_t sample, const int& sub_num); + void gui_set_meter_position (MeterSection*, const samplepos_t sample); bool gui_change_tempo (TempoSection*, const Tempo& bpm); - void gui_stretch_tempo (TempoSection* tempo, const framepos_t frame, const framepos_t end_frame, const double start_qnote, const double end_qnote); - void gui_stretch_tempo_end (TempoSection* tempo, const framepos_t frame, const framepos_t end_frame); - bool gui_twist_tempi (TempoSection* first, const Tempo& bpm, const framepos_t frame, const framepos_t end_frame); + void gui_stretch_tempo (TempoSection* tempo, const samplepos_t sample, const samplepos_t end_sample, const double start_qnote, const double end_qnote); + void gui_stretch_tempo_end (TempoSection* tempo, const samplepos_t sample, const samplepos_t end_sample); + bool gui_twist_tempi (TempoSection* first, const Tempo& bpm, const samplepos_t sample, const samplepos_t end_sample); - std::pair<double, framepos_t> predict_tempo_position (TempoSection* section, const Timecode::BBT_Time& bbt); + std::pair<double, samplepos_t> predict_tempo_position (TempoSection* section, const Timecode::BBT_Time& bbt); bool can_solve_bbt (TempoSection* section, const Timecode::BBT_Time& bbt); PBD::Signal1<void,const PBD::PropertyChange&> MetricPositionChanged; void fix_legacy_session(); void fix_legacy_end_session(); - framepos_t music_origin (); + samplepos_t music_origin (); private: /* prevent copy construction */ @@ -558,7 +558,7 @@ private: Timecode::BBT_Time bbt_at_pulse_locked (const Metrics& metrics, const double& pulse) const; double minutes_between_quarter_notes_locked (const Metrics& metrics, const double start_qn, const double end_qn) const; - double quarter_notes_between_frames_locked (const Metrics& metrics, const framecnt_t start, const framecnt_t end) const; + double quarter_notes_between_samples_locked (const Metrics& metrics, const samplecnt_t start, const samplecnt_t end) const; const TempoSection& tempo_section_at_minute_locked (const Metrics& metrics, double minute) const; TempoSection& tempo_section_at_minute_locked (const Metrics& metrics, double minute); @@ -568,18 +568,18 @@ private: const MeterSection& meter_section_at_beat_locked (const Metrics& metrics, const double& beat) const; bool check_solved (const Metrics& metrics) const; - bool set_active_tempi (const Metrics& metrics, const framepos_t frame); + bool set_active_tempi (const Metrics& metrics, const samplepos_t sample); bool solve_map_minute (Metrics& metrics, TempoSection* section, const double& minute); bool solve_map_pulse (Metrics& metrics, TempoSection* section, const double& pulse); bool solve_map_minute (Metrics& metrics, MeterSection* section, const double& minute); bool solve_map_bbt (Metrics& metrics, MeterSection* section, const Timecode::BBT_Time& bbt); - double exact_beat_at_frame_locked (const Metrics& metrics, const framepos_t frame, const int32_t sub_num) const; - double exact_qn_at_frame_locked (const Metrics& metrics, const framepos_t frame, const int32_t sub_num) const; + double exact_beat_at_sample_locked (const Metrics& metrics, const samplepos_t sample, const int32_t sub_num) const; + double exact_qn_at_sample_locked (const Metrics& metrics, const samplepos_t sample, const int32_t sub_num) const; - double minute_at_frame (const framepos_t frame) const; - framepos_t frame_at_minute (const double minute) const; + double minute_at_sample (const samplepos_t sample) const; + samplepos_t sample_at_minute (const double minute) const; friend class ::BBTTest; friend class ::FrameposPlusBeatsTest; @@ -590,14 +590,14 @@ private: static Meter _default_meter; Metrics _metrics; - framecnt_t _frame_rate; + samplecnt_t _sample_rate; mutable Glib::Threads::RWLock lock; void recompute_tempi (Metrics& metrics); void recompute_meters (Metrics& metrics); - void recompute_map (Metrics& metrics, framepos_t end = -1); + void recompute_map (Metrics& metrics, samplepos_t end = -1); - MusicFrame round_to_type (framepos_t fr, RoundMode dir, BBTPointType); + MusicSample round_to_type (samplepos_t fr, RoundMode dir, BBTPointType); const MeterSection& first_meter() const; MeterSection& first_meter(); @@ -609,7 +609,7 @@ private: TempoSection* add_tempo_locked (const Tempo&, double pulse, double minute , PositionLockStyle pls, bool recompute, bool locked_to_meter = false, bool clamped = false); - MeterSection* add_meter_locked (const Meter&, const Timecode::BBT_Time& where, framepos_t frame, PositionLockStyle pls, bool recompute); + MeterSection* add_meter_locked (const Meter&, const Timecode::BBT_Time& where, samplepos_t sample, PositionLockStyle pls, bool recompute); bool remove_tempo_locked (const TempoSection&); bool remove_meter_locked (const MeterSection&); diff --git a/libs/ardour/ardour/thread_buffers.h b/libs/ardour/ardour/thread_buffers.h index 12e549fe55..cf8e31c692 100644 --- a/libs/ardour/ardour/thread_buffers.h +++ b/libs/ardour/ardour/thread_buffers.h @@ -50,7 +50,7 @@ public: uint32_t npan_buffers; private: - void allocate_pan_automation_buffers (framecnt_t nframes, uint32_t howmany, bool force); + void allocate_pan_automation_buffers (samplecnt_t nframes, uint32_t howmany, bool force); }; } // namespace diff --git a/libs/ardour/ardour/ticker.h b/libs/ardour/ardour/ticker.h index fbca0161d4..93d7a79041 100644 --- a/libs/ardour/ardour/ticker.h +++ b/libs/ardour/ardour/ticker.h @@ -42,7 +42,7 @@ public: MidiClockTicker (); virtual ~MidiClockTicker(); - void tick (const framepos_t& transport_frames, pframes_t nframes); + void tick (const samplepos_t& transport_samples, pframes_t nframes); bool has_midi_port() const { return _midi_port != 0; } @@ -74,7 +74,7 @@ public: class Position; boost::scoped_ptr<Position> _pos; - double one_ppqn_in_frames (framepos_t transport_position); + double one_ppqn_in_samples (samplepos_t transport_position); void send_midi_clock_event (pframes_t offset, pframes_t nframes); void send_start_event (pframes_t offset, pframes_t nframes); diff --git a/libs/ardour/ardour/track.h b/libs/ardour/ardour/track.h index 055ac93707..9d00f812d3 100644 --- a/libs/ardour/ardour/track.h +++ b/libs/ardour/ardour/track.h @@ -69,17 +69,17 @@ class LIBARDOUR_API Track : public Route, public Recordable bool set_processor_state (XMLNode const & node, XMLProperty const* prop, ProcessorList& new_order, bool& must_configure); - virtual int no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, + virtual int no_roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, bool state_changing); - virtual int roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, + virtual int roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_sample, int declick, bool& need_butler) = 0; bool needs_butler() const { return _needs_butler; } bool can_record(); - void set_latency_compensation (framecnt_t); + void set_latency_compensation (samplecnt_t); void update_latency_information (); enum FreezeState { NoFreeze, @@ -117,9 +117,9 @@ class LIBARDOUR_API Track : public Route, public Recordable * @param include_endpoint include the given processor in the bounced audio. * @return a new audio region (or nil in case of error) */ - virtual boost::shared_ptr<Region> bounce_range (framepos_t start, framepos_t end, InterThreadInfo& itt, + virtual boost::shared_ptr<Region> bounce_range (samplepos_t start, samplepos_t end, InterThreadInfo& itt, boost::shared_ptr<Processor> endpoint, bool include_endpoint) = 0; - virtual int export_stuff (BufferSet& bufs, framepos_t start_frame, framecnt_t nframes, + virtual int export_stuff (BufferSet& bufs, samplepos_t start_sample, samplecnt_t nframes, boost::shared_ptr<Processor> endpoint, bool include_endpoint, bool for_export, bool for_freeze) = 0; XMLNode& get_state(); @@ -150,27 +150,27 @@ class LIBARDOUR_API Track : public Route, public Recordable int do_refill (); int do_flush (RunContext, bool force = false); void set_pending_overwrite (bool); - int seek (framepos_t, bool complete_refill = false); - int can_internal_playback_seek (framecnt_t); - int internal_playback_seek (framecnt_t); - void non_realtime_locate (framepos_t); + int seek (samplepos_t, bool complete_refill = false); + int can_internal_playback_seek (samplecnt_t); + int internal_playback_seek (samplecnt_t); + void non_realtime_locate (samplepos_t); void realtime_handle_transport_stopped (); void non_realtime_speed_change (); int overwrite_existing_buffers (); - framecnt_t get_captured_frames (uint32_t n = 0) const; + samplecnt_t get_captured_samples (uint32_t n = 0) const; int set_loop (ARDOUR::Location *); - void transport_looped (framepos_t); + void transport_looped (samplepos_t); bool realtime_speed_change (); void transport_stopped_wallclock (struct tm &, time_t, bool); bool pending_overwrite () const; - void prepare_to_stop (framepos_t, framepos_t); + void prepare_to_stop (samplepos_t, samplepos_t); void set_slaved (bool); ChanCount n_channels (); - framepos_t get_capture_start_frame (uint32_t n = 0) const; + samplepos_t get_capture_start_sample (uint32_t n = 0) const; AlignStyle alignment_style () const; AlignChoice alignment_choice () const; - framepos_t current_capture_start () const; - framepos_t current_capture_end () const; + samplepos_t current_capture_start () const; + samplepos_t current_capture_end () const; void set_align_style (AlignStyle, bool force=false); void set_align_choice (AlignChoice, bool force=false); void playlist_modified (); @@ -228,7 +228,7 @@ class LIBARDOUR_API Track : public Route, public Recordable XMLNode* pending_state; bool _destructive; - void maybe_declick (BufferSet&, framecnt_t, int); + void maybe_declick (BufferSet&, samplecnt_t, int); boost::shared_ptr<AutomationControl> _record_enable_control; boost::shared_ptr<AutomationControl> _record_safe_control; @@ -236,7 +236,7 @@ class LIBARDOUR_API Track : public Route, public Recordable virtual void record_enable_changed (bool, PBD::Controllable::GroupControlDisposition); virtual void record_safe_changed (bool, PBD::Controllable::GroupControlDisposition); - framecnt_t check_initial_delay (framecnt_t nframes, framepos_t&); + samplecnt_t check_initial_delay (samplecnt_t nframes, samplepos_t&); virtual void monitoring_changed (bool, PBD::Controllable::GroupControlDisposition); AlignChoice _alignment_choice; diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index 3999c36aa3..d3ed94e552 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -65,27 +65,27 @@ namespace ARDOUR { typedef uint64_t microseconds_t; typedef uint32_t pframes_t; - /* Any position measured in audio frames. + /* Any position measured in audio samples. Assumed to be non-negative but not enforced. */ - typedef int64_t framepos_t; + typedef int64_t samplepos_t; - /* Any distance from a given framepos_t. + /* Any distance from a given samplepos_t. Maybe positive or negative. */ - typedef int64_t frameoffset_t; + typedef int64_t sampleoffset_t; - /* Any count of audio frames. + /* Any count of audio samples. Assumed to be positive but not enforced. */ - typedef int64_t framecnt_t; + typedef int64_t samplecnt_t; - static const framepos_t max_framepos = INT64_MAX; - static const framecnt_t max_framecnt = INT64_MAX; + static const samplepos_t max_samplepos = INT64_MAX; + static const samplecnt_t max_samplecnt = INT64_MAX; static const layer_t max_layer = UINT32_MAX; // a set of (time) intervals: first of pair is the offset of the start within the region, second is the offset of the end - typedef std::list<std::pair<frameoffset_t, frameoffset_t> > AudioIntervalResult; + typedef std::list<std::pair<sampleoffset_t, sampleoffset_t> > AudioIntervalResult; // associate a set of intervals with regions (e.g. for silence detection) typedef std::map<boost::shared_ptr<ARDOUR::Region>,AudioIntervalResult> AudioIntervalMap; @@ -251,7 +251,7 @@ namespace ARDOUR { enum Type { Timecode, BBT, - Frames, + Samples, Seconds }; @@ -261,11 +261,11 @@ namespace ARDOUR { Timecode::BBT_Time bbt; union { - framecnt_t frames; + samplecnt_t samples; double seconds; }; - AnyTime() { type = Frames; frames = 0; } + AnyTime() { type = Samples; samples = 0; } bool operator== (AnyTime const & other) const { if (type != other.type) { return false; } @@ -275,8 +275,8 @@ namespace ARDOUR { return timecode == other.timecode; case BBT: return bbt == other.bbt; - case Frames: - return frames == other.frames; + case Samples: + return samples == other.samples; case Seconds: return seconds == other.seconds; } @@ -291,8 +291,8 @@ namespace ARDOUR { timecode.seconds != 0 || timecode.frames != 0; case BBT: return bbt.bars != 0 || bbt.beats != 0 || bbt.ticks != 0; - case Frames: - return frames != 0; + case Samples: + return samples != 0; case Seconds: return seconds != 0; } @@ -302,38 +302,38 @@ namespace ARDOUR { } }; - /* used for translating audio frames to an exact musical position using a note divisor. - an exact musical position almost never falls exactly on an audio frame, but for sub-sample - musical accuracy we need to derive exact musical locations from a frame position - the division follows TempoMap::exact_beat_at_frame(). + /* used for translating audio samples to an exact musical position using a note divisor. + an exact musical position almost never falls exactly on an audio sample, but for sub-sample + musical accuracy we need to derive exact musical locations from a sample position + the division follows TempoMap::exact_beat_at_sample(). division - -1 musical location is the bar closest to frame - 0 musical location is the musical position of the frame - 1 musical location is the BBT beat closest to frame - n musical location is the quarter-note division n closest to frame + -1 musical location is the bar closest to sample + 0 musical location is the musical position of the sample + 1 musical location is the BBT beat closest to sample + n musical location is the quarter-note division n closest to sample */ - struct MusicFrame { - framepos_t frame; + struct MusicSample { + samplepos_t sample; int32_t division; - MusicFrame (framepos_t f, int32_t d) : frame (f), division (d) {} + MusicSample (samplepos_t f, int32_t d) : sample (f), division (d) {} - void set (framepos_t f, int32_t d) {frame = f; division = d; } + void set (samplepos_t f, int32_t d) {sample = f; division = d; } - MusicFrame operator- (MusicFrame other) { return MusicFrame (frame - other.frame, 0); } + MusicSample operator- (MusicSample other) { return MusicSample (sample - other.sample, 0); } }; /* XXX: slightly unfortunate that there is this and Evoral::Range<>, but this has a uint32_t id which Evoral::Range<> does not. */ struct AudioRange { - framepos_t start; - framepos_t end; + samplepos_t start; + samplepos_t end; uint32_t id; - AudioRange (framepos_t s, framepos_t e, uint32_t i) : start (s), end (e) , id (i) {} + AudioRange (samplepos_t s, samplepos_t e, uint32_t i) : start (s), end (e) , id (i) {} - framecnt_t length() const { return end - start + 1; } + samplecnt_t length() const { return end - start + 1; } bool operator== (const AudioRange& other) const { return start == other.start && end == other.end && id == other.id; @@ -343,7 +343,7 @@ namespace ARDOUR { return start == other.start && end == other.end; } - Evoral::OverlapType coverage (framepos_t s, framepos_t e) const { + Evoral::OverlapType coverage (samplepos_t s, samplepos_t e) const { return Evoral::coverage (start, end, s, e); } }; @@ -570,7 +570,7 @@ namespace ARDOUR { SrcFastest }; - typedef std::list<framepos_t> AnalysisFeatureList; + typedef std::list<samplepos_t> AnalysisFeatureList; typedef std::list<boost::shared_ptr<Route> > RouteList; typedef std::list<boost::shared_ptr<Stripable> > StripableList; @@ -712,38 +712,38 @@ namespace ARDOUR { }; struct CaptureInfo { - framepos_t start; - framecnt_t frames; + samplepos_t start; + samplecnt_t samples; }; typedef std::vector<CaptureInfo*> CaptureInfos; } // namespace ARDOUR -static inline ARDOUR::framepos_t -session_frame_to_track_frame (ARDOUR::framepos_t session_frame, double speed) +static inline ARDOUR::samplepos_t +session_sample_to_track_sample (ARDOUR::samplepos_t session_sample, double speed) { - long double result = (long double) session_frame * (long double) speed; + long double result = (long double) session_sample * (long double) speed; - if (result >= (long double) ARDOUR::max_framepos) { - return ARDOUR::max_framepos; - } else if (result <= (long double) (ARDOUR::max_framepos) * (ARDOUR::framepos_t)(-1)) { - return (ARDOUR::max_framepos * (ARDOUR::framepos_t)(-1)); + if (result >= (long double) ARDOUR::max_samplepos) { + return ARDOUR::max_samplepos; + } else if (result <= (long double) (ARDOUR::max_samplepos) * (ARDOUR::samplepos_t)(-1)) { + return (ARDOUR::max_samplepos * (ARDOUR::samplepos_t)(-1)); } else { return result; } } -static inline ARDOUR::framepos_t -track_frame_to_session_frame (ARDOUR::framepos_t track_frame, double speed) +static inline ARDOUR::samplepos_t +track_sample_to_session_sample (ARDOUR::samplepos_t track_sample, double speed) { /* NB - do we need a check for speed == 0 ??? */ - long double result = (long double) track_frame / (long double) speed; + long double result = (long double) track_sample / (long double) speed; - if (result >= (long double) ARDOUR::max_framepos) { - return ARDOUR::max_framepos; - } else if (result <= (long double) (ARDOUR::max_framepos) * (ARDOUR::framepos_t)(-1)) { - return (ARDOUR::max_framepos * (ARDOUR::framepos_t)(-1)); + if (result >= (long double) ARDOUR::max_samplepos) { + return ARDOUR::max_samplepos; + } else if (result <= (long double) (ARDOUR::max_samplepos) * (ARDOUR::samplepos_t)(-1)) { + return (ARDOUR::max_samplepos * (ARDOUR::samplepos_t)(-1)); } else { return result; } @@ -751,7 +751,7 @@ track_frame_to_session_frame (ARDOUR::framepos_t track_frame, double speed) /* for now, break the rules and use "using" to make this "global" */ -using ARDOUR::framepos_t; +using ARDOUR::samplepos_t; #endif /* __ardour_types_h__ */ diff --git a/libs/ardour/ardour/unknown_processor.h b/libs/ardour/ardour/unknown_processor.h index 170be38042..33d32f5b34 100644 --- a/libs/ardour/ardour/unknown_processor.h +++ b/libs/ardour/ardour/unknown_processor.h @@ -46,7 +46,7 @@ public: virtual ~UnknownProcessor (); bool can_support_io_configuration (const ChanCount &, ChanCount &); - void run (BufferSet& /*bufs*/, framepos_t /*start_frame*/, framepos_t /*end_frame*/, double /*speed*/, pframes_t /*nframes*/, bool /*result_required*/); + void run (BufferSet& /*bufs*/, samplepos_t /*start_sample*/, samplepos_t /*end_sample*/, double /*speed*/, pframes_t /*nframes*/, bool /*result_required*/); XMLNode & state (bool); diff --git a/libs/ardour/ardour/uri_map.h b/libs/ardour/ardour/uri_map.h index de0999d94f..9c1aee30e9 100644 --- a/libs/ardour/ardour/uri_map.h +++ b/libs/ardour/ardour/uri_map.h @@ -78,7 +78,7 @@ public: uint32_t time_beatUnit; uint32_t time_beatsPerBar; uint32_t time_beatsPerMinute; - uint32_t time_frame; + uint32_t time_sample; uint32_t time_speed; uint32_t patch_Get; uint32_t patch_Set; diff --git a/libs/ardour/ardour/utils.h b/libs/ardour/ardour/utils.h index 77dc8236a7..3e5ff1b1a1 100644 --- a/libs/ardour/ardour/utils.h +++ b/libs/ardour/ardour/utils.h @@ -73,7 +73,7 @@ LIBARDOUR_API int cmp_nocase_utf8 (const std::string& s1, const std::string& s2) LIBARDOUR_API std::string region_name_from_path (std::string path, bool strip_channels, bool add_channel_suffix = false, uint32_t total = 0, uint32_t this_one = 0); LIBARDOUR_API bool path_is_paired (std::string path, std::string& pair_base); -LIBARDOUR_API void compute_equal_power_fades (ARDOUR::framecnt_t nframes, float* in, float* out); +LIBARDOUR_API void compute_equal_power_fades (ARDOUR::samplecnt_t nframes, float* in, float* out); LIBARDOUR_API const char* sync_source_to_string (ARDOUR::SyncSource src, bool sh = false); LIBARDOUR_API ARDOUR::SyncSource string_to_sync_source (std::string str); diff --git a/libs/ardour/ardour/vestige/aeffectx.h b/libs/ardour/ardour/vestige/aeffectx.h index a9a168ed1d..40356d3455 100644 --- a/libs/ardour/ardour/vestige/aeffectx.h +++ b/libs/ardour/ardour/vestige/aeffectx.h @@ -159,7 +159,7 @@ struct _VstMidiEvent // 04 int byteSize; // 08 - int deltaFrames; + int deltaSamples; // 0c? int flags; // 10? diff --git a/libs/ardour/ardour/vst_plugin.h b/libs/ardour/ardour/vst_plugin.h index bb172d9efd..74c53ae812 100644 --- a/libs/ardour/ardour/vst_plugin.h +++ b/libs/ardour/ardour/vst_plugin.h @@ -58,7 +58,7 @@ public: bool load_preset (PresetRecord); int get_parameter_descriptor (uint32_t which, ParameterDescriptor&) const; std::string describe_parameter (Evoral::Parameter); - framecnt_t signal_latency() const; + samplecnt_t signal_latency() const; std::set<Evoral::Parameter> automatable() const; PBD::Signal0<void> LoadPresetProgram; @@ -72,9 +72,9 @@ public: uint32_t designated_bypass_port (); int connect_and_run (BufferSet&, - framepos_t start, framepos_t end, double speed, + samplepos_t start, samplepos_t end, double speed, ChanMapping in, ChanMapping out, - pframes_t nframes, framecnt_t offset + pframes_t nframes, samplecnt_t offset ); std::string unique_id () const; @@ -98,7 +98,7 @@ public: PluginInsert* plugin_insert () const { return _pi; } uint32_t plugin_number () const { return _num; } VstTimeInfo* timeinfo () { return &_timeInfo; } - framepos_t transport_frame () const { return _transport_frame; } + samplepos_t transport_sample () const { return _transport_sample; } float transport_speed () const { return _transport_speed; } @@ -126,7 +126,7 @@ protected: MidiBuffer* _midi_out_buf; VstTimeInfo _timeInfo; - framepos_t _transport_frame; + samplepos_t _transport_sample; float _transport_speed; mutable std::map <uint32_t, float> _parameter_defaults; bool _eff_bypassed; |