diff options
Diffstat (limited to 'libs')
66 files changed, 383 insertions, 377 deletions
diff --git a/libs/ardour/amp.cc b/libs/ardour/amp.cc index 6002a2549d..1486353ca0 100644 --- a/libs/ardour/amp.cc +++ b/libs/ardour/amp.cc @@ -434,7 +434,7 @@ Amp::GainControl::get_value (void) const } void -Amp::setup_gain_automation (sframes_t start_frame, sframes_t end_frame, nframes_t nframes) +Amp::setup_gain_automation (framepos_t start_frame, framepos_t end_frame, nframes_t nframes) { Glib::Mutex::Lock am (control_lock(), Glib::TRY_LOCK); diff --git a/libs/ardour/ardour/amp.h b/libs/ardour/ardour/amp.h index 011fef13c0..0ec493e8ce 100644 --- a/libs/ardour/ardour/amp.h +++ b/libs/ardour/ardour/amp.h @@ -48,7 +48,7 @@ public: bool apply_gain() const { return _apply_gain; } void apply_gain(bool yn) { _apply_gain = yn; } - void setup_gain_automation (sframes_t start_frame, sframes_t end_frame, nframes_t nframes); + void setup_gain_automation (framepos_t start_frame, framepos_t end_frame, nframes_t nframes); bool apply_gain_automation() const { return _apply_gain_automation; } void apply_gain_automation(bool yn) { _apply_gain_automation = yn; } diff --git a/libs/ardour/ardour/audio_track.h b/libs/ardour/ardour/audio_track.h index ecd88b94e5..8e31db34fd 100644 --- a/libs/ardour/ardour/audio_track.h +++ b/libs/ardour/ardour/audio_track.h @@ -49,7 +49,7 @@ class AudioTrack : public Track return DataType::AUDIO; } - int export_stuff (BufferSet& bufs, sframes_t start_frame, nframes_t nframes, bool enable_processing = true); + int export_stuff (BufferSet& bufs, framepos_t start_frame, framecnt_t nframes, bool enable_processing = true); void freeze_me (InterThreadInfo&); void unfreeze (); diff --git a/libs/ardour/ardour/audioanalyser.h b/libs/ardour/ardour/audioanalyser.h index 627dc3f137..f16a2b1e49 100644 --- a/libs/ardour/ardour/audioanalyser.h +++ b/libs/ardour/ardour/audioanalyser.h @@ -56,8 +56,8 @@ class AudioAnalyser : public boost::noncopyable { AnalysisPlugin* plugin; AnalysisPluginKey plugin_key; - nframes64_t bufsize; - nframes64_t stepsize; + nframes_t bufsize; + nframes_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/audiofilesource.h b/libs/ardour/ardour/audiofilesource.h index bd3d223fc1..57b5ced93c 100644 --- a/libs/ardour/ardour/audiofilesource.h +++ b/libs/ardour/ardour/audiofilesource.h @@ -58,8 +58,8 @@ public: /* this block of methods do nothing for regular file sources, but are significant for files used in destructive recording. */ - virtual sframes_t last_capture_start_frame() const { return 0; } - virtual void mark_capture_start (sframes_t) {} + virtual framepos_t last_capture_start_frame() const { return 0; } + virtual void mark_capture_start (framepos_t) {} virtual void mark_capture_end () {} virtual void clear_capture_marks() {} virtual bool one_of_several_channels () const { return false; } diff --git a/libs/ardour/ardour/audioregion.h b/libs/ardour/ardour/audioregion.h index 71a948c352..b294082273 100644 --- a/libs/ardour/ardour/audioregion.h +++ b/libs/ardour/ardour/audioregion.h @@ -177,12 +177,12 @@ class AudioRegion : public Region void resume_fade_in (); void resume_fade_out (); - void add_transient (nframes64_t where); - void remove_transient (nframes64_t where); + void add_transient (framepos_t where); + void remove_transient (framepos_t where); int set_transients (AnalysisFeatureList&); int get_transients (AnalysisFeatureList&, bool force_new = false); - int update_transient (nframes64_t old_position, nframes64_t new_position); - int adjust_transients (nframes64_t delta); + int update_transient (framepos_t old_position, framepos_t new_position); + int adjust_transients (framepos_t delta); std::list<std::pair<frameoffset_t, framecnt_t> > find_silence (Sample, framecnt_t, InterThreadInfo&) const; diff --git a/libs/ardour/ardour/beats_frames_converter.h b/libs/ardour/ardour/beats_frames_converter.h index b1e44adbef..816721ebad 100644 --- a/libs/ardour/ardour/beats_frames_converter.h +++ b/libs/ardour/ardour/beats_frames_converter.h @@ -29,15 +29,15 @@ namespace ARDOUR { class TempoMap; -class BeatsFramesConverter : public Evoral::TimeConverter<double,sframes_t> { +class BeatsFramesConverter : public Evoral::TimeConverter<double,framepos_t> { public: - BeatsFramesConverter(const TempoMap& tempo_map, sframes_t origin) - : Evoral::TimeConverter<double, sframes_t> (origin) + BeatsFramesConverter(const TempoMap& tempo_map, framepos_t origin) + : Evoral::TimeConverter<double, framepos_t> (origin) , _tempo_map(tempo_map) {} - sframes_t to(double beats) const; - double from(sframes_t frames) const; + framepos_t to(double beats) const; + double from(framepos_t frames) const; private: const TempoMap& _tempo_map; diff --git a/libs/ardour/ardour/caimportable.h b/libs/ardour/ardour/caimportable.h index dbf93dbb73..1fe94b8953 100644 --- a/libs/ardour/ardour/caimportable.h +++ b/libs/ardour/ardour/caimportable.h @@ -38,7 +38,7 @@ class CAImportableSource : public ImportableSource { nframes_t length() const; nframes_t samplerate() const; void seek (nframes_t pos); - nframes64_t natural_position() const { return 0; } + framepos_t natural_position() const { return 0; } protected: mutable CAAudioFile af; diff --git a/libs/ardour/ardour/coreaudiosource.h b/libs/ardour/ardour/coreaudiosource.h index 649c57c3ca..c83b63934f 100644 --- a/libs/ardour/ardour/coreaudiosource.h +++ b/libs/ardour/ardour/coreaudiosource.h @@ -45,7 +45,7 @@ class CoreAudioSource : public AudioFileSource { static int get_soundfile_info (string path, SoundFileInfo& _info, string& error_msg); protected: - nframes_t read_unlocked (Sample *dst, sframes_t start, nframes_t cnt) const; + nframes_t read_unlocked (Sample *dst, framepos_t start, nframes_t cnt) const; nframes_t write_unlocked (Sample *dst, nframes_t cnt) { return 0; } private: diff --git a/libs/ardour/ardour/delivery.h b/libs/ardour/ardour/delivery.h index f7cbc29af7..c920fadc2c 100644 --- a/libs/ardour/ardour/delivery.h +++ b/libs/ardour/ardour/delivery.h @@ -66,15 +66,15 @@ public: bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const; bool configure_io (ChanCount in, ChanCount out); - void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes, bool); + void run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, nframes_t nframes, bool); /* supplemental method used with MIDI */ - void flush_buffers (nframes_t nframes, nframes64_t time); + void flush_buffers (nframes_t nframes, framepos_t time); void no_outs_cuz_we_no_monitor(bool); void cycle_start (nframes_t); void increment_output_offset (nframes_t); - void transport_stopped (sframes_t frame); + void transport_stopped (framepos_t frame); BufferSet& output_buffers() { return *_output_buffers; } diff --git a/libs/ardour/ardour/export_handler.h b/libs/ardour/ardour/export_handler.h index 49400a9363..f826e09bf5 100644 --- a/libs/ardour/ardour/export_handler.h +++ b/libs/ardour/ardour/export_handler.h @@ -141,7 +141,7 @@ class ExportHandler : public ExportElementFactory TimespanBounds timespan_bounds; PBD::ScopedConnection process_connection; - sframes_t process_position; + framepos_t process_position; /* CD Marker stuff */ @@ -161,13 +161,13 @@ class ExportHandler : public ExportElementFactory /* Track info */ uint32_t track_number; - sframes_t track_position; - sframes_t track_duration; - sframes_t track_start_frame; + framepos_t track_position; + framepos_t track_duration; + framepos_t track_start_frame; /* Index info */ uint32_t index_number; - sframes_t index_position; + framepos_t index_position; }; @@ -182,7 +182,7 @@ class ExportHandler : public ExportElementFactory void write_index_info_cue (CDMarkerStatus & status); void write_index_info_toc (CDMarkerStatus & status); - void frames_to_cd_frames_string (char* buf, sframes_t when); + void frames_to_cd_frames_string (char* buf, framepos_t when); int cue_tracknum; int cue_indexnum; diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h index 1facfb8ec2..6793072cba 100644 --- a/libs/ardour/ardour/io.h +++ b/libs/ardour/ardour/io.h @@ -163,7 +163,7 @@ class IO : public SessionObject, public Latent /* three utility functions - this just seems to be simplest place to put them */ void collect_input (BufferSet& bufs, nframes_t nframes, ChanCount offset); - void process_input (boost::shared_ptr<Processor>, sframes_t start_frame, sframes_t end_frame, nframes_t nframes); + void process_input (boost::shared_ptr<Processor>, framepos_t start_frame, framepos_t end_frame, nframes_t nframes); void copy_to_outputs (BufferSet& bufs, DataType type, nframes_t nframes, nframes_t offset); /* AudioTrack::deprecated_use_diskstream_connections() needs these */ diff --git a/libs/ardour/ardour/location.h b/libs/ardour/ardour/location.h index f3c322e2d4..c2da2c04cb 100644 --- a/libs/ardour/ardour/location.h +++ b/libs/ardour/ardour/location.h @@ -52,7 +52,7 @@ class Location : public SessionHandleRef, public PBD::StatefulDestructible }; Location (Session &); - Location (Session &, nframes64_t, nframes64_t, const std::string &, Flags bits = Flags(0)); + Location (Session &, framepos_t, framepos_t, const std::string &, Flags bits = Flags(0)); Location (const Location& other); Location (Session &, const XMLNode&); Location* operator= (const Location& other); @@ -61,15 +61,15 @@ class Location : public SessionHandleRef, public PBD::StatefulDestructible void lock (); void unlock (); - nframes64_t start() const { return _start; } - nframes64_t end() const { return _end; } - nframes64_t length() const { return _end - _start; } + framepos_t start() const { return _start; } + framepos_t end() const { return _end; } + framepos_t length() const { return _end - _start; } - int set_start (nframes64_t s, bool force = false, bool allow_bbt_recompute = true); - int set_end (nframes64_t e, bool force = false, bool allow_bbt_recompute = true); - int set (nframes64_t start, nframes64_t end, bool allow_bbt_recompute = true); + int set_start (framepos_t s, bool force = false, bool allow_bbt_recompute = true); + int set_end (framepos_t e, bool force = false, bool allow_bbt_recompute = true); + int set (framepos_t start, framepos_t end, bool allow_bbt_recompute = true); - int move_to (nframes64_t pos); + int move_to (framepos_t pos); const std::string& name() const { return _name; } void set_name (const std::string &str) { _name = str; name_changed(this); } @@ -116,9 +116,9 @@ class Location : public SessionHandleRef, public PBD::StatefulDestructible private: std::string _name; - nframes64_t _start; + framepos_t _start; BBT_Time _bbt_start; - nframes64_t _end; + framepos_t _end; BBT_Time _bbt_end; Flags _flags; bool _locked; @@ -159,12 +159,12 @@ class Locations : public SessionHandleRef, public PBD::StatefulDestructible int set_current (Location *, bool want_lock = true); Location *current () const { return current_location; } - Location* first_location_before (nframes64_t, bool include_special_ranges = false); - Location* first_location_after (nframes64_t, bool include_special_ranges = false); + Location* first_location_before (framepos_t, bool include_special_ranges = false); + Location* first_location_after (framepos_t, bool include_special_ranges = false); - void marks_either_side (nframes64_t const, nframes64_t &, nframes64_t &) const; + void marks_either_side (framepos_t const, framepos_t &, framepos_t &) const; - void find_all_between (nframes64_t start, nframes64_t, LocationList&, Location::Flags); + void find_all_between (framepos_t start, framepos_t, LocationList&, Location::Flags); enum Change { ADDITION, ///< a location was added, but nothing else changed diff --git a/libs/ardour/ardour/midi_port.h b/libs/ardour/ardour/midi_port.h index 10d8c7b6ca..8b6095c470 100644 --- a/libs/ardour/ardour/midi_port.h +++ b/libs/ardour/ardour/midi_port.h @@ -41,7 +41,7 @@ class MidiPort : public Port { void cycle_end (nframes_t nframes); void cycle_split (); - void flush_buffers (nframes_t nframes, nframes64_t time, nframes_t offset = 0); + void flush_buffers (nframes_t nframes, framepos_t time, nframes_t offset = 0); void transport_stopped (); size_t raw_buffer_size(jack_nframes_t nframes) const; diff --git a/libs/ardour/ardour/midi_source.h b/libs/ardour/ardour/midi_source.h index 71c4eaca6d..3bad6d6ddc 100644 --- a/libs/ardour/ardour/midi_source.h +++ b/libs/ardour/ardour/midi_source.h @@ -59,25 +59,25 @@ class MidiSource : virtual public Source * \param tracker an optional pointer to MidiStateTracker object, for note on/off tracking */ virtual nframes_t midi_read (Evoral::EventSink<nframes_t>& dst, - sframes_t source_start, - sframes_t start, nframes_t cnt, + framepos_t source_start, + framepos_t start, nframes_t cnt, MidiStateTracker*, std::set<Evoral::Parameter> const &) const; virtual nframes_t midi_write (MidiRingBuffer<nframes_t>& src, - sframes_t source_start, + framepos_t source_start, nframes_t cnt); virtual void append_event_unlocked_beats(const Evoral::Event<Evoral::MusicalTime>& ev) = 0; virtual void append_event_unlocked_frames(const Evoral::Event<nframes_t>& ev, - sframes_t source_start) = 0; + framepos_t source_start) = 0; virtual bool empty () const; virtual framecnt_t length (framepos_t pos) const; virtual void update_length (framepos_t pos, framecnt_t cnt); - virtual void mark_streaming_midi_write_started (NoteMode mode, sframes_t start_time); + virtual void mark_streaming_midi_write_started (NoteMode mode, framepos_t start_time); virtual void mark_streaming_write_started (); virtual void mark_streaming_write_completed (); @@ -92,7 +92,7 @@ class MidiSource : virtual public Source static PBD::Signal1<void,MidiSource*> MidiSourceCreated; // Signal a range of recorded data is available for reading from model() - mutable PBD::Signal2<void,sframes_t,nframes_t> ViewDataRangeReady; + mutable PBD::Signal2<void,framepos_t,nframes_t> ViewDataRangeReady; XMLNode& get_state (); int set_state (const XMLNode&, int version); @@ -134,12 +134,12 @@ class MidiSource : virtual public Source virtual void flush_midi() = 0; virtual nframes_t read_unlocked (Evoral::EventSink<nframes_t>& dst, - sframes_t position, - sframes_t start, nframes_t cnt, + framepos_t position, + framepos_t start, nframes_t cnt, MidiStateTracker* tracker) const = 0; virtual nframes_t write_unlocked (MidiRingBuffer<nframes_t>& dst, - sframes_t position, + framepos_t position, nframes_t cnt) = 0; std::string _captured_for; @@ -153,8 +153,8 @@ class MidiSource : virtual public Source mutable bool _model_iter_valid; mutable double _length_beats; - mutable sframes_t _last_read_end; - sframes_t _last_write_end; + mutable framepos_t _last_read_end; + framepos_t _last_write_end; /** 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 5c65c1f018..9720649a10 100644 --- a/libs/ardour/ardour/midi_state_tracker.h +++ b/libs/ardour/ardour/midi_state_tracker.h @@ -41,8 +41,8 @@ public: void track (const MidiBuffer::iterator& from, const MidiBuffer::iterator& to, bool& looped); void add (uint8_t note, uint8_t chn); void remove (uint8_t note, uint8_t chn); - void resolve_notes (MidiBuffer& buffer, nframes64_t time); - void resolve_notes (Evoral::EventSink<nframes_t>& buffer, nframes64_t time); + void resolve_notes (MidiBuffer& buffer, framepos_t time); + void resolve_notes (Evoral::EventSink<nframes_t>& buffer, framepos_t time); void resolve_notes (MidiSource& src, Evoral::MusicalTime time); void dump (std::ostream&); void reset (); diff --git a/libs/ardour/ardour/midi_track.h b/libs/ardour/ardour/midi_track.h index ea2b0804f8..0475f3f5ea 100644 --- a/libs/ardour/ardour/midi_track.h +++ b/libs/ardour/ardour/midi_track.h @@ -54,7 +54,7 @@ public: void set_latency_delay (nframes_t); - int export_stuff (BufferSet& bufs, nframes_t nframes, sframes_t end_frame); + int export_stuff (BufferSet& bufs, nframes_t nframes, framepos_t end_frame); void freeze_me (InterThreadInfo&); void unfreeze (); @@ -110,7 +110,7 @@ protected: private: boost::shared_ptr<MidiDiskstream> midi_diskstream () const; - void write_out_of_band_data (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes); + void write_out_of_band_data (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, nframes_t nframes); void set_state_part_two (); void set_state_part_three (); @@ -122,7 +122,7 @@ private: uint8_t _default_channel; bool _midi_thru; - int no_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, + int no_roll (nframes_t nframes, framepos_t start_frame, framepos_t end_frame, bool state_changing, bool can_record, bool rec_monitors_input); void push_midi_input_to_step_edit_ringbuffer (nframes_t nframes); }; diff --git a/libs/ardour/ardour/pi_controller.h b/libs/ardour/ardour/pi_controller.h index 250c943de9..a118fd739f 100644 --- a/libs/ardour/ardour/pi_controller.h +++ b/libs/ardour/ardour/pi_controller.h @@ -60,24 +60,24 @@ class PIChaser { PIChaser(); ~PIChaser(); - double get_ratio( nframes64_t chasetime_measured, nframes64_t chasetime, nframes64_t slavetime_measured, nframes64_t slavetime, bool in_control, int period_size ); + double get_ratio( framepos_t chasetime_measured, framepos_t chasetime, framepos_t slavetime_measured, framepos_t slavetime, bool in_control, int period_size ); void reset(); - nframes64_t want_locate() { return want_locate_val; } + framepos_t want_locate() { return want_locate_val; } private: PIController *pic; - nframes64_t realtime_stamps[ESTIMATOR_SIZE]; - nframes64_t chasetime_stamps[ESTIMATOR_SIZE]; + framepos_t realtime_stamps[ESTIMATOR_SIZE]; + framepos_t chasetime_stamps[ESTIMATOR_SIZE]; int array_index; - nframes64_t want_locate_val; + framepos_t want_locate_val; - void feed_estimator( nframes64_t realtime, nframes64_t chasetime ); + void feed_estimator( framepos_t realtime, framepos_t chasetime ); double get_estimate(); double speed; double speed_threshold; - nframes64_t pos_threshold; + framepos_t pos_threshold; }; diff --git a/libs/ardour/ardour/port.h b/libs/ardour/ardour/port.h index 8b2b3dcbd3..23b42a55ea 100644 --- a/libs/ardour/ardour/port.h +++ b/libs/ardour/ardour/port.h @@ -109,7 +109,7 @@ public: virtual void cycle_end (nframes_t) = 0; virtual void cycle_split () = 0; virtual Buffer& get_buffer (nframes_t nframes, nframes_t offset = 0) = 0; - virtual void flush_buffers (nframes_t nframes, nframes64_t /*time*/, nframes_t offset = 0) { + virtual void flush_buffers (nframes_t nframes, framepos_t /*time*/, nframes_t offset = 0) { assert(offset < nframes); } virtual void transport_stopped () {} diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h index b09e89d3a0..b78699d906 100644 --- a/libs/ardour/ardour/region.h +++ b/libs/ardour/ardour/region.h @@ -103,8 +103,8 @@ class Region * START: first frame of the region within its source(s) * LENGTH: number of frames the region represents */ - sframes_t position () const { return _position; } - sframes_t start () const { return _start; } + framepos_t position () const { return _position; } + framepos_t start () const { return _start; } framecnt_t length() const { return _length; } layer_t layer () const { return _layer; } @@ -112,15 +112,15 @@ class Region /* these two are valid ONLY during a StateChanged signal handler */ - sframes_t last_position() const { return _last_position; } + framepos_t last_position() const { return _last_position; } framecnt_t last_length() const { return _last_length; } - sframes_t ancestral_start () const { return _ancestral_start; } + framepos_t ancestral_start () const { return _ancestral_start; } framecnt_t ancestral_length () const { return _ancestral_length; } float stretch() const { return _stretch; } float shift() const { return _shift; } - void set_ancestral_data (nframes64_t start, nframes64_t length, float stretch, float shift); + void set_ancestral_data (framepos_t start, framepos_t length, float stretch, float shift); frameoffset_t sync_offset(int& dir) const; framepos_t sync_position() const; @@ -247,16 +247,16 @@ class Region virtual int exportme (ARDOUR::Session&, ARDOUR::ExportSpecification&) = 0; - virtual void add_transient (nframes64_t) { + virtual void add_transient (framepos_t) { // no transients, but its OK } - virtual int update_transient (nframes64_t /* old_position */, nframes64_t /* new_position */) { + virtual int update_transient (framepos_t /* old_position */, framepos_t /* new_position */) { // no transients, but its OK return 0; } - virtual void remove_transient (nframes64_t /* where */) { + virtual void remove_transient (framepos_t /* where */) { // no transients, but its OK } @@ -271,7 +271,7 @@ class Region return 0; } - virtual int adjust_transients (nframes64_t /*delta*/) { + virtual int adjust_transients (framepos_t /*delta*/) { // no transients, but its OK return 0; } diff --git a/libs/ardour/ardour/return.h b/libs/ardour/ardour/return.h index 2dcb6eb270..cf709ed2f2 100644 --- a/libs/ardour/ardour/return.h +++ b/libs/ardour/ardour/return.h @@ -74,7 +74,7 @@ private: uint32_t _bitslot; void collect_input (BufferSet& bufs, nframes_t nframes, ChanCount offset=ChanCount::ZERO); - void just_meter_input (sframes_t start_frame, sframes_t end_frame, nframes_t nframes); + void just_meter_input (framepos_t start_frame, framepos_t end_frame, nframes_t nframes); }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index b49cb77788..9a874b459d 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -101,13 +101,13 @@ class Route : public SessionObject, public Automatable, public RouteGroupMember, /* these are the core of the API of a Route. see the protected sections as well */ - virtual int roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, + virtual int roll (nframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool can_record, bool rec_monitors_input, bool& need_butler); - virtual int no_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, + virtual int no_roll (nframes_t nframes, framepos_t start_frame, framepos_t end_frame, bool state_changing, bool can_record, bool rec_monitors_input); - virtual int silent_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, + virtual int silent_roll (nframes_t nframes, framepos_t start_frame, framepos_t end_frame, bool can_record, bool rec_monitors_input, bool& need_butler); virtual void toggle_monitor_input (); @@ -120,7 +120,7 @@ class Route : public SessionObject, public Automatable, public RouteGroupMember, /* end of vfunc-based API */ - void shift (nframes64_t, nframes64_t); + void shift (framepos_t, framepos_t); void set_gain (gain_t val, void *src); void inc_gain (gain_t delta, void *src); @@ -382,20 +382,20 @@ class Route : public SessionObject, public Automatable, public RouteGroupMember, void mod_solo_by_others_downstream (int32_t); bool has_external_redirects() const; void curve_reallocate (); - void just_meter_input (sframes_t start_frame, sframes_t end_frame, nframes_t nframes); + void just_meter_input (framepos_t start_frame, framepos_t end_frame, nframes_t nframes); virtual void set_block_size (nframes_t nframes); protected: nframes_t check_initial_delay (nframes_t, nframes_t&); - void passthru (sframes_t start_frame, sframes_t end_frame, + void passthru (framepos_t start_frame, framepos_t end_frame, nframes_t nframes, int declick); - virtual void write_out_of_band_data (BufferSet& /* bufs */, sframes_t /* start_frame */, sframes_t /* end_frame */, + virtual void write_out_of_band_data (BufferSet& /* bufs */, framepos_t /* start_frame */, framepos_t /* end_frame */, nframes_t /* nframes */) {} virtual void process_output_buffers (BufferSet& bufs, - sframes_t start_frame, sframes_t end_frame, + framepos_t start_frame, framepos_t end_frame, nframes_t nframes, bool with_processors, int declick); boost::shared_ptr<IO> _input; @@ -444,7 +444,7 @@ class Route : public SessionObject, public Automatable, public RouteGroupMember, int configure_processors (ProcessorStreams*); - void passthru_silence (sframes_t start_frame, sframes_t end_frame, + void passthru_silence (framepos_t start_frame, framepos_t end_frame, nframes_t nframes, int declick); void silence (nframes_t); diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 315ad887ae..93d15b8439 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -212,7 +212,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi boost::shared_ptr<RouteList> get_routes_with_internal_returns() const; - boost::shared_ptr<RouteList> get_routes_with_regions_at (nframes64_t const) const; + boost::shared_ptr<RouteList> get_routes_with_regions_at (framepos_t const) const; uint32_t nroutes() const { return routes.reader()->size(); } uint32_t ntracks () const; @@ -270,8 +270,8 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi /* Transport mechanism signals */ PBD::Signal0<void> TransportStateChange; /* generic */ - PBD::Signal1<void,nframes64_t> PositionChanged; /* sent after any non-sequential motion */ - PBD::Signal1<void,nframes64_t> Xrun; + PBD::Signal1<void,framepos_t> PositionChanged; /* sent after any non-sequential motion */ + PBD::Signal1<void,framepos_t> Xrun; PBD::Signal0<void> TransportLooped; /** emitted when a locate has occurred */ @@ -428,9 +428,9 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi /* Time */ - nframes64_t transport_frame () const {return _transport_frame; } - nframes64_t audible_frame () const; - nframes64_t requested_return_frame() const { return _requested_return_frame; } + framepos_t transport_frame () const {return _transport_frame; } + framepos_t audible_frame () const; + framepos_t requested_return_frame() const { return _requested_return_frame; } enum PullupFormat { pullup_Plus4Plus1, @@ -774,8 +774,8 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi boost::shared_ptr<SessionPlaylists> playlists; - void send_mmc_locate (nframes64_t); - int send_full_time_code (nframes64_t); + void send_mmc_locate (framepos_t); + int send_full_time_code (framepos_t); PBD::Signal0<void> RouteOrderKeyChanged; @@ -822,7 +822,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi nframes_t _nominal_frame_rate; //ignores audioengine setting, "native" SR int transport_sub_state; mutable gint _record_status; - volatile nframes64_t _transport_frame; + volatile framepos_t _transport_frame; Location* _session_range_location; ///< session range, or 0 if there is nothing in the session yet Slave* _slave; bool _silent; @@ -834,9 +834,9 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi CubicInterpolation interpolation; bool auto_play_legal; - nframes64_t _last_slave_transport_frame; + framepos_t _last_slave_transport_frame; nframes_t maximum_output_latency; - volatile nframes64_t _requested_return_frame; + volatile framepos_t _requested_return_frame; nframes_t current_block_size; nframes_t _worst_output_latency; nframes_t _worst_input_latency; @@ -1147,9 +1147,9 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi void overwrite_some_buffers (Track *); void flush_all_inserts (); int micro_locate (nframes_t distance); - void locate (nframes64_t, bool with_roll, bool with_flush, bool with_loop=false, bool force=false, bool with_mmc=true); - void start_locate (nframes64_t, bool with_roll, bool with_flush, bool with_loop=false, bool force=false); - void force_locate (nframes64_t frame, bool with_roll = false); + 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 with_loop=false, bool force=false); + void force_locate (framepos_t frame, bool with_roll = false); void set_track_speed (Track *, double speed); void set_transport_speed (double speed, bool abort = false, bool clear_state = false); void stop_transport (bool abort = false, bool clear_state = false); diff --git a/libs/ardour/ardour/session_event.h b/libs/ardour/ardour/session_event.h index 396f4e778b..5c31217045 100644 --- a/libs/ardour/ardour/session_event.h +++ b/libs/ardour/ardour/session_event.h @@ -53,14 +53,14 @@ struct SessionEvent { Type type; Action action; - nframes64_t action_frame; - nframes64_t target_frame; + framepos_t action_frame; + framepos_t target_frame; double speed; union { void* ptr; bool yes_or_no; - nframes64_t target2_frame; + framepos_t target2_frame; Slave* slave; Route* route; }; @@ -148,13 +148,13 @@ protected: void dump_events () const; void merge_event (SessionEvent*); - void replace_event (SessionEvent::Type, nframes64_t action_frame, nframes64_t target = 0); + void replace_event (SessionEvent::Type, framepos_t action_frame, framepos_t target = 0); bool _replace_event (SessionEvent*); bool _remove_event (SessionEvent *); void _clear_event_type (SessionEvent::Type); - void add_event (nframes64_t action_frame, SessionEvent::Type type, nframes64_t target_frame = 0); - void remove_event (nframes64_t frame, SessionEvent::Type 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); virtual void process_event(SessionEvent*) = 0; virtual void set_next_event () = 0; diff --git a/libs/ardour/ardour/slave.h b/libs/ardour/ardour/slave.h index 111564cc23..74cf4371b0 100644 --- a/libs/ardour/ardour/slave.h +++ b/libs/ardour/ardour/slave.h @@ -113,7 +113,7 @@ class 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, nframes64_t& position) = 0; + virtual bool speed_and_position (double& speed, framepos_t& position) = 0; /** * reports to ARDOUR whether the Slave is currently synced to its external @@ -156,7 +156,7 @@ class Slave { * only if requires_seekahead() returns true. */ - virtual nframes64_t seekahead_distance() const { return 0; } + virtual framepos_t seekahead_distance() const { return 0; } /** * @return - when returning true, ARDOUR will use transport speed 1.0 no matter what @@ -176,12 +176,12 @@ class ISlaveSessionProxy { virtual ~ISlaveSessionProxy() {} virtual TempoMap& tempo_map() const { return *((TempoMap *) 0); } virtual nframes_t frame_rate() const { return 0; } - virtual nframes64_t audible_frame () const { return 0; } - virtual nframes64_t transport_frame () const { return 0; } + virtual framepos_t audible_frame () const { return 0; } + virtual framepos_t transport_frame () const { return 0; } virtual nframes_t frames_since_cycle_start () const { return 0; } - virtual nframes64_t frame_time () const { return 0; } + virtual framepos_t frame_time () const { return 0; } - virtual void request_locate (nframes64_t /*frame*/, bool with_roll = false) { + virtual void request_locate (framepos_t /*frame*/, bool with_roll = false) { (void) with_roll; } virtual void request_transport_speed (double /*speed*/) {} @@ -197,19 +197,19 @@ class SlaveSessionProxy : public ISlaveSessionProxy { TempoMap& tempo_map() const; nframes_t frame_rate() const; - nframes64_t audible_frame () const; - nframes64_t transport_frame () const; + framepos_t audible_frame () const; + framepos_t transport_frame () const; nframes_t frames_since_cycle_start () const; - nframes64_t frame_time () const; + framepos_t frame_time () const; - void request_locate (nframes64_t frame, bool with_roll = false); + void request_locate (framepos_t frame, bool with_roll = false); void request_transport_speed (double speed); }; struct SafeTime { volatile int guard1; - nframes64_t position; - nframes64_t timestamp; + framepos_t position; + framepos_t timestamp; double speed; volatile int guard2; @@ -228,7 +228,7 @@ class MTC_Slave : public Slave { ~MTC_Slave (); void rebind (MIDI::Port&); - bool speed_and_position (double&, nframes64_t&); + bool speed_and_position (double&, framepos_t&); bool locked() const; bool ok() const; @@ -236,7 +236,7 @@ class MTC_Slave : public Slave { nframes_t resolution() const; bool requires_seekahead () const { return true; } - nframes64_t seekahead_distance() const; + framepos_t seekahead_distance() const; bool give_slave_full_control_over_transport_speed() const; private: @@ -275,8 +275,8 @@ class MTC_Slave : public Slave { void update_mtc_time (const MIDI::byte *, bool, nframes_t); void update_mtc_status (MIDI::MTC_Status); void read_current (SafeTime *) const; - void reset_window (nframes64_t); - bool outside_window (nframes64_t) const; + void reset_window (framepos_t); + bool outside_window (framepos_t) const; void process_apparent_speed (double); }; @@ -289,7 +289,7 @@ class MIDIClock_Slave : public Slave { ~MIDIClock_Slave (); void rebind (MIDI::Port&); - bool speed_and_position (double&, nframes64_t&); + bool speed_and_position (double&, framepos_t&); bool locked() const; bool ok() const; @@ -344,17 +344,17 @@ class MIDIClock_Slave : public Slave { double b, c, omega; void reset (); - void start (MIDI::Parser& parser, nframes64_t timestamp); - void contineu (MIDI::Parser& parser, nframes64_t timestamp); - void stop (MIDI::Parser& parser, nframes64_t timestamp); + 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 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(nframes64_t time); - nframes64_t calculate_song_position(uint16_t song_position_in_sixteenth_notes); + void calculate_one_ppqn_in_frames_at(framepos_t time); + framepos_t calculate_song_position(uint16_t song_position_in_sixteenth_notes); void calculate_filter_coefficients(); - void update_midi_clock (MIDI::Parser& parser, nframes64_t timestamp); + void update_midi_clock (MIDI::Parser& parser, framepos_t timestamp); void read_current (SafeTime *) const; - bool stop_if_no_more_clock_events(nframes64_t& pos, nframes64_t now); + bool stop_if_no_more_clock_events(framepos_t& pos, framepos_t now); /// whether transport should be rolling bool _started; @@ -370,7 +370,7 @@ class JACK_Slave : public Slave JACK_Slave (jack_client_t*); ~JACK_Slave (); - bool speed_and_position (double& speed, nframes64_t& pos); + bool speed_and_position (double& speed, framepos_t& pos); bool starting() const { return _starting; } bool locked() const; diff --git a/libs/ardour/ardour/smf_source.h b/libs/ardour/ardour/smf_source.h index 165e03e483..bd1428a129 100644 --- a/libs/ardour/ardour/smf_source.h +++ b/libs/ardour/ardour/smf_source.h @@ -52,9 +52,9 @@ public: bool set_name (const std::string& newname) { return (set_source_name(newname, false) == 0); } void append_event_unlocked_beats (const Evoral::Event<Evoral::MusicalTime>& ev); - void append_event_unlocked_frames (const Evoral::Event<nframes_t>& ev, sframes_t source_start); + void append_event_unlocked_frames (const Evoral::Event<nframes_t>& ev, framepos_t source_start); - void mark_streaming_midi_write_started (NoteMode mode, sframes_t start_time); + void mark_streaming_midi_write_started (NoteMode mode, framepos_t start_time); void mark_streaming_write_completed (); XMLNode& get_state (); @@ -74,21 +74,21 @@ public: private: nframes_t read_unlocked (Evoral::EventSink<nframes_t>& dst, - sframes_t position, - sframes_t start, + framepos_t position, + framepos_t start, nframes_t cnt, MidiStateTracker* tracker) const; nframes_t write_unlocked (MidiRingBuffer<nframes_t>& src, - sframes_t position, + framepos_t position, nframes_t cnt); double _last_ev_time_beats; - sframes_t _last_ev_time_frames; + framepos_t _last_ev_time_frames; /** end time (start + duration) of last call to read_unlocked */ - mutable sframes_t _smf_last_read_end; + mutable framepos_t _smf_last_read_end; /** time (in SMF ticks, 1 tick per _ppqn) of the last event read by read_unlocked */ - mutable sframes_t _smf_last_read_time; + mutable framepos_t _smf_last_read_time; }; }; /* namespace ARDOUR */ diff --git a/libs/ardour/ardour/sndfilesource.h b/libs/ardour/ardour/sndfilesource.h index 06e329a74b..ae2cba449a 100644 --- a/libs/ardour/ardour/sndfilesource.h +++ b/libs/ardour/ardour/sndfilesource.h @@ -47,10 +47,10 @@ class SndFileSource : public AudioFileSource { int update_header (framepos_t when, struct tm&, time_t); int flush_header (); - nframes64_t natural_position () const; + framepos_t natural_position () const; - sframes_t last_capture_start_frame() const; - void mark_capture_start (sframes_t); + framepos_t last_capture_start_frame() const; + void mark_capture_start (framepos_t); void mark_capture_end (); void clear_capture_marks(); diff --git a/libs/ardour/ardour/source.h b/libs/ardour/ardour/source.h index ebe8cdf0f5..b8b3c9c229 100644 --- a/libs/ardour/ardour/source.h +++ b/libs/ardour/ardour/source.h @@ -97,8 +97,8 @@ class Source : public SessionObject std::string get_transients_path() const; int load_transients (const std::string&); - sframes_t timeline_position() const { return _timeline_position; } - virtual void set_timeline_position (sframes_t pos); + framepos_t timeline_position() const { return _timeline_position; } + virtual void set_timeline_position (framepos_t pos); void set_allow_remove_if_empty (bool yn); @@ -114,7 +114,7 @@ class Source : public SessionObject DataType _type; Flag _flags; time_t _timestamp; - sframes_t _timeline_position; + framepos_t _timeline_position; bool _analysed; mutable Glib::Mutex _lock; mutable Glib::Mutex _analysis_lock; diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h index 21a1185725..e692334234 100644 --- a/libs/ardour/ardour/tempo.h +++ b/libs/ardour/ardour/tempo.h @@ -80,18 +80,18 @@ class MetricSection { public: MetricSection (const BBT_Time& start) : _start (start), _frame (0), _movable (true) {} - MetricSection (nframes64_t start) + MetricSection (framepos_t start) : _frame (start), _movable (true) {} virtual ~MetricSection() {} const BBT_Time& start() const { return _start; } - nframes64_t frame() const { return _frame; } + framepos_t frame() const { return _frame; } void set_movable (bool yn) { _movable = yn; } bool movable() const { return _movable; } - virtual void set_frame (nframes64_t f) { + virtual void set_frame (framepos_t f) { _frame = f; } @@ -109,7 +109,7 @@ class MetricSection { private: BBT_Time _start; - nframes64_t _frame; + framepos_t _frame; bool _movable; }; @@ -117,7 +117,7 @@ class MeterSection : public MetricSection, public Meter { public: MeterSection (const BBT_Time& start, double bpb, double note_type) : MetricSection (start), Meter (bpb, note_type) {} - MeterSection (nframes64_t start, double bpb, double note_type) + MeterSection (framepos_t start, double bpb, double note_type) : MetricSection (start), Meter (bpb, note_type) {} MeterSection (const XMLNode&); @@ -130,7 +130,7 @@ class TempoSection : public MetricSection, public Tempo { public: TempoSection (const BBT_Time& start, double qpm, double note_type) : MetricSection (start), Tempo (qpm, note_type) {} - TempoSection (nframes64_t start, double qpm, double note_type) + TempoSection (framepos_t start, double qpm, double note_type) : MetricSection (start), Tempo (qpm, note_type) {} TempoSection (const XMLNode&); @@ -150,25 +150,25 @@ class TempoMetric { void set_tempo (const Tempo& t) { _tempo = &t; } void set_meter (const Meter& m) { _meter = &m; } - void set_frame (nframes64_t f) { _frame = f; } + void set_frame (framepos_t f) { _frame = f; } void set_start (const BBT_Time& t) { _start = t; } const Meter& meter() const { return *_meter; } const Tempo& tempo() const { return *_tempo; } - nframes64_t frame() const { return _frame; } + framepos_t frame() const { return _frame; } const BBT_Time& start() const { return _start; } private: const Meter* _meter; const Tempo* _tempo; - nframes64_t _frame; + framepos_t _frame; BBT_Time _start; }; class TempoMap : public PBD::StatefulDestructible { public: - TempoMap (nframes64_t frame_rate); + TempoMap (nframes_t frame_rate); ~TempoMap(); /* measure-based stuff */ @@ -180,13 +180,13 @@ class TempoMap : public PBD::StatefulDestructible struct BBTPoint { BBTPointType type; - nframes64_t frame; + framepos_t frame; const Meter* meter; const Tempo* tempo; uint32_t bar; uint32_t beat; - BBTPoint (const Meter& m, const Tempo& t, nframes64_t f, + BBTPoint (const Meter& m, const Tempo& t, framepos_t f, BBTPointType ty, uint32_t b, uint32_t e) : type (ty), frame (f), meter (&m), tempo (&t), bar (b), beat (e) {} }; @@ -198,27 +198,27 @@ class TempoMap : public PBD::StatefulDestructible (obj.*method)(*metrics); } - BBTPointList *get_points (nframes64_t start, nframes64_t end) const; + BBTPointList *get_points (framepos_t start, framepos_t end) const; - void bbt_time (nframes64_t when, BBT_Time&) const; - nframes64_t frame_time (const BBT_Time&) const; - nframes64_t bbt_duration_at (nframes64_t, const BBT_Time&, int dir) const; + void bbt_time (framepos_t when, BBT_Time&) const; + framecnt_t frame_time (const BBT_Time&) const; + framecnt_t bbt_duration_at (framepos_t, const BBT_Time&, int dir) const; - void bbt_time_add (nframes64_t origin, BBT_Time& start, const BBT_Time& shift); + void bbt_time_add (framepos_t origin, BBT_Time& start, const BBT_Time& shift); static const Tempo& default_tempo() { return _default_tempo; } static const Meter& default_meter() { return _default_meter; } - const Tempo& tempo_at (nframes64_t) const; - const Meter& meter_at (nframes64_t) const; + const Tempo& tempo_at (framepos_t) const; + const Meter& meter_at (framepos_t) const; - const TempoSection& tempo_section_at (nframes64_t); + const TempoSection& tempo_section_at (framepos_t); void add_tempo(const Tempo&, BBT_Time where); void add_meter(const Meter&, BBT_Time where); - void add_tempo(const Tempo&, nframes64_t where); - void add_meter(const Meter&, nframes64_t where); + void add_tempo(const Tempo&, framepos_t where); + void add_meter(const Meter&, framepos_t where); void move_tempo (TempoSection&, const BBT_Time& to); void move_meter (MeterSection&, const BBT_Time& to); @@ -229,12 +229,12 @@ class TempoMap : public PBD::StatefulDestructible void replace_tempo (TempoSection& existing, const Tempo& replacement); void replace_meter (MeterSection& existing, const Meter& replacement); - nframes64_t round_to_bar (nframes64_t frame, int dir); - nframes64_t round_to_beat (nframes64_t frame, int dir); - nframes64_t round_to_beat_subdivision (nframes64_t fr, int sub_num, int dir); - nframes64_t round_to_tick (nframes64_t frame, int dir); + framepos_t round_to_bar (framepos_t frame, int dir); + framepos_t round_to_beat (framepos_t frame, int dir); + framepos_t round_to_beat_subdivision (framepos_t fr, int sub_num, int dir); + framepos_t round_to_tick (framepos_t frame, int dir); - void set_length (nframes64_t frames); + void set_length (framepos_t frames); XMLNode& get_state (void); int set_state (const XMLNode&, int version); @@ -243,17 +243,17 @@ class TempoMap : public PBD::StatefulDestructible void clear (); TempoMetric metric_at (BBT_Time bbt) const; - TempoMetric metric_at (nframes64_t) const; - void bbt_time_with_metric (nframes64_t, BBT_Time&, const TempoMetric&) const; + TempoMetric metric_at (framepos_t) const; + void bbt_time_with_metric (framepos_t, BBT_Time&, const TempoMetric&) const; BBT_Time bbt_add (const BBT_Time&, const BBT_Time&, const TempoMetric&) const; BBT_Time bbt_add (const BBT_Time& a, const BBT_Time& b) const; BBT_Time bbt_subtract (const BBT_Time&, const BBT_Time&) const; - void change_existing_tempo_at (nframes64_t, double bpm, double note_type); + void change_existing_tempo_at (framepos_t, double bpm, double note_type); void change_initial_tempo (double bpm, double note_type); - void insert_time (nframes64_t, nframes64_t); + void insert_time (framepos_t, framecnt_t); int n_tempos () const; int n_meters () const; @@ -266,27 +266,27 @@ class TempoMap : public PBD::StatefulDestructible Metrics* metrics; nframes_t _frame_rate; - nframes64_t last_bbt_when; + framepos_t last_bbt_when; bool last_bbt_valid; BBT_Time last_bbt; mutable Glib::RWLock lock; void timestamp_metrics (bool use_bbt); - nframes64_t round_to_type (nframes64_t fr, int dir, BBTPointType); + framepos_t round_to_type (framepos_t fr, int dir, BBTPointType); - nframes64_t frame_time_unlocked (const BBT_Time&) const; + framepos_t frame_time_unlocked (const BBT_Time&) const; - void bbt_time_unlocked (nframes64_t, BBT_Time&) const; + void bbt_time_unlocked (framepos_t, BBT_Time&) const; - nframes64_t bbt_duration_at_unlocked (const BBT_Time& when, const BBT_Time& bbt, int dir) const; + framecnt_t bbt_duration_at_unlocked (const BBT_Time& when, const BBT_Time& bbt, int dir) const; const MeterSection& first_meter() const; const TempoSection& first_tempo() const; - nframes64_t count_frames_between (const BBT_Time&, const BBT_Time&) const; - nframes64_t count_frames_between_metrics (const Meter&, const Tempo&, - const BBT_Time&, const BBT_Time&) const; + framecnt_t count_frames_between (const BBT_Time&, const BBT_Time&) const; + framecnt_t count_frames_between_metrics (const Meter&, const Tempo&, + const BBT_Time&, const BBT_Time&) const; int move_metric_section (MetricSection&, const BBT_Time& to); void do_insert (MetricSection* section, bool with_bbt); diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index f91b67bb5a..cc36941ba8 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -53,13 +53,20 @@ namespace ARDOUR { typedef uint32_t layer_t; typedef uint64_t microseconds_t; typedef uint32_t nframes_t; - typedef int64_t nframes64_t; - typedef int64_t sframes_t; + /* Any position measured in audio frames. + Assumed to be non-negative but not enforced. + */ typedef int64_t framepos_t; - /* any offset from a framepos_t, measured in audio frames */ + + /* Any distance from a given framepos_t. + Maybe positive or negative. + */ typedef int64_t frameoffset_t; - /* any count of audio frames */ + + /* Any count of audio frames. + Assumed to be positive but not enforced. + */ typedef int64_t framecnt_t; static const framepos_t max_framepos = INT64_MAX; @@ -422,7 +429,7 @@ namespace ARDOUR { int opts; // really RubberBandStretcher::Options }; - typedef std::list<nframes64_t> AnalysisFeatureList; + typedef std::list<framepos_t> AnalysisFeatureList; typedef std::list<boost::shared_ptr<Route> > RouteList; @@ -533,22 +540,22 @@ std::ostream& operator<<(std::ostream& o, const ARDOUR::WaveformScale& sf); std::ostream& operator<<(std::ostream& o, const ARDOUR::WaveformShape& sf); std::ostream& operator<<(std::ostream& o, const ARDOUR::PositionLockStyle& sf); -static inline ARDOUR::nframes64_t -session_frame_to_track_frame (ARDOUR::nframes64_t session_frame, double speed) +static inline ARDOUR::framepos_t +session_frame_to_track_frame (ARDOUR::framepos_t session_frame, double speed) { - return (ARDOUR::nframes64_t)( (double)session_frame * speed ); + return (ARDOUR::framepos_t)( (double)session_frame * speed ); } -static inline ARDOUR::nframes64_t -track_frame_to_session_frame (ARDOUR::nframes64_t track_frame, double speed) +static inline ARDOUR::framepos_t +track_frame_to_session_frame (ARDOUR::framepos_t track_frame, double speed) { - return (ARDOUR::nframes64_t)( (double)track_frame / speed ); + return (ARDOUR::framepos_t)( (double)track_frame / speed ); } /* for now, break the rules and use "using" to make these "global" */ using ARDOUR::nframes_t; -using ARDOUR::nframes64_t; +using ARDOUR::framepos_t; #endif /* __ardour_types_h__ */ diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc index fcc6da2ad0..90813715b0 100644 --- a/libs/ardour/audio_track.cc +++ b/libs/ardour/audio_track.cc @@ -348,7 +348,7 @@ AudioTrack::set_state_part_two () } int -AudioTrack::roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, int declick, +AudioTrack::roll (nframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool can_record, bool rec_monitors_input, bool& need_butler) { Glib::RWLock::ReaderLock lm (_processor_lock, Glib::TRY_LOCK); @@ -522,7 +522,7 @@ AudioTrack::roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, } int -AudioTrack::export_stuff (BufferSet& buffers, sframes_t start, nframes_t nframes, bool enable_processing) +AudioTrack::export_stuff (BufferSet& buffers, framepos_t start, framecnt_t nframes, bool enable_processing) { boost::scoped_array<gain_t> gain_buffer (new gain_t[nframes]); boost::scoped_array<Sample> mix_buffer (new Sample[nframes]); @@ -533,7 +533,7 @@ AudioTrack::export_stuff (BufferSet& buffers, sframes_t start, nframes_t nframes boost::shared_ptr<AudioPlaylist> apl = boost::dynamic_pointer_cast<AudioPlaylist>(diskstream->playlist()); assert(apl); - assert(buffers.get_audio(0).capacity() >= nframes); + assert ((framecnt_t) buffers.get_audio(0).capacity() >= nframes); if (apl->read (buffers.get_audio(0).data(), mix_buffer.get(), gain_buffer.get(), start, nframes) != nframes) { return -1; diff --git a/libs/ardour/audioanalyser.cc b/libs/ardour/audioanalyser.cc index 3acfc9bce4..7b649aae89 100644 --- a/libs/ardour/audioanalyser.cc +++ b/libs/ardour/audioanalyser.cc @@ -88,8 +88,8 @@ AudioAnalyser::analyse (const string& path, Readable* src, uint32_t channel) int ret = -1; bool done = false; Sample* data = 0; - nframes64_t len = src->readable_length(); - nframes64_t pos = 0; + framecnt_t len = src->readable_length(); + framepos_t pos = 0; float* bufs[1] = { 0 }; string tmp_path; @@ -111,11 +111,11 @@ AudioAnalyser::analyse (const string& path, Readable* src, uint32_t channel) while (!done) { - nframes64_t to_read; + nframes_t to_read; /* read from source */ - to_read = min ((len - pos), bufsize); + to_read = min ((len - pos), (framecnt_t) bufsize); if (src->read (data, pos, to_read, channel) != to_read) { goto out; diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc index b35417b539..4947f2ec3b 100644 --- a/libs/ardour/audioregion.cc +++ b/libs/ardour/audioregion.cc @@ -154,7 +154,7 @@ AudioRegion::AudioRegion (const SourceList& srcs) assert (_sources.size() == _master_sources.size()); } -AudioRegion::AudioRegion (boost::shared_ptr<const AudioRegion> other, nframes64_t offset, bool offset_relative) +AudioRegion::AudioRegion (boost::shared_ptr<const AudioRegion> other, framecnt_t offset, bool offset_relative) : Region (other, offset, offset_relative) , AUDIOREGION_COPY_STATE (other) , _automatable (other->session()) @@ -1287,7 +1287,7 @@ AudioRegion::audio_source (uint32_t n) const } int -AudioRegion::adjust_transients (nframes64_t delta) +AudioRegion::adjust_transients (frameoffset_t delta) { for (AnalysisFeatureList::iterator x = _transients.begin(); x != _transients.end(); ++x) { (*x) = (*x) + delta; @@ -1299,7 +1299,7 @@ AudioRegion::adjust_transients (nframes64_t delta) } int -AudioRegion::update_transient (nframes64_t old_position, nframes64_t new_position) +AudioRegion::update_transient (framepos_t old_position, framepos_t new_position) { for (AnalysisFeatureList::iterator x = _transients.begin(); x != _transients.end(); ++x) { if ((*x) == old_position) { @@ -1314,7 +1314,7 @@ AudioRegion::update_transient (nframes64_t old_position, nframes64_t new_positio } void -AudioRegion::add_transient (nframes64_t where) +AudioRegion::add_transient (framepos_t where) { _transients.push_back(where); _valid_transients = true; @@ -1323,7 +1323,7 @@ AudioRegion::add_transient (nframes64_t where) } void -AudioRegion::remove_transient (nframes64_t where) +AudioRegion::remove_transient (framepos_t where) { _transients.remove(where); _valid_transients = true; diff --git a/libs/ardour/beats_frames_converter.cc b/libs/ardour/beats_frames_converter.cc index 9d3b8ae4c6..180b3e563a 100644 --- a/libs/ardour/beats_frames_converter.cc +++ b/libs/ardour/beats_frames_converter.cc @@ -24,7 +24,7 @@ namespace ARDOUR { -sframes_t +framecnt_t BeatsFramesConverter::to(double beats) const { // FIXME: assumes tempo never changes after origin @@ -33,11 +33,11 @@ BeatsFramesConverter::to(double beats) const _tempo_map.frame_rate(), _tempo_map.meter_at (_origin_b)); - return lrint(beats * frames_per_beat); + return llrint (beats * frames_per_beat); } double -BeatsFramesConverter::from(sframes_t frames) const +BeatsFramesConverter::from (framecnt_t frames) const { // FIXME: assumes tempo never changes after origin const Tempo& tempo = _tempo_map.tempo_at (_origin_b); diff --git a/libs/ardour/coreaudiosource.cc b/libs/ardour/coreaudiosource.cc index 6627409bd0..5212a3006d 100644 --- a/libs/ardour/coreaudiosource.cc +++ b/libs/ardour/coreaudiosource.cc @@ -139,7 +139,7 @@ CoreAudioSource::safe_read (Sample* dst, nframes_t start, nframes_t cnt, AudioBu nframes_t -CoreAudioSource::read_unlocked (Sample *dst, sframes_t start, nframes_t cnt) const +CoreAudioSource::read_unlocked (Sample *dst, framepos_t start, nframes_t cnt) const { nframes_t file_cnt; AudioBufferList abl; diff --git a/libs/ardour/crossfade.cc b/libs/ardour/crossfade.cc index 6b0c0a9560..d2271030a5 100644 --- a/libs/ardour/crossfade.cc +++ b/libs/ardour/crossfade.cc @@ -355,7 +355,7 @@ Crossfade::read_at (Sample *buf, Sample *mixdown_buffer, start = _position; buf += offset; - to_write = min (_length.val(), (nframes64_t) cnt); + to_write = min (_length.val(), cnt); } else { diff --git a/libs/ardour/delivery.cc b/libs/ardour/delivery.cc index e93e550308..4277ee4ed8 100644 --- a/libs/ardour/delivery.cc +++ b/libs/ardour/delivery.cc @@ -437,7 +437,7 @@ Delivery::end_pan_touch (uint32_t which, bool mark, double when) void -Delivery::flush_buffers (nframes_t nframes, nframes64_t time) +Delivery::flush_buffers (nframes_t nframes, framepos_t time) { /* io_lock, not taken: function must be called from Session::process() calltree */ diff --git a/libs/ardour/export_handler.cc b/libs/ardour/export_handler.cc index 05fa1d881d..9ffb7c1778 100644 --- a/libs/ardour/export_handler.cc +++ b/libs/ardour/export_handler.cc @@ -195,8 +195,8 @@ ExportHandler::process_timespan (nframes_t frames) /* update position */ nframes_t frames_to_read = 0; - sframes_t const start = current_timespan->get_start(); - sframes_t const end = current_timespan->get_end(); + framepos_t const start = current_timespan->get_start(); + framepos_t const end = current_timespan->get_end(); bool const last_cycle = (process_position + frames >= end); @@ -308,7 +308,7 @@ ExportHandler::export_cd_marker_file (TimespanPtr timespan, FormatPtr file_forma /* Start actual marker stuff */ - sframes_t last_end_time = timespan->get_start(), last_start_time = timespan->get_start(); + framepos_t last_end_time = timespan->get_start(), last_start_time = timespan->get_start(); status.track_position = last_start_time - timespan->get_start(); for (i = temp.begin(); i != temp.end(); ++i) { @@ -535,9 +535,9 @@ ExportHandler::write_index_info_toc (CDMarkerStatus & status) } void -ExportHandler::frames_to_cd_frames_string (char* buf, sframes_t when) +ExportHandler::frames_to_cd_frames_string (char* buf, framepos_t when) { - sframes_t remainder; + framecnt_t remainder; nframes_t fr = session.nominal_frame_rate(); int mins, secs, frames; diff --git a/libs/ardour/import.cc b/libs/ardour/import.cc index 13fb859efe..929f3c5bf4 100644 --- a/libs/ardour/import.cc +++ b/libs/ardour/import.cc @@ -410,7 +410,7 @@ write_midi_data_to_new_files (Evoral::SMF* source, ImportStatus& status, status.progress += 0.01; } - const nframes64_t pos = 0; + const framepos_t pos = 0; const double length_beats = ceil(t / (double)source->ppqn()); BeatsFramesConverter converter(smfs->session().tempo_map(), pos); smfs->update_length(pos, converter.to(length_beats)); diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc index ed2b23f7ee..0faab06d5c 100644 --- a/libs/ardour/io.cc +++ b/libs/ardour/io.cc @@ -1505,7 +1505,7 @@ IO::connected_to (boost::shared_ptr<const IO> other) const } void -IO::process_input (boost::shared_ptr<Processor> proc, sframes_t start_frame, sframes_t end_frame, nframes_t nframes) +IO::process_input (boost::shared_ptr<Processor> proc, framepos_t start_frame, framepos_t end_frame, nframes_t nframes) { BufferSet bufs; diff --git a/libs/ardour/jack_slave.cc b/libs/ardour/jack_slave.cc index 9ef6eb8579..116ccdd145 100644 --- a/libs/ardour/jack_slave.cc +++ b/libs/ardour/jack_slave.cc @@ -35,7 +35,7 @@ JACK_Slave::JACK_Slave (jack_client_t* j) : jack (j) { double x; - nframes64_t p; + framepos_t p; /* call this to initialize things */ speed_and_position (x, p); } @@ -63,7 +63,7 @@ JACK_Slave::ok() const } bool -JACK_Slave::speed_and_position (double& sp, nframes64_t& position) +JACK_Slave::speed_and_position (double& sp, framepos_t& position) { jack_position_t pos; jack_transport_state_t state; diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc index ad6fd1859d..5f6f14ce14 100644 --- a/libs/ardour/location.cc +++ b/libs/ardour/location.cc @@ -53,7 +53,7 @@ Location::Location (Session& s) } -Location::Location (Session& s, nframes64_t sample_start, nframes64_t sample_end, const std::string &name, Flags bits) +Location::Location (Session& s, framepos_t sample_start, framepos_t sample_end, const std::string &name, Flags bits) : SessionHandleRef (s) , _name (name) , _start (sample_start) @@ -124,7 +124,7 @@ Location::operator= (const Location& other) * @param allow_bbt_recompute True to recompute BBT start time from the new given start time. */ int -Location::set_start (nframes64_t s, bool force, bool allow_bbt_recompute) +Location::set_start (framepos_t s, bool force, bool allow_bbt_recompute) { if (_locked) { return -1; @@ -170,7 +170,7 @@ Location::set_start (nframes64_t s, bool force, bool allow_bbt_recompute) * @param allow_bbt_recompute True to recompute BBT end time from the new given end time. */ int -Location::set_end (nframes64_t e, bool force, bool allow_bbt_recompute) +Location::set_end (framepos_t e, bool force, bool allow_bbt_recompute) { if (_locked) { return -1; @@ -211,7 +211,7 @@ Location::set_end (nframes64_t e, bool force, bool allow_bbt_recompute) } int -Location::set (nframes64_t start, nframes64_t end, bool allow_bbt_recompute) +Location::set (framepos_t start, framepos_t end, bool allow_bbt_recompute) { /* check validity */ if (((is_auto_punch() || is_auto_loop()) && start >= end) || (!is_mark() && start > end)) { @@ -226,7 +226,7 @@ Location::set (nframes64_t start, nframes64_t end, bool allow_bbt_recompute) } int -Location::move_to (nframes64_t pos) +Location::move_to (framepos_t pos) { if (_locked) { return -1; @@ -844,7 +844,7 @@ struct LocationStartLaterComparison }; Location * -Locations::first_location_before (nframes64_t frame, bool include_special_ranges) +Locations::first_location_before (framepos_t frame, bool include_special_ranges) { LocationList locs; @@ -871,7 +871,7 @@ Locations::first_location_before (nframes64_t frame, bool include_special_ranges } Location * -Locations::first_location_after (nframes64_t frame, bool include_special_ranges) +Locations::first_location_after (framepos_t frame, bool include_special_ranges) { LocationList locs; @@ -905,7 +905,7 @@ Locations::first_location_after (nframes64_t frame, bool include_special_ranges) * @param after Filled in with the position of the next `mark' after `frame' (or max_framepos if none exists) */ void -Locations::marks_either_side (nframes64_t const frame, nframes64_t& before, nframes64_t& after) const +Locations::marks_either_side (framepos_t const frame, framepos_t& before, framepos_t& after) const { before = after = max_framepos; @@ -918,7 +918,7 @@ Locations::marks_either_side (nframes64_t const frame, nframes64_t& before, nfra /* Get a list of positions; don't store any that are exactly on our requested position */ - std::list<nframes64_t> positions; + std::list<framepos_t> positions; for (LocationList::const_iterator i = locs.begin(); i != locs.end(); ++i) { if (((*i)->is_auto_loop() || (*i)->is_auto_punch())) { @@ -947,7 +947,7 @@ Locations::marks_either_side (nframes64_t const frame, nframes64_t& before, nfra positions.sort (); - std::list<nframes64_t>::iterator i = positions.begin (); + std::list<framepos_t>::iterator i = positions.begin (); while (i != positions.end () && *i < frame) { ++i; } @@ -1027,7 +1027,7 @@ Locations::get_location_by_id(PBD::ID id) } void -Locations::find_all_between (nframes64_t start, nframes64_t end, LocationList& ll, Location::Flags flags) +Locations::find_all_between (framepos_t start, framepos_t end, LocationList& ll, Location::Flags flags) { Glib::Mutex::Lock lm (lock); diff --git a/libs/ardour/midi_clock_slave.cc b/libs/ardour/midi_clock_slave.cc index 61c68609f9..f6fe0d0930 100644 --- a/libs/ardour/midi_clock_slave.cc +++ b/libs/ardour/midi_clock_slave.cc @@ -85,7 +85,7 @@ MIDIClock_Slave::rebind (MIDI::Port& p) } void -MIDIClock_Slave::calculate_one_ppqn_in_frames_at(nframes64_t time) +MIDIClock_Slave::calculate_one_ppqn_in_frames_at(framepos_t time) { const Tempo& current_tempo = session->tempo_map().tempo_at(time); const Meter& current_meter = session->tempo_map().meter_at(time); @@ -100,14 +100,14 @@ MIDIClock_Slave::calculate_one_ppqn_in_frames_at(nframes64_t time) // DEBUG_TRACE (DEBUG::MidiClock, string_compose ("at %1, one ppqn = %2\n", time, one_ppqn_in_frames)); } -ARDOUR::nframes64_t +ARDOUR::framepos_t MIDIClock_Slave::calculate_song_position(uint16_t song_position_in_sixteenth_notes) { - nframes64_t song_position_frames = 0; + framepos_t song_position_frames = 0; for (uint16_t i = 1; i <= song_position_in_sixteenth_notes; ++i) { // one quarter note contains ppqn pulses, so a sixteenth note is ppqn / 4 pulses calculate_one_ppqn_in_frames_at(song_position_frames); - song_position_frames += one_ppqn_in_frames * (nframes64_t)(ppqn / 4); + song_position_frames += one_ppqn_in_frames * (framepos_t)(ppqn / 4); } return song_position_frames; @@ -123,7 +123,7 @@ MIDIClock_Slave::calculate_filter_coefficients() } void -MIDIClock_Slave::update_midi_clock (Parser& /*parser*/, nframes64_t timestamp) +MIDIClock_Slave::update_midi_clock (Parser& /*parser*/, framepos_t timestamp) { // some pieces of hardware send MIDI Clock all the time if ( (!_starting) && (!_started) ) { @@ -132,7 +132,7 @@ MIDIClock_Slave::update_midi_clock (Parser& /*parser*/, nframes64_t timestamp) calculate_one_ppqn_in_frames_at(should_be_position); - nframes64_t elapsed_since_start = timestamp - first_timestamp; + framepos_t elapsed_since_start = timestamp - first_timestamp; double error = 0; if (_starting || last_timestamp == 0) { @@ -189,7 +189,7 @@ MIDIClock_Slave::update_midi_clock (Parser& /*parser*/, nframes64_t timestamp) } void -MIDIClock_Slave::start (Parser& /*parser*/, nframes64_t timestamp) +MIDIClock_Slave::start (Parser& /*parser*/, framepos_t timestamp) { DEBUG_TRACE (DEBUG::MidiClock, string_compose ("MIDIClock_Slave got start message at time %1 engine time %2\n", timestamp, session->frame_time())); @@ -216,7 +216,7 @@ MIDIClock_Slave::reset () } void -MIDIClock_Slave::contineu (Parser& /*parser*/, nframes64_t /*timestamp*/) +MIDIClock_Slave::contineu (Parser& /*parser*/, framepos_t /*timestamp*/) { DEBUG_TRACE (DEBUG::MidiClock, "MIDIClock_Slave got continue message\n"); @@ -228,7 +228,7 @@ MIDIClock_Slave::contineu (Parser& /*parser*/, nframes64_t /*timestamp*/) void -MIDIClock_Slave::stop (Parser& /*parser*/, nframes64_t /*timestamp*/) +MIDIClock_Slave::stop (Parser& /*parser*/, framepos_t /*timestamp*/) { DEBUG_TRACE (DEBUG::MidiClock, "MIDIClock_Slave got stop message\n"); @@ -245,7 +245,7 @@ MIDIClock_Slave::stop (Parser& /*parser*/, nframes64_t /*timestamp*/) // that is the position of the last MIDI Clock // message and that is probably what the master // expects where we are right now - nframes64_t stop_position = should_be_position; + framepos_t stop_position = should_be_position; // find out the last MIDI beat: go back #midi_clocks mod 6 // and lets hope the tempo didnt change in those last 6 beats :) @@ -272,7 +272,7 @@ MIDIClock_Slave::position (Parser& /*parser*/, byte* message, size_t size) assert((lsb <= 0x7f) && (msb <= 0x7f)); uint16_t position_in_sixteenth_notes = (uint16_t(msb) << 7) | uint16_t(lsb); - nframes64_t position_in_frames = calculate_song_position(position_in_sixteenth_notes); + framepos_t position_in_frames = calculate_song_position(position_in_sixteenth_notes); DEBUG_TRACE (DEBUG::MidiClock, string_compose ("Song Position: %1 frames: %2\n", position_in_sixteenth_notes, position_in_frames)); @@ -301,7 +301,7 @@ MIDIClock_Slave::starting() const } bool -MIDIClock_Slave::stop_if_no_more_clock_events(nframes64_t& pos, nframes64_t now) +MIDIClock_Slave::stop_if_no_more_clock_events(framepos_t& pos, framepos_t now) { /* no timecode for 1/4 second ? conclude that its stopped */ if (last_timestamp && @@ -318,7 +318,7 @@ MIDIClock_Slave::stop_if_no_more_clock_events(nframes64_t& pos, nframes64_t now) } bool -MIDIClock_Slave::speed_and_position (double& speed, nframes64_t& pos) +MIDIClock_Slave::speed_and_position (double& speed, framepos_t& pos) { if (!_started || _starting) { speed = 0.0; @@ -326,7 +326,7 @@ MIDIClock_Slave::speed_and_position (double& speed, nframes64_t& pos) return true; } - nframes64_t engine_now = session->frame_time(); + framepos_t engine_now = session->frame_time(); if (stop_if_no_more_clock_events(pos, engine_now)) { return false; @@ -343,8 +343,8 @@ MIDIClock_Slave::speed_and_position (double& speed, nframes64_t& pos) if (engine_now > last_timestamp) { // we are in between MIDI clock messages // so we interpolate position according to speed - nframes64_t elapsed = engine_now - last_timestamp; - pos = (nframes64_t) (should_be_position + double(elapsed) * speed); + framecnt_t elapsed = engine_now - last_timestamp; + pos = (framepos_t) (should_be_position + double(elapsed) * speed); } else { // A new MIDI clock message has arrived this cycle pos = should_be_position; diff --git a/libs/ardour/midi_playlist.cc b/libs/ardour/midi_playlist.cc index 0fd32ebddd..abc0d682ba 100644 --- a/libs/ardour/midi_playlist.cc +++ b/libs/ardour/midi_playlist.cc @@ -103,7 +103,7 @@ MidiPlaylist::read (MidiRingBuffer<nframes_t>& dst, nframes_t start, nframes_t d // relevent regions overlapping start <--> end vector< boost::shared_ptr<Region> > regs; - typedef pair<MidiStateTracker*,nframes64_t> TrackerInfo; + typedef pair<MidiStateTracker*,framepos_t> TrackerInfo; vector<TrackerInfo> tracker_info; uint32_t note_cnt = 0; @@ -123,7 +123,7 @@ MidiPlaylist::read (MidiRingBuffer<nframes_t>& dst, nframes_t start, nframes_t d of this read range. */ - nframes64_t resolve_at = (*i)->last_frame(); + framepos_t resolve_at = (*i)->last_frame(); if (resolve_at >= end) { resolve_at = start; } diff --git a/libs/ardour/midi_port.cc b/libs/ardour/midi_port.cc index 5d04457832..adf24c2eaf 100644 --- a/libs/ardour/midi_port.cc +++ b/libs/ardour/midi_port.cc @@ -114,7 +114,7 @@ MidiPort::cycle_split () } void -MidiPort::flush_buffers (nframes_t nframes, nframes64_t time, nframes_t offset) +MidiPort::flush_buffers (nframes_t nframes, framepos_t time, nframes_t offset) { if (sends_output ()) { diff --git a/libs/ardour/midi_source.cc b/libs/ardour/midi_source.cc index b54e044201..b105aa00c5 100644 --- a/libs/ardour/midi_source.cc +++ b/libs/ardour/midi_source.cc @@ -183,7 +183,7 @@ MidiSource::length (framepos_t pos) const } void -MidiSource::update_length (sframes_t /*pos*/, sframes_t /*cnt*/) +MidiSource::update_length (framepos_t /*pos*/, framecnt_t /*cnt*/) { // You're not the boss of me! } @@ -197,8 +197,8 @@ MidiSource::invalidate () /** @param filtered A set of parameters whose MIDI messages will not be returned */ nframes_t -MidiSource::midi_read (Evoral::EventSink<nframes_t>& dst, sframes_t source_start, - sframes_t start, nframes_t cnt, +MidiSource::midi_read (Evoral::EventSink<nframes_t>& dst, framepos_t source_start, + framepos_t start, nframes_t cnt, MidiStateTracker* tracker, std::set<Evoral::Parameter> const & filtered) const { @@ -226,7 +226,7 @@ MidiSource::midi_read (Evoral::EventSink<nframes_t>& dst, sframes_t source_start // Read events up to end for (; i != _model->end(); ++i) { - const sframes_t time_frames = converter.to(i->time()); + const framecnt_t time_frames = converter.to(i->time()); if (time_frames < start + cnt) { /* convert event times to session frames by adding on the source start position in session frames */ dst.write (time_frames + source_start, i->event_type(), i->size(), i->buffer()); @@ -252,7 +252,7 @@ MidiSource::midi_read (Evoral::EventSink<nframes_t>& dst, sframes_t source_start } nframes_t -MidiSource::midi_write (MidiRingBuffer<nframes_t>& source, sframes_t source_start, nframes_t duration) +MidiSource::midi_write (MidiRingBuffer<nframes_t>& source, framepos_t source_start, nframes_t duration) { Glib::Mutex::Lock lm (_lock); const nframes_t ret = write_unlocked (source, source_start, duration); @@ -261,7 +261,7 @@ MidiSource::midi_write (MidiRingBuffer<nframes_t>& source, sframes_t source_star } void -MidiSource::mark_streaming_midi_write_started (NoteMode mode, sframes_t start_frame) +MidiSource::mark_streaming_midi_write_started (NoteMode mode, framepos_t start_frame) { set_timeline_position(start_frame); diff --git a/libs/ardour/midi_state_tracker.cc b/libs/ardour/midi_state_tracker.cc index 4e43e72693..24c9d2884c 100644 --- a/libs/ardour/midi_state_tracker.cc +++ b/libs/ardour/midi_state_tracker.cc @@ -90,7 +90,7 @@ MidiStateTracker::track (const MidiBuffer::iterator &from, const MidiBuffer::ite } void -MidiStateTracker::resolve_notes (MidiBuffer &dst, nframes64_t time) +MidiStateTracker::resolve_notes (MidiBuffer &dst, framepos_t time) { if (!_on) { return; @@ -111,7 +111,7 @@ MidiStateTracker::resolve_notes (MidiBuffer &dst, nframes64_t time) } void -MidiStateTracker::resolve_notes (Evoral::EventSink<nframes_t> &dst, nframes64_t time) +MidiStateTracker::resolve_notes (Evoral::EventSink<nframes_t> &dst, framepos_t time) { uint8_t buf[3]; diff --git a/libs/ardour/midi_track.cc b/libs/ardour/midi_track.cc index 2bac842655..595fccf360 100644 --- a/libs/ardour/midi_track.cc +++ b/libs/ardour/midi_track.cc @@ -381,7 +381,7 @@ MidiTrack::roll (nframes_t nframes, framepos_t start_frame, framepos_t end_frame } int -MidiTrack::no_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, +MidiTrack::no_roll (nframes_t nframes, framepos_t start_frame, framepos_t end_frame, bool state_changing, bool can_record, bool rec_monitors_input) { int ret = Track::no_roll (nframes, start_frame, end_frame, state_changing, can_record, rec_monitors_input); @@ -427,7 +427,7 @@ MidiTrack::push_midi_input_to_step_edit_ringbuffer (nframes_t nframes) } void -MidiTrack::write_out_of_band_data (BufferSet& bufs, sframes_t /*start*/, sframes_t /*end*/, nframes_t nframes) +MidiTrack::write_out_of_band_data (BufferSet& bufs, framepos_t /*start*/, framepos_t /*end*/, nframes_t nframes) { // Append immediate events MidiBuffer& buf (bufs.get_midi (0)); @@ -444,7 +444,7 @@ MidiTrack::write_out_of_band_data (BufferSet& bufs, sframes_t /*start*/, sframes } int -MidiTrack::export_stuff (BufferSet& /*bufs*/, nframes_t /*nframes*/, sframes_t /*end_frame*/) +MidiTrack::export_stuff (BufferSet& /*bufs*/, nframes_t /*nframes*/, framepos_t /*end_frame*/) { return -1; } diff --git a/libs/ardour/midi_ui.cc b/libs/ardour/midi_ui.cc index 5c36d46c3b..fecbf9b8e3 100644 --- a/libs/ardour/midi_ui.cc +++ b/libs/ardour/midi_ui.cc @@ -107,7 +107,7 @@ MidiControlUI::midi_input_handler (IOCondition ioc, MIDI::Port* port) CrossThreadChannel::drain (port->selectable()); DEBUG_TRACE (DEBUG::MidiIO, string_compose ("data available on %1\n", port->name())); - nframes64_t now = _session.engine().frame_time(); + framepos_t now = _session.engine().frame_time(); port->parse (now); } diff --git a/libs/ardour/mtc_slave.cc b/libs/ardour/mtc_slave.cc index 354341de24..953b79083b 100644 --- a/libs/ardour/mtc_slave.cc +++ b/libs/ardour/mtc_slave.cc @@ -230,8 +230,8 @@ MTC_Slave::update_mtc_time (const byte *msg, bool was_full, nframes_t now) * its not the average, but we will assign it to current.speed below */ - static nframes64_t last_seen_timestamp = 0; - static nframes64_t last_seen_position = 0; + static framepos_t last_seen_timestamp = 0; + static framepos_t last_seen_position = 0; if ((now - last_seen_timestamp) < 300) { mtc_frame = (mtc_frame + last_seen_position)/2; @@ -247,7 +247,7 @@ MTC_Slave::update_mtc_time (const byte *msg, bool was_full, nframes_t now) /* Non-PiC */ - nframes64_t time_delta = (now - last_mtc_timestamp); + framepos_t time_delta = (now - last_mtc_timestamp); if (time_delta != 0) { double apparent_speed = (mtc_frame - last_mtc_frame) / (double) (time_delta); @@ -391,9 +391,9 @@ MTC_Slave::ok() const } bool -MTC_Slave::speed_and_position (double& speed, nframes64_t& pos) +MTC_Slave::speed_and_position (double& speed, framepos_t& pos) { - nframes64_t now = session.engine().frame_time(); + framepos_t now = session.engine().frame_time(); SafeTime last; nframes_t elapsed; bool in_control = false; @@ -423,12 +423,12 @@ MTC_Slave::speed_and_position (double& speed, nframes64_t& pos) if (give_slave_full_control_over_transport_speed()) { in_control = (session.slave_state() == Session::Running); - nframes64_t pic_want_locate = 0; - //nframes64_t slave_pos = session.audible_frame(); - nframes64_t slave_pos = session.transport_frame(); + framepos_t pic_want_locate = 0; + //framepos_t slave_pos = session.audible_frame(); + framepos_t slave_pos = session.transport_frame(); static double average_speed = 0; - nframes64_t ref_now = session.engine().frame_time_at_cycle_start(); + framepos_t ref_now = session.engine().frame_time_at_cycle_start(); average_speed = pic->get_ratio (last.timestamp, last.position, ref_now, slave_pos, in_control, session.engine().frames_per_cycle()); pic_want_locate = pic->want_locate(); @@ -535,7 +535,7 @@ MTC_Slave::reset (bool with_position) } void -MTC_Slave::reset_window (nframes64_t root) +MTC_Slave::reset_window (framepos_t root) { /* if we're waiting for the master to catch us after seeking ahead, keep the window @@ -581,7 +581,7 @@ MTC_Slave::reset_window (nframes64_t root) DEBUG_TRACE (DEBUG::MTC, string_compose ("legal MTC window now %1 .. %2\n", window_begin, window_end)); } -nframes64_t +framecnt_t MTC_Slave::seekahead_distance () const { /* 1 second */ @@ -589,7 +589,7 @@ MTC_Slave::seekahead_distance () const } bool -MTC_Slave::outside_window (nframes64_t pos) const +MTC_Slave::outside_window (framepos_t pos) const { return ((pos < window_begin) || (pos > window_end)); } diff --git a/libs/ardour/onset_detector.cc b/libs/ardour/onset_detector.cc index 59fd8d10df..abe7df7022 100644 --- a/libs/ardour/onset_detector.cc +++ b/libs/ardour/onset_detector.cc @@ -100,7 +100,7 @@ OnsetDetector::cleanup_onsets (AnalysisFeatureList& t, float sr, float gap_msecs AnalysisFeatureList::iterator i = t.begin(); AnalysisFeatureList::iterator f, b; - const nframes64_t gap_frames = (nframes64_t) floor (gap_msecs * (sr / 1000.0)); + const framecnt_t gap_frames = (framecnt_t) floor (gap_msecs * (sr / 1000.0)); while (i != t.end()) { diff --git a/libs/ardour/pi_controller.cc b/libs/ardour/pi_controller.cc index 0d9e5b8c37..2ecfe730d8 100644 --- a/libs/ardour/pi_controller.cc +++ b/libs/ardour/pi_controller.cc @@ -152,15 +152,15 @@ PIChaser::~PIChaser() { } double -PIChaser::get_ratio(nframes64_t chasetime_measured, nframes64_t chasetime, nframes64_t slavetime_measured, nframes64_t slavetime, bool in_control, int period_size ) { +PIChaser::get_ratio(framepos_t chasetime_measured, framepos_t chasetime, framepos_t slavetime_measured, framepos_t slavetime, bool in_control, int period_size ) { feed_estimator( chasetime_measured, chasetime ); std::cerr << (double)chasetime_measured/48000.0 << " " << chasetime << " " << slavetime << " "; double crude = get_estimate(); double fine; - nframes64_t massaged_chasetime = chasetime + (nframes64_t)( (double)(slavetime_measured - chasetime_measured) * crude ); + framepos_t massaged_chasetime = chasetime + (framepos_t)( (double)(slavetime_measured - chasetime_measured) * crude ); - fine = pic->get_ratio( slavetime - massaged_chasetime, period_size ); + fine = pic->get_ratio (slavetime - massaged_chasetime, period_size); if (in_control) { if (fabs(fine-crude) > crude*speed_threshold) { std::cout << "reset to " << crude << " fine = " << fine << "\n"; @@ -188,7 +188,7 @@ PIChaser::get_ratio(nframes64_t chasetime_measured, nframes64_t chasetime, nfram } void -PIChaser::feed_estimator( nframes64_t realtime, nframes64_t chasetime ) { +PIChaser::feed_estimator (framepos_t realtime, framepos_t chasetime ) { array_index += 1; realtime_stamps [ array_index%ESTIMATOR_SIZE ] = realtime; chasetime_stamps[ array_index%ESTIMATOR_SIZE ] = chasetime; @@ -199,8 +199,8 @@ PIChaser::get_estimate() { double est = 0; int num=0; int i; - nframes64_t n1_realtime; - nframes64_t n1_chasetime; + framepos_t n1_realtime; + framepos_t n1_chasetime; for( i=(array_index + 1); i<=(array_index + ESTIMATOR_SIZE); i++ ) { if( realtime_stamps[(i)%ESTIMATOR_SIZE] ) { n1_realtime = realtime_stamps[(i)%ESTIMATOR_SIZE]; @@ -213,8 +213,8 @@ PIChaser::get_estimate() { for( ; i<=(array_index + ESTIMATOR_SIZE); i++ ) { if( realtime_stamps[(i)%ESTIMATOR_SIZE] ) { if( (realtime_stamps[(i)%ESTIMATOR_SIZE] - n1_realtime) > 200 ) { - nframes64_t n_realtime = realtime_stamps[(i)%ESTIMATOR_SIZE]; - nframes64_t n_chasetime = chasetime_stamps[(i)%ESTIMATOR_SIZE]; + framepos_t n_realtime = realtime_stamps[(i)%ESTIMATOR_SIZE]; + framepos_t n_chasetime = chasetime_stamps[(i)%ESTIMATOR_SIZE]; est += ((double)( n_chasetime - n1_chasetime )) / ((double)( n_realtime - n1_realtime )); n1_realtime = n_realtime; diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index 13576ff11a..07d27faee9 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -804,7 +804,7 @@ Region::modify_front (nframes_t new_position, bool reset_fade, void *src) if (new_position < end) { /* can't trim it zero or negative length */ nframes_t newlen = 0; - nframes64_t delta = 0; + framepos_t delta = 0; /* can't trim it back passed where source position zero is located */ @@ -1444,11 +1444,11 @@ Region::uses_source (boost::shared_ptr<const Source> source) const return false; } -sframes_t +framecnt_t Region::source_length(uint32_t n) const { assert (n < _sources.size()); - return _sources[n]->length(_position - _start); + return _sources[n]->length (_position - _start); } bool diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index cda4fa8e1e..81d822e749 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -379,7 +379,7 @@ Route::set_gain (gain_t val, void *src) */ void Route::process_output_buffers (BufferSet& bufs, - sframes_t start_frame, sframes_t end_frame, nframes_t nframes, + framepos_t start_frame, framepos_t end_frame, nframes_t nframes, bool /*with_processors*/, int declick) { bool monitor; @@ -500,7 +500,7 @@ Route::n_process_buffers () } void -Route::passthru (sframes_t start_frame, sframes_t end_frame, nframes_t nframes, int declick) +Route::passthru (framepos_t start_frame, framepos_t end_frame, nframes_t nframes, int declick) { BufferSet& bufs = _session.get_scratch_buffers (n_process_buffers()); @@ -540,7 +540,7 @@ Route::passthru (sframes_t start_frame, sframes_t end_frame, nframes_t nframes, } void -Route::passthru_silence (sframes_t start_frame, sframes_t end_frame, nframes_t nframes, int declick) +Route::passthru_silence (framepos_t start_frame, framepos_t end_frame, nframes_t nframes, int declick) { BufferSet& bufs (_session.get_silent_buffers (n_process_buffers())); bufs.set_count (_input->n_ports()); @@ -2701,7 +2701,7 @@ Route::pans_required () const } int -Route::no_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, +Route::no_roll (nframes_t nframes, framepos_t start_frame, framepos_t end_frame, bool session_state_changing, bool /*can_record*/, bool /*rec_monitors_input*/) { Glib::RWLock::ReaderLock lm (_processor_lock, Glib::TRY_LOCK); @@ -2766,7 +2766,7 @@ Route::check_initial_delay (nframes_t nframes, nframes_t& transport_frame) } int -Route::roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, int declick, +Route::roll (nframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool /*can_record*/, bool /*rec_monitors_input*/, bool& /* need_butler */) { Glib::RWLock::ReaderLock lm (_processor_lock, Glib::TRY_LOCK); @@ -2799,7 +2799,7 @@ Route::roll (nframes_t nframes, sframes_t start_frame, sframes_t end_frame, int } int -Route::silent_roll (nframes_t nframes, sframes_t /*start_frame*/, sframes_t /*end_frame*/, +Route::silent_roll (nframes_t nframes, framepos_t /*start_frame*/, framepos_t /*end_frame*/, bool /*can_record*/, bool /*rec_monitors_input*/, bool& /* need_butler */) { silence (nframes); @@ -3148,7 +3148,7 @@ Route::set_pending_declick (int declick) */ void -Route::shift (nframes64_t /*pos*/, nframes64_t /*frames*/) +Route::shift (framepos_t /*pos*/, framecnt_t /*frames*/) { #ifdef THIS_NEEDS_FIXING_FOR_V3 diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 682bb541f5..4f18a300af 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -1113,11 +1113,11 @@ Session::maybe_enable_record () set_dirty(); } -nframes64_t +framepos_t Session::audible_frame () const { - nframes64_t ret; - nframes64_t tf; + framepos_t ret; + framepos_t tf; nframes_t offset; /* the first of these two possible settings for "offset" @@ -3929,7 +3929,7 @@ Session::get_available_sync_options () const } boost::shared_ptr<RouteList> -Session::get_routes_with_regions_at (nframes64_t const p) const +Session::get_routes_with_regions_at (framepos_t const p) const { shared_ptr<RouteList> r = routes.reader (); shared_ptr<RouteList> rl (new RouteList); diff --git a/libs/ardour/session_events.cc b/libs/ardour/session_events.cc index 4df5111b03..2e30c4a8f1 100644 --- a/libs/ardour/session_events.cc +++ b/libs/ardour/session_events.cc @@ -78,21 +78,21 @@ SessionEvent::operator delete (void *ptr, size_t /*size*/) } void -SessionEventManager::add_event (nframes64_t frame, SessionEvent::Type type, nframes64_t target_frame) +SessionEventManager::add_event (framepos_t frame, SessionEvent::Type type, framepos_t target_frame) { SessionEvent* ev = new SessionEvent (type, SessionEvent::Add, frame, target_frame, 0); queue_event (ev); } void -SessionEventManager::remove_event (nframes64_t frame, SessionEvent::Type type) +SessionEventManager::remove_event (framepos_t frame, SessionEvent::Type type) { SessionEvent* ev = new SessionEvent (type, SessionEvent::Remove, frame, 0, 0); queue_event (ev); } void -SessionEventManager::replace_event (SessionEvent::Type type, nframes64_t frame, nframes64_t target) +SessionEventManager::replace_event (SessionEvent::Type type, framepos_t frame, framepos_t target) { SessionEvent* ev = new SessionEvent (type, SessionEvent::Replace, frame, target, 0); queue_event (ev); diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc index c5efb1f3f8..6914b9db94 100644 --- a/libs/ardour/session_midi.cc +++ b/libs/ardour/session_midi.cc @@ -349,7 +349,7 @@ Session::mmc_record_enable (MIDI::MachineControl &mmc, size_t trk, bool enabled) * @param t time to send. */ int -Session::send_full_time_code (nframes64_t const t) +Session::send_full_time_code (framepos_t const t) { /* This function could easily send at a given frame offset, but would * that be useful? Does ardour do sub-block accurate locating? [DR] */ diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc index 342ae5c8a8..b18e00f9fd 100644 --- a/libs/ardour/session_process.cc +++ b/libs/ardour/session_process.cc @@ -435,7 +435,7 @@ bool Session::follow_slave (nframes_t nframes) { double slave_speed; - nframes64_t slave_transport_frame; + framepos_t slave_transport_frame; nframes_t this_delta; int dir; diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc index 946d3ea890..c96c5ce510 100644 --- a/libs/ardour/session_transport.cc +++ b/libs/ardour/session_transport.cc @@ -131,7 +131,7 @@ Session::request_locate (nframes_t target_frame, bool with_roll) } void -Session::force_locate (nframes64_t target_frame, bool with_roll) +Session::force_locate (framepos_t target_frame, bool with_roll) { SessionEvent *ev = new SessionEvent (with_roll ? SessionEvent::LocateRoll : SessionEvent::Locate, SessionEvent::Add, SessionEvent::Immediate, target_frame, 0, true); DEBUG_TRACE (DEBUG::Transport, string_compose ("Request forced locate to %1\n", target_frame)); @@ -594,7 +594,7 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished) } // can't cast away volatile so copy and emit that - nframes64_t tframe = _transport_frame; + framepos_t tframe = _transport_frame; PositionChanged (tframe); /* EMIT SIGNAL */ TransportStateChange (); /* EMIT SIGNAL */ @@ -724,12 +724,12 @@ Session::flush_all_inserts () } void -Session::start_locate (nframes64_t target_frame, bool with_roll, bool with_flush, bool with_loop, bool force) +Session::start_locate (framepos_t target_frame, bool with_roll, bool with_flush, bool with_loop, bool force) { if (synced_to_jack()) { double sp; - nframes64_t pos; + framepos_t pos; _slave->speed_and_position (sp, pos); @@ -776,7 +776,7 @@ Session::micro_locate (nframes_t distance) /** @param with_mmc true to send a MMC locate command when the locate is done */ void -Session::locate (nframes64_t target_frame, bool with_roll, bool with_flush, bool with_loop, bool force, bool with_mmc) +Session::locate (framepos_t target_frame, bool with_roll, bool with_flush, bool with_loop, bool force, bool with_mmc) { if (actively_recording() && !with_loop) { return; @@ -1444,7 +1444,7 @@ void Session::xrun_recovery () { // can't cast away volatile so copy and emit that - nframes64_t tframe = _transport_frame; + framepos_t tframe = _transport_frame; Xrun (tframe); //EMIT SIGNAL if (Config->get_stop_recording_on_xrun() && actively_recording()) { @@ -1565,7 +1565,7 @@ Session::maybe_stop (nframes_t limit) } void -Session::send_mmc_locate (nframes64_t t) +Session::send_mmc_locate (framepos_t t) { Timecode::Time time; timecode_time_subframes (t, time); diff --git a/libs/ardour/slave.cc b/libs/ardour/slave.cc index be88fe223c..ce03f0b17e 100644 --- a/libs/ardour/slave.cc +++ b/libs/ardour/slave.cc @@ -35,13 +35,13 @@ SlaveSessionProxy::frame_rate() const return session.frame_rate(); } -nframes64_t +framepos_t SlaveSessionProxy::audible_frame() const { return session.audible_frame(); } -nframes64_t +framepos_t SlaveSessionProxy::transport_frame() const { return session.transport_frame(); @@ -53,14 +53,14 @@ SlaveSessionProxy::frames_since_cycle_start() const return session.engine().frames_since_cycle_start(); } -nframes64_t +framepos_t SlaveSessionProxy::frame_time() const { return session.engine().frame_time(); } void -SlaveSessionProxy::request_locate(nframes64_t frame, bool with_roll) +SlaveSessionProxy::request_locate(framepos_t frame, bool with_roll) { session.request_locate(frame, with_roll); } diff --git a/libs/ardour/smf_source.cc b/libs/ardour/smf_source.cc index 11100b9f52..4ddbba8457 100644 --- a/libs/ardour/smf_source.cc +++ b/libs/ardour/smf_source.cc @@ -105,8 +105,8 @@ SMFSource::~SMFSource () /** All stamps in audio frames */ nframes_t -SMFSource::read_unlocked (Evoral::EventSink<nframes_t>& destination, sframes_t const source_start, - sframes_t start, nframes_t duration, +SMFSource::read_unlocked (Evoral::EventSink<nframes_t>& destination, framepos_t const source_start, + framepos_t start, nframes_t duration, MidiStateTracker* tracker) const { int ret = 0; @@ -174,7 +174,7 @@ SMFSource::read_unlocked (Evoral::EventSink<nframes_t>& destination, sframes_t c /* Note that we add on the source start time (in session frames) here so that ev_frame_time is in session frames. */ - const sframes_t ev_frame_time = converter.to(time / (double)ppqn()) + source_start; + const framepos_t ev_frame_time = converter.to(time / (double)ppqn()) + source_start; if (ev_frame_time < start + duration) { destination.write (ev_frame_time, ev_type, ev_size, ev_buffer); @@ -203,7 +203,7 @@ SMFSource::read_unlocked (Evoral::EventSink<nframes_t>& destination, sframes_t c /** All stamps in audio frames */ nframes_t -SMFSource::write_unlocked (MidiRingBuffer<nframes_t>& source, sframes_t position, nframes_t duration) +SMFSource::write_unlocked (MidiRingBuffer<nframes_t>& source, framepos_t position, nframes_t duration) { _write_data_count = 0; @@ -313,7 +313,7 @@ SMFSource::append_event_unlocked_beats (const Evoral::Event<double>& ev) /** Append an event with a timestamp in frames (nframes_t) */ void -SMFSource::append_event_unlocked_frames (const Evoral::Event<nframes_t>& ev, sframes_t position) +SMFSource::append_event_unlocked_frames (const Evoral::Event<nframes_t>& ev, framepos_t position) { assert(_writing); if (ev.size() == 0) { @@ -349,7 +349,7 @@ SMFSource::append_event_unlocked_frames (const Evoral::Event<nframes_t>& ev, sfr _length_beats = max(_length_beats, ev_time_beats); - const sframes_t delta_time_frames = ev.time() - _last_ev_time_frames; + const framepos_t delta_time_frames = ev.time() - _last_ev_time_frames; const double delta_time_beats = converter.from(delta_time_frames); const uint32_t delta_time_ticks = (uint32_t)(lrint(delta_time_beats * (double)ppqn())); @@ -385,7 +385,7 @@ SMFSource::set_state (const XMLNode& node, int version) } void -SMFSource::mark_streaming_midi_write_started (NoteMode mode, sframes_t start_frame) +SMFSource::mark_streaming_midi_write_started (NoteMode mode, framepos_t start_frame) { Glib::Mutex::Lock lm (_lock); MidiSource::mark_streaming_midi_write_started (mode, start_frame); diff --git a/libs/ardour/sndfilesource.cc b/libs/ardour/sndfilesource.cc index a183d26b84..b2b486813c 100644 --- a/libs/ardour/sndfilesource.cc +++ b/libs/ardour/sndfilesource.cc @@ -521,7 +521,7 @@ SndFileSource::flush_header () } int -SndFileSource::setup_broadcast_info (sframes_t /*when*/, struct tm& now, time_t /*tnow*/) +SndFileSource::setup_broadcast_info (framepos_t /*when*/, struct tm& now, time_t /*tnow*/) { if (!writable()) { warning << string_compose (_("attempt to store broadcast info in a non-writable audio file source (%1)"), _path) << endmsg; @@ -632,7 +632,7 @@ SndFileSource::clear_capture_marks () } void -SndFileSource::mark_capture_start (sframes_t pos) +SndFileSource::mark_capture_start (framepos_t pos) { if (destructive()) { if (pos < _timeline_position) { @@ -775,7 +775,7 @@ SndFileSource::crossfade (Sample* data, framecnt_t cnt, int fade_in) return cnt; } -sframes_t +framepos_t SndFileSource::last_capture_start_frame () const { if (destructive()) { diff --git a/libs/ardour/source.cc b/libs/ardour/source.cc index 165da0befd..e5aa759670 100644 --- a/libs/ardour/source.cc +++ b/libs/ardour/source.cc @@ -195,7 +195,7 @@ Source::load_transients (const string& path) file >> val; if (!file.fail()) { - nframes64_t frame = (nframes64_t) floor (val * _session.frame_rate()); + framepos_t frame = (framepos_t) floor (val * _session.frame_rate()); transients.push_back (frame); } } diff --git a/libs/ardour/st_stretch.cc b/libs/ardour/st_stretch.cc index 369ed95279..748c854daf 100644 --- a/libs/ardour/st_stretch.cc +++ b/libs/ardour/st_stretch.cc @@ -177,8 +177,8 @@ STStretch::run (boost::shared_ptr<Region> a_region) /* now reset ancestral data for each new region */ for (vector<boost::shared_ptr<Region> >::iterator x = results.begin(); x != results.end(); ++x) { - nframes64_t astart = (*x)->ancestral_start(); - nframes64_t alength = (*x)->ancestral_length(); + framepos_t astart = (*x)->ancestral_start(); + framepos_t alength = (*x)->ancestral_length(); nframes_t start; nframes_t length; diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc index a60b0d32d3..67c3419b1b 100644 --- a/libs/ardour/tempo.cc +++ b/libs/ardour/tempo.cc @@ -218,7 +218,7 @@ struct MetricSectionSorter { } }; -TempoMap::TempoMap (nframes64_t fr) +TempoMap::TempoMap (nframes_t fr) { metrics = new Metrics; _frame_rate = fr; @@ -259,11 +259,11 @@ TempoMap::move_metric_section (MetricSection& section, const BBT_Time& when) /* position by audio frame, then recompute BBT timestamps from the audio ones */ - nframes64_t frame = frame_time (when); + framepos_t frame = frame_time (when); // cerr << "nominal frame time = " << frame << endl; - nframes64_t prev_frame = round_to_type (frame, -1, Beat); - nframes64_t next_frame = round_to_type (frame, 1, Beat); + framepos_t prev_frame = round_to_type (frame, -1, Beat); + framepos_t next_frame = round_to_type (frame, 1, Beat); // cerr << "previous beat at " << prev_frame << " next at " << next_frame << endl; @@ -439,7 +439,7 @@ TempoMap::add_tempo (const Tempo& tempo, BBT_Time where) } void -TempoMap::add_tempo (const Tempo& tempo, nframes64_t where) +TempoMap::add_tempo (const Tempo& tempo, framepos_t where) { { Glib::RWLock::WriterLock lm (lock); @@ -506,7 +506,7 @@ TempoMap::add_meter (const Meter& meter, BBT_Time where) } void -TempoMap::add_meter (const Meter& meter, nframes64_t where) +TempoMap::add_meter (const Meter& meter, framepos_t where) { { Glib::RWLock::WriterLock lm (lock); @@ -559,7 +559,7 @@ TempoMap::change_initial_tempo (double beats_per_minute, double note_type) } void -TempoMap::change_existing_tempo_at (nframes64_t where, double beats_per_minute, double note_type) +TempoMap::change_existing_tempo_at (framepos_t where, double beats_per_minute, double note_type) { Tempo newtempo (beats_per_minute, note_type); @@ -649,8 +649,8 @@ TempoMap::timestamp_metrics (bool use_bbt) // cerr << "\n\n\n ######################\nTIMESTAMP via BBT ##############\n" << endl; - nframes64_t current = 0; - nframes64_t section_frames; + framepos_t current = 0; + framepos_t section_frames; BBT_Time start; BBT_Time end; @@ -744,7 +744,7 @@ TempoMap::timestamp_metrics (bool use_bbt) } TempoMetric -TempoMap::metric_at (nframes64_t frame) const +TempoMap::metric_at (framepos_t frame) const { TempoMetric m (first_meter(), first_tempo()); const Meter* meter; @@ -812,7 +812,7 @@ TempoMap::metric_at (BBT_Time bbt) const } void -TempoMap::bbt_time (nframes64_t frame, BBT_Time& bbt) const +TempoMap::bbt_time (framepos_t frame, BBT_Time& bbt) const { { Glib::RWLock::ReaderLock lm (lock); @@ -821,15 +821,15 @@ TempoMap::bbt_time (nframes64_t frame, BBT_Time& bbt) const } void -TempoMap::bbt_time_unlocked (nframes64_t frame, BBT_Time& bbt) const +TempoMap::bbt_time_unlocked (framepos_t frame, BBT_Time& bbt) const { bbt_time_with_metric (frame, bbt, metric_at (frame)); } void -TempoMap::bbt_time_with_metric (nframes64_t frame, BBT_Time& bbt, const TempoMetric& metric) const +TempoMap::bbt_time_with_metric (framepos_t frame, BBT_Time& bbt, const TempoMetric& metric) const { - nframes64_t frame_diff; + framecnt_t frame_diff; // cerr << "---- BBT time for " << frame << " using metric @ " << metric.frame() << " BBT " << metric.start() << endl; @@ -872,16 +872,16 @@ TempoMap::bbt_time_with_metric (nframes64_t frame, BBT_Time& bbt, const TempoMet // cerr << "-----\t RETURN " << bbt << endl; } -nframes64_t -TempoMap::count_frames_between ( const BBT_Time& start, const BBT_Time& end) const +framecnt_t +TempoMap::count_frames_between (const BBT_Time& start, const BBT_Time& end) const { /* for this to work with fractional measure types, start and end have to be "legal" BBT types, that means that the beats and ticks should be inside a bar */ - nframes64_t frames = 0; - nframes64_t start_frame = 0; - nframes64_t end_frame = 0; + framecnt_t frames = 0; + framepos_t start_frame = 0; + framepos_t end_frame = 0; TempoMetric m = metric_at (start); @@ -891,7 +891,7 @@ TempoMap::count_frames_between ( const BBT_Time& start, const BBT_Time& end) con + start.ticks/Meter::ticks_per_beat; - start_frame = m.frame() + (nframes64_t) rint( beat_offset * m.tempo().frames_per_beat(_frame_rate, m.meter())); + start_frame = m.frame() + (framepos_t) rint( beat_offset * m.tempo().frames_per_beat(_frame_rate, m.meter())); m = metric_at(end); @@ -900,7 +900,7 @@ TempoMap::count_frames_between ( const BBT_Time& start, const BBT_Time& end) con beat_offset = bar_offset * m.meter().beats_per_bar() - (m.start().beats -1) + (end.beats - 1) + end.ticks/Meter::ticks_per_beat; - end_frame = m.frame() + (nframes64_t) rint(beat_offset * m.tempo().frames_per_beat(_frame_rate, m.meter())); + end_frame = m.frame() + (framepos_t) rint(beat_offset * m.tempo().frames_per_beat(_frame_rate, m.meter())); frames = end_frame - start_frame; @@ -908,12 +908,12 @@ TempoMap::count_frames_between ( const BBT_Time& start, const BBT_Time& end) con } -nframes64_t +framecnt_t TempoMap::count_frames_between_metrics (const Meter& meter, const Tempo& tempo, const BBT_Time& start, const BBT_Time& end) const { /* this is used in timestamping the metrics by actually counting the beats */ - nframes64_t frames = 0; + framecnt_t frames = 0; uint32_t bar = start.bars; double beat = (double) start.beats; double beats_counted = 0; @@ -952,13 +952,13 @@ TempoMap::count_frames_between_metrics (const Meter& meter, const Tempo& tempo, // << " fpb was " << beat_frames // << endl; - frames = (nframes64_t) floor (beats_counted * beat_frames); + frames = (framecnt_t) llrint (floor (beats_counted * beat_frames)); return frames; } -nframes64_t +framepos_t TempoMap::frame_time (const BBT_Time& bbt) const { BBT_Time start ; /* 1|1|0 */ @@ -966,10 +966,10 @@ TempoMap::frame_time (const BBT_Time& bbt) const return count_frames_between ( start, bbt); } -nframes64_t -TempoMap::bbt_duration_at (nframes64_t pos, const BBT_Time& bbt, int dir) const +framecnt_t +TempoMap::bbt_duration_at (framepos_t pos, const BBT_Time& bbt, int dir) const { - nframes64_t frames = 0; + framecnt_t frames = 0; BBT_Time when; bbt_time(pos, when); @@ -982,11 +982,10 @@ TempoMap::bbt_duration_at (nframes64_t pos, const BBT_Time& bbt, int dir) const return frames; } -nframes64_t +framecnt_t TempoMap::bbt_duration_at_unlocked (const BBT_Time& when, const BBT_Time& bbt, int dir) const { - - nframes64_t frames = 0; + framecnt_t frames = 0; double beats_per_bar; BBT_Time result; @@ -1109,8 +1108,8 @@ TempoMap::bbt_duration_at_unlocked (const BBT_Time& when, const BBT_Time& bbt, i -nframes64_t -TempoMap::round_to_bar (nframes64_t fr, int dir) +framepos_t +TempoMap::round_to_bar (framepos_t fr, int dir) { { Glib::RWLock::ReaderLock lm (lock); @@ -1119,8 +1118,8 @@ TempoMap::round_to_bar (nframes64_t fr, int dir) } -nframes64_t -TempoMap::round_to_beat (nframes64_t fr, int dir) +framepos_t +TempoMap::round_to_beat (framepos_t fr, int dir) { { Glib::RWLock::ReaderLock lm (lock); @@ -1128,8 +1127,8 @@ TempoMap::round_to_beat (nframes64_t fr, int dir) } } -nframes64_t -TempoMap::round_to_beat_subdivision (nframes64_t fr, int sub_num, int dir) +framepos_t +TempoMap::round_to_beat_subdivision (framepos_t fr, int sub_num, int dir) { BBT_Time the_beat; uint32_t ticks_one_half_subdivisions_worth; @@ -1199,8 +1198,8 @@ TempoMap::round_to_beat_subdivision (nframes64_t fr, int sub_num, int dir) return frame_time (the_beat); } -nframes64_t -TempoMap::round_to_type (nframes64_t frame, int dir, BBTPointType type) +framepos_t +TempoMap::round_to_type (framepos_t frame, int dir, BBTPointType type) { TempoMetric metric = metric_at (frame); BBT_Time bbt; @@ -1320,7 +1319,7 @@ TempoMap::round_to_type (nframes64_t frame, int dir, BBTPointType type) } TempoMap::BBTPointList * -TempoMap::get_points (nframes64_t lower, nframes64_t upper) const +TempoMap::get_points (framepos_t lower, framepos_t upper) const { Metrics::const_iterator i; @@ -1339,7 +1338,7 @@ TempoMap::get_points (nframes64_t lower, nframes64_t upper) const double delta_bars; double delta_beats; double dummy; - nframes64_t limit; + framepos_t limit; meter = &first_meter (); tempo = &first_tempo (); @@ -1416,7 +1415,7 @@ TempoMap::get_points (nframes64_t lower, nframes64_t upper) const if (beat == 1) { if (current >= lower) { // cerr << "Add Bar at " << bar << "|1" << " @ " << current << endl; - points->push_back (BBTPoint (*meter, *tempo,(nframes64_t)rint(current), Bar, bar, 1)); + points->push_back (BBTPoint (*meter, *tempo,(framepos_t)rint(current), Bar, bar, 1)); } } @@ -1428,7 +1427,7 @@ TempoMap::get_points (nframes64_t lower, nframes64_t upper) const while (beat <= ceil( beats_per_bar) && beat_frame < limit) { if (beat_frame >= lower) { // cerr << "Add Beat at " << bar << '|' << beat << " @ " << beat_frame << endl; - points->push_back (BBTPoint (*meter, *tempo, (nframes64_t) rint(beat_frame), Beat, bar, beat)); + points->push_back (BBTPoint (*meter, *tempo, (framepos_t) rint(beat_frame), Beat, bar, beat)); } beat_frame += beat_frames; current+= beat_frames; @@ -1509,7 +1508,7 @@ TempoMap::get_points (nframes64_t lower, nframes64_t upper) const } const TempoSection& -TempoMap::tempo_section_at (nframes64_t frame) +TempoMap::tempo_section_at (framepos_t frame) { Glib::RWLock::ReaderLock lm (lock); Metrics::iterator i; @@ -1536,7 +1535,7 @@ TempoMap::tempo_section_at (nframes64_t frame) } const Tempo& -TempoMap::tempo_at (nframes64_t frame) const +TempoMap::tempo_at (framepos_t frame) const { TempoMetric m (metric_at (frame)); return m.tempo(); @@ -1544,7 +1543,7 @@ TempoMap::tempo_at (nframes64_t frame) const const Meter& -TempoMap::meter_at (nframes64_t frame) const +TempoMap::meter_at (framepos_t frame) const { TempoMetric m (metric_at (frame)); return m.meter(); @@ -1671,7 +1670,7 @@ TempoMap::n_meters() const } void -TempoMap::insert_time (nframes64_t where, nframes64_t amount) +TempoMap::insert_time (framepos_t where, framecnt_t amount) { for (Metrics::iterator i = metrics->begin(); i != metrics->end(); ++i) { if ((*i)->frame() >= where) { diff --git a/libs/ardour/transient_detector.cc b/libs/ardour/transient_detector.cc index 1eca79e67d..6573262393 100644 --- a/libs/ardour/transient_detector.cc +++ b/libs/ardour/transient_detector.cc @@ -91,7 +91,7 @@ TransientDetector::cleanup_transients (AnalysisFeatureList& t, float sr, float g AnalysisFeatureList::iterator i = t.begin(); AnalysisFeatureList::iterator f, b; - const nframes64_t gap_frames = (nframes64_t) floor (gap_msecs * (sr / 1000.0)); + const framecnt_t gap_frames = (framecnt_t) floor (gap_msecs * (sr / 1000.0)); while (i != t.end()) { |