From 93c7aeba048f19df5abee5e4325ef8b0ef62c279 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 28 Sep 2006 17:23:52 +0000 Subject: fixes for destructive track offsets of various kinds; move from jack_nframes_t -> nframes_t git-svn-id: svn://localhost/ardour2/trunk@933 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/ardour.h | 2 +- libs/ardour/ardour/audio_diskstream.h | 20 +-- libs/ardour/ardour/audio_track.h | 20 +-- libs/ardour/ardour/audio_unit.h | 6 +- libs/ardour/ardour/audioengine.h | 52 +++---- libs/ardour/ardour/audiofilesource.h | 10 +- libs/ardour/ardour/audioplaylist.h | 6 +- libs/ardour/ardour/audioregion.h | 50 +++---- libs/ardour/ardour/audiosource.h | 33 ++--- libs/ardour/ardour/auditioner.h | 6 +- libs/ardour/ardour/configuration_vars.h | 8 +- libs/ardour/ardour/coreaudiosource.h | 11 +- libs/ardour/ardour/crossfade.h | 40 +++--- libs/ardour/ardour/destructive_filesource.h | 20 +-- libs/ardour/ardour/diskstream.h | 66 ++++----- libs/ardour/ardour/export.h | 22 +-- libs/ardour/ardour/gain.h | 8 +- libs/ardour/ardour/insert.h | 22 +-- libs/ardour/ardour/io.h | 38 ++--- libs/ardour/ardour/ladspa_plugin.h | 14 +- libs/ardour/ardour/location.h | 28 ++-- libs/ardour/ardour/mix.h | 32 ++--- libs/ardour/ardour/panner.h | 28 ++-- libs/ardour/ardour/peak.h | 4 +- libs/ardour/ardour/playlist.h | 44 +++--- libs/ardour/ardour/plugin.h | 6 +- libs/ardour/ardour/port.h | 18 +-- libs/ardour/ardour/redirect.h | 10 +- libs/ardour/ardour/region.h | 74 +++++----- libs/ardour/ardour/region_factory.h | 12 +- libs/ardour/ardour/route.h | 40 +++--- libs/ardour/ardour/send.h | 2 +- libs/ardour/ardour/session.h | 206 ++++++++++++++-------------- libs/ardour/ardour/slave.h | 28 ++-- libs/ardour/ardour/sndfilesource.h | 16 +-- libs/ardour/ardour/source_factory.h | 2 +- libs/ardour/ardour/tempo.h | 64 ++++----- libs/ardour/ardour/track.h | 22 +-- libs/ardour/ardour/types.h | 35 +++-- libs/ardour/ardour/utils.h | 2 +- libs/ardour/ardour/vst_plugin.h | 6 +- libs/ardour/audio_diskstream.cc | 90 ++++++------ libs/ardour/audio_playlist.cc | 23 ++-- libs/ardour/audio_track.cc | 18 +-- libs/ardour/audio_unit.cc | 6 +- libs/ardour/audioengine.cc | 38 ++--- libs/ardour/audiofilesource.cc | 5 +- libs/ardour/audioregion.cc | 110 +++++++-------- libs/ardour/audiosource.cc | 77 +++++++---- libs/ardour/auditioner.cc | 4 +- libs/ardour/automation_event.cc | 4 +- libs/ardour/coreaudiosource.cc | 6 +- libs/ardour/crossfade.cc | 46 +++---- libs/ardour/default_click.cc | 4 +- libs/ardour/destructive_filesource.cc | 56 ++++---- libs/ardour/diskstream.cc | 12 +- libs/ardour/gain.cc | 8 +- libs/ardour/globals.cc | 4 +- libs/ardour/import.cc | 2 +- libs/ardour/insert.cc | 26 ++-- libs/ardour/io.cc | 56 ++++---- libs/ardour/jack_slave.cc | 4 +- libs/ardour/ladspa_plugin.cc | 14 +- libs/ardour/location.cc | 18 +-- libs/ardour/mix.cc | 32 ++--- libs/ardour/mtc_slave.cc | 20 +-- libs/ardour/panner.cc | 46 +++---- libs/ardour/playlist.cc | 90 ++++++------ libs/ardour/playlist_factory.cc | 2 +- libs/ardour/redirect.cc | 2 +- libs/ardour/region.cc | 80 ++++++----- libs/ardour/region_factory.cc | 12 +- libs/ardour/reverse.cc | 12 +- libs/ardour/route.cc | 38 ++--- libs/ardour/send.cc | 2 +- libs/ardour/session.cc | 50 +++---- libs/ardour/session_click.cc | 8 +- libs/ardour/session_events.cc | 6 +- libs/ardour/session_export.cc | 14 +- libs/ardour/session_midi.cc | 16 +-- libs/ardour/session_process.cc | 50 +++---- libs/ardour/session_state.cc | 4 +- libs/ardour/session_time.cc | 38 ++--- libs/ardour/session_timefx.cc | 12 +- libs/ardour/session_transport.cc | 24 ++-- libs/ardour/sndfilesource.cc | 43 +++--- libs/ardour/source_factory.cc | 2 +- libs/ardour/tempo.cc | 86 ++++++------ libs/ardour/track.cc | 4 +- libs/ardour/utils.cc | 4 +- libs/ardour/vst_plugin.cc | 6 +- 91 files changed, 1252 insertions(+), 1215 deletions(-) (limited to 'libs/ardour') diff --git a/libs/ardour/ardour/ardour.h b/libs/ardour/ardour/ardour.h index 668907ea8c..85dad103d4 100644 --- a/libs/ardour/ardour/ardour.h +++ b/libs/ardour/ardour/ardour.h @@ -43,7 +43,7 @@ namespace ARDOUR { extern OSC* osc; - static const jack_nframes_t max_frames = JACK_MAX_FRAMES; + static const nframes_t max_frames = JACK_MAX_FRAMES; int init (bool with_vst, bool try_optimization); int cleanup (); diff --git a/libs/ardour/ardour/audio_diskstream.h b/libs/ardour/ardour/audio_diskstream.h index a43c198ff2..4dee5e9b00 100644 --- a/libs/ardour/ardour/audio_diskstream.h +++ b/libs/ardour/ardour/audio_diskstream.h @@ -131,7 +131,7 @@ class AudioDiskstream : public Diskstream } } - static void swap_by_ptr (Sample *first, Sample *last, jack_nframes_t n) { + static void swap_by_ptr (Sample *first, Sample *last, nframes_t n) { while (n--) { Sample tmp = *first; *first++ = *last; @@ -151,22 +151,22 @@ class AudioDiskstream : public Diskstream void set_pending_overwrite(bool); int overwrite_existing_buffers (); - void set_block_size (jack_nframes_t); - int internal_playback_seek (jack_nframes_t distance); - int can_internal_playback_seek (jack_nframes_t distance); + void set_block_size (nframes_t); + int internal_playback_seek (nframes_t distance); + int can_internal_playback_seek (nframes_t distance); int rename_write_sources (); void reset_write_sources (bool, bool force = false); void non_realtime_input_change (); protected: friend class Auditioner; - int seek (jack_nframes_t which_sample, bool complete_refill = false); + int seek (nframes_t which_sample, bool complete_refill = false); protected: friend class AudioTrack; - int process (jack_nframes_t transport_frame, jack_nframes_t nframes, jack_nframes_t offset, bool can_record, bool rec_monitors_input); - bool commit (jack_nframes_t nframes); + int process (nframes_t transport_frame, nframes_t nframes, nframes_t offset, bool can_record, bool rec_monitors_input); + bool commit (nframes_t nframes); private: @@ -197,7 +197,7 @@ class AudioDiskstream : public Diskstream RingBufferNPT * capture_transition_buf; // the following are used in the butler thread only - jack_nframes_t curr_capture_cnt; + nframes_t curr_capture_cnt; }; /* The two central butler operations */ @@ -207,7 +207,7 @@ class AudioDiskstream : public Diskstream int do_refill_with_alloc(); int read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer, - jack_nframes_t& start, jack_nframes_t cnt, + nframes_t& start, nframes_t cnt, ChannelInfo& channel_info, int channel, bool reversed); void finish_capture (bool rec_monitors_input); @@ -227,7 +227,7 @@ class AudioDiskstream : public Diskstream int use_pending_capture_data (XMLNode& node); void get_input_sources (); - void check_record_status (jack_nframes_t transport_frame, jack_nframes_t nframes, bool can_record); + void check_record_status (nframes_t transport_frame, nframes_t nframes, bool can_record); void set_align_style_from_io(); void setup_destructive_playlist (); void use_destructive_playlist (); diff --git a/libs/ardour/ardour/audio_track.h b/libs/ardour/ardour/audio_track.h index 33010dc880..a074732c39 100644 --- a/libs/ardour/ardour/audio_track.h +++ b/libs/ardour/ardour/audio_track.h @@ -37,35 +37,35 @@ class AudioTrack : public Track AudioTrack (Session&, const XMLNode&); ~AudioTrack (); - int roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, - jack_nframes_t offset, int declick, bool can_record, bool rec_monitors_input); + int roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, + nframes_t offset, int declick, bool can_record, bool rec_monitors_input); - int no_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, - jack_nframes_t offset, bool state_changing, bool can_record, bool rec_monitors_input); + int no_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, + nframes_t offset, bool state_changing, bool can_record, bool rec_monitors_input); - int silent_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, - jack_nframes_t offset, bool can_record, bool rec_monitors_input); + int silent_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, + nframes_t offset, bool can_record, bool rec_monitors_input); boost::shared_ptr audio_diskstream() const; int use_diskstream (string name); int use_diskstream (const PBD::ID& id); - int export_stuff (vector& buffers, uint32_t nbufs, jack_nframes_t nframes, jack_nframes_t end_frame); + int export_stuff (vector& buffers, uint32_t nbufs, nframes_t nframes, nframes_t end_frame); void freeze (InterThreadInfo&); void unfreeze (); void bounce (InterThreadInfo&); - void bounce_range (jack_nframes_t start, jack_nframes_t end, InterThreadInfo&); + void bounce_range (nframes_t start, nframes_t end, InterThreadInfo&); int set_state(const XMLNode& node); protected: XMLNode& state (bool full); - void passthru_silence (jack_nframes_t start_frame, jack_nframes_t end_frame, - jack_nframes_t nframes, jack_nframes_t offset, int declick, + void passthru_silence (nframes_t start_frame, nframes_t end_frame, + nframes_t nframes, nframes_t offset, int declick, bool meter); uint32_t n_process_buffers (); diff --git a/libs/ardour/ardour/audio_unit.h b/libs/ardour/ardour/audio_unit.h index a007f41d2b..aa7c34a2d2 100644 --- a/libs/ardour/ardour/audio_unit.h +++ b/libs/ardour/ardour/audio_unit.h @@ -54,7 +54,7 @@ class AUPlugin : public ARDOUR::Plugin const char * maker () const; uint32_t parameter_count () const; float default_value (uint32_t port); - jack_nframes_t latency () const; + nframes_t latency () const; void set_parameter (uint32_t which, float val); float get_parameter (uint32_t which) const; @@ -62,9 +62,9 @@ class AUPlugin : public ARDOUR::Plugin uint32_t nth_parameter (uint32_t which, bool& ok) const; void activate (); void deactivate (); - void set_block_size (jack_nframes_t nframes); + void set_block_size (nframes_t nframes); - int connect_and_run (vector& bufs, uint32_t maxbuf, int32_t& in, int32_t& out, jack_nframes_t nframes, jack_nframes_t offset); + int connect_and_run (vector& bufs, uint32_t maxbuf, int32_t& in, int32_t& out, nframes_t nframes, nframes_t offset); std::set automatable() const; void store_state (ARDOUR::PluginState&); void restore_state (ARDOUR::PluginState&); diff --git a/libs/ardour/ardour/audioengine.h b/libs/ardour/ardour/audioengine.h index 36a08e237e..e53eb8a85e 100644 --- a/libs/ardour/ardour/audioengine.h +++ b/libs/ardour/ardour/audioengine.h @@ -67,30 +67,30 @@ class AudioEngine : public sigc::trackable Glib::Mutex& process_lock() { return _process_lock; } - jack_nframes_t frame_rate(); - jack_nframes_t frames_per_cycle(); + nframes_t frame_rate(); + nframes_t frames_per_cycle(); int usecs_per_cycle () const { return _usecs_per_cycle; } - bool get_sync_offset (jack_nframes_t& offset) const; + bool get_sync_offset (nframes_t& offset) const; - jack_nframes_t frames_since_cycle_start () { + nframes_t frames_since_cycle_start () { if (!_running || !_jack) return 0; return jack_frames_since_cycle_start (_jack); } - jack_nframes_t frame_time () { + nframes_t frame_time () { if (!_running || !_jack) return 0; return jack_frame_time (_jack); } - jack_nframes_t transport_frame () const { + nframes_t transport_frame () const { if (!_running || !_jack) return 0; return jack_get_current_transport_frame (_jack); } - int request_buffer_size (jack_nframes_t); + int request_buffer_size (nframes_t); - jack_nframes_t set_monitor_check_interval (jack_nframes_t); + nframes_t set_monitor_check_interval (nframes_t); float get_cpu_load() { if (!_running || !_jack) return 0; @@ -134,7 +134,7 @@ class AudioEngine : public sigc::trackable return get_nth_physical (n, JackPortIsOutput); } - jack_nframes_t get_port_total_latency (const Port&); + nframes_t get_port_total_latency (const Port&); void update_total_latencies (); /* the caller may not delete the object pointed to by @@ -152,7 +152,7 @@ class AudioEngine : public sigc::trackable void transport_start (); void transport_stop (); - void transport_locate (jack_nframes_t); + void transport_locate (nframes_t); TransportState transport_state (); int reset_timebase (); @@ -166,7 +166,7 @@ class AudioEngine : public sigc::trackable the regular process() call to session->process() is not made. */ - sigc::signal Freewheel; + sigc::signal Freewheel; sigc::signal Xrun; @@ -176,7 +176,7 @@ class AudioEngine : public sigc::trackable /* this signal is emitted if the sample rate changes */ - sigc::signal SampleRateChanged; + sigc::signal SampleRateChanged; /* this signal is sent if JACK ever disconnects us */ @@ -202,21 +202,21 @@ class AudioEngine : public sigc::trackable bool session_remove_pending; bool _running; bool _has_run; - jack_nframes_t _buffer_size; - jack_nframes_t _frame_rate; - jack_nframes_t monitor_check_interval; - jack_nframes_t last_monitor_check; - jack_nframes_t _processed_frames; + nframes_t _buffer_size; + nframes_t _frame_rate; + nframes_t monitor_check_interval; + nframes_t last_monitor_check; + nframes_t _processed_frames; bool _freewheeling; bool _freewheel_thread_registered; - sigc::slot freewheel_action; + sigc::slot freewheel_action; bool reconnect_on_halt; int _usecs_per_cycle; typedef std::set Ports; SerializedRCUManager ports; - int process_callback (jack_nframes_t nframes); + int process_callback (nframes_t nframes); void remove_all_ports (); typedef std::pair PortConnection; @@ -229,17 +229,17 @@ class AudioEngine : public sigc::trackable static int _xrun_callback (void *arg); static int _graph_order_callback (void *arg); - static int _process_callback (jack_nframes_t nframes, void *arg); - static int _sample_rate_callback (jack_nframes_t nframes, void *arg); - static int _bufsize_callback (jack_nframes_t nframes, void *arg); - static void _jack_timebase_callback (jack_transport_state_t, jack_nframes_t, jack_position_t*, int, void*); + static int _process_callback (nframes_t nframes, void *arg); + static int _sample_rate_callback (nframes_t nframes, void *arg); + static int _bufsize_callback (nframes_t nframes, void *arg); + static void _jack_timebase_callback (jack_transport_state_t, nframes_t, jack_position_t*, int, void*); static int _jack_sync_callback (jack_transport_state_t, jack_position_t*, void *arg); static void _freewheel_callback (int , void *arg); - void jack_timebase_callback (jack_transport_state_t, jack_nframes_t, jack_position_t*, int); + void jack_timebase_callback (jack_transport_state_t, nframes_t, jack_position_t*, int); int jack_sync_callback (jack_transport_state_t, jack_position_t*); - int jack_bufsize_callback (jack_nframes_t); - int jack_sample_rate_callback (jack_nframes_t); + int jack_bufsize_callback (nframes_t); + int jack_sample_rate_callback (nframes_t); static void halted (void *); diff --git a/libs/ardour/ardour/audiofilesource.h b/libs/ardour/ardour/audiofilesource.h index 507a464421..fb32d892d2 100644 --- a/libs/ardour/ardour/audiofilesource.h +++ b/libs/ardour/ardour/audiofilesource.h @@ -65,12 +65,12 @@ class AudioFileSource : public AudioSource { for files used in destructive recording. */ - virtual jack_nframes_t last_capture_start_frame() const { return 0; } - virtual void mark_capture_start (jack_nframes_t) {} + virtual nframes_t last_capture_start_frame() const { return 0; } + virtual void mark_capture_start (nframes_t) {} virtual void mark_capture_end () {} virtual void clear_capture_marks() {} - virtual int update_header (jack_nframes_t when, struct tm&, time_t) = 0; + virtual int update_header (nframes_t when, struct tm&, time_t) = 0; virtual int flush_header () = 0; int move_to_trash (const string trash_dir_name); @@ -86,7 +86,7 @@ class AudioFileSource : public AudioSource { static void set_bwf_serial_number (int); static void set_search_path (string); - static void set_header_position_offset (jack_nframes_t offset ); + static void set_header_position_offset (nframes_t offset ); static sigc::signal HeaderPositionOffsetChanged; @@ -132,7 +132,7 @@ class AudioFileSource : public AudioSource { static uint64_t header_position_offset; - virtual void set_timeline_position (jack_nframes_t pos); + virtual void set_timeline_position (nframes_t pos); virtual void set_header_timeline_position () = 0; bool find (std::string path, bool must_exist, bool& is_new); diff --git a/libs/ardour/ardour/audioplaylist.h b/libs/ardour/ardour/audioplaylist.h index 6a52f1c16f..341b08930c 100644 --- a/libs/ardour/ardour/audioplaylist.h +++ b/libs/ardour/ardour/audioplaylist.h @@ -56,11 +56,11 @@ class AudioPlaylist : public ARDOUR::Playlist AudioPlaylist (Session&, const XMLNode&, bool hidden = false); AudioPlaylist (Session&, string name, bool hidden = false); AudioPlaylist (const AudioPlaylist&, string name, bool hidden = false); - AudioPlaylist (const AudioPlaylist&, jack_nframes_t start, jack_nframes_t cnt, string name, bool hidden = false); + AudioPlaylist (const AudioPlaylist&, nframes_t start, nframes_t cnt, string name, bool hidden = false); void clear (bool with_save = true); - jack_nframes_t read (Sample *dst, Sample *mixdown, float *gain_buffer, jack_nframes_t start, jack_nframes_t cnt, uint32_t chan_n=0); + nframes_t read (Sample *dst, Sample *mixdown, float *gain_buffer, nframes_t start, nframes_t cnt, uint32_t chan_n=0); int set_state (const XMLNode&); UndoAction get_memento() const; @@ -68,7 +68,7 @@ class AudioPlaylist : public ARDOUR::Playlist sigc::signal NewCrossfade; template void foreach_crossfade (T *t, void (T::*func)(Crossfade *)); - void crossfades_at (jack_nframes_t frame, Crossfades&); + void crossfades_at (nframes_t frame, Crossfades&); template void apply_to_history (T& obj, void (T::*method)(const ARDOUR::StateManager::StateMap&, state_id_t)) { RegionLock rlock (this); diff --git a/libs/ardour/ardour/audioregion.h b/libs/ardour/ardour/audioregion.h index 06115aa8b0..d1d7c6e5fb 100644 --- a/libs/ardour/ardour/audioregion.h +++ b/libs/ardour/ardour/audioregion.h @@ -90,24 +90,24 @@ class AudioRegion : public Region Curve& fade_out() { return _fade_out; } Curve& envelope() { return _envelope; } - jack_nframes_t read_peaks (PeakData *buf, jack_nframes_t npeaks, - jack_nframes_t offset, jack_nframes_t cnt, + nframes_t read_peaks (PeakData *buf, nframes_t npeaks, + nframes_t offset, nframes_t cnt, uint32_t chan_n=0, double samples_per_unit= 1.0) const; - virtual jack_nframes_t read_at (Sample *buf, Sample *mixdown_buf, - float *gain_buf, jack_nframes_t position, jack_nframes_t cnt, + virtual nframes_t read_at (Sample *buf, Sample *mixdown_buf, + float *gain_buf, nframes_t position, nframes_t cnt, uint32_t chan_n = 0, - jack_nframes_t read_frames = 0, - jack_nframes_t skip_frames = 0) const; + nframes_t read_frames = 0, + nframes_t skip_frames = 0) const; - jack_nframes_t master_read_at (Sample *buf, Sample *mixdown_buf, + nframes_t master_read_at (Sample *buf, Sample *mixdown_buf, float *gain_buf, - jack_nframes_t position, jack_nframes_t cnt, uint32_t chan_n=0) const; + nframes_t position, nframes_t cnt, uint32_t chan_n=0) const; XMLNode& state (bool); int set_state (const XMLNode&); - static void set_default_fade (float steepness, jack_nframes_t len); + static void set_default_fade (float steepness, nframes_t len); enum FadeShape { Linear, @@ -119,13 +119,13 @@ class AudioRegion : public Region void set_fade_in_active (bool yn); void set_fade_in_shape (FadeShape); - void set_fade_in_length (jack_nframes_t); - void set_fade_in (FadeShape, jack_nframes_t); + void set_fade_in_length (nframes_t); + void set_fade_in (FadeShape, nframes_t); void set_fade_out_active (bool yn); void set_fade_out_shape (FadeShape); - void set_fade_out_length (jack_nframes_t); - void set_fade_out (FadeShape, jack_nframes_t); + void set_fade_out_length (nframes_t); + void set_fade_out (FadeShape, nframes_t); void set_envelope_active (bool yn); @@ -153,10 +153,10 @@ class AudioRegion : public Region private: friend class RegionFactory; - AudioRegion (boost::shared_ptr, jack_nframes_t start, jack_nframes_t length); - AudioRegion (boost::shared_ptr, jack_nframes_t start, jack_nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags); - AudioRegion (SourceList &, jack_nframes_t start, jack_nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags); - AudioRegion (boost::shared_ptr, jack_nframes_t start, jack_nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags); + AudioRegion (boost::shared_ptr, nframes_t start, nframes_t length); + AudioRegion (boost::shared_ptr, nframes_t start, nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags); + AudioRegion (SourceList &, nframes_t start, nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags); + AudioRegion (boost::shared_ptr, nframes_t start, nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags); AudioRegion (boost::shared_ptr); AudioRegion (boost::shared_ptr, const XMLNode&); AudioRegion (SourceList &, const XMLNode&); @@ -173,16 +173,16 @@ class AudioRegion : public Region void recompute_gain_at_end (); void recompute_gain_at_start (); - jack_nframes_t _read_at (const SourceList&, Sample *buf, Sample *mixdown_buffer, - float *gain_buffer, jack_nframes_t position, jack_nframes_t cnt, + nframes_t _read_at (const SourceList&, Sample *buf, Sample *mixdown_buffer, + float *gain_buffer, nframes_t position, nframes_t cnt, uint32_t chan_n = 0, - jack_nframes_t read_frames = 0, - jack_nframes_t skip_frames = 0) const; + nframes_t read_frames = 0, + nframes_t skip_frames = 0) const; - bool verify_start (jack_nframes_t position); - bool verify_length (jack_nframes_t position); - bool verify_start_mutable (jack_nframes_t& start); - bool verify_start_and_length (jack_nframes_t start, jack_nframes_t length); + bool verify_start (nframes_t position); + bool verify_length (nframes_t position); + bool verify_start_mutable (nframes_t& start); + bool verify_start_and_length (nframes_t start, nframes_t length); void recompute_at_start (); void recompute_at_end (); diff --git a/libs/ardour/ardour/audiosource.h b/libs/ardour/ardour/audiosource.h index d598e424ac..d2d23bcfab 100644 --- a/libs/ardour/ardour/audiosource.h +++ b/libs/ardour/ardour/audiosource.h @@ -42,7 +42,7 @@ using std::string; namespace ARDOUR { -const jack_nframes_t frames_per_peak = 256; +const nframes_t frames_per_peak = 256; class AudioSource : public Source { @@ -56,18 +56,18 @@ class AudioSource : public Source so its here in AudioSource for now. */ - virtual jack_nframes_t natural_position() const { return 0; } + virtual nframes_t natural_position() const { return 0; } /* returns the number of items in this `audio_source' */ - virtual jack_nframes_t length() const { + virtual nframes_t length() const { return _length; } - virtual jack_nframes_t available_peaks (double zoom) const; + virtual nframes_t available_peaks (double zoom) const; - virtual jack_nframes_t read (Sample *dst, jack_nframes_t start, jack_nframes_t cnt) const; - virtual jack_nframes_t write (Sample *src, jack_nframes_t cnt); + virtual nframes_t read (Sample *dst, nframes_t start, nframes_t cnt) const; + virtual nframes_t write (Sample *src, nframes_t cnt); virtual float sample_rate () const = 0; @@ -80,12 +80,12 @@ class AudioSource : public Source uint32_t read_data_count() const { return _read_data_count; } uint32_t write_data_count() const { return _write_data_count; } - int read_peaks (PeakData *peaks, jack_nframes_t npeaks, jack_nframes_t start, jack_nframes_t cnt, double samples_per_unit) const; + int read_peaks (PeakData *peaks, nframes_t npeaks, nframes_t start, nframes_t cnt, double samples_per_unit) const; int build_peaks (); bool peaks_ready (sigc::slot, sigc::connection&) const; mutable sigc::signal PeaksReady; - mutable sigc::signal PeakRangeReady; + mutable sigc::signal PeakRangeReady; XMLNode& get_state (); int set_state (const XMLNode&); @@ -94,6 +94,7 @@ class AudioSource : public Source static void stop_peak_thread (); int rename_peakfile (std::string newpath); + void touch_peakfile (); static void set_build_missing_peakfiles (bool yn) { _build_missing_peakfiles = yn; @@ -109,7 +110,7 @@ class AudioSource : public Source bool _peaks_built; mutable Glib::Mutex _lock; - jack_nframes_t _length; + nframes_t _length; bool next_peak_clear_should_notify; string peakpath; string _captured_for; @@ -120,14 +121,14 @@ class AudioSource : public Source int initialize_peakfile (bool newfile, string path); void build_peaks_from_scratch (); - int do_build_peak (jack_nframes_t, jack_nframes_t); + int do_build_peak (nframes_t, nframes_t); - virtual jack_nframes_t read_unlocked (Sample *dst, jack_nframes_t start, jack_nframes_t cnt) const = 0; - virtual jack_nframes_t write_unlocked (Sample *dst, jack_nframes_t cnt) = 0; + virtual nframes_t read_unlocked (Sample *dst, nframes_t start, nframes_t cnt) const = 0; + virtual nframes_t write_unlocked (Sample *dst, nframes_t cnt) = 0; virtual string peak_path(string audio_path) = 0; virtual string old_peak_path(string audio_path) = 0; - void update_length (jack_nframes_t pos, jack_nframes_t cnt); + void update_length (nframes_t pos, nframes_t cnt); static pthread_t peak_thread; static bool have_peak_thread; @@ -149,10 +150,10 @@ class AudioSource : public Source static void clear_queue_for_peaks (); struct PeakBuildRecord { - jack_nframes_t frame; - jack_nframes_t cnt; + nframes_t frame; + nframes_t cnt; - PeakBuildRecord (jack_nframes_t f, jack_nframes_t c) + PeakBuildRecord (nframes_t f, nframes_t c) : frame (f), cnt (c) {} PeakBuildRecord (const PeakBuildRecord& other) { frame = other.frame; diff --git a/libs/ardour/ardour/auditioner.h b/libs/ardour/ardour/auditioner.h index 424ede0009..e6091cfba0 100644 --- a/libs/ardour/ardour/auditioner.h +++ b/libs/ardour/ardour/auditioner.h @@ -45,7 +45,7 @@ class Auditioner : public AudioTrack ARDOUR::AudioPlaylist& prepare_playlist (); void audition_current_playlist (); - int play_audition (jack_nframes_t nframes); + int play_audition (nframes_t nframes); void cancel_audition () { g_atomic_int_set (&_active, 0); @@ -55,10 +55,10 @@ class Auditioner : public AudioTrack private: boost::shared_ptr the_region; - jack_nframes_t current_frame; + nframes_t current_frame; mutable gint _active; Glib::Mutex lock; - jack_nframes_t length; + nframes_t length; void drop_ports (); static void *_drop_ports (void *); diff --git a/libs/ardour/ardour/configuration_vars.h b/libs/ardour/ardour/configuration_vars.h index a3898feef6..8cd66decb1 100644 --- a/libs/ardour/ardour/configuration_vars.h +++ b/libs/ardour/ardour/configuration_vars.h @@ -76,10 +76,10 @@ CONFIG_VARIABLE (float, shuttle_speed_threshold, "shuttle-speed-threshold", 5.0f CONFIG_VARIABLE (float, smpte_frames_per_second, "smpte-frames-per-second", 30.0f) CONFIG_VARIABLE (float, video_pullup, "video-pullup", 0.0f) CONFIG_VARIABLE (bool, smpte_drop_frames, "smpte-drop-frames", false) -CONFIG_VARIABLE (jack_nframes_t, preroll, "preroll", 0) -CONFIG_VARIABLE (jack_nframes_t, postroll, "postroll", 0) -CONFIG_VARIABLE (jack_nframes_t, over_length_short, "over-length-short", 2) -CONFIG_VARIABLE (jack_nframes_t, over_length_long, "over-length-long", 10) +CONFIG_VARIABLE (nframes_t, preroll, "preroll", 0) +CONFIG_VARIABLE (nframes_t, postroll, "postroll", 0) +CONFIG_VARIABLE (nframes_t, over_length_short, "over-length-short", 2) +CONFIG_VARIABLE (nframes_t, over_length_long, "over-length-long", 10) CONFIG_VARIABLE (bool, full_xfades_unmuted, "full-xfades-unmuted", true) CONFIG_VARIABLE (float, short_xfade_seconds, "short-xfade-seconds", 0.015) CONFIG_VARIABLE (SlaveSource, slave_source, "slave-source", None) diff --git a/libs/ardour/ardour/coreaudiosource.h b/libs/ardour/ardour/coreaudiosource.h index 49009caf53..668fe61102 100644 --- a/libs/ardour/ardour/coreaudiosource.h +++ b/libs/ardour/ardour/coreaudiosource.h @@ -33,24 +33,21 @@ class CoreAudioSource : public AudioFileSource { ~CoreAudioSource (); float sample_rate() const; - int update_header (jack_nframes_t when, struct tm&, time_t); + int update_header (nframes_t when, struct tm&, time_t); int flush_header () {return 0;}; void set_header_timeline_position () {}; protected: - jack_nframes_t read_unlocked (Sample *dst, jack_nframes_t start, jack_nframes_t cnt) const; - - jack_nframes_t write_unlocked (Sample *dst, jack_nframes_t cnt) - { return 0; } - + nframes_t read_unlocked (Sample *dst, nframes_t start, nframes_t cnt) const; + nframes_t write_unlocked (Sample *dst, nframes_t cnt) { return 0; } private: mutable CAAudioFile af; uint16_t n_channels; mutable float *tmpbuf; - mutable jack_nframes_t tmpbufsize; + mutable nframes_t tmpbufsize; mutable Glib::Mutex _tmpbuf_lock; void init (const string &str); diff --git a/libs/ardour/ardour/crossfade.h b/libs/ardour/ardour/crossfade.h index ded41bbfda..7fd7323b36 100644 --- a/libs/ardour/ardour/crossfade.h +++ b/libs/ardour/ardour/crossfade.h @@ -46,8 +46,8 @@ struct CrossfadeState : public StateManager::State { UndoAction fade_in_memento; UndoAction fade_out_memento; - jack_nframes_t position; - jack_nframes_t length; + nframes_t position; + nframes_t length; AnchorPoint anchor_point; bool follow_overlap; bool active; @@ -65,8 +65,8 @@ class Crossfade : public PBD::StatefulDestructible, public StateManager /* constructor for "fixed" xfades at each end of an internal overlap */ Crossfade (boost::shared_ptr in, boost::shared_ptr out, - jack_nframes_t position, - jack_nframes_t initial_length, + nframes_t position, + nframes_t initial_length, AnchorPoint); /* constructor for xfade between two regions that are overlapped in any way @@ -93,11 +93,11 @@ class Crossfade : public PBD::StatefulDestructible, public StateManager boost::shared_ptr in() const { return _in; } boost::shared_ptr out() const { return _out; } - jack_nframes_t read_at (Sample *buf, Sample *mixdown_buffer, - float *gain_buffer, jack_nframes_t position, jack_nframes_t cnt, + nframes_t read_at (Sample *buf, Sample *mixdown_buffer, + float *gain_buffer, nframes_t position, nframes_t cnt, uint32_t chan_n, - jack_nframes_t read_frames = 0, - jack_nframes_t skip_frames = 0); + nframes_t read_frames = 0, + nframes_t skip_frames = 0); bool refresh (); @@ -117,21 +117,21 @@ class Crossfade : public PBD::StatefulDestructible, public StateManager return (_in == a && _out == b) || (_in == b && _out == a); } - jack_nframes_t length() const { return _length; } - jack_nframes_t overlap_length() const; - jack_nframes_t position() const { return _position; } + nframes_t length() const { return _length; } + nframes_t overlap_length() const; + nframes_t position() const { return _position; } sigc::signal Invalidated; - bool covers (jack_nframes_t frame) const { + bool covers (nframes_t frame) const { return _position <= frame && frame < _position + _length; } - OverlapType coverage (jack_nframes_t start, jack_nframes_t end) const; + OverlapType coverage (nframes_t start, nframes_t end) const; UndoAction get_memento() const; - static void set_buffer_size (jack_nframes_t); + static void set_buffer_size (nframes_t); bool active () const { return _active; } void set_active (bool yn); @@ -143,10 +143,10 @@ class Crossfade : public PBD::StatefulDestructible, public StateManager Curve& fade_in() { return _fade_in; } Curve& fade_out() { return _fade_out; } - jack_nframes_t set_length (jack_nframes_t); + nframes_t set_length (nframes_t); - static jack_nframes_t short_xfade_length() { return _short_xfade_length; } - static void set_short_xfade_length (jack_nframes_t n); + static nframes_t short_xfade_length() { return _short_xfade_length; } + static void set_short_xfade_length (nframes_t n); static Change ActiveChanged; @@ -154,15 +154,15 @@ class Crossfade : public PBD::StatefulDestructible, public StateManager friend struct CrossfadeComparePtr; friend class AudioPlaylist; - static jack_nframes_t _short_xfade_length; + static nframes_t _short_xfade_length; boost::shared_ptr _in; boost::shared_ptr _out; bool _active; bool _in_update; OverlapType overlap_type; - jack_nframes_t _length; - jack_nframes_t _position; + nframes_t _length; + nframes_t _position; AnchorPoint _anchor_point; bool _follow_overlap; bool _fixed; diff --git a/libs/ardour/ardour/destructive_filesource.h b/libs/ardour/ardour/destructive_filesource.h index fed84217e7..1e75042ce9 100644 --- a/libs/ardour/ardour/destructive_filesource.h +++ b/libs/ardour/ardour/destructive_filesource.h @@ -31,7 +31,7 @@ namespace ARDOUR { class DestructiveFileSource : public SndFileSource { public: - DestructiveFileSource (Session&, std::string path, SampleFormat samp_format, HeaderFormat hdr_format, jack_nframes_t rate, + DestructiveFileSource (Session&, std::string path, SampleFormat samp_format, HeaderFormat hdr_format, nframes_t rate, Flag flags = AudioFileSource::Flag (AudioFileSource::Writable)); DestructiveFileSource (Session&, std::string path, Flag flags); @@ -39,34 +39,34 @@ class DestructiveFileSource : public SndFileSource { DestructiveFileSource (Session&, const XMLNode&); ~DestructiveFileSource (); - jack_nframes_t last_capture_start_frame() const; - void mark_capture_start (jack_nframes_t); + nframes_t last_capture_start_frame() const; + void mark_capture_start (nframes_t); void mark_capture_end (); void clear_capture_marks(); XMLNode& get_state (); - static void setup_standard_crossfades (jack_nframes_t sample_rate); + static void setup_standard_crossfades (nframes_t sample_rate); protected: - jack_nframes_t write_unlocked (Sample *src, jack_nframes_t cnt); + nframes_t write_unlocked (Sample *src, nframes_t cnt); virtual void handle_header_position_change (); private: - static jack_nframes_t xfade_frames; + static nframes_t xfade_frames; static gain_t* out_coefficient; static gain_t* in_coefficient; bool _capture_start; bool _capture_end; - jack_nframes_t capture_start_frame; - jack_nframes_t file_pos; // unit is frames + nframes_t capture_start_frame; + nframes_t file_pos; // unit is frames Sample* xfade_buf; void init (); - jack_nframes_t crossfade (Sample* data, jack_nframes_t cnt, int dir); - void set_timeline_position (jack_nframes_t); + nframes_t crossfade (Sample* data, nframes_t cnt, int dir); + void set_timeline_position (nframes_t); }; } diff --git a/libs/ardour/ardour/diskstream.h b/libs/ardour/ardour/diskstream.h index 08041d949f..d3b5d6dce4 100644 --- a/libs/ardour/ardour/diskstream.h +++ b/libs/ardour/ardour/diskstream.h @@ -83,8 +83,8 @@ class IO; void set_align_style (AlignStyle); void set_persistent_align_style (AlignStyle a) { _persistent_alignment_style = a; } - jack_nframes_t roll_delay() const { return _roll_delay; } - void set_roll_delay (jack_nframes_t); + nframes_t roll_delay() const { return _roll_delay; } + void set_roll_delay (nframes_t); bool record_enabled() const { return g_atomic_int_get (&_record_enabled); } virtual void set_record_enabled (bool yn) = 0; @@ -109,14 +109,14 @@ class IO; virtual int use_new_playlist () = 0; virtual int use_copy_playlist () = 0; - jack_nframes_t current_capture_start() const { return capture_start_frame; } - jack_nframes_t current_capture_end() const { return capture_start_frame + capture_captured; } - jack_nframes_t get_capture_start_frame (uint32_t n=0); - jack_nframes_t get_captured_frames (uint32_t n=0); + nframes_t current_capture_start() const { return capture_start_frame; } + nframes_t current_capture_end() const { return capture_start_frame + capture_captured; } + nframes_t get_capture_start_frame (uint32_t n=0); + nframes_t get_captured_frames (uint32_t n=0); uint32_t n_channels() { return _n_channels; } - static jack_nframes_t disk_io_frames() { return disk_io_chunk_frames; } + static nframes_t disk_io_frames() { return disk_io_chunk_frames; } static void set_disk_io_chunk_frames (uint32_t n) { disk_io_chunk_frames = n; } /* Stateful */ @@ -126,7 +126,7 @@ class IO; // FIXME: makes sense for all diskstream types? virtual void monitor_input (bool) {} - jack_nframes_t capture_offset() const { return _capture_offset; } + nframes_t capture_offset() const { return _capture_offset; } virtual void set_capture_offset (); bool slaved() const { return _slaved; } @@ -158,9 +158,9 @@ class IO; virtual void set_pending_overwrite (bool) = 0; virtual int overwrite_existing_buffers () = 0; - virtual void set_block_size (jack_nframes_t) = 0; - virtual int internal_playback_seek (jack_nframes_t distance) = 0; - virtual int can_internal_playback_seek (jack_nframes_t distance) = 0; + virtual void set_block_size (nframes_t) = 0; + virtual int internal_playback_seek (nframes_t distance) = 0; + virtual int can_internal_playback_seek (nframes_t distance) = 0; virtual int rename_write_sources () = 0; virtual void reset_write_sources (bool, bool force = false) = 0; virtual void non_realtime_input_change () = 0; @@ -170,14 +170,14 @@ class IO; protected: friend class Auditioner; - virtual int seek (jack_nframes_t which_sample, bool complete_refill = false) = 0; + virtual int seek (nframes_t which_sample, bool complete_refill = false) = 0; protected: friend class Track; virtual void prepare (); - virtual int process (jack_nframes_t transport_frame, jack_nframes_t nframes, jack_nframes_t offset, bool can_record, bool rec_monitors_input) = 0; - virtual bool commit (jack_nframes_t nframes) = 0; + virtual int process (nframes_t transport_frame, nframes_t nframes, nframes_t offset, bool can_record, bool rec_monitors_input) = 0; + virtual bool commit (nframes_t nframes) = 0; virtual void recover (); /* called if commit will not be called, but process was */ //private: @@ -189,7 +189,7 @@ class IO; struct CaptureTransition { TransitionType type; - jack_nframes_t capture_val; ///< The start or end file frame position + nframes_t capture_val; ///< The start or end file frame position }; /* The two central butler operations */ @@ -228,12 +228,12 @@ class IO; virtual int use_pending_capture_data (XMLNode& node) = 0; virtual void get_input_sources () = 0; - virtual void check_record_status (jack_nframes_t transport_frame, jack_nframes_t nframes, bool can_record) = 0; + virtual void check_record_status (nframes_t transport_frame, nframes_t nframes, bool can_record) = 0; virtual void set_align_style_from_io() {} virtual void setup_destructive_playlist () = 0; virtual void use_destructive_playlist () = 0; - static jack_nframes_t disk_io_chunk_frames; + static nframes_t disk_io_chunk_frames; vector capture_info; Glib::Mutex capture_info_lock; @@ -253,34 +253,34 @@ class IO; bool _seek_required; bool force_refill; - jack_nframes_t capture_start_frame; - jack_nframes_t capture_captured; + nframes_t capture_start_frame; + nframes_t capture_captured; bool was_recording; - jack_nframes_t adjust_capture_position; - jack_nframes_t _capture_offset; - jack_nframes_t _roll_delay; - jack_nframes_t first_recordable_frame; - jack_nframes_t last_recordable_frame; + nframes_t adjust_capture_position; + nframes_t _capture_offset; + nframes_t _roll_delay; + nframes_t first_recordable_frame; + nframes_t last_recordable_frame; int last_possibly_recording; AlignStyle _alignment_style; bool _scrubbing; bool _slaved; bool _processed; Location* loop_location; - jack_nframes_t overwrite_frame; + nframes_t overwrite_frame; off_t overwrite_offset; bool pending_overwrite; bool overwrite_queued; IOChange input_change_pending; - jack_nframes_t wrap_buffer_size; - jack_nframes_t speed_buffer_size; + nframes_t wrap_buffer_size; + nframes_t speed_buffer_size; uint64_t last_phase; uint64_t phi; - jack_nframes_t file_frame; - jack_nframes_t playback_sample; - jack_nframes_t playback_distance; + nframes_t file_frame; + nframes_t playback_sample; + nframes_t playback_distance; uint32_t _read_data_count; uint32_t _write_data_count; @@ -291,9 +291,9 @@ class IO; Glib::Mutex state_lock; - jack_nframes_t scrub_start; - jack_nframes_t scrub_buffer_size; - jack_nframes_t scrub_offset; + nframes_t scrub_start; + nframes_t scrub_buffer_size; + nframes_t scrub_offset; sigc::connection ports_created_c; sigc::connection plmod_connection; diff --git a/libs/ardour/ardour/export.h b/libs/ardour/ardour/export.h index 075464767e..f66acec893 100644 --- a/libs/ardour/ardour/export.h +++ b/libs/ardour/ardour/export.h @@ -34,43 +34,43 @@ namespace ARDOUR void clear (); - int prepare (jack_nframes_t blocksize, jack_nframes_t frame_rate); + int prepare (nframes_t blocksize, nframes_t frame_rate); - int process (jack_nframes_t nframes); + int process (nframes_t nframes); /* set by the user */ string path; - jack_nframes_t sample_rate; + nframes_t sample_rate; int src_quality; SNDFILE* out; uint32_t channels; AudioExportPortMap port_map; - jack_nframes_t start_frame; - jack_nframes_t end_frame; + nframes_t start_frame; + nframes_t end_frame; GDitherType dither_type; bool do_freewheel; /* used exclusively during export */ - jack_nframes_t frame_rate; + nframes_t frame_rate; GDither dither; float* dataF; float* dataF2; float* leftoverF; - jack_nframes_t leftover_frames; - jack_nframes_t max_leftover_frames; + nframes_t leftover_frames; + nframes_t max_leftover_frames; void* output_data; - jack_nframes_t out_samples_max; + nframes_t out_samples_max; uint32_t sample_bytes; uint32_t data_width; - jack_nframes_t total_frames; + nframes_t total_frames; SF_INFO sfinfo; SRC_DATA src_data; SRC_STATE* src_state; - jack_nframes_t pos; + nframes_t pos; sigc::connection freewheel_connection; diff --git a/libs/ardour/ardour/gain.h b/libs/ardour/ardour/gain.h index 3bd2d3be61..3613ea1a5a 100644 --- a/libs/ardour/ardour/gain.h +++ b/libs/ardour/ardour/gain.h @@ -32,10 +32,10 @@ struct Gain : public Curve { Gain (const Gain&); Gain& operator= (const Gain&); - static void fill_linear_fade_in (Gain& curve, jack_nframes_t frames); - static void fill_linear_volume_fade_in (Gain& curve, jack_nframes_t frames); - static void fill_linear_fade_out (Gain& curve, jack_nframes_t frames); - static void fill_linear_volume_fade_out (Gain& curve, jack_nframes_t frames); + static void fill_linear_fade_in (Gain& curve, nframes_t frames); + static void fill_linear_volume_fade_in (Gain& curve, nframes_t frames); + static void fill_linear_fade_out (Gain& curve, nframes_t frames); + static void fill_linear_volume_fade_out (Gain& curve, nframes_t frames); }; diff --git a/libs/ardour/ardour/insert.h b/libs/ardour/ardour/insert.h index c81d4e5761..ee07b7ebd3 100644 --- a/libs/ardour/ardour/insert.h +++ b/libs/ardour/ardour/insert.h @@ -53,7 +53,7 @@ class Insert : public Redirect virtual ~Insert() { } - virtual void run (vector& bufs, uint32_t nbufs, jack_nframes_t nframes, jack_nframes_t offset) = 0; + virtual void run (vector& bufs, uint32_t nbufs, nframes_t nframes, nframes_t offset) = 0; virtual void activate () {} virtual void deactivate () {} @@ -75,9 +75,9 @@ class PortInsert : public Insert int set_state(const XMLNode&); void init (); - void run (vector& bufs, uint32_t nbufs, jack_nframes_t nframes, jack_nframes_t offset); + void run (vector& bufs, uint32_t nbufs, nframes_t nframes, nframes_t offset); - jack_nframes_t latency(); + nframes_t latency(); uint32_t output_streams() const; uint32_t input_streams() const; @@ -113,12 +113,12 @@ class PluginInsert : public Insert StateManager::State* state_factory (std::string why) const; Change restore_state (StateManager::State&); - void run (vector& bufs, uint32_t nbufs, jack_nframes_t nframes, jack_nframes_t offset); - void silence (jack_nframes_t nframes, jack_nframes_t offset); + void run (vector& bufs, uint32_t nbufs, nframes_t nframes, nframes_t offset); + void silence (nframes_t nframes, nframes_t offset); void activate (); void deactivate (); - void set_block_size (jack_nframes_t nframes); + void set_block_size (nframes_t nframes); uint32_t output_streams() const; uint32_t input_streams() const; @@ -154,10 +154,10 @@ class PluginInsert : public Insert string describe_parameter (uint32_t); - jack_nframes_t latency(); + nframes_t latency(); - void transport_stopped (jack_nframes_t now); - void automation_snapshot (jack_nframes_t now); + void transport_stopped (nframes_t now); + void automation_snapshot (nframes_t now); protected: void store_state (PluginInsertState&) const; @@ -167,8 +167,8 @@ class PluginInsert : public Insert void parameter_changed (uint32_t, float); vector > _plugins; - void automation_run (vector& bufs, uint32_t nbufs, jack_nframes_t nframes, jack_nframes_t offset); - void connect_and_run (vector& bufs, uint32_t nbufs, jack_nframes_t nframes, jack_nframes_t offset, bool with_auto, jack_nframes_t now = 0); + void automation_run (vector& bufs, uint32_t nbufs, nframes_t nframes, nframes_t offset); + void connect_and_run (vector& bufs, uint32_t nbufs, nframes_t nframes, nframes_t offset, bool with_auto, nframes_t now = 0); void init (); void set_automatable (); diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h index 77f72f82d7..163ae462f3 100644 --- a/libs/ardour/ardour/io.h +++ b/libs/ardour/ardour/io.h @@ -87,18 +87,18 @@ virtual ~IO(); const string& name() const { return _name; } virtual int set_name (string str, void *src); - virtual void silence (jack_nframes_t, jack_nframes_t offset); + virtual void silence (nframes_t, nframes_t offset); // These should be moved in to a separate object that manipulates an IO - void pan (vector& bufs, uint32_t nbufs, jack_nframes_t nframes, jack_nframes_t offset, gain_t gain_coeff); - void pan_automated (vector& bufs, uint32_t nbufs, jack_nframes_t start_frame, jack_nframes_t end_frame, - jack_nframes_t nframes, jack_nframes_t offset); - void collect_input (vector&, uint32_t nbufs, jack_nframes_t nframes, jack_nframes_t offset); - void deliver_output (vector&, uint32_t nbufs, jack_nframes_t nframes, jack_nframes_t offset); - void deliver_output_no_pan (vector&, uint32_t nbufs, jack_nframes_t nframes, jack_nframes_t offset); - void just_meter_input (jack_nframes_t start_frame, jack_nframes_t end_frame, - jack_nframes_t nframes, jack_nframes_t offset); + void pan (vector& bufs, uint32_t nbufs, nframes_t nframes, nframes_t offset, gain_t gain_coeff); + void pan_automated (vector& bufs, uint32_t nbufs, nframes_t start_frame, nframes_t end_frame, + nframes_t nframes, nframes_t offset); + void collect_input (vector&, uint32_t nbufs, nframes_t nframes, nframes_t offset); + void deliver_output (vector&, uint32_t nbufs, nframes_t nframes, nframes_t offset); + void deliver_output_no_pan (vector&, uint32_t nbufs, nframes_t nframes, nframes_t offset); + void just_meter_input (nframes_t start_frame, nframes_t end_frame, + nframes_t nframes, nframes_t offset); virtual uint32_t n_process_buffers () { return 0; } @@ -134,9 +134,9 @@ virtual ~IO(); int disconnect_inputs (void *src); int disconnect_outputs (void *src); - jack_nframes_t output_latency() const; - jack_nframes_t input_latency() const; - void set_port_latency (jack_nframes_t); + nframes_t output_latency() const; + nframes_t input_latency() const; + void set_port_latency (nframes_t); Port *output (uint32_t n) const { if (n < _noutputs) { @@ -234,16 +234,16 @@ public: AutoStyle gain_automation_style () const { return _gain_automation_curve.automation_style(); } sigc::signal gain_automation_style_changed; - static void set_automation_interval (jack_nframes_t frames) { + static void set_automation_interval (nframes_t frames) { _automation_interval = frames; } - static jack_nframes_t automation_interval() { + static nframes_t automation_interval() { return _automation_interval; } - virtual void transport_stopped (jack_nframes_t now); - virtual void automation_snapshot (jack_nframes_t now); + virtual void transport_stopped (nframes_t now); + virtual void automation_snapshot (nframes_t now); ARDOUR::Curve& gain_automation_curve () { return _gain_automation_curve; } @@ -291,7 +291,7 @@ public: virtual uint32_t pans_required() const { return _ninputs; } - static void apply_declick (vector&, uint32_t nbufs, jack_nframes_t nframes, + static void apply_declick (vector&, uint32_t nbufs, nframes_t nframes, gain_t initial, gain_t target, bool invert_polarity); struct GainControllable : public PBD::Controllable { @@ -312,8 +312,8 @@ public: /* automation */ - jack_nframes_t last_automation_snapshot; - static jack_nframes_t _automation_interval; + nframes_t last_automation_snapshot; + static nframes_t _automation_interval; AutoState _gain_automation_state; AutoStyle _gain_automation_style; diff --git a/libs/ardour/ardour/ladspa_plugin.h b/libs/ardour/ardour/ladspa_plugin.h index 99fc884898..291ff41dc8 100644 --- a/libs/ardour/ardour/ladspa_plugin.h +++ b/libs/ardour/ardour/ladspa_plugin.h @@ -48,7 +48,7 @@ class Session; class LadspaPlugin : public ARDOUR::Plugin { public: - LadspaPlugin (void *module, ARDOUR::AudioEngine&, ARDOUR::Session&, uint32_t index, jack_nframes_t sample_rate); + LadspaPlugin (void *module, ARDOUR::AudioEngine&, ARDOUR::Session&, uint32_t index, nframes_t sample_rate); LadspaPlugin (const LadspaPlugin &); ~LadspaPlugin (); @@ -60,7 +60,7 @@ class LadspaPlugin : public ARDOUR::Plugin const char * maker() const { return descriptor->Maker; } uint32_t parameter_count() const { return descriptor->PortCount; } float default_value (uint32_t port); - jack_nframes_t latency() const; + nframes_t latency() const; void set_parameter (uint32_t port, float val); float get_parameter (uint32_t port) const; int get_parameter_descriptor (uint32_t which, ParameterDescriptor&) const; @@ -81,9 +81,9 @@ class LadspaPlugin : public ARDOUR::Plugin descriptor->cleanup (handle); } } - void set_block_size (jack_nframes_t nframes) {} + void set_block_size (nframes_t nframes) {} - int connect_and_run (vector& bufs, uint32_t maxbuf, int32_t& in, int32_t& out, jack_nframes_t nframes, jack_nframes_t offset); + int connect_and_run (vector& bufs, uint32_t maxbuf, int32_t& in, int32_t& out, nframes_t nframes, nframes_t offset); void store_state (ARDOUR::PluginState&); void restore_state (ARDOUR::PluginState&); string describe_parameter (uint32_t); @@ -126,15 +126,15 @@ class LadspaPlugin : public ARDOUR::Plugin void *module; const LADSPA_Descriptor *descriptor; LADSPA_Handle handle; - jack_nframes_t sample_rate; + nframes_t sample_rate; LADSPA_Data *control_data; LADSPA_Data *shadow_data; LADSPA_Data *latency_control_port; uint32_t _index; bool was_activated; - void init (void *mod, uint32_t index, jack_nframes_t rate); - void run (jack_nframes_t nsamples); + void init (void *mod, uint32_t index, nframes_t rate); + void run (nframes_t nsamples); void latency_compute_run (); }; diff --git a/libs/ardour/ardour/location.h b/libs/ardour/ardour/location.h index 96fb1b1bcf..2dd49847fb 100644 --- a/libs/ardour/ardour/location.h +++ b/libs/ardour/ardour/location.h @@ -56,8 +56,8 @@ class Location : public sigc::trackable, public PBD::StatefulDestructible IsStart = 0x80 }; - Location (jack_nframes_t sample_start, - jack_nframes_t sample_end, + Location (nframes_t sample_start, + nframes_t sample_end, const string &name, Flags bits = Flags(0)) @@ -76,13 +76,13 @@ class Location : public sigc::trackable, public PBD::StatefulDestructible Location (const XMLNode&); Location* operator= (const Location& other); - jack_nframes_t start() { return _start; } - jack_nframes_t end() { return _end; } - jack_nframes_t length() { return _end - _start; } + nframes_t start() { return _start; } + nframes_t end() { return _end; } + nframes_t length() { return _end - _start; } - int set_start (jack_nframes_t s); - int set_end (jack_nframes_t e); - int set (jack_nframes_t start, jack_nframes_t end); + int set_start (nframes_t s); + int set_end (nframes_t e); + int set (nframes_t start, nframes_t end); const string& name() { return _name; } void set_name (const string &str) { _name = str; name_changed(this); } @@ -123,8 +123,8 @@ class Location : public sigc::trackable, public PBD::StatefulDestructible private: string _name; - jack_nframes_t _start; - jack_nframes_t _end; + nframes_t _start; + nframes_t _end; uint32_t _flags; void set_mark (bool yn); @@ -159,11 +159,11 @@ class Locations : public StateManager, public PBD::StatefulDestructible int set_current (Location *, bool want_lock = true); Location *current () const { return current_location; } - Location *first_location_before (jack_nframes_t); - Location *first_location_after (jack_nframes_t); + Location *first_location_before (nframes_t); + Location *first_location_after (nframes_t); - jack_nframes_t first_mark_before (jack_nframes_t); - jack_nframes_t first_mark_after (jack_nframes_t); + nframes_t first_mark_before (nframes_t); + nframes_t first_mark_after (nframes_t); sigc::signal current_changed; sigc::signal changed; diff --git a/libs/ardour/ardour/mix.h b/libs/ardour/ardour/mix.h index b351e3ef17..653b61cb95 100644 --- a/libs/ardour/ardour/mix.h +++ b/libs/ardour/ardour/mix.h @@ -28,47 +28,47 @@ extern "C" { /* SSE functions */ - float x86_sse_compute_peak (ARDOUR::Sample *buf, jack_nframes_t nsamples, float current); + float x86_sse_compute_peak (ARDOUR::Sample *buf, nframes_t nsamples, float current); - void x86_sse_apply_gain_to_buffer (ARDOUR::Sample *buf, jack_nframes_t nframes, float gain); + void x86_sse_apply_gain_to_buffer (ARDOUR::Sample *buf, nframes_t nframes, float gain); - void x86_sse_mix_buffers_with_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, jack_nframes_t nframes, float gain); + void x86_sse_mix_buffers_with_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, nframes_t nframes, float gain); - void x86_sse_mix_buffers_no_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, jack_nframes_t nframes); + void x86_sse_mix_buffers_no_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, nframes_t nframes); } /* debug wrappers for SSE functions */ -float debug_compute_peak (ARDOUR::Sample *buf, jack_nframes_t nsamples, float current); +float debug_compute_peak (ARDOUR::Sample *buf, nframes_t nsamples, float current); -void debug_apply_gain_to_buffer (ARDOUR::Sample *buf, jack_nframes_t nframes, float gain); +void debug_apply_gain_to_buffer (ARDOUR::Sample *buf, nframes_t nframes, float gain); -void debug_mix_buffers_with_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, jack_nframes_t nframes, float gain); +void debug_mix_buffers_with_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, nframes_t nframes, float gain); -void debug_mix_buffers_no_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, jack_nframes_t nframes); +void debug_mix_buffers_no_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, nframes_t nframes); #endif #if defined (__APPLE__) -float veclib_compute_peak (ARDOUR::Sample *buf, jack_nframes_t nsamples, float current); +float veclib_compute_peak (ARDOUR::Sample *buf, nframes_t nsamples, float current); -void veclib_apply_gain_to_buffer (ARDOUR::Sample *buf, jack_nframes_t nframes, float gain); +void veclib_apply_gain_to_buffer (ARDOUR::Sample *buf, nframes_t nframes, float gain); -void veclib_mix_buffers_with_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, jack_nframes_t nframes, float gain); +void veclib_mix_buffers_with_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, nframes_t nframes, float gain); -void veclib_mix_buffers_no_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, jack_nframes_t nframes); +void veclib_mix_buffers_no_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, nframes_t nframes); #endif /* non-optimized functions */ -float compute_peak (ARDOUR::Sample *buf, jack_nframes_t nsamples, float current); +float compute_peak (ARDOUR::Sample *buf, nframes_t nsamples, float current); -void apply_gain_to_buffer (ARDOUR::Sample *buf, jack_nframes_t nframes, float gain); +void apply_gain_to_buffer (ARDOUR::Sample *buf, nframes_t nframes, float gain); -void mix_buffers_with_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, jack_nframes_t nframes, float gain); +void mix_buffers_with_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, nframes_t nframes, float gain); -void mix_buffers_no_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, jack_nframes_t nframes); +void mix_buffers_no_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, nframes_t nframes); #endif /* __ardour_mix_h__ */ diff --git a/libs/ardour/ardour/panner.h b/libs/ardour/ardour/panner.h index 75c59eb924..3091527e59 100644 --- a/libs/ardour/ardour/panner.h +++ b/libs/ardour/ardour/panner.h @@ -64,14 +64,14 @@ class StreamPanner : public sigc::trackable, public Stateful /* the basic panner API */ - virtual void distribute (Sample* src, Sample** obufs, gain_t gain_coeff, jack_nframes_t nframes) = 0; + virtual void distribute (Sample* src, Sample** obufs, gain_t gain_coeff, nframes_t nframes) = 0; virtual void distribute_automated (Sample* src, Sample** obufs, - jack_nframes_t start, jack_nframes_t end, jack_nframes_t nframes, pan_t** buffers) = 0; + nframes_t start, nframes_t end, nframes_t nframes, pan_t** buffers) = 0; /* automation */ - virtual void snapshot (jack_nframes_t now) = 0; - virtual void transport_stopped (jack_nframes_t frame) = 0; + virtual void snapshot (nframes_t now) = 0; + virtual void transport_stopped (nframes_t frame) = 0; virtual void set_automation_state (AutoState) = 0; virtual void set_automation_style (AutoStyle) = 0; @@ -141,12 +141,12 @@ class BaseStereoPanner : public StreamPanner and a type name. See EqualPowerStereoPanner as an example. */ - void distribute (Sample* src, Sample** obufs, gain_t gain_coeff, jack_nframes_t nframes); + void distribute (Sample* src, Sample** obufs, gain_t gain_coeff, nframes_t nframes); int load (istream&, string path, uint32_t&); int save (ostream&) const; - void snapshot (jack_nframes_t now); - void transport_stopped (jack_nframes_t frame); + void snapshot (nframes_t now); + void transport_stopped (nframes_t frame); void set_automation_state (AutoState); void set_automation_style (AutoStyle); @@ -170,7 +170,7 @@ class EqualPowerStereoPanner : public BaseStereoPanner ~EqualPowerStereoPanner (); void distribute_automated (Sample* src, Sample** obufs, - jack_nframes_t start, jack_nframes_t end, jack_nframes_t nframes, pan_t** buffers); + nframes_t start, nframes_t end, nframes_t nframes, pan_t** buffers); void get_current_coefficients (pan_t*) const; void get_desired_coefficients (pan_t*) const; @@ -192,8 +192,8 @@ class Multi2dPanner : public StreamPanner Multi2dPanner (Panner& parent); ~Multi2dPanner (); - void snapshot (jack_nframes_t now); - void transport_stopped (jack_nframes_t frame); + void snapshot (nframes_t now); + void transport_stopped (nframes_t frame); void set_automation_state (AutoState); void set_automation_style (AutoStyle); @@ -203,9 +203,9 @@ class Multi2dPanner : public StreamPanner Curve& automation() { return _automation; } - void distribute (Sample* src, Sample** obufs, gain_t gain_coeff, jack_nframes_t nframes); + void distribute (Sample* src, Sample** obufs, gain_t gain_coeff, nframes_t nframes); void distribute_automated (Sample* src, Sample** obufs, - jack_nframes_t start, jack_nframes_t end, jack_nframes_t nframes, pan_t** buffers); + nframes_t start, nframes_t end, nframes_t nframes, pan_t** buffers); int load (istream&, string path, uint32_t&); int save (ostream&) const; @@ -249,8 +249,8 @@ class Panner : public std::vector, public Stateful, public sigc:: void clear (); void reset (uint32_t noutputs, uint32_t npans); - void snapshot (jack_nframes_t now); - void transport_stopped (jack_nframes_t frame); + void snapshot (nframes_t now); + void transport_stopped (nframes_t frame); void clear_automation (); diff --git a/libs/ardour/ardour/peak.h b/libs/ardour/ardour/peak.h index d08357024b..2c8abe7cf4 100644 --- a/libs/ardour/ardour/peak.h +++ b/libs/ardour/ardour/peak.h @@ -6,9 +6,9 @@ #include static inline float -compute_peak (ARDOUR::Sample *buf, jack_nframes_t nsamples, float current) +compute_peak (ARDOUR::Sample *buf, nframes_t nsamples, float current) { - for (jack_nframes_t i = 0; i < nsamples; ++i) { + for (nframes_t i = 0; i < nsamples; ++i) { current = f_max (current, fabsf (buf[i])); } return current; diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h index e3911dac0b..04f2df0ae9 100644 --- a/libs/ardour/ardour/playlist.h +++ b/libs/ardour/ardour/playlist.h @@ -54,7 +54,7 @@ class Playlist : public StateManager, public PBD::StatefulDestructible { Playlist (Session&, const XMLNode&, bool hidden = false); Playlist (Session&, string name, bool hidden = false); Playlist (const Playlist&, string name, bool hidden = false); - Playlist (const Playlist&, jack_nframes_t start, jack_nframes_t cnt, string name, bool hidden = false); + Playlist (const Playlist&, nframes_t start, nframes_t cnt, string name, bool hidden = false); virtual void clear (bool with_save = true); virtual void dump () const; @@ -72,7 +72,7 @@ class Playlist : public StateManager, public PBD::StatefulDestructible { bool hidden() const { return _hidden; } bool empty() const; - jack_nframes_t get_maximum_extent () const; + nframes_t get_maximum_extent () const; layer_t top_layer() const; EditMode get_edit_mode() const { return _edit_mode; } @@ -80,29 +80,29 @@ class Playlist : public StateManager, public PBD::StatefulDestructible { /* Editing operations */ - void add_region (boost::shared_ptr, jack_nframes_t position, float times = 1, bool with_save = true); + void add_region (boost::shared_ptr, nframes_t position, float times = 1, bool with_save = true); void remove_region (boost::shared_ptr); void get_equivalent_regions (boost::shared_ptr, std::vector >&); void get_region_list_equivalent_regions (boost::shared_ptr, std::vector >&); - void replace_region (boost::shared_ptr old, boost::shared_ptr newr, jack_nframes_t pos); - void split_region (boost::shared_ptr, jack_nframes_t position); - void partition (jack_nframes_t start, jack_nframes_t end, bool just_top_level); - void duplicate (boost::shared_ptr, jack_nframes_t position, float times); - void nudge_after (jack_nframes_t start, jack_nframes_t distance, bool forwards); + void replace_region (boost::shared_ptr old, boost::shared_ptr newr, nframes_t pos); + void split_region (boost::shared_ptr, nframes_t position); + void partition (nframes_t start, nframes_t end, bool just_top_level); + void duplicate (boost::shared_ptr, nframes_t position, float times); + void nudge_after (nframes_t start, nframes_t distance, bool forwards); boost::shared_ptr find_region (const PBD::ID&) const; Playlist* cut (list&, bool result_is_hidden = true); Playlist* copy (list&, bool result_is_hidden = true); - int paste (Playlist&, jack_nframes_t position, float times); + int paste (Playlist&, nframes_t position, float times); uint32_t read_data_count() { return _read_data_count; } - RegionList* regions_at (jack_nframes_t frame); - RegionList* regions_touched (jack_nframes_t start, jack_nframes_t end); - boost::shared_ptr top_region_at (jack_nframes_t frame); + RegionList* regions_at (nframes_t frame); + RegionList* regions_touched (nframes_t start, nframes_t end); + boost::shared_ptr top_region_at (nframes_t frame); - boost::shared_ptr find_next_region (jack_nframes_t frame, RegionPoint point, int dir); + boost::shared_ptr find_next_region (nframes_t frame, RegionPoint point, int dir); template void foreach_region (T *t, void (T::*func)(boost::shared_ptr, void *), void *arg); template void foreach_region (T *t, void (T::*func)(boost::shared_ptr)); @@ -194,7 +194,7 @@ class Playlist : public StateManager, public PBD::StatefulDestructible { uint32_t _read_data_count; PBD::ID _orig_diskstream_id; uint64_t layer_op_counter; - jack_nframes_t freeze_length; + nframes_t freeze_length; void init (bool hide); @@ -249,25 +249,25 @@ class Playlist : public StateManager, public PBD::StatefulDestructible { void save_state (std::string why); void maybe_save_state (std::string why); - void add_region_internal (boost::shared_ptr, jack_nframes_t position, bool delay_sort = false); + void add_region_internal (boost::shared_ptr, nframes_t position, bool delay_sort = false); int remove_region_internal (boost::shared_ptr, bool delay_sort = false); - RegionList *find_regions_at (jack_nframes_t frame); + RegionList *find_regions_at (nframes_t frame); void copy_regions (RegionList&) const; - void partition_internal (jack_nframes_t start, jack_nframes_t end, bool cutting, RegionList& thawlist); + void partition_internal (nframes_t start, nframes_t end, bool cutting, RegionList& thawlist); - jack_nframes_t _get_maximum_extent() const; + nframes_t _get_maximum_extent() const; - Playlist* cut_copy (Playlist* (Playlist::*pmf)(jack_nframes_t, jack_nframes_t, bool), + Playlist* cut_copy (Playlist* (Playlist::*pmf)(nframes_t, nframes_t, bool), list& ranges, bool result_is_hidden); - Playlist *cut (jack_nframes_t start, jack_nframes_t cnt, bool result_is_hidden); - Playlist *copy (jack_nframes_t start, jack_nframes_t cnt, bool result_is_hidden); + Playlist *cut (nframes_t start, nframes_t cnt, bool result_is_hidden); + Playlist *copy (nframes_t start, nframes_t cnt, bool result_is_hidden); int move_region_to_layer (layer_t, boost::shared_ptr r, int dir); void relayer (); - static Playlist* copyPlaylist (const Playlist&, jack_nframes_t start, jack_nframes_t length, + static Playlist* copyPlaylist (const Playlist&, nframes_t start, nframes_t length, string name, bool result_is_hidden); void unset_freeze_parent (Playlist*); diff --git a/libs/ardour/ardour/plugin.h b/libs/ardour/ardour/plugin.h index 4800bc35fc..dcc657018a 100644 --- a/libs/ardour/ardour/plugin.h +++ b/libs/ardour/ardour/plugin.h @@ -109,7 +109,7 @@ class Plugin : public PBD::StatefulDestructible, public sigc::trackable virtual const char * maker() const = 0; virtual uint32_t parameter_count () const = 0; virtual float default_value (uint32_t port) = 0; - virtual jack_nframes_t latency() const = 0; + virtual nframes_t latency() const = 0; virtual void set_parameter (uint32_t which, float val) = 0; virtual float get_parameter(uint32_t which) const = 0; @@ -117,9 +117,9 @@ class Plugin : public PBD::StatefulDestructible, public sigc::trackable virtual uint32_t nth_parameter (uint32_t which, bool& ok) const = 0; virtual void activate () = 0; virtual void deactivate () = 0; - virtual void set_block_size (jack_nframes_t nframes) = 0; + virtual void set_block_size (nframes_t nframes) = 0; - virtual int connect_and_run (vector& bufs, uint32_t maxbuf, int32_t& in, int32_t& out, jack_nframes_t nframes, jack_nframes_t offset) = 0; + virtual int connect_and_run (vector& bufs, uint32_t maxbuf, int32_t& in, int32_t& out, nframes_t nframes, nframes_t offset) = 0; virtual std::set automatable() const = 0; virtual void store_state (ARDOUR::PluginState&) = 0; virtual void restore_state (ARDOUR::PluginState&) = 0; diff --git a/libs/ardour/ardour/port.h b/libs/ardour/ardour/port.h index 92dd85ee86..b6a8e6fd36 100644 --- a/libs/ardour/ardour/port.h +++ b/libs/ardour/ardour/port.h @@ -36,7 +36,7 @@ class Port : public sigc::trackable { free (_port); } - Sample *get_buffer (jack_nframes_t nframes) { + Sample *get_buffer (nframes_t nframes) { if (_flags & JackPortIsOutput) { return _buffer; } else { @@ -116,8 +116,8 @@ class Port : public sigc::trackable { uint32_t short_overs () const { return _short_overs; } uint32_t long_overs () const { return _long_overs; } - static void set_short_over_length (jack_nframes_t); - static void set_long_over_length (jack_nframes_t); + static void set_short_over_length (nframes_t); + static void set_long_over_length (nframes_t); bool receives_input() const { return _flags & JackPortIsInput; @@ -150,11 +150,11 @@ class Port : public sigc::trackable { jack_port_request_monitor (_port, yn); } - jack_nframes_t latency () const { + nframes_t latency () const { return jack_port_get_latency (_port); } - void set_latency (jack_nframes_t nframes) { + void set_latency (nframes_t nframes) { jack_port_set_latency (_port, nframes); } @@ -164,7 +164,7 @@ class Port : public sigc::trackable { bool is_silent() const { return _silent; } /** Assumes that the port is an audio output port */ - void silence (jack_nframes_t nframes, jack_nframes_t offset) { + void silence (nframes_t nframes, nframes_t offset) { if (!_silent) { memset (_buffer + offset, 0, sizeof (Sample) * nframes); if (offset == 0) { @@ -203,15 +203,15 @@ class Port : public sigc::trackable { bool _last_monitor : 1; bool _silent : 1; jack_port_t *_port; - jack_nframes_t _overlen; + nframes_t _overlen; jack_default_audio_sample_t _peak; float _peak_db; uint32_t _short_overs; uint32_t _long_overs; unsigned short _metering; - static jack_nframes_t _long_over_length; - static jack_nframes_t _short_over_length; + static nframes_t _long_over_length; + static nframes_t _short_over_length; }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/redirect.h b/libs/ardour/ardour/redirect.h index 5f63fad8c8..691e690b47 100644 --- a/libs/ardour/ardour/redirect.h +++ b/libs/ardour/ardour/redirect.h @@ -81,12 +81,12 @@ class Redirect : public IO Placement placement() const { return _placement; } void set_placement (Placement, void *src); - virtual void run (vector& ibufs, uint32_t nbufs, jack_nframes_t nframes, jack_nframes_t offset) = 0; + virtual void run (vector& ibufs, uint32_t nbufs, nframes_t nframes, nframes_t offset) = 0; virtual void activate () = 0; virtual void deactivate () = 0; - virtual jack_nframes_t latency() { return 0; } + virtual nframes_t latency() { return 0; } - virtual void set_block_size (jack_nframes_t nframes) {} + virtual void set_block_size (nframes_t nframes) {} sigc::signal active_changed; sigc::signal placement_changed; @@ -120,9 +120,9 @@ class Redirect : public IO void mark_automation_visible (uint32_t, bool); AutomationList& automation_list (uint32_t); - bool find_next_event (jack_nframes_t, jack_nframes_t, ControlEvent&) const; + bool find_next_event (nframes_t, nframes_t, ControlEvent&) const; - virtual void transport_stopped (jack_nframes_t frame) {}; + virtual void transport_stopped (nframes_t frame) {}; protected: void set_placement (const string&, void *src); diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h index 2ff7d0bdb2..30cd3267df 100644 --- a/libs/ardour/ardour/region.h +++ b/libs/ardour/ardour/region.h @@ -46,11 +46,11 @@ struct RegionState : public StateManager::State { RegionState (std::string why) : StateManager::State (why) {} - jack_nframes_t _start; - jack_nframes_t _length; - jack_nframes_t _position; + nframes_t _start; + nframes_t _length; + nframes_t _position; uint32_t _flags; - jack_nframes_t _sync_position; + nframes_t _sync_position; layer_t _layer; string _name; mutable RegionEditState _first_edit; @@ -99,20 +99,20 @@ class Region : public PBD::StatefulDestructible, public StateManager, public boo string name() const { return _name; } void set_name (string str); - jack_nframes_t position () const { return _position; } - jack_nframes_t start () const { return _start; } - jack_nframes_t length() const { return _length; } + nframes_t position () const { return _position; } + nframes_t start () const { return _start; } + nframes_t length() const { return _length; } layer_t layer () const { return _layer; } - jack_nframes_t sync_offset(int& dir) const; - jack_nframes_t sync_position() const; + nframes_t sync_offset(int& dir) const; + nframes_t sync_position() const; - jack_nframes_t adjust_to_sync (jack_nframes_t); + nframes_t adjust_to_sync (nframes_t); /* first_frame() is an alias; last_frame() just hides some math */ - jack_nframes_t first_frame() const { return _position; } - jack_nframes_t last_frame() const { return _position + _length - 1; } + nframes_t first_frame() const { return _position; } + nframes_t last_frame() const { return _position + _length - 1; } bool hidden() const { return _flags & Hidden; } bool muted() const { return _flags & Muted; } @@ -127,12 +127,12 @@ class Region : public PBD::StatefulDestructible, public StateManager, public boo void freeze (); void thaw (const string& why); - bool covers (jack_nframes_t frame) const { - return _position <= frame && frame < _position + _length; + bool covers (nframes_t frame) const { + return first_frame() <= frame && frame < last_frame(); } - OverlapType coverage (jack_nframes_t start, jack_nframes_t end) const { - return ARDOUR::coverage (_position, _position + _length - 1, start, end); + OverlapType coverage (nframes_t start, nframes_t end) const { + return ARDOUR::coverage (first_frame(), last_frame(), start, end); } bool equivalent (boost::shared_ptr) const; @@ -145,19 +145,19 @@ class Region : public PBD::StatefulDestructible, public StateManager, public boo /* EDITING OPERATIONS */ - void set_length (jack_nframes_t, void *src); - void set_start (jack_nframes_t, void *src); - void set_position (jack_nframes_t, void *src); - void set_position_on_top (jack_nframes_t, void *src); - void special_set_position (jack_nframes_t); + void set_length (nframes_t, void *src); + void set_start (nframes_t, void *src); + void set_position (nframes_t, void *src); + void set_position_on_top (nframes_t, void *src); + void special_set_position (nframes_t); void nudge_position (long, void *src); void move_to_natural_position (void *src); - void trim_start (jack_nframes_t new_position, void *src); - void trim_front (jack_nframes_t new_position, void *src); - void trim_end (jack_nframes_t new_position, void *src); - void trim_to (jack_nframes_t position, jack_nframes_t length, void *src); + void trim_start (nframes_t new_position, void *src); + void trim_front (nframes_t new_position, void *src); + void trim_end (nframes_t new_position, void *src); + void trim_to (nframes_t position, nframes_t length, void *src); void set_layer (layer_t l); /* ONLY Playlist can call this */ void raise (); @@ -165,7 +165,7 @@ class Region : public PBD::StatefulDestructible, public StateManager, public boo void raise_to_top (); void lower_to_bottom (); - void set_sync_position (jack_nframes_t n); + void set_sync_position (nframes_t n); void clear_sync_position (); void set_hidden (bool yn); void set_muted (bool yn); @@ -197,9 +197,9 @@ class Region : public PBD::StatefulDestructible, public StateManager, public boo protected: friend class RegionFactory; - Region (jack_nframes_t start, jack_nframes_t length, + Region (nframes_t start, nframes_t length, const string& name, layer_t = 0, Flag flags = DefaultFlags); - Region (boost::shared_ptr, jack_nframes_t start, jack_nframes_t length, const string& name, layer_t = 0, Flag flags = DefaultFlags); + Region (boost::shared_ptr, nframes_t start, nframes_t length, const string& name, layer_t = 0, Flag flags = DefaultFlags); Region (boost::shared_ptr); Region (const XMLNode&); @@ -216,25 +216,25 @@ class Region : public PBD::StatefulDestructible, public StateManager, public boo void store_state (RegionState&) const; Change restore_and_return_flags (RegionState&); - void trim_to_internal (jack_nframes_t position, jack_nframes_t length, void *src); + void trim_to_internal (nframes_t position, nframes_t length, void *src); bool copied() const { return _flags & Copied; } void maybe_uncopy (); void first_edit (); - virtual bool verify_start (jack_nframes_t) = 0; - virtual bool verify_start_and_length (jack_nframes_t, jack_nframes_t) = 0; - virtual bool verify_start_mutable (jack_nframes_t&_start) = 0; - virtual bool verify_length (jack_nframes_t) = 0; + virtual bool verify_start (nframes_t) = 0; + virtual bool verify_start_and_length (nframes_t, nframes_t) = 0; + virtual bool verify_start_mutable (nframes_t&_start) = 0; + virtual bool verify_length (nframes_t) = 0; virtual void recompute_at_start () = 0; virtual void recompute_at_end () = 0; - jack_nframes_t _start; - jack_nframes_t _length; - jack_nframes_t _position; + nframes_t _start; + nframes_t _length; + nframes_t _position; Flag _flags; - jack_nframes_t _sync_position; + nframes_t _sync_position; layer_t _layer; string _name; mutable RegionEditState _first_edit; diff --git a/libs/ardour/ardour/region_factory.h b/libs/ardour/ardour/region_factory.h index 3bf1b6005e..f1f5d1e69f 100644 --- a/libs/ardour/ardour/region_factory.h +++ b/libs/ardour/ardour/region_factory.h @@ -23,14 +23,14 @@ class RegionFactory { static sigc::signal > CheckNewRegion; - static boost::shared_ptr create (boost::shared_ptr, jack_nframes_t start, - jack_nframes_t length, std::string name, + static boost::shared_ptr create (boost::shared_ptr, nframes_t start, + nframes_t length, std::string name, layer_t = 0, Region::Flag flags = Region::DefaultFlags, bool announce = true); - static boost::shared_ptr create (boost::shared_ptr, jack_nframes_t start, - jack_nframes_t length, std::string name, + static boost::shared_ptr create (boost::shared_ptr, nframes_t start, + nframes_t length, std::string name, layer_t = 0, Region::Flag flags = Region::DefaultFlags, bool announce = true); - static boost::shared_ptr create (boost::shared_ptr, jack_nframes_t start, jack_nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags, bool announce = true); - static boost::shared_ptr create (SourceList &, jack_nframes_t start, jack_nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags, bool announce = true); + static boost::shared_ptr create (boost::shared_ptr, nframes_t start, nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags, bool announce = true); + static boost::shared_ptr create (SourceList &, nframes_t start, nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags, bool announce = true); static boost::shared_ptr create (boost::shared_ptr); static boost::shared_ptr create (Session&, XMLNode&, bool); static boost::shared_ptr create (SourceList &, const XMLNode&); diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index 2191439744..8ebc598e95 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -89,14 +89,14 @@ class Route : public IO /* these are the core of the API of a Route. see the protected sections as well */ - virtual int roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, - jack_nframes_t offset, int declick, bool can_record, bool rec_monitors_input); + virtual int roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, + nframes_t offset, int declick, bool can_record, bool rec_monitors_input); - virtual int no_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, - jack_nframes_t offset, bool state_changing, bool can_record, bool rec_monitors_input); + virtual int no_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, + nframes_t offset, bool state_changing, bool can_record, bool rec_monitors_input); - virtual int silent_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, - jack_nframes_t offset, bool can_record, bool rec_monitors_input); + virtual int silent_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, + nframes_t offset, bool can_record, bool rec_monitors_input); virtual void toggle_monitor_input (); virtual bool can_record() { return false; } virtual void set_record_enable (bool yn, void *src) {} @@ -174,9 +174,9 @@ class Route : public IO void all_redirects_flip(); void all_redirects_active (bool state); - virtual jack_nframes_t update_total_latency(); - jack_nframes_t signal_latency() const { return _own_latency; } - virtual void set_latency_delay (jack_nframes_t); + virtual nframes_t update_total_latency(); + nframes_t signal_latency() const { return _own_latency; } + virtual void set_latency_delay (nframes_t); sigc::signal solo_changed; sigc::signal solo_safe_changed; @@ -238,7 +238,7 @@ class Route : public IO return _mute_control; } - void automation_snapshot (jack_nframes_t now); + void automation_snapshot (nframes_t now); void protect_automation (); @@ -250,7 +250,7 @@ class Route : public IO friend class Session; void set_solo_mute (bool yn); - void set_block_size (jack_nframes_t nframes); + void set_block_size (nframes_t nframes); bool has_external_redirects() const; void curve_reallocate (); @@ -283,11 +283,11 @@ class Route : public IO gain_t desired_solo_gain; gain_t desired_mute_gain; - jack_nframes_t check_initial_delay (jack_nframes_t, jack_nframes_t&, jack_nframes_t&); + nframes_t check_initial_delay (nframes_t, nframes_t&, nframes_t&); - jack_nframes_t _initial_delay; - jack_nframes_t _roll_delay; - jack_nframes_t _own_latency; + nframes_t _initial_delay; + nframes_t _roll_delay; + nframes_t _own_latency; RedirectList _redirects; Glib::RWLock redirect_lock; IO *_control_outs; @@ -300,12 +300,12 @@ class Route : public IO ToggleControllable _solo_control; ToggleControllable _mute_control; - void passthru (jack_nframes_t start_frame, jack_nframes_t end_frame, - jack_nframes_t nframes, jack_nframes_t offset, int declick, bool meter_inputs); + void passthru (nframes_t start_frame, nframes_t end_frame, + nframes_t nframes, nframes_t offset, int declick, bool meter_inputs); void process_output_buffers (vector& bufs, uint32_t nbufs, - jack_nframes_t start_frame, jack_nframes_t end_frame, - jack_nframes_t nframes, jack_nframes_t offset, bool with_redirects, int declick, + nframes_t start_frame, nframes_t end_frame, + nframes_t nframes, nframes_t offset, bool with_redirects, int declick, bool meter); protected: @@ -313,7 +313,7 @@ class Route : public IO virtual XMLNode& state(bool); - void silence (jack_nframes_t nframes, jack_nframes_t offset); + void silence (nframes_t nframes, nframes_t offset); sigc::connection input_signal_connection; state_id_t _current_state_id; diff --git a/libs/ardour/ardour/send.h b/libs/ardour/ardour/send.h index 0a068e8af0..1a9a892f33 100644 --- a/libs/ardour/ardour/send.h +++ b/libs/ardour/ardour/send.h @@ -40,7 +40,7 @@ class Send : public Redirect { Send (const Send&); ~Send (); - void run (vector &bufs, uint32_t nbufs, jack_nframes_t nframes, jack_nframes_t offset); + void run (vector &bufs, uint32_t nbufs, nframes_t nframes, nframes_t offset); void activate() {} void deactivate () {} diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 3d70520c49..2ac2d3c48f 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -154,8 +154,8 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible Type type; Action action; - jack_nframes_t action_frame; - jack_nframes_t target_frame; + nframes_t action_frame; + nframes_t target_frame; float speed; union { @@ -170,7 +170,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible list audio_range; list music_range; - Event(Type t, Action a, jack_nframes_t when, jack_nframes_t where, float spd, bool yn = false) + Event(Type t, Action a, nframes_t when, nframes_t where, float spd, bool yn = false) : type (t), action (a), action_frame (when), @@ -202,7 +202,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible pool.release (ptr); } - static const jack_nframes_t Immediate = 0; + static const nframes_t Immediate = 0; private: static MultiAllocSingleReleasePool pool; @@ -226,7 +226,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible uint32_t master_out_channels, uint32_t n_physical_in, uint32_t n_physical_out, - jack_nframes_t initial_length); + nframes_t initial_length); virtual ~Session (); @@ -261,7 +261,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible static string change_audio_path_by_name (string oldpath, string oldname, string newname, bool destructive); string audio_path_from_name (string, uint32_t nchans, uint32_t chan, bool destructive); - void process (jack_nframes_t nframes); + void process (nframes_t nframes); vector& get_passthru_buffers() { return _passthru_buffers; } vector& get_silent_buffers (uint32_t howmany); @@ -336,22 +336,22 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible /* Transport mechanism signals */ sigc::signal TransportStateChange; /* generic */ - sigc::signal PositionChanged; /* sent after any non-sequential motion */ + sigc::signal PositionChanged; /* sent after any non-sequential motion */ sigc::signal DurationChanged; sigc::signal HaltOnXrun; sigc::signal RouteAdded; void request_roll (); - void request_bounded_roll (jack_nframes_t start, jack_nframes_t end); + void request_bounded_roll (nframes_t start, nframes_t end); void request_stop (bool abort = false); - void request_locate (jack_nframes_t frame, bool with_roll = false); + void request_locate (nframes_t frame, bool with_roll = false); void request_play_loop (bool yn); - jack_nframes_t last_transport_start() const { return _last_roll_location; } + nframes_t last_transport_start() const { return _last_roll_location; } void goto_end () { request_locate (end_location->start(), false);} void goto_start () { request_locate (start_location->start(), false); } - void set_session_start (jack_nframes_t start) { start_location->set_start(start); } - void set_session_end (jack_nframes_t end) { end_location->set_start(end); _end_location_is_free = false; } + void set_session_start (nframes_t start) { start_location->set_start(start); } + void set_session_end (nframes_t end) { end_location->set_start(end); _end_location_is_free = false; } void use_rf_shuttle_speed (); void request_transport_speed (float speed); void request_overwrite_buffer (Diskstream*); @@ -365,14 +365,14 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible int remove_region_from_region_list (boost::shared_ptr); - jack_nframes_t get_maximum_extent () const; - jack_nframes_t current_end_frame() const { return end_location->start(); } - jack_nframes_t current_start_frame() const { return start_location->start(); } - jack_nframes_t frame_rate() const { return _current_frame_rate; } - jack_nframes_t frames_per_hour() const { return _frames_per_hour; } + nframes_t get_maximum_extent () const; + nframes_t current_end_frame() const { return end_location->start(); } + nframes_t current_start_frame() const { return start_location->start(); } + nframes_t frame_rate() const { return _current_frame_rate; } + nframes_t frames_per_hour() const { return _frames_per_hour; } double frames_per_smpte_frame() const { return _frames_per_smpte_frame; } - jack_nframes_t smpte_frames_per_hour() const { return _smpte_frames_per_hour; } + nframes_t smpte_frames_per_hour() const { return _smpte_frames_per_hour; } /* Locations */ @@ -387,14 +387,14 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible void reset_input_monitor_state (); - void add_event (jack_nframes_t action_frame, Event::Type type, jack_nframes_t target_frame = 0); - void remove_event (jack_nframes_t frame, Event::Type type); + void add_event (nframes_t action_frame, Event::Type type, nframes_t target_frame = 0); + void remove_event (nframes_t frame, Event::Type type); void clear_events (Event::Type type); - jack_nframes_t get_block_size() const { return current_block_size; } - jack_nframes_t worst_output_latency () const { return _worst_output_latency; } - jack_nframes_t worst_input_latency () const { return _worst_input_latency; } - jack_nframes_t worst_track_latency () const { return _worst_track_latency; } + nframes_t get_block_size() const { return current_block_size; } + nframes_t worst_output_latency () const { return _worst_output_latency; } + nframes_t worst_input_latency () const { return _worst_input_latency; } + nframes_t worst_track_latency () const { return _worst_track_latency; } int save_state (string snapshot_name, bool pending = false); int restore_state (string snapshot_name); @@ -473,8 +473,8 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible /* Time */ - jack_nframes_t transport_frame () const {return _transport_frame; } - jack_nframes_t audible_frame () const; + nframes_t transport_frame () const {return _transport_frame; } + nframes_t audible_frame () const; enum SmpteFormat { smpte_23976, @@ -505,22 +505,22 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible void sync_time_vars(); - void bbt_time (jack_nframes_t when, BBT_Time&); - void smpte_to_sample( SMPTE::Time& smpte, jack_nframes_t& sample, bool use_offset, bool use_subframes ) const; - void sample_to_smpte( jack_nframes_t sample, SMPTE::Time& smpte, bool use_offset, bool use_subframes ) const; + void bbt_time (nframes_t when, BBT_Time&); + void smpte_to_sample( SMPTE::Time& smpte, nframes_t& sample, bool use_offset, bool use_subframes ) const; + void sample_to_smpte( nframes_t sample, SMPTE::Time& smpte, bool use_offset, bool use_subframes ) const; void smpte_time (SMPTE::Time &); - void smpte_time (jack_nframes_t when, SMPTE::Time&); - void smpte_time_subframes (jack_nframes_t when, SMPTE::Time&); + void smpte_time (nframes_t when, SMPTE::Time&); + void smpte_time_subframes (nframes_t when, SMPTE::Time&); - void smpte_duration (jack_nframes_t, SMPTE::Time&) const; - void smpte_duration_string (char *, jack_nframes_t) const; + void smpte_duration (nframes_t, SMPTE::Time&) const; + void smpte_duration_string (char *, nframes_t) const; - void set_smpte_offset (jack_nframes_t); - jack_nframes_t smpte_offset () const { return _smpte_offset; } + void set_smpte_offset (nframes_t); + nframes_t smpte_offset () const { return _smpte_offset; } void set_smpte_offset_negative (bool); bool smpte_offset_negative () const { return _smpte_offset_negative; } - jack_nframes_t convert_to_frames_at (jack_nframes_t position, AnyTime&); + nframes_t convert_to_frames_at (nframes_t position, AnyTime&); static sigc::signal StartTimeChanged; static sigc::signal EndTimeChanged; @@ -533,7 +533,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible bool transport_stopped() const { return _transport_speed == 0.0f; } bool transport_rolling() const { return _transport_speed != 0.0f; } - int jack_slave_sync (jack_nframes_t); + int jack_slave_sync (nframes_t); TempoMap& tempo_map() { return *_tempo_map; } @@ -574,7 +574,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible string build_tmp_convert_name (string file); SlaveSource post_export_slave; - jack_nframes_t post_export_position; + nframes_t post_export_position; int start_audio_export (ARDOUR::AudioExportSpecification&); int stop_audio_export (ARDOUR::AudioExportSpecification&); @@ -660,7 +660,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible /* flattening stuff */ - int write_one_audio_track (AudioTrack&, jack_nframes_t start, jack_nframes_t cnt, bool overwrite, vector >&, + int write_one_audio_track (AudioTrack&, nframes_t start, nframes_t cnt, bool overwrite, vector >&, InterThreadInfo& wot); int freeze (InterThreadInfo&); @@ -692,7 +692,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible /* s/w "RAID" management */ - jack_nframes_t available_capture_duration(); + nframes_t available_capture_duration(); /* I/O Connections */ @@ -729,10 +729,10 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible /* Scrubbing */ - void start_scrub (jack_nframes_t where); + void start_scrub (nframes_t where); void stop_scrub (); void set_scrub_speed (float); - jack_nframes_t scrub_buffer_size() const; + nframes_t scrub_buffer_size() const; sigc::signal ScrubReady; /* History (for editors, mixers, UIs etc.) */ @@ -892,10 +892,10 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible void* ptr, float opt); - typedef float (*compute_peak_t) (Sample *, jack_nframes_t, float); - typedef void (*apply_gain_to_buffer_t) (Sample *, jack_nframes_t, float); - typedef void (*mix_buffers_with_gain_t) (Sample *, Sample *, jack_nframes_t, float); - typedef void (*mix_buffers_no_gain_t) (Sample *, Sample *, jack_nframes_t); + typedef float (*compute_peak_t) (Sample *, nframes_t, float); + typedef void (*apply_gain_to_buffer_t) (Sample *, nframes_t, float); + typedef void (*mix_buffers_with_gain_t) (Sample *, Sample *, nframes_t, float); + typedef void (*mix_buffers_no_gain_t) (Sample *, Sample *, nframes_t); static compute_peak_t compute_peak; static apply_gain_to_buffer_t apply_gain_to_buffer; @@ -910,8 +910,8 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible protected: friend class AudioEngine; - void set_block_size (jack_nframes_t nframes); - void set_frame_rate (jack_nframes_t nframes); + void set_block_size (nframes_t nframes); + void set_frame_rate (nframes_t nframes); protected: friend class Diskstream; @@ -924,7 +924,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible void update_latency_compensation (bool, bool); private: - int create (bool& new_session, string* mix_template, jack_nframes_t initial_length); + int create (bool& new_session, string* mix_template, nframes_t initial_length); static const char* _template_suffix; static const char* _statefile_suffix; @@ -943,34 +943,34 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible maximise cache hits */ - typedef void (Session::*process_function_type)(jack_nframes_t); + typedef void (Session::*process_function_type)(nframes_t); AudioEngine &_engine; mutable gint processing_prohibited; process_function_type process_function; process_function_type last_process_function; bool waiting_for_sync_offset; - jack_nframes_t _base_frame_rate; - jack_nframes_t _current_frame_rate; //this includes video pullup offset + nframes_t _base_frame_rate; + nframes_t _current_frame_rate; //this includes video pullup offset int transport_sub_state; mutable gint _record_status; - jack_nframes_t _transport_frame; + nframes_t _transport_frame; Location* end_location; Location* start_location; Slave *_slave; volatile float _transport_speed; volatile float _desired_transport_speed; float _last_transport_speed; - jack_nframes_t _last_slave_transport_frame; - jack_nframes_t maximum_output_latency; - jack_nframes_t last_stop_frame; + nframes_t _last_slave_transport_frame; + nframes_t maximum_output_latency; + nframes_t last_stop_frame; vector _passthru_buffers; vector _silent_buffers; vector _send_buffers; - jack_nframes_t current_block_size; - jack_nframes_t _worst_output_latency; - jack_nframes_t _worst_input_latency; - jack_nframes_t _worst_track_latency; + nframes_t current_block_size; + nframes_t _worst_output_latency; + nframes_t _worst_input_latency; + nframes_t _worst_track_latency; bool _have_captured; float _meter_hold; float _meter_falloff; @@ -985,11 +985,11 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible void ensure_passthru_buffers (uint32_t howmany); - void process_scrub (jack_nframes_t); - void process_without_events (jack_nframes_t); - void process_with_events (jack_nframes_t); - void process_audition (jack_nframes_t); - int process_export (jack_nframes_t, ARDOUR::AudioExportSpecification*); + void process_scrub (nframes_t); + void process_without_events (nframes_t); + void process_with_events (nframes_t); + void process_audition (nframes_t); + int process_export (nframes_t, ARDOUR::AudioExportSpecification*); /* slave tracking */ @@ -1007,19 +1007,19 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible }; SlaveState slave_state; - jack_nframes_t slave_wait_end; + nframes_t slave_wait_end; void reset_slave_state (); - bool follow_slave (jack_nframes_t, jack_nframes_t); + bool follow_slave (nframes_t, nframes_t); void set_slave_source (SlaveSource); bool _exporting; int prepare_to_export (ARDOUR::AudioExportSpecification&); void prepare_diskstreams (); - void commit_diskstreams (jack_nframes_t, bool& session_requires_butler); - int process_routes (jack_nframes_t, jack_nframes_t); - int silent_process_routes (jack_nframes_t, jack_nframes_t); + void commit_diskstreams (nframes_t, bool& session_requires_butler); + int process_routes (nframes_t, nframes_t); + int silent_process_routes (nframes_t, nframes_t); bool get_rec_monitors_input () { if (actively_recording()) { @@ -1045,7 +1045,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible } } - bool maybe_stop (jack_nframes_t limit) { + bool maybe_stop (nframes_t limit) { if ((_transport_speed > 0.0f && _transport_frame >= limit) || (_transport_speed < 0.0f && _transport_frame == 0)) { stop_transport (); return true; @@ -1053,7 +1053,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible return false; } - bool maybe_sync_start (jack_nframes_t&, jack_nframes_t&); + bool maybe_sync_start (nframes_t&, nframes_t&); void check_declick_out (); @@ -1068,7 +1068,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible bool session_midi_feedback; bool play_loop; bool loop_changing; - jack_nframes_t last_loopend; + nframes_t last_loopend; RingBuffer pending_events; @@ -1088,10 +1088,10 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible XMLNode& get_options () const; int load_state (string snapshot_name); - jack_nframes_t _last_roll_location; - jack_nframes_t _last_record_location; + nframes_t _last_roll_location; + nframes_t _last_record_location; bool pending_locate_roll; - jack_nframes_t pending_locate_frame; + nframes_t pending_locate_frame; bool pending_locate_flush; bool pending_abort; @@ -1156,7 +1156,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible uint32_t rf_scale; void set_rf_speed (float speed); - void reset_rf_scale (jack_nframes_t frames_moved); + void reset_rf_scale (nframes_t frames_moved); Locations _locations; void locations_changed (); @@ -1191,7 +1191,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible void dump_events () const; void queue_event (Event *ev); void merge_event (Event*); - void replace_event (Event::Type, jack_nframes_t action_frame, jack_nframes_t target = 0); + void replace_event (Event::Type, nframes_t action_frame, nframes_t target = 0); bool _replace_event (Event*); bool _remove_event (Event *); void _clear_event_type (Event::Type); @@ -1232,7 +1232,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible /* MIDI Machine Control */ - void deliver_mmc (MIDI::MachineControl::Command, jack_nframes_t); + void deliver_mmc (MIDI::MachineControl::Command, nframes_t); void deliver_midi_message (MIDI::Port * port, MIDI::eventType ev, MIDI::channel_t, MIDI::EventTwoBytes); void deliver_data (MIDI::Port* port, MIDI::byte*, int32_t size); @@ -1268,14 +1268,14 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible MIDI::byte mtc_msg[16]; MIDI::byte mtc_smpte_bits; /* encoding of SMTPE type for MTC */ MIDI::byte midi_msg[16]; - jack_nframes_t outbound_mtc_smpte_frame; + nframes_t outbound_mtc_smpte_frame; SMPTE::Time transmitting_smpte_time; int next_quarter_frame_to_send; double _frames_per_smpte_frame; /* has to be floating point because of drop frame */ - jack_nframes_t _frames_per_hour; - jack_nframes_t _smpte_frames_per_hour; - jack_nframes_t _smpte_offset; + nframes_t _frames_per_hour; + nframes_t _smpte_frames_per_hour; + nframes_t _smpte_offset; bool _smpte_offset_negative; /* cache the most-recently requested time conversions. @@ -1284,7 +1284,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible */ bool last_smpte_valid; - jack_nframes_t last_smpte_when; + nframes_t last_smpte_when; SMPTE::Time last_smpte; int send_full_time_code (); @@ -1293,13 +1293,13 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible void send_full_time_code_in_another_thread (); void send_midi_time_code_in_another_thread (); void send_time_code_in_another_thread (bool full); - void send_mmc_in_another_thread (MIDI::MachineControl::Command, jack_nframes_t frame = 0); + void send_mmc_in_another_thread (MIDI::MachineControl::Command, nframes_t frame = 0); - jack_nframes_t adjust_apparent_position (jack_nframes_t frames); + nframes_t adjust_apparent_position (nframes_t frames); void reset_record_status (); - int no_roll (jack_nframes_t nframes, jack_nframes_t offset); + int no_roll (nframes_t nframes, nframes_t offset); bool non_realtime_work_pending() const { return static_cast(post_transport_work); } bool process_can_proceed() const { return !(post_transport_work & ProcessCannotProceedMask); } @@ -1318,7 +1318,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible Type type; MIDI::MachineControl::Command mmc_cmd; - jack_nframes_t locate_frame; + nframes_t locate_frame; // for SendMessage type @@ -1367,9 +1367,9 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible void set_play_loop (bool yn); void overwrite_some_buffers (Diskstream*); void flush_all_redirects (); - void locate (jack_nframes_t, bool with_roll, bool with_flush, bool with_loop=false); - void start_locate (jack_nframes_t, bool with_roll, bool with_flush, bool with_loop=false); - void force_locate (jack_nframes_t frame, bool with_roll = false); + void locate (nframes_t, bool with_roll, bool with_flush, bool with_loop=false); + void start_locate (nframes_t, bool with_roll, bool with_flush, bool with_loop=false); + void force_locate (nframes_t frame, bool with_roll = false); void set_diskstream_speed (Diskstream*, float speed); void set_transport_speed (float speed, bool abort = false); void stop_transport (bool abort = false); @@ -1502,7 +1502,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible /* FLATTEN */ - int flatten_one_track (AudioTrack&, jack_nframes_t start, jack_nframes_t cnt); + int flatten_one_track (AudioTrack&, nframes_t start, nframes_t cnt); /* INSERT AND SEND MANAGEMENT */ @@ -1576,7 +1576,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible void set_global_solo (GlobalRouteBooleanState s, void *src); void set_global_record_enable (GlobalRouteBooleanState s, void *src); - void jack_timebase_callback (jack_transport_state_t, jack_nframes_t, jack_position_t*, int); + void jack_timebase_callback (jack_transport_state_t, nframes_t, jack_position_t*, int); int jack_sync_callback (jack_transport_state_t, jack_position_t*); void record_enable_change_all (bool yn); @@ -1585,12 +1585,12 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible /* click track */ struct Click { - jack_nframes_t start; - jack_nframes_t duration; - jack_nframes_t offset; + nframes_t start; + nframes_t duration; + nframes_t offset; const Sample *data; - Click (jack_nframes_t s, jack_nframes_t d, const Sample *b) + Click (nframes_t s, nframes_t d, const Sample *b) : start (s), duration (d), data (b) { offset = 0; } void *operator new(size_t ignored) { @@ -1612,19 +1612,19 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible boost::shared_ptr _click_io; Sample* click_data; Sample* click_emphasis_data; - jack_nframes_t click_length; - jack_nframes_t click_emphasis_length; + nframes_t click_length; + nframes_t click_emphasis_length; mutable Glib::RWLock click_lock; static const Sample default_click[]; - static const jack_nframes_t default_click_length; + static const nframes_t default_click_length; static const Sample default_click_emphasis[]; - static const jack_nframes_t default_click_emphasis_length; + static const nframes_t default_click_emphasis_length; Click *get_click(); void setup_click_sounds (int which); void clear_clicks (); - void click (jack_nframes_t start, jack_nframes_t nframes, jack_nframes_t offset); + void click (nframes_t start, nframes_t nframes, nframes_t offset); vector master_outs; @@ -1646,7 +1646,7 @@ class Session : public sigc::trackable, public PBD::StatefulDestructible gain_t* _gain_automation_buffer; pan_t** _pan_automation_buffer; - void allocate_pan_automation_buffers (jack_nframes_t nframes, uint32_t howmany, bool force); + void allocate_pan_automation_buffers (nframes_t nframes, uint32_t howmany, bool force); uint32_t _npan_buffers; /* VST support */ diff --git a/libs/ardour/ardour/slave.h b/libs/ardour/ardour/slave.h index 0079c10e0a..d4a7e2f22a 100644 --- a/libs/ardour/ardour/slave.h +++ b/libs/ardour/ardour/slave.h @@ -42,11 +42,11 @@ class Slave { Slave() { } virtual ~Slave() {} - virtual bool speed_and_position (float&, jack_nframes_t&) = 0; + virtual bool speed_and_position (float&, nframes_t&) = 0; virtual bool locked() const = 0; virtual bool ok() const = 0; virtual bool starting() const { return false; } - virtual jack_nframes_t resolution() const = 0; + virtual nframes_t resolution() const = 0; virtual bool requires_seekahead () const = 0; }; @@ -57,13 +57,13 @@ class MTC_Slave : public Slave, public sigc::trackable { ~MTC_Slave (); void rebind (MIDI::Port&); - bool speed_and_position (float&, jack_nframes_t&); + bool speed_and_position (float&, nframes_t&); bool locked() const; bool ok() const; void handle_locate (const MIDI::byte*); - jack_nframes_t resolution() const; + nframes_t resolution() const; bool requires_seekahead () const { return true; } private: @@ -76,8 +76,8 @@ class MTC_Slave : public Slave, public sigc::trackable { int guard1; //SMPTE_Time mtc; - jack_nframes_t position; - jack_nframes_t timestamp; + nframes_t position; + nframes_t timestamp; int guard2; SafeTime() { @@ -88,12 +88,12 @@ class MTC_Slave : public Slave, public sigc::trackable { }; SafeTime current; - jack_nframes_t mtc_frame; /* current time */ - jack_nframes_t last_inbound_frame; /* when we got it; audio clocked */ + nframes_t mtc_frame; /* current time */ + nframes_t last_inbound_frame; /* when we got it; audio clocked */ float mtc_speed; - jack_nframes_t first_mtc_frame; - jack_nframes_t first_mtc_time; + nframes_t first_mtc_frame; + nframes_t first_mtc_time; static const int32_t accumulator_size = 128; float accumulator[accumulator_size]; @@ -113,7 +113,7 @@ class ADAT_Slave : public Slave ADAT_Slave () {} ~ADAT_Slave () {} - bool speed_and_position (float& speed, jack_nframes_t& pos) { + bool speed_and_position (float& speed, nframes_t& pos) { speed = 0; pos = 0; return false; @@ -121,7 +121,7 @@ class ADAT_Slave : public Slave bool locked() const { return false; } bool ok() const { return false; } - jack_nframes_t resolution() const { return 1; } + nframes_t resolution() const { return 1; } bool requires_seekahead () const { return true; } }; @@ -131,12 +131,12 @@ class JACK_Slave : public Slave JACK_Slave (jack_client_t*); ~JACK_Slave (); - bool speed_and_position (float& speed, jack_nframes_t& pos); + bool speed_and_position (float& speed, nframes_t& pos); bool starting() const { return _starting; } bool locked() const; bool ok() const; - jack_nframes_t resolution() const { return 1; } + nframes_t resolution() const { return 1; } bool requires_seekahead () const { return false; } private: diff --git a/libs/ardour/ardour/sndfilesource.h b/libs/ardour/ardour/sndfilesource.h index cb6bd2e920..50fd5e6839 100644 --- a/libs/ardour/ardour/sndfilesource.h +++ b/libs/ardour/ardour/sndfilesource.h @@ -35,7 +35,7 @@ class SndFileSource : public AudioFileSource { /* constructor to be called for new in-session files */ - SndFileSource (Session&, std::string path, SampleFormat samp_format, HeaderFormat hdr_format, jack_nframes_t rate, + SndFileSource (Session&, std::string path, SampleFormat samp_format, HeaderFormat hdr_format, nframes_t rate, Flag flags = AudioFileSource::Flag (AudioFileSource::Writable| AudioFileSource::Removable| AudioFileSource::RemovableIfEmpty| @@ -48,18 +48,18 @@ class SndFileSource : public AudioFileSource { ~SndFileSource (); float sample_rate () const; - int update_header (jack_nframes_t when, struct tm&, time_t); + int update_header (nframes_t when, struct tm&, time_t); int flush_header (); - jack_nframes_t natural_position () const; + nframes_t natural_position () const; protected: void set_header_timeline_position (); - jack_nframes_t read_unlocked (Sample *dst, jack_nframes_t start, jack_nframes_t cnt) const; - jack_nframes_t write_unlocked (Sample *dst, jack_nframes_t cnt); + nframes_t read_unlocked (Sample *dst, nframes_t start, nframes_t cnt) const; + nframes_t write_unlocked (Sample *dst, nframes_t cnt); - jack_nframes_t write_float (Sample* data, jack_nframes_t pos, jack_nframes_t cnt); + nframes_t write_float (Sample* data, nframes_t pos, nframes_t cnt); private: SNDFILE *sf; @@ -67,12 +67,12 @@ class SndFileSource : public AudioFileSource { SF_BROADCAST_INFO *_broadcast_info; mutable float *interleave_buf; - mutable jack_nframes_t interleave_bufsize; + mutable nframes_t interleave_bufsize; void init (const string &str); int open(); void close(); - int setup_broadcast_info (jack_nframes_t when, struct tm&, time_t); + int setup_broadcast_info (nframes_t when, struct tm&, time_t); }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/source_factory.h b/libs/ardour/ardour/source_factory.h index 9b2a7d98f0..815b825b8d 100644 --- a/libs/ardour/ardour/source_factory.h +++ b/libs/ardour/ardour/source_factory.h @@ -23,7 +23,7 @@ class SourceFactory { // MIDI sources will have to be hacked in here somehow static boost::shared_ptr createReadable (Session&, std::string idstr, AudioFileSource::Flag flags, bool announce = true); - static boost::shared_ptr createWritable (Session&, std::string name, bool destructive, jack_nframes_t rate, bool announce = true); + static boost::shared_ptr createWritable (Session&, std::string name, bool destructive, nframes_t rate, bool announce = true); }; } diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h index 0b37579ecb..7cdbe56cf2 100644 --- a/libs/ardour/ardour/tempo.h +++ b/libs/ardour/ardour/tempo.h @@ -57,7 +57,7 @@ class Tempo { } double beats_per_minute () const { return _beats_per_minute; } - double frames_per_beat (jack_nframes_t sr) const { + double frames_per_beat (nframes_t sr) const { return ((60.0 * sr) / _beats_per_minute); } @@ -85,7 +85,7 @@ class Meter { double beats_per_bar () const { return _beats_per_bar; } double note_divisor() const { return _note_type; } - double frames_per_bar (const Tempo&, jack_nframes_t sr) const; + double frames_per_bar (const Tempo&, nframes_t sr) const; protected: @@ -112,12 +112,12 @@ class MetricSection { virtual ~MetricSection() {} const BBT_Time& start() const { return _start; } - const jack_nframes_t frame() const { return _frame; } + const nframes_t frame() const { return _frame; } void set_movable (bool yn) { _movable = yn; } bool movable() const { return _movable; } - virtual void set_frame (jack_nframes_t f) { + virtual void set_frame (nframes_t f) { _frame = f; }; @@ -134,7 +134,7 @@ class MetricSection { private: BBT_Time _start; - jack_nframes_t _frame; + nframes_t _frame; bool _movable; }; @@ -176,7 +176,7 @@ class TempoMap : public StateManager, public PBD::StatefulDestructible { public: - TempoMap (jack_nframes_t frame_rate); + TempoMap (nframes_t frame_rate); ~TempoMap(); /* measure-based stuff */ @@ -188,13 +188,13 @@ class TempoMap : public StateManager, public PBD::StatefulDestructible struct BBTPoint { BBTPointType type; - jack_nframes_t frame; + nframes_t frame; const Meter* meter; const Tempo* tempo; uint32_t bar; uint32_t beat; - BBTPoint (const Meter& m, const Tempo& t, jack_nframes_t f, BBTPointType ty, uint32_t b, uint32_t e) + BBTPoint (const Meter& m, const Tempo& t, nframes_t f, BBTPointType ty, uint32_t b, uint32_t e) : type (ty), frame (f), meter (&m), tempo (&t), bar (b), beat (e) {} }; @@ -205,17 +205,17 @@ class TempoMap : public StateManager, public PBD::StatefulDestructible (obj.*method)(*metrics); } - BBTPointList *get_points (jack_nframes_t start, jack_nframes_t end) const; + BBTPointList *get_points (nframes_t start, nframes_t end) const; - void bbt_time (jack_nframes_t when, BBT_Time&) const; - jack_nframes_t frame_time (const BBT_Time&) const; - jack_nframes_t bbt_duration_at (jack_nframes_t, const BBT_Time&, int dir) const; + void bbt_time (nframes_t when, BBT_Time&) const; + nframes_t frame_time (const BBT_Time&) const; + nframes_t bbt_duration_at (nframes_t, const BBT_Time&, int dir) const; static const Tempo& default_tempo() { return _default_tempo; } static const Meter& default_meter() { return _default_meter; } - const Tempo& tempo_at (jack_nframes_t); - const Meter& meter_at (jack_nframes_t); + const Tempo& tempo_at (nframes_t); + const Meter& meter_at (nframes_t); void add_tempo(const Tempo&, BBT_Time where); void add_meter(const Meter&, BBT_Time where); @@ -230,15 +230,15 @@ class TempoMap : public StateManager, public PBD::StatefulDestructible void replace_meter (MeterSection& existing, const Meter& replacement); - jack_nframes_t round_to_bar (jack_nframes_t frame, int dir); + nframes_t round_to_bar (nframes_t frame, int dir); - jack_nframes_t round_to_beat (jack_nframes_t frame, int dir); + nframes_t round_to_beat (nframes_t frame, int dir); - jack_nframes_t round_to_beat_subdivision (jack_nframes_t fr, int sub_num); + nframes_t round_to_beat_subdivision (nframes_t fr, int sub_num); - jack_nframes_t round_to_tick (jack_nframes_t frame, int dir); + nframes_t round_to_tick (nframes_t frame, int dir); - void set_length (jack_nframes_t frames); + void set_length (nframes_t frames); XMLNode& get_state (void); int set_state (const XMLNode&); @@ -259,33 +259,33 @@ class TempoMap : public StateManager, public PBD::StatefulDestructible void set_tempo (const Tempo& t) { _tempo = &t; } void set_meter (const Meter& m) { _meter = &m; } - void set_frame (jack_nframes_t f) { _frame = f; } + void set_frame (nframes_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; } - jack_nframes_t frame() const { return _frame; } + nframes_t frame() const { return _frame; } const BBT_Time& start() const { return _start; } private: const Meter* _meter; const Tempo* _tempo; - jack_nframes_t _frame; + nframes_t _frame; BBT_Time _start; }; Metric metric_at (BBT_Time bbt) const; - Metric metric_at (jack_nframes_t) const; - void bbt_time_with_metric (jack_nframes_t, BBT_Time&, const Metric&) const; + Metric metric_at (nframes_t) const; + void bbt_time_with_metric (nframes_t, BBT_Time&, const Metric&) const; private: static Tempo _default_tempo; static Meter _default_meter; Metrics *metrics; - jack_nframes_t _frame_rate; - jack_nframes_t last_bbt_when; + nframes_t _frame_rate; + nframes_t last_bbt_when; bool last_bbt_valid; BBT_Time last_bbt; mutable Glib::RWLock lock; @@ -293,19 +293,19 @@ class TempoMap : public StateManager, public PBD::StatefulDestructible void timestamp_metrics (); - jack_nframes_t round_to_type (jack_nframes_t fr, int dir, BBTPointType); + nframes_t round_to_type (nframes_t fr, int dir, BBTPointType); - jack_nframes_t frame_time_unlocked (const BBT_Time&) const; + nframes_t frame_time_unlocked (const BBT_Time&) const; - void bbt_time_unlocked (jack_nframes_t, BBT_Time&) const; + void bbt_time_unlocked (nframes_t, BBT_Time&) const; - jack_nframes_t bbt_duration_at_unlocked (const BBT_Time& when, const BBT_Time& bbt, int dir) const; + nframes_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; - jack_nframes_t count_frames_between (const BBT_Time&, const BBT_Time&) const; - jack_nframes_t count_frames_between_metrics (const Meter&, const Tempo&, const BBT_Time&, const BBT_Time&) const; + nframes_t count_frames_between (const BBT_Time&, const BBT_Time&) const; + nframes_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); diff --git a/libs/ardour/ardour/track.h b/libs/ardour/ardour/track.h index ec444e78dc..cf380de153 100644 --- a/libs/ardour/ardour/track.h +++ b/libs/ardour/ardour/track.h @@ -39,14 +39,14 @@ class Track : public Route int set_name (string str, void *src); - virtual int roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, - jack_nframes_t offset, int declick, bool can_record, bool rec_monitors_input) = 0; + virtual int roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, + nframes_t offset, int declick, bool can_record, bool rec_monitors_input) = 0; - virtual int no_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, - jack_nframes_t offset, bool state_changing, bool can_record, bool rec_monitors_input) = 0; + virtual int no_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, + nframes_t offset, bool state_changing, bool can_record, bool rec_monitors_input) = 0; - virtual int silent_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, - jack_nframes_t offset, bool can_record, bool rec_monitors_input) = 0; + virtual int silent_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, + nframes_t offset, bool can_record, bool rec_monitors_input) = 0; void toggle_monitor_input (); @@ -60,8 +60,8 @@ class Track : public Route TrackMode mode() const { return _mode; } void set_mode (TrackMode m); - jack_nframes_t update_total_latency(); - void set_latency_delay (jack_nframes_t); + nframes_t update_total_latency(); + void set_latency_delay (nframes_t); enum FreezeState { NoFreeze, @@ -75,7 +75,7 @@ class Track : public Route virtual void unfreeze () = 0; virtual void bounce (InterThreadInfo&) = 0; - virtual void bounce_range (jack_nframes_t start, jack_nframes_t end, InterThreadInfo&) = 0; + virtual void bounce_range (nframes_t start, nframes_t end, InterThreadInfo&) = 0; XMLNode& get_state(); XMLNode& get_template(); @@ -97,8 +97,8 @@ class Track : public Route virtual XMLNode& state (bool full) = 0; - virtual void passthru_silence (jack_nframes_t start_frame, jack_nframes_t end_frame, - jack_nframes_t nframes, jack_nframes_t offset, int declick, bool meter) = 0; + virtual void passthru_silence (nframes_t start_frame, nframes_t end_frame, + nframes_t nframes, nframes_t offset, int declick, bool meter) = 0; virtual uint32_t n_process_buffers () = 0; diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index b70448e8a5..d4e49bc624 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -41,6 +41,13 @@ typedef int intptr_t; #endif +/* at some point move this into the ARDOUR namespace, + but for now its outside because it replaces the + old global "jack_nframes_t" +*/ + +typedef uint32_t nframes_t; + namespace ARDOUR { class Source; @@ -66,8 +73,8 @@ namespace ARDOUR { OverlapExternal // overlap extends to (at least) begin+end }; - OverlapType coverage (jack_nframes_t start_a, jack_nframes_t end_a, - jack_nframes_t start_b, jack_nframes_t end_b); + OverlapType coverage (nframes_t start_a, nframes_t end_a, + nframes_t start_b, nframes_t end_b); enum AutomationType { GainAutomation = 0x1, @@ -147,7 +154,7 @@ namespace ARDOUR { BBT_Time bbt; union { - jack_nframes_t frames; + nframes_t frames; double seconds; }; @@ -155,13 +162,13 @@ namespace ARDOUR { }; struct AudioRange { - jack_nframes_t start; - jack_nframes_t end; + nframes_t start; + nframes_t end; uint32_t id; - AudioRange (jack_nframes_t s, jack_nframes_t e, uint32_t i) : start (s), end (e) , id (i) {} + AudioRange (nframes_t s, nframes_t e, uint32_t i) : start (s), end (e) , id (i) {} - jack_nframes_t length() { return end - start + 1; } + nframes_t length() { return end - start + 1; } bool operator== (const AudioRange& other) const { return start == other.start && end == other.end && id == other.id; @@ -171,7 +178,7 @@ namespace ARDOUR { return start == other.start && end == other.end; } - OverlapType coverage (jack_nframes_t s, jack_nframes_t e) const { + OverlapType coverage (nframes_t s, nframes_t e) const { return ARDOUR::coverage (start, end, s, e); } }; @@ -302,16 +309,16 @@ std::istream& operator>>(std::istream& o, ARDOUR::SlaveSource& sf); std::istream& operator>>(std::istream& o, ARDOUR::ShuttleBehaviour& sf); std::istream& operator>>(std::istream& o, ARDOUR::ShuttleUnits& sf); -static inline jack_nframes_t -session_frame_to_track_frame (jack_nframes_t session_frame, double speed) +static inline nframes_t +session_frame_to_track_frame (nframes_t session_frame, double speed) { - return (jack_nframes_t)( (double)session_frame * speed ); + return (nframes_t)( (double)session_frame * speed ); } -static inline jack_nframes_t -track_frame_to_session_frame (jack_nframes_t track_frame, double speed) +static inline nframes_t +track_frame_to_session_frame (nframes_t track_frame, double speed) { - return (jack_nframes_t)( (double)track_frame / speed ); + return (nframes_t)( (double)track_frame / speed ); } diff --git a/libs/ardour/ardour/utils.h b/libs/ardour/ardour/utils.h index ab9f2ad952..1764885366 100644 --- a/libs/ardour/ardour/utils.h +++ b/libs/ardour/ardour/utils.h @@ -57,7 +57,7 @@ int touch_file(std::string path); std::string region_name_from_path (std::string path); std::string path_expand (std::string); -void compute_equal_power_fades (jack_nframes_t nframes, float* in, float* out); +void compute_equal_power_fades (nframes_t nframes, float* in, float* out); const char* slave_source_to_string (ARDOUR::SlaveSource src); ARDOUR::SlaveSource string_to_slave_source (std::string str); diff --git a/libs/ardour/ardour/vst_plugin.h b/libs/ardour/ardour/vst_plugin.h index 4fb5b0babb..7b8246868c 100644 --- a/libs/ardour/ardour/vst_plugin.h +++ b/libs/ardour/ardour/vst_plugin.h @@ -64,7 +64,7 @@ class VSTPlugin : public ARDOUR::Plugin const char * maker() const; uint32_t parameter_count() const; float default_value (uint32_t port); - jack_nframes_t latency() const; + nframes_t latency() const; void set_parameter (uint32_t port, float val); float get_parameter (uint32_t port) const; int get_parameter_descriptor (uint32_t which, ParameterDescriptor&) const; @@ -72,8 +72,8 @@ class VSTPlugin : public ARDOUR::Plugin uint32_t nth_parameter (uint32_t port, bool& ok) const; void activate (); void deactivate (); - void set_block_size (jack_nframes_t nframes); - int connect_and_run (vector& bufs, uint32_t maxbuf, int32_t& in, int32_t& out, jack_nframes_t nframes, jack_nframes_t offset); + void set_block_size (nframes_t nframes); + int connect_and_run (vector& bufs, uint32_t maxbuf, int32_t& in, int32_t& out, nframes_t nframes, nframes_t offset); void store_state (ARDOUR::PluginState&); void restore_state (ARDOUR::PluginState&); string describe_parameter (uint32_t); diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc index f1d6cb2db8..580ce49231 100644 --- a/libs/ardour/audio_diskstream.cc +++ b/libs/ardour/audio_diskstream.cc @@ -249,7 +249,7 @@ AudioDiskstream::non_realtime_input_change () /* now refill channel buffers */ if (speed() != 1.0f || speed() != -1.0f) { - seek ((jack_nframes_t) (_session.transport_frame() * (double) speed())); + seek ((nframes_t) (_session.transport_frame() * (double) speed())); } else { seek (_session.transport_frame()); } @@ -374,9 +374,7 @@ AudioDiskstream::setup_destructive_playlist () /* a single full-sized region */ - cerr << "setup DS using " << srcs.front()->natural_position () << endl; - - boost::shared_ptr region (RegionFactory::create (srcs, 0, max_frames, _name)); + boost::shared_ptr region (RegionFactory::create (srcs, 0, max_frames - srcs.front()->natural_position(), _name)); _playlist->add_region (region, srcs.front()->natural_position()); } @@ -389,21 +387,19 @@ AudioDiskstream::use_destructive_playlist () with the (presumed single, full-extent) region. */ - Playlist::RegionList* rl = _playlist->regions_at (0); + boost::shared_ptr rp = _playlist->find_next_region (_session.current_start_frame(), Start, 1); - if (rl->empty()) { + if (!rp) { reset_write_sources (false, true); return; } - boost::shared_ptr region = boost::dynamic_pointer_cast (rl->front()); + boost::shared_ptr region = boost::dynamic_pointer_cast (rp); if (region == 0) { throw failed_constructor(); } - delete rl; - uint32_t n; ChannelList::iterator chan; @@ -417,7 +413,7 @@ AudioDiskstream::use_destructive_playlist () } void -AudioDiskstream::check_record_status (jack_nframes_t transport_frame, jack_nframes_t nframes, bool can_record) +AudioDiskstream::check_record_status (nframes_t transport_frame, nframes_t nframes, bool can_record) { int possibly_recording; int rolling; @@ -541,13 +537,13 @@ AudioDiskstream::check_record_status (jack_nframes_t transport_frame, jack_nfram } int -AudioDiskstream::process (jack_nframes_t transport_frame, jack_nframes_t nframes, jack_nframes_t offset, bool can_record, bool rec_monitors_input) +AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, nframes_t offset, bool can_record, bool rec_monitors_input) { uint32_t n; ChannelList::iterator c; int ret = -1; - jack_nframes_t rec_offset = 0; - jack_nframes_t rec_nframes = 0; + nframes_t rec_offset = 0; + nframes_t rec_nframes = 0; bool nominally_recording; bool re = record_enabled (); bool collect_playback = false; @@ -666,7 +662,7 @@ AudioDiskstream::process (jack_nframes_t transport_frame, jack_nframes_t nframes } else { - jack_nframes_t total = chan.capture_vector.len[0] + chan.capture_vector.len[1]; + nframes_t total = chan.capture_vector.len[0] + chan.capture_vector.len[1]; if (rec_nframes > total) { DiskOverrun (); @@ -674,7 +670,7 @@ AudioDiskstream::process (jack_nframes_t transport_frame, jack_nframes_t nframes } Sample* buf = _io->input (n)->get_buffer (nframes) + offset; - jack_nframes_t first = chan.capture_vector.len[0]; + nframes_t first = chan.capture_vector.len[0]; memcpy (chan.capture_wrap_buffer, buf, sizeof (Sample) * first); memcpy (chan.capture_vector.buf[0], buf, sizeof (Sample) * first); @@ -737,12 +733,12 @@ AudioDiskstream::process (jack_nframes_t transport_frame, jack_nframes_t nframes /* we're doing playback */ - jack_nframes_t necessary_samples; + nframes_t necessary_samples; /* no varispeed playback if we're recording, because the output .... TBD */ if (rec_nframes == 0 && _actual_speed != 1.0f) { - necessary_samples = (jack_nframes_t) floor ((nframes * fabs (_actual_speed))) + 1; + necessary_samples = (nframes_t) floor ((nframes * fabs (_actual_speed))) + 1; } else { necessary_samples = nframes; } @@ -762,7 +758,7 @@ AudioDiskstream::process (jack_nframes_t transport_frame, jack_nframes_t nframes chan.current_playback_buffer = chan.playback_vector.buf[0]; } else { - jack_nframes_t total = chan.playback_vector.len[0] + chan.playback_vector.len[1]; + nframes_t total = chan.playback_vector.len[0] + chan.playback_vector.len[1]; if (necessary_samples > total) { DiskUnderrun (); @@ -783,7 +779,7 @@ AudioDiskstream::process (jack_nframes_t transport_frame, jack_nframes_t nframes if (rec_nframes == 0 && _actual_speed != 1.0f && _actual_speed != -1.0f) { uint64_t phase = last_phase; - jack_nframes_t i = 0; + nframes_t i = 0; // Linearly interpolate into the alt buffer // using 40.24 fixp maths (swh) @@ -796,7 +792,7 @@ AudioDiskstream::process (jack_nframes_t transport_frame, jack_nframes_t nframes i = 0; phase = last_phase; - for (jack_nframes_t outsample = 0; outsample < nframes; ++outsample) { + for (nframes_t outsample = 0; outsample < nframes; ++outsample) { i = phase >> 24; fr = (phase & 0xFFFFFF) / 16777216.0f; chan.speed_buffer[outsample] = @@ -835,7 +831,7 @@ AudioDiskstream::process (jack_nframes_t transport_frame, jack_nframes_t nframes } bool -AudioDiskstream::commit (jack_nframes_t nframes) +AudioDiskstream::commit (nframes_t nframes) { bool need_butler = false; @@ -895,7 +891,7 @@ AudioDiskstream::overwrite_existing_buffers () overwrite_queued = false; /* assume all are the same size */ - jack_nframes_t size = channels[0].playback_buf->bufsize(); + nframes_t size = channels[0].playback_buf->bufsize(); mixdown_buffer = new Sample[size]; gain_buffer = new float[size]; @@ -904,12 +900,12 @@ AudioDiskstream::overwrite_existing_buffers () size--; uint32_t n=0; - jack_nframes_t start; + nframes_t start; for (ChannelList::iterator chan = channels.begin(); chan != channels.end(); ++chan, ++n) { start = overwrite_frame; - jack_nframes_t cnt = size; + nframes_t cnt = size; /* to fill the buffer without resetting the playback sample, we need to do it one or two chunks (normally two). @@ -922,7 +918,7 @@ AudioDiskstream::overwrite_existing_buffers () */ - jack_nframes_t to_read = size - overwrite_offset; + nframes_t to_read = size - overwrite_offset; if (read ((*chan).playback_buf->buffer() + overwrite_offset, mixdown_buffer, gain_buffer, start, to_read, *chan, n, reversed)) { error << string_compose(_("AudioDiskstream %1: when refilling, cannot read %2 from playlist at frame %3"), @@ -953,7 +949,7 @@ AudioDiskstream::overwrite_existing_buffers () } int -AudioDiskstream::seek (jack_nframes_t frame, bool complete_refill) +AudioDiskstream::seek (nframes_t frame, bool complete_refill) { Glib::Mutex::Lock lm (state_lock); uint32_t n; @@ -984,7 +980,7 @@ AudioDiskstream::seek (jack_nframes_t frame, bool complete_refill) } int -AudioDiskstream::can_internal_playback_seek (jack_nframes_t distance) +AudioDiskstream::can_internal_playback_seek (nframes_t distance) { ChannelList::iterator chan; @@ -997,7 +993,7 @@ AudioDiskstream::can_internal_playback_seek (jack_nframes_t distance) } int -AudioDiskstream::internal_playback_seek (jack_nframes_t distance) +AudioDiskstream::internal_playback_seek (nframes_t distance) { ChannelList::iterator chan; @@ -1012,15 +1008,15 @@ AudioDiskstream::internal_playback_seek (jack_nframes_t distance) } int -AudioDiskstream::read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer, jack_nframes_t& start, jack_nframes_t cnt, +AudioDiskstream::read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer, nframes_t& start, nframes_t cnt, ChannelInfo& channel_info, int channel, bool reversed) { - jack_nframes_t this_read = 0; + nframes_t this_read = 0; bool reloop = false; - jack_nframes_t loop_end = 0; - jack_nframes_t loop_start = 0; - jack_nframes_t loop_length = 0; - jack_nframes_t offset = 0; + nframes_t loop_end = 0; + nframes_t loop_start = 0; + nframes_t loop_length = 0; + nframes_t offset = 0; Location *loc = 0; if (!reversed) { @@ -1120,14 +1116,14 @@ int AudioDiskstream::_do_refill (Sample* mixdown_buffer, float* gain_buffer) { int32_t ret = 0; - jack_nframes_t to_read; + nframes_t to_read; RingBufferNPT::rw_vector vector; bool reversed = (_visible_speed * _session.transport_speed()) < 0.0f; - jack_nframes_t total_space; - jack_nframes_t zero_fill; + nframes_t total_space; + nframes_t zero_fill; uint32_t chan_n; ChannelList::iterator i; - jack_nframes_t ts; + nframes_t ts; assert(mixdown_buffer); assert(gain_buffer); @@ -1239,14 +1235,14 @@ AudioDiskstream::_do_refill (Sample* mixdown_buffer, float* gain_buffer) } } - jack_nframes_t file_frame_tmp = 0; + nframes_t file_frame_tmp = 0; for (chan_n = 0, i = channels.begin(); i != channels.end(); ++i, ++chan_n) { ChannelInfo& chan (*i); Sample* buf1; Sample* buf2; - jack_nframes_t len1, len2; + nframes_t len1, len2; chan.playback_buf->get_write_vector (&vector); @@ -1327,7 +1323,7 @@ AudioDiskstream::do_flush (Session::RunContext context, bool force_flush) int32_t ret = 0; RingBufferNPT::rw_vector vector; RingBufferNPT::rw_vector transvec; - jack_nframes_t total; + nframes_t total; _write_data_count = 0; @@ -1357,7 +1353,7 @@ AudioDiskstream::do_flush (Session::RunContext context, bool force_flush) ret = 1; } - to_write = min (disk_io_chunk_frames, (jack_nframes_t) vector.len[0]); + to_write = min (disk_io_chunk_frames, (nframes_t) vector.len[0]); // check the transition buffer when recording destructive // important that we get this after the capture buf @@ -1427,7 +1423,7 @@ AudioDiskstream::do_flush (Session::RunContext context, bool force_flush) of vector.len[1] to be flushed to disk as well. */ - to_write = min ((jack_nframes_t)(disk_io_chunk_frames - to_write), (jack_nframes_t) vector.len[1]); + to_write = min ((nframes_t)(disk_io_chunk_frames - to_write), (nframes_t) vector.len[1]); if ((*chan).write_source->write (vector.buf[1], to_write) != to_write) { error << string_compose(_("AudioDiskstream %1: cannot write to disk"), _id) << endmsg; @@ -1452,7 +1448,7 @@ AudioDiskstream::transport_stopped (struct tm& when, time_t twhen, bool abort_ca bool more_work = true; int err = 0; boost::shared_ptr region; - jack_nframes_t total_capture; + nframes_t total_capture; SourceList srcs; SourceList::iterator src; ChannelList::iterator chan; @@ -2025,7 +2021,7 @@ AudioDiskstream::rename_write_sources () } void -AudioDiskstream::set_block_size (jack_nframes_t nframes) +AudioDiskstream::set_block_size (nframes_t nframes) { if (_session.get_block_size() > speed_buffer_size) { speed_buffer_size = _session.get_block_size(); @@ -2047,7 +2043,7 @@ AudioDiskstream::allocate_temporary_buffers () */ double sp = max (fabsf (_actual_speed), 1.2f); - jack_nframes_t required_wrap_size = (jack_nframes_t) floor (_session.get_block_size() * sp) + 1; + nframes_t required_wrap_size = (nframes_t) floor (_session.get_block_size() * sp) + 1; if (required_wrap_size > wrap_buffer_size) { @@ -2157,7 +2153,7 @@ AudioDiskstream::use_pending_capture_data (XMLNode& node) boost::shared_ptr fs; boost::shared_ptr first_fs; SourceList pending_sources; - jack_nframes_t position; + nframes_t position; if ((prop = node.property (X_("at"))) == 0) { return -1; diff --git a/libs/ardour/audio_playlist.cc b/libs/ardour/audio_playlist.cc index e7e410afe3..526003e6b2 100644 --- a/libs/ardour/audio_playlist.cc +++ b/libs/ardour/audio_playlist.cc @@ -115,7 +115,7 @@ AudioPlaylist::AudioPlaylist (const AudioPlaylist& other, string name, bool hidd } } -AudioPlaylist::AudioPlaylist (const AudioPlaylist& other, jack_nframes_t start, jack_nframes_t cnt, string name, bool hidden) +AudioPlaylist::AudioPlaylist (const AudioPlaylist& other, nframes_t start, nframes_t cnt, string name, bool hidden) : Playlist (other, start, cnt, name, hidden) { save_state (_("initial state")); @@ -162,14 +162,14 @@ struct RegionSortByLayer { } }; -jack_nframes_t -AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, jack_nframes_t start, - jack_nframes_t cnt, unsigned chan_n) +nframes_t +AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, nframes_t start, + nframes_t cnt, unsigned chan_n) { - jack_nframes_t ret = cnt; - jack_nframes_t end; - jack_nframes_t read_frames; - jack_nframes_t skip_frames; + nframes_t ret = cnt; + nframes_t end; + nframes_t read_frames; + nframes_t skip_frames; /* optimizing this memset() away involves a lot of conditionals that may well cause more of a hit due to cache misses @@ -204,7 +204,6 @@ AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, ja for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) { if ((*i)->coverage (start, end) != OverlapNone) { - relevant_regions[(*i)->layer()].push_back (*i); relevant_layers.push_back ((*i)->layer()); } @@ -440,7 +439,7 @@ AudioPlaylist::check_dependents (boost::shared_ptr r, bool norefresh) audio engineering. */ - jack_nframes_t xfade_length = min ((jack_nframes_t) 720, top->length()); + nframes_t xfade_length = min ((nframes_t) 720, top->length()); /* in, out */ xfade = new Crossfade (top, bottom, xfade_length, top->first_frame(), StartOfIn); @@ -882,12 +881,12 @@ AudioPlaylist::region_changed (Change what_changed, boost::shared_ptr re } void -AudioPlaylist::crossfades_at (jack_nframes_t frame, Crossfades& clist) +AudioPlaylist::crossfades_at (nframes_t frame, Crossfades& clist) { RegionLock rlock (this); for (Crossfades::iterator i = _crossfades.begin(); i != _crossfades.end(); ++i) { - jack_nframes_t start, end; + nframes_t start, end; start = (*i)->position(); end = start + (*i)->overlap_length(); // not length(), important difference diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc index 7d6fd75206..7987222aa3 100644 --- a/libs/ardour/audio_track.cc +++ b/libs/ardour/audio_track.cc @@ -405,14 +405,14 @@ AudioTrack::n_process_buffers () } void -AudioTrack::passthru_silence (jack_nframes_t start_frame, jack_nframes_t end_frame, jack_nframes_t nframes, jack_nframes_t offset, int declick, bool meter) +AudioTrack::passthru_silence (nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset, int declick, bool meter) { uint32_t nbufs = n_process_buffers (); process_output_buffers (_session.get_silent_buffers (nbufs), nbufs, start_frame, end_frame, nframes, offset, true, declick, meter); } int -AudioTrack::no_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, jack_nframes_t offset, +AudioTrack::no_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nframes_t offset, bool session_state_changing, bool can_record, bool rec_monitors_input) { if (n_outputs() == 0) { @@ -492,13 +492,13 @@ AudioTrack::no_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nf } int -AudioTrack::roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, jack_nframes_t offset, int declick, +AudioTrack::roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nframes_t offset, int declick, bool can_record, bool rec_monitors_input) { int dret; Sample* b; Sample* tmpb; - jack_nframes_t transport_frame; + nframes_t transport_frame; boost::shared_ptr diskstream = audio_diskstream(); { @@ -604,7 +604,7 @@ AudioTrack::roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nfram } int -AudioTrack::silent_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, jack_nframes_t offset, +AudioTrack::silent_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nframes_t offset, bool can_record, bool rec_monitors_input) { if (n_outputs() == 0 && _redirects.empty()) { @@ -625,7 +625,7 @@ AudioTrack::silent_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jac } int -AudioTrack::export_stuff (vector& buffers, uint32_t nbufs, jack_nframes_t start, jack_nframes_t nframes) +AudioTrack::export_stuff (vector& buffers, uint32_t nbufs, nframes_t start, nframes_t nframes) { gain_t gain_automation[nframes]; gain_t gain_buffer[nframes]; @@ -690,7 +690,7 @@ AudioTrack::export_stuff (vector& buffers, uint32_t nbufs, jack_nframes for (bi = buffers.begin(); bi != buffers.end(); ++bi) { Sample *b = *bi; - for (jack_nframes_t n = 0; n < nframes; ++n) { + for (nframes_t n = 0; n < nframes; ++n) { b[n] *= gain_automation[n]; } } @@ -699,7 +699,7 @@ AudioTrack::export_stuff (vector& buffers, uint32_t nbufs, jack_nframes for (bi = buffers.begin(); bi != buffers.end(); ++bi) { Sample *b = *bi; - for (jack_nframes_t n = 0; n < nframes; ++n) { + for (nframes_t n = 0; n < nframes; ++n) { b[n] *= this_gain; } } @@ -734,7 +734,7 @@ AudioTrack::bounce (InterThreadInfo& itt) void -AudioTrack::bounce_range (jack_nframes_t start, jack_nframes_t end, InterThreadInfo& itt) +AudioTrack::bounce_range (nframes_t start, nframes_t end, InterThreadInfo& itt) { vector > srcs; _session.write_one_audio_track (*this, start, end, false, srcs, itt); diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc index 57d5505a0f..ac240828b5 100644 --- a/libs/ardour/audio_unit.cc +++ b/libs/ardour/audio_unit.cc @@ -112,7 +112,7 @@ AUPlugin::default_value (uint32_t port) return 0; } -jack_nframes_t +nframes_t AUPlugin::latency () const { return unit->Latency (); @@ -159,13 +159,13 @@ AUPlugin::deactivate () } void -AUPlugin::set_block_size (jack_nframes_t nframes) +AUPlugin::set_block_size (nframes_t nframes) { } int -AUPlugin::connect_and_run (vector& bufs, uint32_t maxbuf, int32_t& in, int32_t& out, jack_nframes_t nframes, jack_nframes_t offset) +AUPlugin::connect_and_run (vector& bufs, uint32_t maxbuf, int32_t& in, int32_t& out, nframes_t nframes, nframes_t offset) { AudioUnitRenderActionFlags flags = 0; AudioTimeStamp ts; diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc index dae5b8f5e3..1b4ca05d38 100644 --- a/libs/ardour/audioengine.cc +++ b/libs/ardour/audioengine.cc @@ -43,8 +43,8 @@ using namespace std; using namespace ARDOUR; using namespace PBD; -jack_nframes_t Port::_short_over_length = 2; -jack_nframes_t Port::_long_over_length = 10; +nframes_t Port::_short_over_length = 2; +nframes_t Port::_long_over_length = 10; AudioEngine::AudioEngine (string client_name) : ports (new Ports) @@ -102,7 +102,7 @@ AudioEngine::start () if (!_running) { if (session) { - jack_nframes_t blocksize = jack_get_buffer_size (_jack); + nframes_t blocksize = jack_get_buffer_size (_jack); session->set_block_size (blocksize); session->set_frame_rate (jack_get_sample_rate (_jack)); @@ -165,7 +165,7 @@ AudioEngine::stop () bool -AudioEngine::get_sync_offset (jack_nframes_t& offset) const +AudioEngine::get_sync_offset (nframes_t& offset) const { #ifdef HAVE_JACK_VIDEO_SUPPORT @@ -185,14 +185,14 @@ AudioEngine::get_sync_offset (jack_nframes_t& offset) const } void -AudioEngine::_jack_timebase_callback (jack_transport_state_t state, jack_nframes_t nframes, +AudioEngine::_jack_timebase_callback (jack_transport_state_t state, nframes_t nframes, jack_position_t* pos, int new_position, void *arg) { static_cast (arg)->jack_timebase_callback (state, nframes, pos, new_position); } void -AudioEngine::jack_timebase_callback (jack_transport_state_t state, jack_nframes_t nframes, +AudioEngine::jack_timebase_callback (jack_transport_state_t state, nframes_t nframes, jack_position_t* pos, int new_position) { if (session && session->synced_to_jack()) { @@ -231,7 +231,7 @@ AudioEngine::_graph_order_callback (void *arg) } int -AudioEngine::_process_callback (jack_nframes_t nframes, void *arg) +AudioEngine::_process_callback (nframes_t nframes, void *arg) { return static_cast (arg)->process_callback (nframes); } @@ -243,11 +243,11 @@ AudioEngine::_freewheel_callback (int onoff, void *arg) } int -AudioEngine::process_callback (jack_nframes_t nframes) +AudioEngine::process_callback (nframes_t nframes) { // CycleTimer ct ("AudioEngine::process"); Glib::Mutex::Lock tm (_process_lock, Glib::TRY_LOCK); - jack_nframes_t next_processed_frames; + nframes_t next_processed_frames; /* handle wrap around of total frames counter */ @@ -314,13 +314,13 @@ AudioEngine::process_callback (jack_nframes_t nframes) } int -AudioEngine::_sample_rate_callback (jack_nframes_t nframes, void *arg) +AudioEngine::_sample_rate_callback (nframes_t nframes, void *arg) { return static_cast (arg)->jack_sample_rate_callback (nframes); } int -AudioEngine::jack_sample_rate_callback (jack_nframes_t nframes) +AudioEngine::jack_sample_rate_callback (nframes_t nframes) { _frame_rate = nframes; _usecs_per_cycle = (int) floor ((((double) frames_per_cycle() / nframes)) * 1000000.0); @@ -340,13 +340,13 @@ AudioEngine::jack_sample_rate_callback (jack_nframes_t nframes) } int -AudioEngine::_bufsize_callback (jack_nframes_t nframes, void *arg) +AudioEngine::_bufsize_callback (nframes_t nframes, void *arg) { return static_cast (arg)->jack_bufsize_callback (nframes); } int -AudioEngine::jack_bufsize_callback (jack_nframes_t nframes) +AudioEngine::jack_bufsize_callback (nframes_t nframes) { _buffer_size = nframes; _usecs_per_cycle = (int) floor ((((double) nframes / frame_rate())) * 1000000.0); @@ -611,7 +611,7 @@ AudioEngine::disconnect (Port *port) } -jack_nframes_t +nframes_t AudioEngine::frame_rate () { if (_jack) { @@ -628,7 +628,7 @@ AudioEngine::frame_rate () } } -jack_nframes_t +nframes_t AudioEngine::frames_per_cycle () { if (_jack) { @@ -838,7 +838,7 @@ AudioEngine::get_nth_physical (uint32_t n, int flag) return ret; } -jack_nframes_t +nframes_t AudioEngine::get_port_total_latency (const Port& port) { if (!_jack) { @@ -875,7 +875,7 @@ AudioEngine::transport_start () } void -AudioEngine::transport_locate (jack_nframes_t where) +AudioEngine::transport_locate (nframes_t where) { // cerr << "tell JACK to locate to " << where << endl; if (_jack) { @@ -1086,7 +1086,7 @@ AudioEngine::reconnect_to_jack () if (session) { - jack_nframes_t blocksize = jack_get_buffer_size (_jack); + nframes_t blocksize = jack_get_buffer_size (_jack); session->set_block_size (blocksize); session->set_frame_rate (jack_get_sample_rate (_jack)); } @@ -1135,7 +1135,7 @@ AudioEngine::reconnect_to_jack () } int -AudioEngine::request_buffer_size (jack_nframes_t nframes) +AudioEngine::request_buffer_size (nframes_t nframes) { if (_jack) { int ret = jack_set_buffer_size (_jack, nframes); diff --git a/libs/ardour/audiofilesource.cc b/libs/ardour/audiofilesource.cc index 256286b729..dfc07de787 100644 --- a/libs/ardour/audiofilesource.cc +++ b/libs/ardour/audiofilesource.cc @@ -119,6 +119,7 @@ AudioFileSource::init (string pathstr, bool must_exist) bool is_new = false; _length = 0; + timeline_position = 0; next_peak_clear_should_notify = false; if (!find (pathstr, must_exist, is_new)) { @@ -503,14 +504,14 @@ AudioFileSource::set_search_path (string p) } void -AudioFileSource::set_header_position_offset (jack_nframes_t offset) +AudioFileSource::set_header_position_offset (nframes_t offset) { header_position_offset = offset; HeaderPositionOffsetChanged (); } void -AudioFileSource::set_timeline_position (jack_nframes_t pos) +AudioFileSource::set_timeline_position (nframes_t pos) { timeline_position = pos; } diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc index 9a5f5892e0..ee3840063d 100644 --- a/libs/ardour/audioregion.cc +++ b/libs/ardour/audioregion.cc @@ -65,7 +65,7 @@ AudioRegionState::AudioRegionState (string why) { } -AudioRegion::AudioRegion (boost::shared_ptr src, jack_nframes_t start, jack_nframes_t length) +AudioRegion::AudioRegion (boost::shared_ptr src, nframes_t start, nframes_t length) : Region (start, length, PBD::basename_nosuffix(src->name()), 0, Region::Flag(Region::DefaultFlags|Region::External)), _fade_in (0.0, 2.0, 1.0, false), _fade_out (0.0, 2.0, 1.0, false), @@ -92,7 +92,7 @@ AudioRegion::AudioRegion (boost::shared_ptr src, jack_nframes_t sta _envelope.StateChanged.connect (mem_fun (*this, &AudioRegion::envelope_changed)); } -AudioRegion::AudioRegion (boost::shared_ptr src, jack_nframes_t start, jack_nframes_t length, const string& name, layer_t layer, Flag flags) +AudioRegion::AudioRegion (boost::shared_ptr src, nframes_t start, nframes_t length, const string& name, layer_t layer, Flag flags) : Region (start, length, name, layer, flags), _fade_in (0.0, 2.0, 1.0, false), _fade_out (0.0, 2.0, 1.0, false), @@ -118,7 +118,7 @@ AudioRegion::AudioRegion (boost::shared_ptr src, jack_nframes_t sta _envelope.StateChanged.connect (mem_fun (*this, &AudioRegion::envelope_changed)); } -AudioRegion::AudioRegion (SourceList& srcs, jack_nframes_t start, jack_nframes_t length, const string& name, layer_t layer, Flag flags) +AudioRegion::AudioRegion (SourceList& srcs, nframes_t start, nframes_t length, const string& name, layer_t layer, Flag flags) : Region (start, length, name, layer, flags), _fade_in (0.0, 2.0, 1.0, false), _fade_out (0.0, 2.0, 1.0, false), @@ -147,7 +147,7 @@ AudioRegion::AudioRegion (SourceList& srcs, jack_nframes_t start, jack_nframes_t } -AudioRegion::AudioRegion (boost::shared_ptr other, jack_nframes_t offset, jack_nframes_t length, const string& name, layer_t layer, Flag flags) +AudioRegion::AudioRegion (boost::shared_ptr other, nframes_t offset, nframes_t length, const string& name, layer_t layer, Flag flags) : Region (other, offset, length, name, layer, flags), _fade_in (other->_fade_in), _fade_out (other->_fade_out), @@ -411,7 +411,7 @@ AudioRegion::get_memento() const } bool -AudioRegion::verify_length (jack_nframes_t len) +AudioRegion::verify_length (nframes_t len) { if (boost::dynamic_pointer_cast(source())) { return true; @@ -426,7 +426,7 @@ AudioRegion::verify_length (jack_nframes_t len) } bool -AudioRegion::verify_start_and_length (jack_nframes_t new_start, jack_nframes_t new_length) +AudioRegion::verify_start_and_length (nframes_t new_start, nframes_t new_length) { if (boost::dynamic_pointer_cast(source())) { return true; @@ -440,7 +440,7 @@ AudioRegion::verify_start_and_length (jack_nframes_t new_start, jack_nframes_t n return true; } bool -AudioRegion::verify_start (jack_nframes_t pos) +AudioRegion::verify_start (nframes_t pos) { if (boost::dynamic_pointer_cast(source())) { return true; @@ -455,7 +455,7 @@ AudioRegion::verify_start (jack_nframes_t pos) } bool -AudioRegion::verify_start_mutable (jack_nframes_t& new_start) +AudioRegion::verify_start_mutable (nframes_t& new_start) { if (boost::dynamic_pointer_cast(source())) { return true; @@ -488,8 +488,8 @@ AudioRegion::set_envelope_active (bool yn) } } -jack_nframes_t -AudioRegion::read_peaks (PeakData *buf, jack_nframes_t npeaks, jack_nframes_t offset, jack_nframes_t cnt, uint32_t chan_n, double samples_per_unit) const +nframes_t +AudioRegion::read_peaks (PeakData *buf, nframes_t npeaks, nframes_t offset, nframes_t cnt, uint32_t chan_n, double samples_per_unit) const { if (chan_n >= sources.size()) { return 0; @@ -499,7 +499,7 @@ AudioRegion::read_peaks (PeakData *buf, jack_nframes_t npeaks, jack_nframes_t of return 0; } else { if (_scale_amplitude != 1.0) { - for (jack_nframes_t n = 0; n < npeaks; ++n) { + for (nframes_t n = 0; n < npeaks; ++n) { buf[n].max *= _scale_amplitude; buf[n].min *= _scale_amplitude; } @@ -508,30 +508,30 @@ AudioRegion::read_peaks (PeakData *buf, jack_nframes_t npeaks, jack_nframes_t of } } -jack_nframes_t -AudioRegion::read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, jack_nframes_t position, - jack_nframes_t cnt, - uint32_t chan_n, jack_nframes_t read_frames, jack_nframes_t skip_frames) const +nframes_t +AudioRegion::read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, nframes_t position, + nframes_t cnt, + uint32_t chan_n, nframes_t read_frames, nframes_t skip_frames) const { return _read_at (sources, buf, mixdown_buffer, gain_buffer, position, cnt, chan_n, read_frames, skip_frames); } -jack_nframes_t -AudioRegion::master_read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, jack_nframes_t position, - jack_nframes_t cnt, uint32_t chan_n) const +nframes_t +AudioRegion::master_read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, nframes_t position, + nframes_t cnt, uint32_t chan_n) const { return _read_at (master_sources, buf, mixdown_buffer, gain_buffer, position, cnt, chan_n, 0, 0); } -jack_nframes_t +nframes_t AudioRegion::_read_at (const SourceList& srcs, Sample *buf, Sample *mixdown_buffer, float *gain_buffer, - jack_nframes_t position, jack_nframes_t cnt, - uint32_t chan_n, jack_nframes_t read_frames, jack_nframes_t skip_frames) const + nframes_t position, nframes_t cnt, + uint32_t chan_n, nframes_t read_frames, nframes_t skip_frames) const { - jack_nframes_t internal_offset; - jack_nframes_t buf_offset; - jack_nframes_t to_read; - + nframes_t internal_offset; + nframes_t buf_offset; + nframes_t to_read; + /* precondition: caller has verified that we cover the desired section */ if (chan_n >= sources.size()) { @@ -550,7 +550,6 @@ AudioRegion::_read_at (const SourceList& srcs, Sample *buf, Sample *mixdown_buff if (internal_offset >= _length) { return 0; /* read nothing */ } - if ((to_read = min (cnt, _length - internal_offset)) == 0) { return 0; /* read nothing */ @@ -579,19 +578,19 @@ AudioRegion::_read_at (const SourceList& srcs, Sample *buf, Sample *mixdown_buff if (_flags & FadeIn) { - jack_nframes_t fade_in_length = (jack_nframes_t) _fade_in.back()->when; + nframes_t fade_in_length = (nframes_t) _fade_in.back()->when; /* see if this read is within the fade in */ if (internal_offset < fade_in_length) { - jack_nframes_t limit; + nframes_t limit; limit = min (to_read, fade_in_length - internal_offset); _fade_in.get_vector (internal_offset, internal_offset+limit, gain_buffer, limit); - for (jack_nframes_t n = 0; n < limit; ++n) { + for (nframes_t n = 0; n < limit; ++n) { mixdown_buffer[n] *= gain_buffer[n]; } } @@ -601,9 +600,6 @@ AudioRegion::_read_at (const SourceList& srcs, Sample *buf, Sample *mixdown_buff if (_flags & FadeOut) { - - - /* see if some part of this read is within the fade out */ /* ................. >| REGION @@ -623,20 +619,20 @@ AudioRegion::_read_at (const SourceList& srcs, Sample *buf, Sample *mixdown_buff */ - jack_nframes_t fade_out_length = (jack_nframes_t) _fade_out.back()->when; - jack_nframes_t fade_interval_start = max(internal_offset, _length-fade_out_length); - jack_nframes_t fade_interval_end = min(internal_offset + to_read, _length); + nframes_t fade_out_length = (nframes_t) _fade_out.back()->when; + nframes_t fade_interval_start = max(internal_offset, _length-fade_out_length); + nframes_t fade_interval_end = min(internal_offset + to_read, _length); if (fade_interval_end > fade_interval_start) { /* (part of the) the fade out is in this buffer */ - jack_nframes_t limit = fade_interval_end - fade_interval_start; - jack_nframes_t curve_offset = fade_interval_start - (_length-fade_out_length); - jack_nframes_t fade_offset = fade_interval_start - internal_offset; + nframes_t limit = fade_interval_end - fade_interval_start; + nframes_t curve_offset = fade_interval_start - (_length-fade_out_length); + nframes_t fade_offset = fade_interval_start - internal_offset; _fade_out.get_vector (curve_offset,curve_offset+limit, gain_buffer, limit); - for (jack_nframes_t n = 0, m = fade_offset; n < limit; ++n, ++m) { + for (nframes_t n = 0, m = fade_offset; n < limit; ++n, ++m) { mixdown_buffer[m] *= gain_buffer[n]; } } @@ -649,11 +645,11 @@ AudioRegion::_read_at (const SourceList& srcs, Sample *buf, Sample *mixdown_buff _envelope.get_vector (internal_offset, internal_offset + to_read, gain_buffer, to_read); if (_scale_amplitude != 1.0f) { - for (jack_nframes_t n = 0; n < to_read; ++n) { + for (nframes_t n = 0; n < to_read; ++n) { mixdown_buffer[n] *= gain_buffer[n] * _scale_amplitude; } } else { - for (jack_nframes_t n = 0; n < to_read; ++n) { + for (nframes_t n = 0; n < to_read; ++n) { mixdown_buffer[n] *= gain_buffer[n]; } } @@ -668,7 +664,7 @@ AudioRegion::_read_at (const SourceList& srcs, Sample *buf, Sample *mixdown_buff buf += buf_offset; - for (jack_nframes_t n = 0; n < to_read; ++n) { + for (nframes_t n = 0; n < to_read; ++n) { buf[n] += mixdown_buffer[n]; } } @@ -822,17 +818,17 @@ AudioRegion::set_state (const XMLNode& node) void AudioRegion::set_fade_in_shape (FadeShape shape) { - set_fade_in (shape, (jack_nframes_t) _fade_in.back()->when); + set_fade_in (shape, (nframes_t) _fade_in.back()->when); } void AudioRegion::set_fade_out_shape (FadeShape shape) { - set_fade_out (shape, (jack_nframes_t) _fade_out.back()->when); + set_fade_out (shape, (nframes_t) _fade_out.back()->when); } void -AudioRegion::set_fade_in (FadeShape shape, jack_nframes_t len) +AudioRegion::set_fade_in (FadeShape shape, nframes_t len) { _fade_in.freeze (); _fade_in.clear (); @@ -896,7 +892,7 @@ AudioRegion::set_fade_in (FadeShape shape, jack_nframes_t len) } void -AudioRegion::set_fade_out (FadeShape shape, jack_nframes_t len) +AudioRegion::set_fade_out (FadeShape shape, nframes_t len) { _fade_out.freeze (); _fade_out.clear (); @@ -958,7 +954,7 @@ AudioRegion::set_fade_out (FadeShape shape, jack_nframes_t len) } void -AudioRegion::set_fade_in_length (jack_nframes_t len) +AudioRegion::set_fade_in_length (nframes_t len) { bool changed = _fade_in.extend_to (len); @@ -976,7 +972,7 @@ AudioRegion::set_fade_in_length (jack_nframes_t len) } void -AudioRegion::set_fade_out_length (jack_nframes_t len) +AudioRegion::set_fade_out_length (nframes_t len) { bool changed = _fade_out.extend_to (len); @@ -1174,8 +1170,8 @@ AudioRegion::apply (AudioFilter& filter) int AudioRegion::exportme (Session& session, AudioExportSpecification& spec) { - const jack_nframes_t blocksize = 4096; - jack_nframes_t to_read; + const nframes_t blocksize = 4096; + nframes_t to_read; int status = -1; spec.channels = sources.size(); @@ -1210,7 +1206,7 @@ AudioRegion::exportme (Session& session, AudioExportSpecification& spec) goto out; } - for (jack_nframes_t x = 0; x < to_read; ++x) { + for (nframes_t x = 0; x < to_read; ++x) { spec.dataF[chan+(x*spec.channels)] = buf[x]; } } @@ -1266,11 +1262,11 @@ AudioRegion::set_scale_amplitude (gain_t g) void AudioRegion::normalize_to (float target_dB) { - const jack_nframes_t blocksize = 64 * 1024; + const nframes_t blocksize = 64 * 1024; Sample buf[blocksize]; - jack_nframes_t fpos; - jack_nframes_t fend; - jack_nframes_t to_read; + nframes_t fpos; + nframes_t fend; + nframes_t to_read; double maxamp = 0; gain_t target = dB_to_coefficient (target_dB); @@ -1392,7 +1388,7 @@ AudioRegion::speed_mismatch (float sr) const void AudioRegion::source_offset_changed () { - if (boost::dynamic_pointer_cast (source())) { + if (boost::dynamic_pointer_cast(sources.front())) { set_start (source()->natural_position(), this); set_position (source()->natural_position(), this); } else { @@ -1404,7 +1400,7 @@ extern "C" { int region_read_peaks_from_c (void *arg, uint32_t npeaks, uint32_t start, uint32_t cnt, intptr_t data, uint32_t n_chan, double samples_per_unit) { - return ((AudioRegion *) arg)->read_peaks ((PeakData *) data, (jack_nframes_t) npeaks, (jack_nframes_t) start, (jack_nframes_t) cnt, n_chan,samples_per_unit); + return ((AudioRegion *) arg)->read_peaks ((PeakData *) data, (nframes_t) npeaks, (nframes_t) start, (nframes_t) cnt, n_chan,samples_per_unit); } uint32_t region_length_from_c (void *arg) diff --git a/libs/ardour/audiosource.cc b/libs/ardour/audiosource.cc index a8a7af6f9c..9aee818588 100644 --- a/libs/ardour/audiosource.cc +++ b/libs/ardour/audiosource.cc @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -296,6 +297,23 @@ AudioSource::peaks_ready (sigc::slot the_slot, sigc::connection& conn) con return ret; } +void +AudioSource::touch_peakfile () +{ + struct stat statbuf; + + if (stat (peakpath.c_str(), &statbuf) != 0 || statbuf.st_size == 0) { + return; + } + + struct utimbuf tbuf; + + tbuf.actime = statbuf.st_atime; + tbuf.modtime = time ((time_t) 0); + + utime (peakpath.c_str(), &tbuf); +} + int AudioSource::rename_peakfile (string newpath) { @@ -350,7 +368,6 @@ AudioSource::initialize_peakfile (bool newfile, string audio_path) error << string_compose(_("AudioSource: cannot stat peakfile \"%1\""), peakpath) << endmsg; return -1; } - } else { /* we found it in the peaks dir */ @@ -378,22 +395,22 @@ AudioSource::initialize_peakfile (bool newfile, string audio_path) return 0; } -jack_nframes_t -AudioSource::read (Sample *dst, jack_nframes_t start, jack_nframes_t cnt) const +nframes_t +AudioSource::read (Sample *dst, nframes_t start, nframes_t cnt) const { Glib::Mutex::Lock lm (_lock); return read_unlocked (dst, start, cnt); } -jack_nframes_t -AudioSource::write (Sample *dst, jack_nframes_t cnt) +nframes_t +AudioSource::write (Sample *dst, nframes_t cnt) { Glib::Mutex::Lock lm (_lock); return write_unlocked (dst, cnt); } int -AudioSource::read_peaks (PeakData *peaks, jack_nframes_t npeaks, jack_nframes_t start, jack_nframes_t cnt, double samples_per_visual_peak) const +AudioSource::read_peaks (PeakData *peaks, nframes_t npeaks, nframes_t start, nframes_t cnt, double samples_per_visual_peak) const { Glib::Mutex::Lock lm (_lock); double scale; @@ -402,7 +419,7 @@ AudioSource::read_peaks (PeakData *peaks, jack_nframes_t npeaks, jack_nframes_t PeakData::PeakDatum xmin; int32_t to_read; uint32_t nread; - jack_nframes_t zero_fill = 0; + nframes_t zero_fill = 0; int ret = -1; PeakData* staging = 0; Sample* raw_staging = 0; @@ -428,8 +445,8 @@ AudioSource::read_peaks (PeakData *peaks, jack_nframes_t npeaks, jack_nframes_t if (cnt > _length - start) { // cerr << "too close to end @ " << _length << " given " << start << " + " << cnt << endl; cnt = _length - start; - jack_nframes_t old = npeaks; - npeaks = min ((jack_nframes_t) floor (cnt / samples_per_visual_peak), npeaks); + nframes_t old = npeaks; + npeaks = min ((nframes_t) floor (cnt / samples_per_visual_peak), npeaks); zero_fill = old - npeaks; } @@ -437,7 +454,7 @@ AudioSource::read_peaks (PeakData *peaks, jack_nframes_t npeaks, jack_nframes_t if (npeaks == cnt) { - // cerr << "RAW DATA\n"; + cerr << "RAW DATA\n"; /* no scaling at all, just get the sample data and duplicate it for both max and min peak values. @@ -450,7 +467,7 @@ AudioSource::read_peaks (PeakData *peaks, jack_nframes_t npeaks, jack_nframes_t return -1; } - for (jack_nframes_t i = 0; i < npeaks; ++i) { + for (nframes_t i = 0; i < npeaks; ++i) { peaks[i].max = raw_staging[i]; peaks[i].min = raw_staging[i]; } @@ -499,7 +516,7 @@ AudioSource::read_peaks (PeakData *peaks, jack_nframes_t npeaks, jack_nframes_t } - jack_nframes_t tnp; + nframes_t tnp; if (scale < 1.0) { @@ -521,11 +538,11 @@ AudioSource::read_peaks (PeakData *peaks, jack_nframes_t npeaks, jack_nframes_t /* compute the rounded up frame position */ - jack_nframes_t current_frame = start; - jack_nframes_t current_stored_peak = (jack_nframes_t) ceil (current_frame / (double) frames_per_peak); + nframes_t current_frame = start; + nframes_t current_stored_peak = (nframes_t) ceil (current_frame / (double) frames_per_peak); uint32_t next_visual_peak = (uint32_t) ceil (current_frame / samples_per_visual_peak); double next_visual_peak_frame = next_visual_peak * samples_per_visual_peak; - uint32_t stored_peak_before_next_visual_peak = (jack_nframes_t) next_visual_peak_frame / frames_per_peak; + uint32_t stored_peak_before_next_visual_peak = (nframes_t) next_visual_peak_frame / frames_per_peak; uint32_t nvisual_peaks = 0; uint32_t stored_peaks_read = 0; uint32_t i = 0; @@ -546,7 +563,7 @@ AudioSource::read_peaks (PeakData *peaks, jack_nframes_t npeaks, jack_nframes_t if (i == stored_peaks_read) { uint32_t start_byte = current_stored_peak * sizeof(PeakData); - tnp = min ((_length/frames_per_peak - current_stored_peak), (jack_nframes_t) expected_peaks); + tnp = min ((_length/frames_per_peak - current_stored_peak), (nframes_t) expected_peaks); to_read = min (chunksize, tnp); off_t fend = lseek (peakfile, 0, SEEK_END); @@ -615,14 +632,14 @@ AudioSource::read_peaks (PeakData *peaks, jack_nframes_t npeaks, jack_nframes_t data on the fly. */ - jack_nframes_t frames_read = 0; - jack_nframes_t current_frame = start; - jack_nframes_t i = 0; - jack_nframes_t nvisual_peaks = 0; - jack_nframes_t chunksize = (jack_nframes_t) min (cnt, (jack_nframes_t) 4096); + nframes_t frames_read = 0; + nframes_t current_frame = start; + nframes_t i = 0; + nframes_t nvisual_peaks = 0; + nframes_t chunksize = (nframes_t) min (cnt, (nframes_t) 4096); raw_staging = new Sample[chunksize]; - jack_nframes_t frame_pos = start; + nframes_t frame_pos = start; double pixel_pos = floor (frame_pos / samples_per_visual_peak); double next_pixel_pos = ceil (frame_pos / samples_per_visual_peak); double pixels_per_frame = 1.0 / samples_per_visual_peak; @@ -635,7 +652,7 @@ AudioSource::read_peaks (PeakData *peaks, jack_nframes_t npeaks, jack_nframes_t if (i == frames_read) { to_read = min (chunksize, (_length - current_frame)); - + if ((frames_read = read_unlocked (raw_staging, current_frame, to_read)) == 0) { error << string_compose(_("AudioSource[%1]: peak read - cannot read %2 samples at offset %3") , _name, to_read, current_frame) @@ -745,15 +762,15 @@ AudioSource::build_peaks () } int -AudioSource::do_build_peak (jack_nframes_t first_frame, jack_nframes_t cnt) +AudioSource::do_build_peak (nframes_t first_frame, nframes_t cnt) { - jack_nframes_t current_frame; + nframes_t current_frame; Sample buf[frames_per_peak]; Sample xmin, xmax; uint32_t peaki; PeakData* peakbuf; - jack_nframes_t frames_read; - jack_nframes_t frames_to_read; + nframes_t frames_read; + nframes_t frames_to_read; off_t first_peak_byte; int peakfile = -1; int ret = -1; @@ -791,7 +808,7 @@ AudioSource::do_build_peak (jack_nframes_t first_frame, jack_nframes_t cnt) xmin = buf[0]; xmax = buf[0]; - for (jack_nframes_t n = 1; n < frames_read; ++n) { + for (nframes_t n = 1; n < frames_read; ++n) { xmax = max (xmax, buf[n]); xmin = min (xmin, buf[n]); @@ -849,7 +866,7 @@ AudioSource::file_changed (string path) } } -jack_nframes_t +nframes_t AudioSource::available_peaks (double zoom_factor) const { int peakfile; @@ -877,7 +894,7 @@ AudioSource::available_peaks (double zoom_factor) const } void -AudioSource::update_length (jack_nframes_t pos, jack_nframes_t cnt) +AudioSource::update_length (nframes_t pos, nframes_t cnt) { if (pos + cnt > _length) { _length = pos+cnt; diff --git a/libs/ardour/auditioner.cc b/libs/ardour/auditioner.cc index addb92bbca..7bf9f0542a 100644 --- a/libs/ardour/auditioner.cc +++ b/libs/ardour/auditioner.cc @@ -148,10 +148,10 @@ Auditioner::audition_region (boost::shared_ptr region) } int -Auditioner::play_audition (jack_nframes_t nframes) +Auditioner::play_audition (nframes_t nframes) { bool need_butler; - jack_nframes_t this_nframes; + nframes_t this_nframes; int ret; if (g_atomic_int_get (&_active) == 0) { diff --git a/libs/ardour/automation_event.cc b/libs/ardour/automation_event.cc index afdeecbbfe..f286b11607 100644 --- a/libs/ardour/automation_event.cc +++ b/libs/ardour/automation_event.cc @@ -1217,7 +1217,7 @@ AutomationList::store_state (XMLNode& node) const XMLNode *pointnode = new XMLNode ("point"); - snprintf (buf, sizeof (buf), "%" PRIu32, (jack_nframes_t) floor ((*i)->when)); + snprintf (buf, sizeof (buf), "%" PRIu32, (nframes_t) floor ((*i)->when)); pointnode->add_property ("x", buf); snprintf (buf, sizeof (buf), "%.12g", (*i)->value); pointnode->add_property ("y", buf); @@ -1232,7 +1232,7 @@ AutomationList::load_state (const XMLNode& node) const XMLNodeList& elist = node.children(); XMLNodeConstIterator i; XMLProperty* prop; - jack_nframes_t x; + nframes_t x; double y; clear (); diff --git a/libs/ardour/coreaudiosource.cc b/libs/ardour/coreaudiosource.cc index 049b5aabbe..448e9c0b32 100644 --- a/libs/ardour/coreaudiosource.cc +++ b/libs/ardour/coreaudiosource.cc @@ -105,8 +105,8 @@ CoreAudioSource::~CoreAudioSource () cerr << "deletion done" << endl; } -jack_nframes_t -CoreAudioSource::read_unlocked (Sample *dst, jack_nframes_t start, jack_nframes_t cnt) const +nframes_t +CoreAudioSource::read_unlocked (Sample *dst, nframes_t start, nframes_t cnt) const { try { af.Seek (start); @@ -188,7 +188,7 @@ CoreAudioSource::sample_rate() const } int -CoreAudioSource::update_header (jack_nframes_t when, struct tm&, time_t) +CoreAudioSource::update_header (nframes_t when, struct tm&, time_t) { return 0; } diff --git a/libs/ardour/crossfade.cc b/libs/ardour/crossfade.cc index fcd2158fd8..acf254e73a 100644 --- a/libs/ardour/crossfade.cc +++ b/libs/ardour/crossfade.cc @@ -35,7 +35,7 @@ using namespace std; using namespace ARDOUR; using namespace PBD; -jack_nframes_t Crossfade::_short_xfade_length = 0; +nframes_t Crossfade::_short_xfade_length = 0; Change Crossfade::ActiveChanged = new_change(); /* XXX if and when we ever implement parallel processing of the process() @@ -46,7 +46,7 @@ Sample* Crossfade::crossfade_buffer_out = 0; Sample* Crossfade::crossfade_buffer_in = 0; void -Crossfade::set_buffer_size (jack_nframes_t sz) +Crossfade::set_buffer_size (nframes_t sz) { if (crossfade_buffer_out) { delete [] crossfade_buffer_out; @@ -71,8 +71,8 @@ Crossfade::operator== (const Crossfade& other) } Crossfade::Crossfade (boost::shared_ptr in, boost::shared_ptr out, - jack_nframes_t length, - jack_nframes_t position, + nframes_t length, + nframes_t position, AnchorPoint ap) : _fade_in (0.0, 2.0, 1.0), // linear (gain coefficient) => -inf..+6dB _fade_out (0.0, 2.0, 1.0) // linear (gain coefficient) => -inf..+6dB @@ -240,7 +240,7 @@ Crossfade::compute (boost::shared_ptr a, boost::shared_ptr top; boost::shared_ptr bottom; - jack_nframes_t short_xfade_length; + nframes_t short_xfade_length; short_xfade_length = _short_xfade_length; @@ -400,13 +400,13 @@ Crossfade::compute (boost::shared_ptr a, boost::shared_ptr= _position) && (end <= my_end)) { return OverlapInternal; @@ -534,7 +534,7 @@ Crossfade::refresh () bool Crossfade::update (bool force) { - jack_nframes_t newlen; + nframes_t newlen; bool save = false; if (_follow_overlap) { @@ -700,7 +700,7 @@ Crossfade::get_state () pnode = new XMLNode ("point"); - snprintf (buf, sizeof (buf), "%" PRIu32, (jack_nframes_t) floor ((*ii)->when)); + snprintf (buf, sizeof (buf), "%" PRIu32, (nframes_t) floor ((*ii)->when)); pnode->add_property ("x", buf); snprintf (buf, sizeof (buf), "%.12g", (*ii)->value); pnode->add_property ("y", buf); @@ -714,7 +714,7 @@ Crossfade::get_state () pnode = new XMLNode ("point"); - snprintf (buf, sizeof (buf), "%" PRIu32, (jack_nframes_t) floor ((*ii)->when)); + snprintf (buf, sizeof (buf), "%" PRIu32, (nframes_t) floor ((*ii)->when)); pnode->add_property ("x", buf); snprintf (buf, sizeof (buf), "%.12g", (*ii)->value); pnode->add_property ("y", buf); @@ -796,7 +796,7 @@ Crossfade::set_state (const XMLNode& node) for (i = children.begin(); i != children.end(); ++i) { if ((*i)->name() == "point") { - jack_nframes_t x; + nframes_t x; float y; prop = (*i)->property ("x"); @@ -817,7 +817,7 @@ Crossfade::set_state (const XMLNode& node) for (i = children.begin(); i != children.end(); ++i) { if ((*i)->name() == "point") { - jack_nframes_t x; + nframes_t x; float y; XMLProperty* prop; @@ -856,10 +856,10 @@ Crossfade::set_follow_overlap (bool yn) } } -jack_nframes_t -Crossfade::set_length (jack_nframes_t len) +nframes_t +Crossfade::set_length (nframes_t len) { - jack_nframes_t limit; + nframes_t limit; switch (_anchor_point) { case StartOfIn: @@ -894,7 +894,7 @@ Crossfade::set_length (jack_nframes_t len) return len; } -jack_nframes_t +nframes_t Crossfade::overlap_length () const { if (_fixed) { @@ -904,7 +904,7 @@ Crossfade::overlap_length () const } void -Crossfade::set_short_xfade_length (jack_nframes_t n) +Crossfade::set_short_xfade_length (nframes_t n) { _short_xfade_length = n; } diff --git a/libs/ardour/default_click.cc b/libs/ardour/default_click.cc index d692af83ec..b4067a2051 100644 --- a/libs/ardour/default_click.cc +++ b/libs/ardour/default_click.cc @@ -556,7 +556,7 @@ const Sample Session::default_click_emphasis[] = { 0, 0, }; -const jack_nframes_t Session::default_click_emphasis_length = sizeof (default_click_emphasis) / sizeof (default_click_emphasis[0]); +const nframes_t Session::default_click_emphasis_length = sizeof (default_click_emphasis) / sizeof (default_click_emphasis[0]); const Sample Session::default_click[] = { 0, -0.014312744, -0.03338623, 0.019165039, 0.042541504, @@ -1172,4 +1172,4 @@ const Sample Session::default_click[] = { 0, 0, 0, 0, 0, 0, 0, 0, }; -const jack_nframes_t Session::default_click_length = sizeof (default_click) / sizeof (default_click[0]); +const nframes_t Session::default_click_length = sizeof (default_click) / sizeof (default_click[0]); diff --git a/libs/ardour/destructive_filesource.cc b/libs/ardour/destructive_filesource.cc index 1e57d88d70..3cd6586799 100644 --- a/libs/ardour/destructive_filesource.cc +++ b/libs/ardour/destructive_filesource.cc @@ -66,9 +66,9 @@ using namespace PBD; gain_t* DestructiveFileSource::out_coefficient = 0; gain_t* DestructiveFileSource::in_coefficient = 0; -jack_nframes_t DestructiveFileSource::xfade_frames = 64; +nframes_t DestructiveFileSource::xfade_frames = 64; -DestructiveFileSource::DestructiveFileSource (Session& s, string path, SampleFormat samp_format, HeaderFormat hdr_format, jack_nframes_t rate, Flag flags) +DestructiveFileSource::DestructiveFileSource (Session& s, string path, SampleFormat samp_format, HeaderFormat hdr_format, nframes_t rate, Flag flags) : SndFileSource (s, path, samp_format, hdr_format, rate, flags) { init (); @@ -106,13 +106,13 @@ DestructiveFileSource::~DestructiveFileSource() } void -DestructiveFileSource::setup_standard_crossfades (jack_nframes_t rate) +DestructiveFileSource::setup_standard_crossfades (nframes_t rate) { /* This static method is assumed to have been called by the Session before any DFS's are created. */ - xfade_frames = (jack_nframes_t) floor ((Config->get_destructive_xfade_msecs () / 1000.0) * rate); + xfade_frames = (nframes_t) floor ((Config->get_destructive_xfade_msecs () / 1000.0) * rate); if (out_coefficient) { delete [] out_coefficient; @@ -129,7 +129,7 @@ DestructiveFileSource::setup_standard_crossfades (jack_nframes_t rate) } void -DestructiveFileSource::mark_capture_start (jack_nframes_t pos) +DestructiveFileSource::mark_capture_start (nframes_t pos) { if (pos < timeline_position) { _capture_start = false; @@ -152,15 +152,15 @@ DestructiveFileSource::clear_capture_marks () _capture_end = false; } -jack_nframes_t -DestructiveFileSource::crossfade (Sample* data, jack_nframes_t cnt, int fade_in) +nframes_t +DestructiveFileSource::crossfade (Sample* data, nframes_t cnt, int fade_in) { - jack_nframes_t xfade = min (xfade_frames, cnt); - jack_nframes_t nofade = cnt - xfade; + nframes_t xfade = min (xfade_frames, cnt); + nframes_t nofade = cnt - xfade; Sample* fade_data = 0; - jack_nframes_t fade_position = 0; // in frames + nframes_t fade_position = 0; // in frames ssize_t retval; - jack_nframes_t file_cnt; + nframes_t file_cnt; if (fade_in) { fade_position = file_pos; @@ -190,6 +190,7 @@ DestructiveFileSource::crossfade (Sample* data, jack_nframes_t cnt, int fade_in) } if (file_cnt) { + if ((retval = read_unlocked (xfade_buf, fade_position, file_cnt)) != (ssize_t) file_cnt) { if (retval >= 0 && errno == EAGAIN) { /* XXX - can we really trust that errno is meaningful here? yes POSIX, i'm talking to you. @@ -203,12 +204,12 @@ DestructiveFileSource::crossfade (Sample* data, jack_nframes_t cnt, int fade_in) } if (file_cnt != xfade) { - jack_nframes_t delta = xfade - file_cnt; + nframes_t delta = xfade - file_cnt; memset (xfade_buf+file_cnt, 0, sizeof (Sample) * delta); } if (nofade && !fade_in) { - if (write_float (data, file_pos - timeline_position, nofade) != nofade) { + if (write_float (data, file_pos, nofade) != nofade) { error << string_compose(_("DestructiveFileSource: \"%1\" bad write (%2)"), _path, strerror (errno)) << endmsg; return 0; } @@ -216,7 +217,7 @@ DestructiveFileSource::crossfade (Sample* data, jack_nframes_t cnt, int fade_in) if (xfade == xfade_frames) { - jack_nframes_t n; + nframes_t n; /* use the standard xfade curve */ @@ -247,20 +248,20 @@ DestructiveFileSource::crossfade (Sample* data, jack_nframes_t cnt, int fade_in) compute_equal_power_fades (xfade, in, out); - for (jack_nframes_t n = 0; n < xfade; ++n) { + for (nframes_t n = 0; n < xfade; ++n) { xfade_buf[n] = (xfade_buf[n] * out[n]) + (fade_data[n] * in[n]); } } if (xfade) { - if (write_float (xfade_buf, fade_position - timeline_position, xfade) != xfade) { + if (write_float (xfade_buf, fade_position, xfade) != xfade) { error << string_compose(_("DestructiveFileSource: \"%1\" bad write (%2)"), _path, strerror (errno)) << endmsg; return 0; } } if (fade_in && nofade) { - if (write_float (data + xfade, file_pos + xfade - timeline_position, nofade) != nofade) { + if (write_float (data + xfade, file_pos + xfade, nofade) != nofade) { error << string_compose(_("DestructiveFileSource: \"%1\" bad write (%2)"), _path, strerror (errno)) << endmsg; return 0; } @@ -269,10 +270,10 @@ DestructiveFileSource::crossfade (Sample* data, jack_nframes_t cnt, int fade_in) return cnt; } -jack_nframes_t -DestructiveFileSource::write_unlocked (Sample* data, jack_nframes_t cnt) +nframes_t +DestructiveFileSource::write_unlocked (Sample* data, nframes_t cnt) { - jack_nframes_t old_file_pos; + nframes_t old_file_pos; if (!writable()) { return 0; @@ -291,8 +292,8 @@ DestructiveFileSource::write_unlocked (Sample* data, jack_nframes_t cnt) file_pos = capture_start_frame; // split cnt in half - jack_nframes_t subcnt = cnt / 2; - jack_nframes_t ofilepos = file_pos; + nframes_t subcnt = cnt / 2; + nframes_t ofilepos = file_pos; // fade in if (crossfade (data, subcnt, 1) != subcnt) { @@ -320,8 +321,8 @@ DestructiveFileSource::write_unlocked (Sample* data, jack_nframes_t cnt) _capture_end = false; /* move to the correct location place */ - file_pos = capture_start_frame; - + file_pos = capture_start_frame - timeline_position; + if (crossfade (data, cnt, 1) != cnt) { return 0; } @@ -343,7 +344,8 @@ DestructiveFileSource::write_unlocked (Sample* data, jack_nframes_t cnt) /* in the middle of recording */ - if (write_float (data, file_pos - timeline_position, cnt) != cnt) { + + if (write_float (data, file_pos, cnt) != cnt) { return 0; } } @@ -380,7 +382,7 @@ DestructiveFileSource::write_unlocked (Sample* data, jack_nframes_t cnt) return cnt; } -jack_nframes_t +nframes_t DestructiveFileSource::last_capture_start_frame () const { return capture_start_frame; @@ -407,7 +409,7 @@ DestructiveFileSource::handle_header_position_change () } void -DestructiveFileSource::set_timeline_position (jack_nframes_t pos) +DestructiveFileSource::set_timeline_position (nframes_t pos) { //destructive track timeline postion does not change except at instantion or when header_position_offset (session start) changes } diff --git a/libs/ardour/diskstream.cc b/libs/ardour/diskstream.cc index 3f89af312e..4f6515d076 100644 --- a/libs/ardour/diskstream.cc +++ b/libs/ardour/diskstream.cc @@ -63,7 +63,7 @@ using namespace PBD; * default from configuration_vars.h). 0 is not a good value for * allocating buffer sizes.. */ -jack_nframes_t Diskstream::disk_io_chunk_frames = 1024 * 256; +nframes_t Diskstream::disk_io_chunk_frames = 1024 * 256; sigc::signal >*> Diskstream::DeleteSources; sigc::signal Diskstream::DiskOverrun; @@ -168,7 +168,7 @@ Diskstream::non_realtime_set_speed () if (_seek_required) { if (speed() != 1.0f || speed() != -1.0f) { - seek ((jack_nframes_t) (_session.transport_frame() * (double) speed()), true); + seek ((nframes_t) (_session.transport_frame() * (double) speed()), true); } else { seek (_session.transport_frame(), true); @@ -191,7 +191,7 @@ Diskstream::realtime_set_speed (double sp, bool global) if (new_speed != _actual_speed) { - jack_nframes_t required_wrap_size = (jack_nframes_t) floor (_session.get_block_size() * + nframes_t required_wrap_size = (nframes_t) floor (_session.get_block_size() * fabs (new_speed)) + 1; if (required_wrap_size > wrap_buffer_size) { @@ -266,7 +266,7 @@ Diskstream::set_loop (Location *location) return 0; } -jack_nframes_t +nframes_t Diskstream::get_capture_start_frame (uint32_t n) { Glib::Mutex::Lock lm (capture_info_lock); @@ -279,7 +279,7 @@ Diskstream::get_capture_start_frame (uint32_t n) } } -jack_nframes_t +nframes_t Diskstream::get_captured_frames (uint32_t n) { Glib::Mutex::Lock lm (capture_info_lock); @@ -293,7 +293,7 @@ Diskstream::get_captured_frames (uint32_t n) } void -Diskstream::set_roll_delay (jack_nframes_t nframes) +Diskstream::set_roll_delay (nframes_t nframes) { _roll_delay = nframes; } diff --git a/libs/ardour/gain.cc b/libs/ardour/gain.cc index d6fd464208..0b77bea279 100644 --- a/libs/ardour/gain.cc +++ b/libs/ardour/gain.cc @@ -42,21 +42,21 @@ Gain::operator= (const Gain& other) } void -Gain::fill_linear_volume_fade_in (Gain& gain, jack_nframes_t frames) +Gain::fill_linear_volume_fade_in (Gain& gain, nframes_t frames) { } void -Gain::fill_linear_volume_fade_out (Gain& gain, jack_nframes_t frames) +Gain::fill_linear_volume_fade_out (Gain& gain, nframes_t frames) { } void -Gain::fill_linear_fade_in (Gain& gain, jack_nframes_t frames) +Gain::fill_linear_fade_in (Gain& gain, nframes_t frames) { } void -Gain::fill_linear_fade_out (Gain& gain, jack_nframes_t frames) +Gain::fill_linear_fade_out (Gain& gain, nframes_t frames) { } diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc index c9c244ca3c..91aa95ba31 100644 --- a/libs/ardour/globals.cc +++ b/libs/ardour/globals.cc @@ -494,8 +494,8 @@ ARDOUR::LocaleGuard::~LocaleGuard () } ARDOUR::OverlapType -ARDOUR::coverage (jack_nframes_t sa, jack_nframes_t ea, - jack_nframes_t sb, jack_nframes_t eb) +ARDOUR::coverage (nframes_t sa, nframes_t ea, + nframes_t sb, nframes_t eb) { /* OverlapType returned reflects how the second (B) range overlaps the first (A). diff --git a/libs/ardour/import.cc b/libs/ardour/import.cc index 5b97407207..2d409e11f7 100644 --- a/libs/ardour/import.cc +++ b/libs/ardour/import.cc @@ -64,7 +64,7 @@ Session::import_audiofile (import_status& status) long n; string basepath; string sounds_dir; - jack_nframes_t so_far; + nframes_t so_far; char buf[PATH_MAX+1]; int ret = -1; vector new_paths; diff --git a/libs/ardour/insert.cc b/libs/ardour/insert.cc index 1c3ce510f3..d955588c44 100644 --- a/libs/ardour/insert.cc +++ b/libs/ardour/insert.cc @@ -253,7 +253,7 @@ PluginInsert::parameter_changed (uint32_t which, float val) } void -PluginInsert::set_block_size (jack_nframes_t nframes) +PluginInsert::set_block_size (nframes_t nframes) { for (vector >::iterator i = _plugins.begin(); i != _plugins.end(); ++i) { (*i)->set_block_size (nframes); @@ -277,7 +277,7 @@ PluginInsert::deactivate () } void -PluginInsert::connect_and_run (vector& bufs, uint32_t nbufs, jack_nframes_t nframes, jack_nframes_t offset, bool with_auto, jack_nframes_t now) +PluginInsert::connect_and_run (vector& bufs, uint32_t nbufs, nframes_t nframes, nframes_t offset, bool with_auto, nframes_t now) { int32_t in_index = 0; int32_t out_index = 0; @@ -317,7 +317,7 @@ PluginInsert::connect_and_run (vector& bufs, uint32_t nbufs, jack_nfram } void -PluginInsert::automation_snapshot (jack_nframes_t now) +PluginInsert::automation_snapshot (nframes_t now) { map::iterator li; @@ -334,7 +334,7 @@ PluginInsert::automation_snapshot (jack_nframes_t now) } void -PluginInsert::transport_stopped (jack_nframes_t now) +PluginInsert::transport_stopped (nframes_t now) { map::iterator li; @@ -349,7 +349,7 @@ PluginInsert::transport_stopped (jack_nframes_t now) } void -PluginInsert::silence (jack_nframes_t nframes, jack_nframes_t offset) +PluginInsert::silence (nframes_t nframes, nframes_t offset) { int32_t in_index = 0; int32_t out_index = 0; @@ -365,7 +365,7 @@ PluginInsert::silence (jack_nframes_t nframes, jack_nframes_t offset) } void -PluginInsert::run (vector& bufs, uint32_t nbufs, jack_nframes_t nframes, jack_nframes_t offset) +PluginInsert::run (vector& bufs, uint32_t nbufs, nframes_t nframes, nframes_t offset) { if (active()) { @@ -404,11 +404,11 @@ PluginInsert::set_parameter (uint32_t port, float val) } void -PluginInsert::automation_run (vector& bufs, uint32_t nbufs, jack_nframes_t nframes, jack_nframes_t offset) +PluginInsert::automation_run (vector& bufs, uint32_t nbufs, nframes_t nframes, nframes_t offset) { ControlEvent next_event (0, 0.0f); - jack_nframes_t now = _session.transport_frame (); - jack_nframes_t end = now + nframes; + nframes_t now = _session.transport_frame (); + nframes_t end = now + nframes; Glib::Mutex::Lock lm (_automation_lock, Glib::TRY_LOCK); @@ -427,7 +427,7 @@ PluginInsert::automation_run (vector& bufs, uint32_t nbufs, jack_nfram while (nframes) { - jack_nframes_t cnt = min (((jack_nframes_t) floor (next_event.when) - now), nframes); + nframes_t cnt = min (((nframes_t) floor (next_event.when) - now), nframes); connect_and_run (bufs, nbufs, cnt, offset, true, now); @@ -787,7 +787,7 @@ PluginInsert::describe_parameter (uint32_t what) return _plugins[0]->describe_parameter (what); } -jack_nframes_t +nframes_t PluginInsert::latency() { return _plugins[0]->latency (); @@ -901,7 +901,7 @@ PortInsert::~PortInsert () } void -PortInsert::run (vector& bufs, uint32_t nbufs, jack_nframes_t nframes, jack_nframes_t offset) +PortInsert::run (vector& bufs, uint32_t nbufs, nframes_t nframes, nframes_t offset) { if (n_outputs() == 0) { return; @@ -981,7 +981,7 @@ PortInsert::set_state(const XMLNode& node) return 0; } -jack_nframes_t +nframes_t PortInsert::latency() { /* because we deliver and collect within the same cycle, diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc index b6bff35c89..f38f938675 100644 --- a/libs/ardour/io.cc +++ b/libs/ardour/io.cc @@ -61,7 +61,7 @@ using namespace PBD; static float current_automation_version_number = 1.0; -jack_nframes_t IO::_automation_interval = 0; +nframes_t IO::_automation_interval = 0; const string IO::state_node_name = "IO"; bool IO::connecting_legal = false; bool IO::ports_legal = false; @@ -160,7 +160,7 @@ IO::~IO () } void -IO::silence (jack_nframes_t nframes, jack_nframes_t offset) +IO::silence (nframes_t nframes, nframes_t offset) { /* io_lock, not taken: function must be called from Session::process() calltree */ @@ -170,9 +170,9 @@ IO::silence (jack_nframes_t nframes, jack_nframes_t offset) } void -IO::apply_declick (vector& bufs, uint32_t nbufs, jack_nframes_t nframes, gain_t initial, gain_t target, bool invert_polarity) +IO::apply_declick (vector& bufs, uint32_t nbufs, nframes_t nframes, gain_t initial, gain_t target, bool invert_polarity) { - jack_nframes_t declick = min ((jack_nframes_t)128, nframes); + nframes_t declick = min ((nframes_t)128, nframes); gain_t delta; Sample *buffer; double fractional_shift; @@ -196,7 +196,7 @@ IO::apply_declick (vector& bufs, uint32_t nbufs, jack_nframes_t nframe buffer = bufs[n]; fractional_pos = 1.0; - for (jack_nframes_t nx = 0; nx < declick; ++nx) { + for (nframes_t nx = 0; nx < declick; ++nx) { buffer[nx] *= polscale * (initial + (delta * (0.5 + 0.5 * cos (M_PI * fractional_pos)))); fractional_pos += fractional_shift; } @@ -217,7 +217,7 @@ IO::apply_declick (vector& bufs, uint32_t nbufs, jack_nframes_t nframe if (this_target == 0.0) { memset (&buffer[declick], 0, sizeof (Sample) * (nframes - declick)); } else if (this_target != 1.0) { - for (jack_nframes_t nx = declick; nx < nframes; ++nx) { + for (nframes_t nx = declick; nx < nframes; ++nx) { buffer[nx] *= this_target; } } @@ -226,7 +226,7 @@ IO::apply_declick (vector& bufs, uint32_t nbufs, jack_nframes_t nframe } void -IO::pan_automated (vector& bufs, uint32_t nbufs, jack_nframes_t start, jack_nframes_t end, jack_nframes_t nframes, jack_nframes_t offset) +IO::pan_automated (vector& bufs, uint32_t nbufs, nframes_t start, nframes_t end, nframes_t nframes, nframes_t offset) { Sample* dst; @@ -273,7 +273,7 @@ IO::pan_automated (vector& bufs, uint32_t nbufs, jack_nframes_t start, } void -IO::pan (vector& bufs, uint32_t nbufs, jack_nframes_t nframes, jack_nframes_t offset, gain_t gain_coeff) +IO::pan (vector& bufs, uint32_t nbufs, nframes_t nframes, nframes_t offset, gain_t gain_coeff) { Sample* dst; Sample* src; @@ -314,7 +314,7 @@ IO::pan (vector& bufs, uint32_t nbufs, jack_nframes_t nframes, jack_nfr for (n = 1; n < nbufs; ++n) { src = bufs[n]; - for (jack_nframes_t n = 0; n < nframes; ++n) { + for (nframes_t n = 0; n < nframes; ++n) { dst[n] += src[n]; } } @@ -329,14 +329,14 @@ IO::pan (vector& bufs, uint32_t nbufs, jack_nframes_t nframes, jack_nfr src = bufs[0]; - for (jack_nframes_t n = 0; n < nframes; ++n) { + for (nframes_t n = 0; n < nframes; ++n) { dst[n] = src[n] * gain_coeff; } for (n = 1; n < nbufs; ++n) { src = bufs[n]; - for (jack_nframes_t n = 0; n < nframes; ++n) { + for (nframes_t n = 0; n < nframes; ++n) { dst[n] += src[n] * gain_coeff; } } @@ -380,7 +380,7 @@ IO::pan (vector& bufs, uint32_t nbufs, jack_nframes_t nframes, jack_nfr } void -IO::deliver_output (vector& bufs, uint32_t nbufs, jack_nframes_t nframes, jack_nframes_t offset) +IO::deliver_output (vector& bufs, uint32_t nbufs, nframes_t nframes, nframes_t offset) { /* io_lock, not taken: function must be called from Session::process() calltree */ @@ -423,7 +423,7 @@ IO::deliver_output (vector& bufs, uint32_t nbufs, jack_nframes_t nfram } void -IO::deliver_output_no_pan (vector& bufs, uint32_t nbufs, jack_nframes_t nframes, jack_nframes_t offset) +IO::deliver_output_no_pan (vector& bufs, uint32_t nbufs, nframes_t nframes, nframes_t offset) { /* io_lock, not taken: function must be called from Session::process() calltree */ @@ -488,7 +488,7 @@ IO::deliver_output_no_pan (vector& bufs, uint32_t nbufs, jack_nframes_ } else if (actual_gain == 0.0f) { memset (dst, 0, sizeof (Sample) * nframes); } else { - for (jack_nframes_t x = 0; x < nframes; ++x) { + for (nframes_t x = 0; x < nframes; ++x) { dst[x] = src[x] * actual_gain; } } @@ -507,7 +507,7 @@ IO::deliver_output_no_pan (vector& bufs, uint32_t nbufs, jack_nframes_ } void -IO::collect_input (vector& bufs, uint32_t nbufs, jack_nframes_t nframes, jack_nframes_t offset) +IO::collect_input (vector& bufs, uint32_t nbufs, nframes_t nframes, nframes_t offset) { /* io_lock, not taken: function must be called from Session::process() calltree */ @@ -547,8 +547,8 @@ IO::collect_input (vector& bufs, uint32_t nbufs, jack_nframes_t nframe } void -IO::just_meter_input (jack_nframes_t start_frame, jack_nframes_t end_frame, - jack_nframes_t nframes, jack_nframes_t offset) +IO::just_meter_input (nframes_t start_frame, nframes_t end_frame, + nframes_t nframes, nframes_t offset) { vector& bufs = _session.get_passthru_buffers (); uint32_t nbufs = n_process_buffers (); @@ -2005,7 +2005,7 @@ IO::set_output_maximum (int n) } void -IO::set_port_latency (jack_nframes_t nframes) +IO::set_port_latency (nframes_t nframes) { Glib::Mutex::Lock lm (io_lock); @@ -2014,11 +2014,11 @@ IO::set_port_latency (jack_nframes_t nframes) } } -jack_nframes_t +nframes_t IO::output_latency () const { - jack_nframes_t max_latency; - jack_nframes_t latency; + nframes_t max_latency; + nframes_t latency; max_latency = 0; @@ -2033,11 +2033,11 @@ IO::output_latency () const return max_latency; } -jack_nframes_t +nframes_t IO::input_latency () const { - jack_nframes_t max_latency; - jack_nframes_t latency; + nframes_t max_latency; + nframes_t latency; max_latency = 0; @@ -2397,7 +2397,7 @@ IO::save_automation (const string& path) /* XXX use apply_to_points to get thread safety */ for (AutomationList::iterator i = _gain_automation_curve.begin(); i != _gain_automation_curve.end(); ++i) { - out << "g " << (jack_nframes_t) floor ((*i)->when) << ' ' << (*i)->value << endl; + out << "g " << (nframes_t) floor ((*i)->when) << ' ' << (*i)->value << endl; } _panner->save (); @@ -2436,7 +2436,7 @@ IO::load_automation (const string& path) while (in.getline (line, sizeof(line), '\n')) { char type; - jack_nframes_t when; + nframes_t when; double value; if (++linecnt == 1) { @@ -2605,7 +2605,7 @@ IO::end_pan_touch (uint32_t which) } void -IO::automation_snapshot (jack_nframes_t now) +IO::automation_snapshot (nframes_t now) { if (last_automation_snapshot > now || (now - last_automation_snapshot) > _automation_interval) { @@ -2620,7 +2620,7 @@ IO::automation_snapshot (jack_nframes_t now) } void -IO::transport_stopped (jack_nframes_t frame) +IO::transport_stopped (nframes_t frame) { _gain_automation_curve.reposition_for_rt_add (frame); diff --git a/libs/ardour/jack_slave.cc b/libs/ardour/jack_slave.cc index 352bcaeee5..2e03b2f45d 100644 --- a/libs/ardour/jack_slave.cc +++ b/libs/ardour/jack_slave.cc @@ -36,7 +36,7 @@ JACK_Slave::JACK_Slave (jack_client_t* j) : jack (j) { float x; - jack_nframes_t p; + nframes_t p; /* call this to initialize things */ speed_and_position (x, p); } @@ -58,7 +58,7 @@ JACK_Slave::ok() const } bool -JACK_Slave::speed_and_position (float& sp, jack_nframes_t& position) +JACK_Slave::speed_and_position (float& sp, nframes_t& position) { jack_position_t pos; jack_transport_state_t state; diff --git a/libs/ardour/ladspa_plugin.cc b/libs/ardour/ladspa_plugin.cc index 310931102d..0744a62db4 100644 --- a/libs/ardour/ladspa_plugin.cc +++ b/libs/ardour/ladspa_plugin.cc @@ -51,7 +51,7 @@ using namespace std; using namespace ARDOUR; using namespace PBD; -LadspaPlugin::LadspaPlugin (void *mod, AudioEngine& e, Session& session, uint32_t index, jack_nframes_t rate) +LadspaPlugin::LadspaPlugin (void *mod, AudioEngine& e, Session& session, uint32_t index, nframes_t rate) : Plugin (e, session) { init (mod, index, rate); @@ -69,7 +69,7 @@ LadspaPlugin::LadspaPlugin (const LadspaPlugin &other) } void -LadspaPlugin::init (void *mod, uint32_t index, jack_nframes_t rate) +LadspaPlugin::init (void *mod, uint32_t index, nframes_t rate) { LADSPA_Descriptor_Function dfunc; uint32_t i, port_cnt; @@ -489,11 +489,11 @@ LadspaPlugin::describe_parameter (uint32_t which) } } -jack_nframes_t +nframes_t LadspaPlugin::latency () const { if (latency_control_port) { - return (jack_nframes_t) floor (*latency_control_port); + return (nframes_t) floor (*latency_control_port); } else { return 0; } @@ -516,7 +516,7 @@ LadspaPlugin::automatable () const } int -LadspaPlugin::connect_and_run (vector& bufs, uint32_t nbufs, int32_t& in_index, int32_t& out_index, jack_nframes_t nframes, jack_nframes_t offset) +LadspaPlugin::connect_and_run (vector& bufs, uint32_t nbufs, int32_t& in_index, int32_t& out_index, nframes_t nframes, nframes_t offset) { uint32_t port_index; cycles_t then, now; @@ -588,7 +588,7 @@ LadspaPlugin::print_parameter (uint32_t param, char *buf, uint32_t len) const } void -LadspaPlugin::run (jack_nframes_t nframes) +LadspaPlugin::run (nframes_t nframes) { for (uint32_t i = 0; i < parameter_count(); ++i) { if (LADSPA_IS_PORT_INPUT(port_descriptor (i)) && LADSPA_IS_PORT_CONTROL(port_descriptor (i))) { @@ -614,7 +614,7 @@ LadspaPlugin::latency_compute_run () uint32_t port_index = 0; uint32_t in_index = 0; uint32_t out_index = 0; - const jack_nframes_t bufsize = 1024; + const nframes_t bufsize = 1024; LADSPA_Data buffer[bufsize]; memset(buffer,0,sizeof(LADSPA_Data)*bufsize); diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc index 6b3ea6f220..5716d9fad5 100644 --- a/libs/ardour/location.cc +++ b/libs/ardour/location.cc @@ -77,7 +77,7 @@ Location::operator= (const Location& other) } int -Location::set_start (jack_nframes_t s) +Location::set_start (nframes_t s) { if (is_mark()) { if (_start != s) { @@ -113,7 +113,7 @@ Location::set_start (jack_nframes_t s) } int -Location::set_end (jack_nframes_t e) +Location::set_end (nframes_t e) { if (is_mark()) { if (_start != e) { @@ -136,7 +136,7 @@ Location::set_end (jack_nframes_t e) } int -Location::set (jack_nframes_t start, jack_nframes_t end) +Location::set (nframes_t start, nframes_t end) { if (is_mark() && start != end) { return -1; @@ -644,7 +644,7 @@ struct LocationStartLaterComparison }; Location * -Locations::first_location_before (jack_nframes_t frame) +Locations::first_location_before (nframes_t frame) { LocationList locs; @@ -668,7 +668,7 @@ Locations::first_location_before (jack_nframes_t frame) } Location * -Locations::first_location_after (jack_nframes_t frame) +Locations::first_location_after (nframes_t frame) { LocationList locs; @@ -691,8 +691,8 @@ Locations::first_location_after (jack_nframes_t frame) return 0; } -jack_nframes_t -Locations::first_mark_before (jack_nframes_t frame) +nframes_t +Locations::first_mark_before (nframes_t frame) { LocationList locs; @@ -728,8 +728,8 @@ Locations::first_mark_before (jack_nframes_t frame) return 0; } -jack_nframes_t -Locations::first_mark_after (jack_nframes_t frame) +nframes_t +Locations::first_mark_after (nframes_t frame) { LocationList locs; diff --git a/libs/ardour/mix.cc b/libs/ardour/mix.cc index c6e234d87b..6b7755e498 100644 --- a/libs/ardour/mix.cc +++ b/libs/ardour/mix.cc @@ -29,7 +29,7 @@ // Debug wrappers float -debug_compute_peak (ARDOUR::Sample *buf, jack_nframes_t nsamples, float current) +debug_compute_peak (ARDOUR::Sample *buf, nframes_t nsamples, float current) { if ( ((intptr_t)buf % 16) != 0) { cerr << "compute_peak(): buffer unaligned!" << endl; @@ -39,7 +39,7 @@ debug_compute_peak (ARDOUR::Sample *buf, jack_nframes_t nsamples, float current) } void -debug_apply_gain_to_buffer (ARDOUR::Sample *buf, jack_nframes_t nframes, float gain) +debug_apply_gain_to_buffer (ARDOUR::Sample *buf, nframes_t nframes, float gain) { if ( ((intptr_t)buf % 16) != 0) { cerr << "apply_gain_to_buffer(): buffer unaligned!" << endl; @@ -49,7 +49,7 @@ debug_apply_gain_to_buffer (ARDOUR::Sample *buf, jack_nframes_t nframes, float g } void -debug_mix_buffers_with_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, jack_nframes_t nframes, float gain) +debug_mix_buffers_with_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, nframes_t nframes, float gain) { if ( ((intptr_t)dst & 15) != 0) { cerr << "mix_buffers_with_gain(): dst unaligned!" << endl; @@ -64,7 +64,7 @@ debug_mix_buffers_with_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, jack_nfra } void -debug_mix_buffers_no_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, jack_nframes_t nframes) +debug_mix_buffers_no_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, nframes_t nframes) { if ( ((intptr_t)dst & 15) != 0) { cerr << "mix_buffers_no_gain(): dst unaligned!" << endl; @@ -82,9 +82,9 @@ debug_mix_buffers_no_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, jack_nframe float -compute_peak (ARDOUR::Sample *buf, jack_nframes_t nsamples, float current) +compute_peak (ARDOUR::Sample *buf, nframes_t nsamples, float current) { - for (jack_nframes_t i = 0; i < nsamples; ++i) { + for (nframes_t i = 0; i < nsamples; ++i) { current = f_max (current, fabsf (buf[i])); } @@ -92,24 +92,24 @@ compute_peak (ARDOUR::Sample *buf, jack_nframes_t nsamples, float current) } void -apply_gain_to_buffer (ARDOUR::Sample *buf, jack_nframes_t nframes, float gain) +apply_gain_to_buffer (ARDOUR::Sample *buf, nframes_t nframes, float gain) { - for (jack_nframes_t i=0; i float -veclib_compute_peak (ARDOUR::Sample *buf, jack_nframes_t nsamples, float current) +veclib_compute_peak (ARDOUR::Sample *buf, nframes_t nsamples, float current) { float tmpmax = 0.0f; vDSP_maxmgv(buf, 1, &tmpmax, nsamples); @@ -126,19 +126,19 @@ veclib_compute_peak (ARDOUR::Sample *buf, jack_nframes_t nsamples, float current } void -veclib_apply_gain_to_buffer (ARDOUR::Sample *buf, jack_nframes_t nframes, float gain) +veclib_apply_gain_to_buffer (ARDOUR::Sample *buf, nframes_t nframes, float gain) { vDSP_vsmul(buf, 1, &gain, buf, 1, nframes); } void -veclib_mix_buffers_with_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, jack_nframes_t nframes, float gain) +veclib_mix_buffers_with_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, nframes_t nframes, float gain) { vDSP_vsma(src, 1, &gain, dst, 1, dst, 1, nframes); } void -veclib_mix_buffers_no_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, jack_nframes_t nframes) +veclib_mix_buffers_no_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, nframes_t nframes) { // It seems that a vector mult only operation does not exist... float gain = 1.0f; diff --git a/libs/ardour/mtc_slave.cc b/libs/ardour/mtc_slave.cc index 32642d570d..0caa86196a 100644 --- a/libs/ardour/mtc_slave.cc +++ b/libs/ardour/mtc_slave.cc @@ -68,8 +68,8 @@ void MTC_Slave::update_mtc_qtr (Parser& p) { cycles_t cnow = get_cycles (); - jack_nframes_t now = session.engine().frame_time(); - jack_nframes_t qtr; + nframes_t now = session.engine().frame_time(); + nframes_t qtr; static cycles_t last_qtr = 0; qtr = (long) (session.frames_per_smpte_frame() / 4); @@ -87,7 +87,7 @@ MTC_Slave::update_mtc_qtr (Parser& p) void MTC_Slave::update_mtc_time (const byte *msg, bool was_full) { - jack_nframes_t now = session.engine().frame_time(); + nframes_t now = session.engine().frame_time(); SMPTE::Time smpte; smpte.hours = msg[3]; @@ -217,12 +217,12 @@ MTC_Slave::ok() const } bool -MTC_Slave::speed_and_position (float& speed, jack_nframes_t& pos) +MTC_Slave::speed_and_position (float& speed, nframes_t& pos) { - jack_nframes_t now = session.engine().frame_time(); + nframes_t now = session.engine().frame_time(); SafeTime last; - jack_nframes_t frame_rate; - jack_nframes_t elapsed; + nframes_t frame_rate; + nframes_t elapsed; float speed_now; read_current (&last); @@ -279,7 +279,7 @@ MTC_Slave::speed_and_position (float& speed, jack_nframes_t& pos) /* scale elapsed time by the current MTC speed */ if (last.timestamp && (now > last.timestamp)) { - elapsed = (jack_nframes_t) floor (mtc_speed * (now - last.timestamp)); + elapsed = (nframes_t) floor (mtc_speed * (now - last.timestamp)); } else { elapsed = 0; /* XXX is this right? */ } @@ -293,10 +293,10 @@ MTC_Slave::speed_and_position (float& speed, jack_nframes_t& pos) return true; } -jack_nframes_t +nframes_t MTC_Slave::resolution() const { - return (jack_nframes_t) session.frames_per_smpte_frame(); + return (nframes_t) session.frames_per_smpte_frame(); } void diff --git a/libs/ardour/panner.cc b/libs/ardour/panner.cc index c93deb8df9..257a21fe58 100644 --- a/libs/ardour/panner.cc +++ b/libs/ardour/panner.cc @@ -193,7 +193,7 @@ BaseStereoPanner::~BaseStereoPanner () } void -BaseStereoPanner::snapshot (jack_nframes_t now) +BaseStereoPanner::snapshot (nframes_t now) { if (_automation.automation_state() == Write || _automation.automation_state() == Touch) { _automation.rt_add (now, x); @@ -201,7 +201,7 @@ BaseStereoPanner::snapshot (jack_nframes_t now) } void -BaseStereoPanner::transport_stopped (jack_nframes_t frame) +BaseStereoPanner::transport_stopped (nframes_t frame) { _automation.reposition_for_rt_add (frame); @@ -246,7 +246,7 @@ BaseStereoPanner::save (ostream& out) const out << "begin" << endl; for (AutomationList::const_iterator i = _automation.const_begin(); i != _automation.const_end(); ++i) { - out << '\t' << (jack_nframes_t) floor ((*i)->when) << ' ' << (*i)->value << endl; + out << '\t' << (nframes_t) floor ((*i)->when) << ' ' << (*i)->value << endl; if (!out) { error << string_compose (_("error writing pan automation file (%s)"), strerror (errno)) << endmsg; return -1; @@ -266,7 +266,7 @@ BaseStereoPanner::load (istream& in, string path, uint32_t& linecnt) _automation.clear (); while (in.getline (line, sizeof (line), '\n')) { - jack_nframes_t when; + nframes_t when; double value; ++linecnt; @@ -292,7 +292,7 @@ BaseStereoPanner::load (istream& in, string path, uint32_t& linecnt) } void -BaseStereoPanner::distribute (Sample* src, Sample** obufs, gain_t gain_coeff, jack_nframes_t nframes) +BaseStereoPanner::distribute (Sample* src, Sample** obufs, gain_t gain_coeff, nframes_t nframes) { pan_t delta; Sample* dst; @@ -310,8 +310,8 @@ BaseStereoPanner::distribute (Sample* src, Sample** obufs, gain_t gain_coeff, ja /* interpolate over 64 frames or nframes, whichever is smaller */ - jack_nframes_t limit = min ((jack_nframes_t)64, nframes); - jack_nframes_t n; + nframes_t limit = min ((nframes_t)64, nframes); + nframes_t n; delta = -(delta / (float) (limit)); @@ -360,8 +360,8 @@ BaseStereoPanner::distribute (Sample* src, Sample** obufs, gain_t gain_coeff, ja /* interpolate over 64 frames or nframes, whichever is smaller */ - jack_nframes_t limit = min ((jack_nframes_t)64, nframes); - jack_nframes_t n; + nframes_t limit = min ((nframes_t)64, nframes); + nframes_t n; delta = -(delta / (float) (limit)); @@ -446,7 +446,7 @@ EqualPowerStereoPanner::update () void EqualPowerStereoPanner::distribute_automated (Sample* src, Sample** obufs, - jack_nframes_t start, jack_nframes_t end, jack_nframes_t nframes, + nframes_t start, nframes_t end, nframes_t nframes, pan_t** buffers) { Sample* dst; @@ -478,7 +478,7 @@ EqualPowerStereoPanner::distribute_automated (Sample* src, Sample** obufs, const float pan_law_attenuation = -3.0f; const float scale = 2.0f - 4.0f * powf (10.0f,pan_law_attenuation/20.0f); - for (jack_nframes_t n = 0; n < nframes; ++n) { + for (nframes_t n = 0; n < nframes; ++n) { float panR = buffers[0][n]; float panL = 1 - panR; @@ -492,7 +492,7 @@ EqualPowerStereoPanner::distribute_automated (Sample* src, Sample** obufs, dst = obufs[0]; pbuf = buffers[0]; - for (jack_nframes_t n = 0; n < nframes; ++n) { + for (nframes_t n = 0; n < nframes; ++n) { dst[n] += src[n] * pbuf[n]; } @@ -503,7 +503,7 @@ EqualPowerStereoPanner::distribute_automated (Sample* src, Sample** obufs, dst = obufs[1]; pbuf = buffers[1]; - for (jack_nframes_t n = 0; n < nframes; ++n) { + for (nframes_t n = 0; n < nframes; ++n) { dst[n] += src[n] * pbuf[n]; } @@ -592,13 +592,13 @@ Multi2dPanner::~Multi2dPanner () } void -Multi2dPanner::snapshot (jack_nframes_t now) +Multi2dPanner::snapshot (nframes_t now) { // how? } void -Multi2dPanner::transport_stopped (jack_nframes_t frame) +Multi2dPanner::transport_stopped (nframes_t frame) { //what? } @@ -648,7 +648,7 @@ Multi2dPanner::update () } void -Multi2dPanner::distribute (Sample* src, Sample** obufs, gain_t gain_coeff, jack_nframes_t nframes) +Multi2dPanner::distribute (Sample* src, Sample** obufs, gain_t gain_coeff, nframes_t nframes) { Sample* dst; pan_t pan; @@ -669,8 +669,8 @@ Multi2dPanner::distribute (Sample* src, Sample** obufs, gain_t gain_coeff, jack_ /* interpolate over 64 frames or nframes, whichever is smaller */ - jack_nframes_t limit = min ((jack_nframes_t)64, nframes); - jack_nframes_t n; + nframes_t limit = min ((nframes_t)64, nframes); + nframes_t n; delta = -(delta / (float) (limit)); @@ -695,7 +695,7 @@ Multi2dPanner::distribute (Sample* src, Sample** obufs, gain_t gain_coeff, jack_ if (pan != 0.0f) { - for (jack_nframes_t n = 0; n < nframes; ++n) { + for (nframes_t n = 0; n < nframes; ++n) { dst[n] += src[n] * pan; } @@ -704,7 +704,7 @@ Multi2dPanner::distribute (Sample* src, Sample** obufs, gain_t gain_coeff, jack_ } else { - for (jack_nframes_t n = 0; n < nframes; ++n) { + for (nframes_t n = 0; n < nframes; ++n) { dst[n] += src[n]; } @@ -720,7 +720,7 @@ Multi2dPanner::distribute (Sample* src, Sample** obufs, gain_t gain_coeff, jack_ void Multi2dPanner::distribute_automated (Sample* src, Sample** obufs, - jack_nframes_t start, jack_nframes_t end, jack_nframes_t nframes, + nframes_t start, nframes_t end, nframes_t nframes, pan_t** buffers) { if (_muted) { @@ -1050,7 +1050,7 @@ Panner::automation_style () const } void -Panner::transport_stopped (jack_nframes_t frame) +Panner::transport_stopped (nframes_t frame) { for (vector::iterator i = begin(); i != end(); ++i) { (*i)->transport_stopped (frame); @@ -1058,7 +1058,7 @@ Panner::transport_stopped (jack_nframes_t frame) } void -Panner::snapshot (jack_nframes_t now) +Panner::snapshot (nframes_t now) { for (vector::iterator i = begin(); i != end(); ++i) { (*i)->snapshot (now); diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index 776af75a36..7a87033a56 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -124,12 +124,12 @@ Playlist::Playlist (const Playlist& other, string namestr, bool hide) } -Playlist::Playlist (const Playlist& other, jack_nframes_t start, jack_nframes_t cnt, string str, bool hide) +Playlist::Playlist (const Playlist& other, nframes_t start, nframes_t cnt, string str, bool hide) : _name (str), _session (other._session), _orig_diskstream_id(other._orig_diskstream_id) { RegionLock rlock2 (&((Playlist&)other)); - jack_nframes_t end = start + cnt - 1; + nframes_t end = start + cnt - 1; init (hide); @@ -137,9 +137,9 @@ Playlist::Playlist (const Playlist& other, jack_nframes_t start, jack_nframes_t boost::shared_ptr region; boost::shared_ptr new_region; - jack_nframes_t offset = 0; - jack_nframes_t position = 0; - jack_nframes_t len = 0; + nframes_t offset = 0; + nframes_t position = 0; + nframes_t len = 0; string new_name; OverlapType overlap; @@ -454,7 +454,7 @@ Playlist::flush_notifications () *************************************************************/ void -Playlist::add_region (boost::shared_ptr region, jack_nframes_t position, float times, bool with_save) +Playlist::add_region (boost::shared_ptr region, nframes_t position, float times, bool with_save) { RegionLock rlock (this); @@ -462,7 +462,7 @@ Playlist::add_region (boost::shared_ptr region, jack_nframes_t position, int itimes = (int) floor (times); - jack_nframes_t pos = position; + nframes_t pos = position; if (itimes >= 1) { add_region_internal (region, pos, true); @@ -487,7 +487,7 @@ Playlist::add_region (boost::shared_ptr region, jack_nframes_t position, } if (floor (times) != times) { - jack_nframes_t length = (jack_nframes_t) floor (region->length() * (times - floor (times))); + nframes_t length = (nframes_t) floor (region->length() * (times - floor (times))); string name; _session.region_name (name, region->name(), false); boost::shared_ptr sub = RegionFactory::create (region, 0, length, name, region->layer(), region->flags()); @@ -500,10 +500,10 @@ Playlist::add_region (boost::shared_ptr region, jack_nframes_t position, } void -Playlist::add_region_internal (boost::shared_ptr region, jack_nframes_t position, bool delay_sort) +Playlist::add_region_internal (boost::shared_ptr region, nframes_t position, bool delay_sort) { RegionSortByPosition cmp; - jack_nframes_t old_length = 0; + nframes_t old_length = 0; if (!holding_state()) { old_length = _get_maximum_extent(); @@ -536,7 +536,7 @@ Playlist::add_region_internal (boost::shared_ptr region, jack_nframes_t } void -Playlist::replace_region (boost::shared_ptr old, boost::shared_ptr newr, jack_nframes_t pos) +Playlist::replace_region (boost::shared_ptr old, boost::shared_ptr newr, nframes_t pos) { RegionLock rlock (this); @@ -567,7 +567,7 @@ int Playlist::remove_region_internal (boost::shared_ptrregion, bool delay_sort) { RegionList::iterator i; - jack_nframes_t old_length = 0; + nframes_t old_length = 0; // cerr << "removing region " << region->name() << endl; @@ -622,7 +622,7 @@ Playlist::get_region_list_equivalent_regions (boost::shared_ptr other, v } void -Playlist::partition (jack_nframes_t start, jack_nframes_t end, bool just_top_level) +Playlist::partition (nframes_t start, nframes_t end, bool just_top_level) { RegionList thawlist; @@ -636,7 +636,7 @@ Playlist::partition (jack_nframes_t start, jack_nframes_t end, bool just_top_lev } void -Playlist::partition_internal (jack_nframes_t start, jack_nframes_t end, bool cutting, RegionList& thawlist) +Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, RegionList& thawlist) { RegionLock rlock (this); boost::shared_ptr region; @@ -644,7 +644,7 @@ Playlist::partition_internal (jack_nframes_t start, jack_nframes_t end, bool cut string new_name; RegionList::iterator tmp; OverlapType overlap; - jack_nframes_t pos1, pos2, pos3, pos4; + nframes_t pos1, pos2, pos3, pos4; RegionList new_regions; in_partition = true; @@ -818,11 +818,11 @@ Playlist::partition_internal (jack_nframes_t start, jack_nframes_t end, bool cut } Playlist* -Playlist::cut_copy (Playlist* (Playlist::*pmf)(jack_nframes_t, jack_nframes_t,bool), list& ranges, bool result_is_hidden) +Playlist::cut_copy (Playlist* (Playlist::*pmf)(nframes_t, nframes_t,bool), list& ranges, bool result_is_hidden) { Playlist* ret; Playlist* pl; - jack_nframes_t start; + nframes_t start; if (ranges.empty()) { return 0; @@ -862,19 +862,19 @@ Playlist::cut_copy (Playlist* (Playlist::*pmf)(jack_nframes_t, jack_nframes_t,bo Playlist* Playlist::cut (list& ranges, bool result_is_hidden) { - Playlist* (Playlist::*pmf)(jack_nframes_t,jack_nframes_t,bool) = &Playlist::cut; + Playlist* (Playlist::*pmf)(nframes_t,nframes_t,bool) = &Playlist::cut; return cut_copy (pmf, ranges, result_is_hidden); } Playlist* Playlist::copy (list& ranges, bool result_is_hidden) { - Playlist* (Playlist::*pmf)(jack_nframes_t,jack_nframes_t,bool) = &Playlist::copy; + Playlist* (Playlist::*pmf)(nframes_t,nframes_t,bool) = &Playlist::copy; return cut_copy (pmf, ranges, result_is_hidden); } Playlist * -Playlist::cut (jack_nframes_t start, jack_nframes_t cnt, bool result_is_hidden) +Playlist::cut (nframes_t start, nframes_t cnt, bool result_is_hidden) { Playlist *the_copy; RegionList thawlist; @@ -902,7 +902,7 @@ Playlist::cut (jack_nframes_t start, jack_nframes_t cnt, bool result_is_hidden) } Playlist * -Playlist::copy (jack_nframes_t start, jack_nframes_t cnt, bool result_is_hidden) +Playlist::copy (nframes_t start, nframes_t cnt, bool result_is_hidden) { char buf[32]; @@ -916,10 +916,10 @@ Playlist::copy (jack_nframes_t start, jack_nframes_t cnt, bool result_is_hidden) } int -Playlist::paste (Playlist& other, jack_nframes_t position, float times) +Playlist::paste (Playlist& other, nframes_t position, float times) { times = fabs (times); - jack_nframes_t old_length; + nframes_t old_length; { RegionLock rl1 (this); @@ -928,8 +928,8 @@ Playlist::paste (Playlist& other, jack_nframes_t position, float times) old_length = _get_maximum_extent(); int itimes = (int) floor (times); - jack_nframes_t pos = position; - jack_nframes_t shift = other._get_maximum_extent(); + nframes_t pos = position; + nframes_t shift = other._get_maximum_extent(); layer_t top_layer = regions.size(); while (itimes--) { @@ -964,13 +964,13 @@ Playlist::paste (Playlist& other, jack_nframes_t position, float times) void -Playlist::duplicate (boost::shared_ptr region, jack_nframes_t position, float times) +Playlist::duplicate (boost::shared_ptr region, nframes_t position, float times) { times = fabs (times); RegionLock rl (this); int itimes = (int) floor (times); - jack_nframes_t pos = position; + nframes_t pos = position; while (itimes--) { boost::shared_ptr copy = RegionFactory::create (region); @@ -979,7 +979,7 @@ Playlist::duplicate (boost::shared_ptr region, jack_nframes_t position, } if (floor (times) != times) { - jack_nframes_t length = (jack_nframes_t) floor (region->length() * (times - floor (times))); + nframes_t length = (nframes_t) floor (region->length() * (times - floor (times))); string name; _session.region_name (name, region->name(), false); boost::shared_ptr sub = RegionFactory::create (region, 0, length, name, region->layer(), region->flags()); @@ -990,7 +990,7 @@ Playlist::duplicate (boost::shared_ptr region, jack_nframes_t position, } void -Playlist::split_region (boost::shared_ptr region, jack_nframes_t playlist_position) +Playlist::split_region (boost::shared_ptr region, nframes_t playlist_position) { RegionLock rl (this); @@ -1005,8 +1005,8 @@ Playlist::split_region (boost::shared_ptr region, jack_nframes_t playlis boost::shared_ptr left; boost::shared_ptr right; - jack_nframes_t before; - jack_nframes_t after; + nframes_t before; + nframes_t after; string before_name; string after_name; @@ -1210,7 +1210,7 @@ Playlist::clear (bool with_save) **********************************************************************/ Playlist::RegionList * -Playlist::regions_at (jack_nframes_t frame) +Playlist::regions_at (nframes_t frame) { RegionLock rlock (this); @@ -1218,7 +1218,7 @@ Playlist::regions_at (jack_nframes_t frame) } boost::shared_ptr -Playlist::top_region_at (jack_nframes_t frame) +Playlist::top_region_at (nframes_t frame) { RegionLock rlock (this); @@ -1236,7 +1236,7 @@ Playlist::top_region_at (jack_nframes_t frame) } Playlist::RegionList * -Playlist::find_regions_at (jack_nframes_t frame) +Playlist::find_regions_at (nframes_t frame) { RegionList *rlist = new RegionList; @@ -1250,7 +1250,7 @@ Playlist::find_regions_at (jack_nframes_t frame) } Playlist::RegionList * -Playlist::regions_touched (jack_nframes_t start, jack_nframes_t end) +Playlist::regions_touched (nframes_t start, nframes_t end) { RegionLock rlock (this); RegionList *rlist = new RegionList; @@ -1266,17 +1266,17 @@ Playlist::regions_touched (jack_nframes_t start, jack_nframes_t end) boost::shared_ptr -Playlist::find_next_region (jack_nframes_t frame, RegionPoint point, int dir) +Playlist::find_next_region (nframes_t frame, RegionPoint point, int dir) { RegionLock rlock (this); boost::shared_ptr ret; - jack_nframes_t closest = max_frames; + nframes_t closest = max_frames; for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) { - jack_nframes_t distance; + nframes_t distance; boost::shared_ptr r = (*i); - jack_nframes_t pos = 0; + nframes_t pos = 0; switch (point) { case Start: @@ -1445,19 +1445,19 @@ Playlist::empty() const return regions.empty(); } -jack_nframes_t +nframes_t Playlist::get_maximum_extent () const { RegionLock rlock (const_cast(this)); return _get_maximum_extent (); } -jack_nframes_t +nframes_t Playlist::_get_maximum_extent () const { RegionList::const_iterator i; - jack_nframes_t max_extent = 0; - jack_nframes_t end = 0; + nframes_t max_extent = 0; + nframes_t end = 0; for (i = regions.begin(); i != regions.end(); ++i) { if ((end = (*i)->position() + (*i)->length()) > max_extent) { @@ -1694,10 +1694,10 @@ Playlist::move_region_to_layer (layer_t target_layer, boost::shared_ptr } void -Playlist::nudge_after (jack_nframes_t start, jack_nframes_t distance, bool forwards) +Playlist::nudge_after (nframes_t start, nframes_t distance, bool forwards) { RegionList::iterator i; - jack_nframes_t new_pos; + nframes_t new_pos; bool moved = false; _nudging = true; diff --git a/libs/ardour/playlist_factory.cc b/libs/ardour/playlist_factory.cc index 05d9c76f7a..4461783874 100644 --- a/libs/ardour/playlist_factory.cc +++ b/libs/ardour/playlist_factory.cc @@ -29,7 +29,7 @@ using namespace ARDOUR; using namespace PBD; Playlist* -Playlist::copyPlaylist (const Playlist& playlist, jack_nframes_t start, jack_nframes_t length, +Playlist::copyPlaylist (const Playlist& playlist, nframes_t start, nframes_t length, string name, bool result_is_hidden) { const AudioPlaylist* apl; diff --git a/libs/ardour/redirect.cc b/libs/ardour/redirect.cc index 1ab2f91cf0..41d6e59246 100644 --- a/libs/ardour/redirect.cc +++ b/libs/ardour/redirect.cc @@ -406,7 +406,7 @@ Redirect::mark_automation_visible (uint32_t what, bool yn) } bool -Redirect::find_next_event (jack_nframes_t now, jack_nframes_t end, ControlEvent& next_event) const +Redirect::find_next_event (nframes_t now, nframes_t end, ControlEvent& next_event) const { map::const_iterator li; AutomationList::TimeComparator cmp; diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index e8353ac529..6c7e72be46 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -48,7 +48,7 @@ Change Region::LockChanged = ARDOUR::new_change (); Change Region::LayerChanged = ARDOUR::new_change (); Change Region::HiddenChanged = ARDOUR::new_change (); -Region::Region (jack_nframes_t start, jack_nframes_t length, const string& name, layer_t layer, Region::Flag flags) +Region::Region (nframes_t start, nframes_t length, const string& name, layer_t layer, Region::Flag flags) { /* basic Region constructor */ @@ -70,7 +70,7 @@ Region::Region (jack_nframes_t start, jack_nframes_t length, const string& name, _last_layer_op = 0; } -Region::Region (boost::shared_ptr other, jack_nframes_t offset, jack_nframes_t length, const string& name, layer_t layer, Flag flags) +Region::Region (boost::shared_ptr other, nframes_t offset, nframes_t length, const string& name, layer_t layer, Flag flags) { /* create a new Region from part of an existing one */ @@ -230,7 +230,7 @@ Region::set_name (string str) } void -Region::set_length (jack_nframes_t len, void *src) +Region::set_length (nframes_t len, void *src) { if (_flags & Locked) { return; @@ -238,6 +238,14 @@ Region::set_length (jack_nframes_t len, void *src) if (_length != len && len != 0) { + /* check that the current _position wouldn't make the new + length impossible. + */ + + if (max_frames - len < _position) { + return; + } + if (!verify_length (len)) { return; } @@ -294,7 +302,7 @@ Region::move_to_natural_position (void *src) } void -Region::special_set_position (jack_nframes_t pos) +Region::special_set_position (nframes_t pos) { /* this is used when creating a whole file region as a way to store its "natural" or "captured" position. @@ -304,7 +312,7 @@ Region::special_set_position (jack_nframes_t pos) } void -Region::set_position (jack_nframes_t pos, void *src) +Region::set_position (nframes_t pos, void *src) { if (_flags & Locked) { return; @@ -313,6 +321,16 @@ Region::set_position (jack_nframes_t pos, void *src) if (_position != pos) { _position = pos; + /* check that the new _position wouldn't make the current + length impossible - if so, change the length. + + XXX is this the right thing to do? + */ + + if (max_frames - _length < _position) { + _length = max_frames - _position; + } + if (!_frozen) { char buf[64]; snprintf (buf, sizeof (buf), "position set to %u", pos); @@ -328,7 +346,7 @@ Region::set_position (jack_nframes_t pos, void *src) } void -Region::set_position_on_top (jack_nframes_t pos, void *src) +Region::set_position_on_top (nframes_t pos, void *src) { if (_flags & Locked) { return; @@ -371,7 +389,7 @@ Region::nudge_position (long n, void *src) _position += n; } } else { - if (_position < (jack_nframes_t) -n) { + if (_position < (nframes_t) -n) { _position = 0; } else { _position += n; @@ -388,7 +406,7 @@ Region::nudge_position (long n, void *src) } void -Region::set_start (jack_nframes_t pos, void *src) +Region::set_start (nframes_t pos, void *src) { if (_flags & Locked) { return; @@ -419,12 +437,12 @@ Region::set_start (jack_nframes_t pos, void *src) } void -Region::trim_start (jack_nframes_t new_position, void *src) +Region::trim_start (nframes_t new_position, void *src) { if (_flags & Locked) { return; } - jack_nframes_t new_start; + nframes_t new_start; int32_t start_shift; if (new_position > _position) { @@ -447,7 +465,7 @@ Region::trim_start (jack_nframes_t new_position, void *src) } else if (start_shift < 0) { - if (_start < (jack_nframes_t) -start_shift) { + if (_start < (nframes_t) -start_shift) { new_start = 0; } else { new_start = _start + start_shift; @@ -474,14 +492,14 @@ Region::trim_start (jack_nframes_t new_position, void *src) } void -Region::trim_front (jack_nframes_t new_position, void *src) +Region::trim_front (nframes_t new_position, void *src) { if (_flags & Locked) { return; } - jack_nframes_t end = _position + _length - 1; - jack_nframes_t source_zero; + nframes_t end = last_frame(); + nframes_t source_zero; if (_position > _start) { source_zero = _position - _start; @@ -491,7 +509,7 @@ Region::trim_front (jack_nframes_t new_position, void *src) if (new_position < end) { /* can't trim it zero or negative length */ - jack_nframes_t newlen; + nframes_t newlen; /* can't trim it back passed where source position zero is located */ @@ -512,7 +530,7 @@ Region::trim_front (jack_nframes_t new_position, void *src) } void -Region::trim_end (jack_nframes_t new_endpoint, void *src) +Region::trim_end (nframes_t new_endpoint, void *src) { if (_flags & Locked) { return; @@ -527,7 +545,7 @@ Region::trim_end (jack_nframes_t new_endpoint, void *src) } void -Region::trim_to (jack_nframes_t position, jack_nframes_t length, void *src) +Region::trim_to (nframes_t position, nframes_t length, void *src) { if (_flags & Locked) { return; @@ -542,10 +560,10 @@ Region::trim_to (jack_nframes_t position, jack_nframes_t length, void *src) } void -Region::trim_to_internal (jack_nframes_t position, jack_nframes_t length, void *src) +Region::trim_to_internal (nframes_t position, nframes_t length, void *src) { int32_t start_shift; - jack_nframes_t new_start; + nframes_t new_start; if (_flags & Locked) { return; @@ -568,7 +586,7 @@ Region::trim_to_internal (jack_nframes_t position, jack_nframes_t length, void * } else if (start_shift < 0) { - if (_start < (jack_nframes_t) -start_shift) { + if (_start < (nframes_t) -start_shift) { new_start = 0; } else { new_start = _start + start_shift; @@ -693,9 +711,9 @@ Region::set_locked (bool yn) } void -Region::set_sync_position (jack_nframes_t absolute_pos) +Region::set_sync_position (nframes_t absolute_pos) { - jack_nframes_t file_pos; + nframes_t file_pos; file_pos = _start + (absolute_pos - _position); @@ -728,7 +746,7 @@ Region::clear_sync_position () } } -jack_nframes_t +nframes_t Region::sync_offset (int& dir) const { /* returns the sync point relative the first frame of the region */ @@ -747,11 +765,11 @@ Region::sync_offset (int& dir) const } } -jack_nframes_t -Region::adjust_to_sync (jack_nframes_t pos) +nframes_t +Region::adjust_to_sync (nframes_t pos) { int sync_dir; - jack_nframes_t offset = sync_offset (sync_dir); + nframes_t offset = sync_offset (sync_dir); if (sync_dir > 0) { if (max_frames - pos > offset) { @@ -768,7 +786,7 @@ Region::adjust_to_sync (jack_nframes_t pos) return pos; } -jack_nframes_t +nframes_t Region::sync_position() const { if (_flags & SyncMarked) { @@ -894,15 +912,15 @@ Region::set_state (const XMLNode& node) _name = prop->value(); if ((prop = node.property ("start")) != 0) { - _start = (jack_nframes_t) atoi (prop->value().c_str()); + sscanf (prop->value().c_str(), "%" PRIu32, &_start); } if ((prop = node.property ("length")) != 0) { - _length = (jack_nframes_t) atoi (prop->value().c_str()); + sscanf (prop->value().c_str(), "%" PRIu32, &_length); } if ((prop = node.property ("position")) != 0) { - _position = (jack_nframes_t) atoi (prop->value().c_str()); + sscanf (prop->value().c_str(), "%" PRIu32, &_position); } if ((prop = node.property ("layer")) != 0) { @@ -912,7 +930,7 @@ Region::set_state (const XMLNode& node) /* note: derived classes set flags */ if ((prop = node.property ("sync-position")) != 0) { - _sync_position = (jack_nframes_t) atoi (prop->value().c_str()); + sscanf (prop->value().c_str(), "%" PRIu32, &_sync_position); } else { _sync_position = _start; } diff --git a/libs/ardour/region_factory.cc b/libs/ardour/region_factory.cc index 101b33e811..313bb31f2a 100644 --- a/libs/ardour/region_factory.cc +++ b/libs/ardour/region_factory.cc @@ -35,8 +35,8 @@ using namespace PBD; sigc::signal > RegionFactory::CheckNewRegion; boost::shared_ptr -RegionFactory::create (boost::shared_ptr region, jack_nframes_t start, - jack_nframes_t length, std::string name, +RegionFactory::create (boost::shared_ptr region, nframes_t start, + nframes_t length, std::string name, layer_t layer, Region::Flag flags, bool announce) { boost::shared_ptr other; @@ -75,8 +75,8 @@ RegionFactory::create (boost::shared_ptr region) } boost::shared_ptr -RegionFactory::create (boost::shared_ptr region, jack_nframes_t start, - jack_nframes_t length, std::string name, +RegionFactory::create (boost::shared_ptr region, nframes_t start, + nframes_t length, std::string name, layer_t layer, Region::Flag flags, bool announce) { return create (boost::static_pointer_cast (region), start, length, name, layer, flags, announce); @@ -91,7 +91,7 @@ RegionFactory::create (Session& session, XMLNode& node, bool yn) } boost::shared_ptr -RegionFactory::create (SourceList& srcs, jack_nframes_t start, jack_nframes_t length, const string& name, layer_t layer, Region::Flag flags, bool announce) +RegionFactory::create (SourceList& srcs, nframes_t start, nframes_t length, const string& name, layer_t layer, Region::Flag flags, bool announce) { AudioRegion* ar = new AudioRegion (srcs, start, length, name, layer, flags); boost::shared_ptr arp (ar); @@ -115,7 +115,7 @@ RegionFactory::create (SourceList& srcs, const XMLNode& node) } boost::shared_ptr -RegionFactory::create (boost::shared_ptr src, jack_nframes_t start, jack_nframes_t length, const string& name, layer_t layer, Region::Flag flags, bool announce) +RegionFactory::create (boost::shared_ptr src, nframes_t start, nframes_t length, const string& name, layer_t layer, Region::Flag flags, bool announce) { boost::shared_ptr as; diff --git a/libs/ardour/reverse.cc b/libs/ardour/reverse.cc index e62821d5e6..eb68a09049 100644 --- a/libs/ardour/reverse.cc +++ b/libs/ardour/reverse.cc @@ -47,12 +47,12 @@ Reverse::run (boost::shared_ptr region) { SourceList nsrcs; SourceList::iterator si; - const jack_nframes_t blocksize = 256 * 1048; + const nframes_t blocksize = 256 * 1048; Sample buf[blocksize]; - jack_nframes_t fpos; - jack_nframes_t fend; - jack_nframes_t fstart; - jack_nframes_t to_read; + nframes_t fpos; + nframes_t fend; + nframes_t fstart; + nframes_t to_read; int ret = -1; /* create new sources */ @@ -88,7 +88,7 @@ Reverse::run (boost::shared_ptr region) /* swap memory order */ - for (jack_nframes_t i = 0; i < to_read/2; ++i) { + for (nframes_t i = 0; i < to_read/2; ++i) { swap (buf[i],buf[to_read-1-i]); } diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 82edb253de..291509a00d 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -215,8 +215,8 @@ Route::set_gain (gain_t val, void *src) void Route::process_output_buffers (vector& bufs, uint32_t nbufs, - jack_nframes_t start_frame, jack_nframes_t end_frame, - jack_nframes_t nframes, jack_nframes_t offset, bool with_redirects, int declick, + nframes_t start_frame, nframes_t end_frame, + nframes_t nframes, nframes_t offset, bool with_redirects, int declick, bool meter) { uint32_t n; @@ -429,7 +429,7 @@ Route::process_output_buffers (vector& bufs, uint32_t nbufs, for (n = 0; n < nbufs; ++n) { Sample *sp = bufs[n]; - for (jack_nframes_t nx = 0; nx < nframes; ++nx) { + for (nframes_t nx = 0; nx < nframes; ++nx) { sp[nx] *= -gab[nx]; } } @@ -437,7 +437,7 @@ Route::process_output_buffers (vector& bufs, uint32_t nbufs, for (n = 0; n < nbufs; ++n) { Sample *sp = bufs[n]; - for (jack_nframes_t nx = 0; nx < nframes; ++nx) { + for (nframes_t nx = 0; nx < nframes; ++nx) { sp[nx] *= gab[nx]; } } @@ -663,7 +663,7 @@ Route::n_process_buffers () void -Route::passthru (jack_nframes_t start_frame, jack_nframes_t end_frame, jack_nframes_t nframes, jack_nframes_t offset, int declick, bool meter_first) +Route::passthru (nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset, int declick, bool meter_first) { vector& bufs = _session.get_passthru_buffers(); uint32_t limit = n_process_buffers (); @@ -1014,7 +1014,7 @@ Route::_reset_plugin_counts (uint32_t* err_streams) uint32_t i_cnt; uint32_t s_cnt; map > insert_map; - jack_nframes_t initial_streams; + nframes_t initial_streams; redirect_max_outs = 0; i_cnt = 0; @@ -1698,7 +1698,7 @@ Route::curve_reallocate () } void -Route::silence (jack_nframes_t nframes, jack_nframes_t offset) +Route::silence (nframes_t nframes, nframes_t offset) { if (!_silent) { @@ -1935,7 +1935,7 @@ Route::set_active (bool yn) void Route::handle_transport_stopped (bool abort_ignored, bool did_locate, bool can_flush_redirects) { - jack_nframes_t now = _session.transport_frame(); + nframes_t now = _session.transport_frame(); { Glib::RWLock::ReaderLock lm (redirect_lock); @@ -2004,7 +2004,7 @@ Route::pans_required () const } int -Route::no_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, jack_nframes_t offset, +Route::no_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nframes_t offset, bool session_state_changing, bool can_record, bool rec_monitors_input) { if (n_outputs() == 0) { @@ -2027,8 +2027,8 @@ Route::no_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes return 0; } -jack_nframes_t -Route::check_initial_delay (jack_nframes_t nframes, jack_nframes_t& offset, jack_nframes_t& transport_frame) +nframes_t +Route::check_initial_delay (nframes_t nframes, nframes_t& offset, nframes_t& transport_frame) { if (_roll_delay > nframes) { @@ -2053,7 +2053,7 @@ Route::check_initial_delay (jack_nframes_t nframes, jack_nframes_t& offset, jack } int -Route::roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, jack_nframes_t offset, int declick, +Route::roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nframes_t offset, int declick, bool can_record, bool rec_monitors_input) { { @@ -2070,7 +2070,7 @@ Route::roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t return 0; } - jack_nframes_t unused = 0; + nframes_t unused = 0; if ((nframes = check_initial_delay (nframes, offset, unused)) == 0) { return 0; @@ -2085,7 +2085,7 @@ Route::roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t if (am.locked() && _session.transport_rolling()) { - jack_nframes_t start_frame = end_frame - nframes; + nframes_t start_frame = end_frame - nframes; if (gain_automation_playback()) { apply_gain_automation = _gain_automation_curve.rt_safe_get_vector (start_frame, end_frame, _session.gain_automation_buffer(), nframes); @@ -2099,7 +2099,7 @@ Route::roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t } int -Route::silent_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, jack_nframes_t offset, +Route::silent_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nframes_t offset, bool can_record, bool rec_monitors_input) { silence (nframes, offset); @@ -2166,7 +2166,7 @@ Route::set_meter_point (MeterPoint p, void *src) } } -jack_nframes_t +nframes_t Route::update_total_latency () { _own_latency = 0; @@ -2192,7 +2192,7 @@ Route::update_total_latency () } void -Route::set_latency_delay (jack_nframes_t longest_session_latency) +Route::set_latency_delay (nframes_t longest_session_latency) { _initial_delay = longest_session_latency - _own_latency; @@ -2202,7 +2202,7 @@ Route::set_latency_delay (jack_nframes_t longest_session_latency) } void -Route::automation_snapshot (jack_nframes_t now) +Route::automation_snapshot (nframes_t now) { IO::automation_snapshot (now); @@ -2254,7 +2254,7 @@ Route::ToggleControllable::get_value (void) const } void -Route::set_block_size (jack_nframes_t nframes) +Route::set_block_size (nframes_t nframes) { for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) { (*i)->set_block_size (nframes); diff --git a/libs/ardour/send.cc b/libs/ardour/send.cc index a8e239d49b..b37168807e 100644 --- a/libs/ardour/send.cc +++ b/libs/ardour/send.cc @@ -104,7 +104,7 @@ Send::set_state(const XMLNode& node) } void -Send::run (vector& bufs, uint32_t nbufs, jack_nframes_t nframes, jack_nframes_t offset) +Send::run (vector& bufs, uint32_t nbufs, nframes_t nframes, nframes_t offset) { if (active()) { diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index ea1cea84f9..2cf86434d7 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -310,7 +310,7 @@ Session::Session (AudioEngine &eng, uint32_t master_out_channels, uint32_t requested_physical_in, uint32_t requested_physical_out, - jack_nframes_t initial_length) + nframes_t initial_length) : _engine (eng), _mmc_port (default_mmc_port), @@ -968,7 +968,7 @@ Session::auto_punch_start_changed (Location* location) void Session::auto_punch_end_changed (Location* location) { - jack_nframes_t when_to_stop = location->end(); + nframes_t when_to_stop = location->end(); // when_to_stop += _worst_output_latency + _worst_input_latency; replace_event (Event::PunchOut, when_to_stop); } @@ -976,7 +976,7 @@ Session::auto_punch_end_changed (Location* location) void Session::auto_punch_changed (Location* location) { - jack_nframes_t when_to_stop = location->end(); + nframes_t when_to_stop = location->end(); replace_event (Event::PunchIn, location->start()); //when_to_stop += _worst_output_latency + _worst_input_latency; @@ -1237,12 +1237,12 @@ Session::maybe_enable_record () set_dirty(); } -jack_nframes_t +nframes_t Session::audible_frame () const { - jack_nframes_t ret; - jack_nframes_t offset; - jack_nframes_t tf; + nframes_t ret; + nframes_t offset; + nframes_t tf; /* the first of these two possible settings for "offset" mean that the audible frame is stationary until @@ -1296,9 +1296,9 @@ Session::audible_frame () const } void -Session::set_frame_rate (jack_nframes_t frames_per_second) +Session::set_frame_rate (nframes_t frames_per_second) { - /** \fn void Session::set_frame_size(jack_nframes_t) + /** \fn void Session::set_frame_size(nframes_t) the AudioEngine object that calls this guarantees that it will not be called while we are also in ::process(). Its fine to do things that block @@ -1309,7 +1309,7 @@ Session::set_frame_rate (jack_nframes_t frames_per_second) sync_time_vars(); - Route::set_automation_interval ((jack_nframes_t) ceil ((double) frames_per_second * 0.25)); + Route::set_automation_interval ((nframes_t) ceil ((double) frames_per_second * 0.25)); // XXX we need some equivalent to this, somehow // DestructiveFileSource::setup_standard_crossfades (frames_per_second); @@ -1320,7 +1320,7 @@ Session::set_frame_rate (jack_nframes_t frames_per_second) } void -Session::set_block_size (jack_nframes_t nframes) +Session::set_block_size (nframes_t nframes) { /* the AudioEngine guarantees that it will not be called while we are also in @@ -1388,7 +1388,7 @@ void Session::set_default_fade (float steepness, float fade_msecs) { #if 0 - jack_nframes_t fade_frames; + nframes_t fade_frames; /* Don't allow fade of less 1 frame */ @@ -1399,7 +1399,7 @@ Session::set_default_fade (float steepness, float fade_msecs) } else { - fade_frames = (jack_nframes_t) floor (fade_msecs * _current_frame_rate * 0.001); + fade_frames = (nframes_t) floor (fade_msecs * _current_frame_rate * 0.001); } @@ -2194,7 +2194,7 @@ Session::find_current_end () return; } - jack_nframes_t max = get_maximum_extent (); + nframes_t max = get_maximum_extent (); if (max > end_location->end()) { end_location->set_end (max); @@ -2203,11 +2203,11 @@ Session::find_current_end () } } -jack_nframes_t +nframes_t Session::get_maximum_extent () const { - jack_nframes_t max = 0; - jack_nframes_t me; + nframes_t max = 0; + nframes_t me; boost::shared_ptr dsl = diskstreams.reader(); @@ -3253,7 +3253,7 @@ Session::remove_redirect (Redirect* redirect) set_dirty(); } -jack_nframes_t +nframes_t Session::available_capture_duration () { const double scale = 4096.0 / sizeof (Sample); @@ -3262,7 +3262,7 @@ Session::available_capture_duration () return max_frames; } - return (jack_nframes_t) floor (_total_free_4k_blocks * scale); + return (nframes_t) floor (_total_free_4k_blocks * scale); } void @@ -3461,7 +3461,7 @@ Session::n_playlists () const } void -Session::allocate_pan_automation_buffers (jack_nframes_t nframes, uint32_t howmany, bool force) +Session::allocate_pan_automation_buffers (nframes_t nframes, uint32_t howmany, bool force) { if (!force && howmany <= _npan_buffers) { return; @@ -3506,7 +3506,7 @@ Session::freeze (InterThreadInfo& itt) } int -Session::write_one_audio_track (AudioTrack& track, jack_nframes_t start, jack_nframes_t len, +Session::write_one_audio_track (AudioTrack& track, nframes_t start, nframes_t len, bool overwrite, vector >& srcs, InterThreadInfo& itt) { int ret = -1; @@ -3516,13 +3516,13 @@ Session::write_one_audio_track (AudioTrack& track, jack_nframes_t start, jack_nf char buf[PATH_MAX+1]; string dir; uint32_t nchans; - jack_nframes_t position; - jack_nframes_t this_chunk; - jack_nframes_t to_do; + nframes_t position; + nframes_t this_chunk; + nframes_t to_do; vector buffers; // any bigger than this seems to cause stack overflows in called functions - const jack_nframes_t chunk_size = (128 * 1024)/4; + const nframes_t chunk_size = (128 * 1024)/4; g_atomic_int_set (&processing_prohibited, 1); diff --git a/libs/ardour/session_click.cc b/libs/ardour/session_click.cc index 426e6e2864..72ce4e25f6 100644 --- a/libs/ardour/session_click.cc +++ b/libs/ardour/session_click.cc @@ -37,10 +37,10 @@ using namespace PBD; Pool Session::Click::pool ("click", sizeof (Click), 128); void -Session::click (jack_nframes_t start, jack_nframes_t nframes, jack_nframes_t offset) +Session::click (nframes_t start, nframes_t nframes, nframes_t offset) { TempoMap::BBTPointList *points; - jack_nframes_t end; + nframes_t end; Sample *buf; vector bufs; @@ -90,8 +90,8 @@ Session::click (jack_nframes_t start, jack_nframes_t nframes, jack_nframes_t off for (list::iterator i = clicks.begin(); i != clicks.end(); ) { - jack_nframes_t copy; - jack_nframes_t internal_offset; + nframes_t copy; + nframes_t internal_offset; Click *clk; list::iterator next; diff --git a/libs/ardour/session_events.cc b/libs/ardour/session_events.cc index a72a2e58d4..6367eaaf17 100644 --- a/libs/ardour/session_events.cc +++ b/libs/ardour/session_events.cc @@ -59,21 +59,21 @@ static const char* event_names[] = { }; void -Session::add_event (jack_nframes_t frame, Event::Type type, jack_nframes_t target_frame) +Session::add_event (nframes_t frame, Event::Type type, nframes_t target_frame) { Event* ev = new Event (type, Event::Add, frame, target_frame, 0); queue_event (ev); } void -Session::remove_event (jack_nframes_t frame, Event::Type type) +Session::remove_event (nframes_t frame, Event::Type type) { Event* ev = new Event (type, Event::Remove, frame, 0, 0); queue_event (ev); } void -Session::replace_event (Event::Type type, jack_nframes_t frame, jack_nframes_t target) +Session::replace_event (Event::Type type, nframes_t frame, nframes_t target) { Event* ev = new Event (type, Event::Replace, frame, target, 0); queue_event (ev); diff --git a/libs/ardour/session_export.cc b/libs/ardour/session_export.cc index 81522dabec..8286934358 100644 --- a/libs/ardour/session_export.cc +++ b/libs/ardour/session_export.cc @@ -153,7 +153,7 @@ AudioExportSpecification::clear () } int -AudioExportSpecification::prepare (jack_nframes_t blocksize, jack_nframes_t frate) +AudioExportSpecification::prepare (nframes_t blocksize, nframes_t frate) { char errbuf[256]; GDitherSize dither_size; @@ -216,7 +216,7 @@ AudioExportSpecification::prepare (jack_nframes_t blocksize, jack_nframes_t frat } src_data.src_ratio = sample_rate / (double) frame_rate; - out_samples_max = (jack_nframes_t) ceil (blocksize * src_data.src_ratio * channels); + out_samples_max = (nframes_t) ceil (blocksize * src_data.src_ratio * channels); dataF2 = new float[out_samples_max]; max_leftover_frames = 4 * blocksize; @@ -258,7 +258,7 @@ AudioExportSpecification::prepare (jack_nframes_t blocksize, jack_nframes_t frat } int -AudioExportSpecification::process (jack_nframes_t nframes) +AudioExportSpecification::process (nframes_t nframes) { float* float_buffer = 0; uint32_t chn; @@ -266,7 +266,7 @@ AudioExportSpecification::process (jack_nframes_t nframes) uint32_t i; sf_count_t written; char errbuf[256]; - jack_nframes_t to_write = 0; + nframes_t to_write = 0; int cnt = 0; do { @@ -413,7 +413,7 @@ AudioExportSpecification::process (jack_nframes_t nframes) break; } - if ((jack_nframes_t) written != to_write) { + if ((nframes_t) written != to_write) { sf_error_str (out, errbuf, sizeof (errbuf) - 1); error << string_compose(_("Export: could not write data to output file (%1)"), errbuf) << endmsg; return -1; @@ -538,12 +538,12 @@ Session::prepare_to_export (AudioExportSpecification& spec) } int -Session::process_export (jack_nframes_t nframes, AudioExportSpecification* spec) +Session::process_export (nframes_t nframes, AudioExportSpecification* spec) { uint32_t chn; uint32_t x; int ret = -1; - jack_nframes_t this_nframes; + nframes_t this_nframes; /* This is not required to be RT-safe because we are running while freewheeling */ diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc index 2a5b18962c..1af00ca337 100644 --- a/libs/ardour/session_midi.cc +++ b/libs/ardour/session_midi.cc @@ -617,7 +617,7 @@ Session::mmc_locate (MIDI::MachineControl &mmc, const MIDI::byte* mmc_tc) return; } - jack_nframes_t target_frame; + nframes_t target_frame; SMPTE::Time smpte; smpte.hours = mmc_tc[0] & 0xf; @@ -703,8 +703,8 @@ Session::send_midi_time_code_in_another_thread () void Session::send_time_code_in_another_thread (bool full) { - jack_nframes_t two_smpte_frames_duration; - jack_nframes_t quarter_frame_duration; + nframes_t two_smpte_frames_duration; + nframes_t quarter_frame_duration; /* Duration of two smpte frames */ two_smpte_frames_duration = ((long) _frames_per_smpte_frame) << 1; @@ -775,7 +775,7 @@ Session::send_full_time_code () if (((mtc_smpte_bits >> 5) != MIDI::MTC_25_FPS) && (transmitting_smpte_time.frames % 2)) { // start MTC quarter frame transmission on an even frame SMPTE::increment( transmitting_smpte_time ); - outbound_mtc_smpte_frame += (jack_nframes_t) _frames_per_smpte_frame; + outbound_mtc_smpte_frame += (nframes_t) _frames_per_smpte_frame; } } @@ -817,8 +817,8 @@ Session::send_midi_time_code () return 0; } - jack_nframes_t two_smpte_frames_duration; - jack_nframes_t quarter_frame_duration; + nframes_t two_smpte_frames_duration; + nframes_t quarter_frame_duration; /* Duration of two smpte frames */ two_smpte_frames_duration = ((long) _frames_per_smpte_frame) << 1; @@ -892,7 +892,7 @@ Session::send_midi_time_code () **********************************************************************/ void -Session::send_mmc_in_another_thread (MIDI::MachineControl::Command cmd, jack_nframes_t target_frame) +Session::send_mmc_in_another_thread (MIDI::MachineControl::Command cmd, nframes_t target_frame) { MIDIRequest* request; @@ -910,7 +910,7 @@ Session::send_mmc_in_another_thread (MIDI::MachineControl::Command cmd, jack_nfr } void -Session::deliver_mmc (MIDI::MachineControl::Command cmd, jack_nframes_t where) +Session::deliver_mmc (MIDI::MachineControl::Command cmd, nframes_t where) { using namespace MIDI; int nbytes = 4; diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc index db6d75beec..9b051252b1 100644 --- a/libs/ardour/session_process.cc +++ b/libs/ardour/session_process.cc @@ -44,7 +44,7 @@ using namespace PBD; using namespace std; void -Session::process (jack_nframes_t nframes) +Session::process (nframes_t nframes) { if (synced_to_jack() && waiting_to_start) { if ( _engine.transport_state() == AudioEngine::TransportRolling) { @@ -73,9 +73,9 @@ Session::prepare_diskstreams () } int -Session::no_roll (jack_nframes_t nframes, jack_nframes_t offset) +Session::no_roll (nframes_t nframes, nframes_t offset) { - jack_nframes_t end_frame = _transport_frame + nframes; + nframes_t end_frame = _transport_frame + nframes; int ret = 0; bool declick = get_transport_declick_required(); boost::shared_ptr r = routes.reader (); @@ -111,7 +111,7 @@ Session::no_roll (jack_nframes_t nframes, jack_nframes_t offset) } int -Session::process_routes (jack_nframes_t nframes, jack_nframes_t offset) +Session::process_routes (nframes_t nframes, nframes_t offset) { bool record_active; int declick = get_transport_declick_required(); @@ -156,7 +156,7 @@ Session::process_routes (jack_nframes_t nframes, jack_nframes_t offset) } int -Session::silent_process_routes (jack_nframes_t nframes, jack_nframes_t offset) +Session::silent_process_routes (nframes_t nframes, nframes_t offset) { bool record_active = actively_recording(); int declick = get_transport_declick_required(); @@ -197,7 +197,7 @@ Session::silent_process_routes (jack_nframes_t nframes, jack_nframes_t offset) } void -Session::commit_diskstreams (jack_nframes_t nframes, bool &needs_butler) +Session::commit_diskstreams (nframes_t nframes, bool &needs_butler) { int dret; float pworst = 1.0f; @@ -242,14 +242,14 @@ Session::commit_diskstreams (jack_nframes_t nframes, bool &needs_butler) } void -Session::process_with_events (jack_nframes_t nframes) +Session::process_with_events (nframes_t nframes) { Event* ev; - jack_nframes_t this_nframes; - jack_nframes_t end_frame; - jack_nframes_t offset; + nframes_t this_nframes; + nframes_t end_frame; + nframes_t offset; bool session_needs_butler = false; - jack_nframes_t stop_limit; + nframes_t stop_limit; long frames_moved; /* make sure the auditioner is silent */ @@ -363,7 +363,7 @@ Session::process_with_events (jack_nframes_t nframes) nframes -= this_nframes; offset += this_nframes; - frames_moved = (jack_nframes_t) floor (_transport_speed * this_nframes); + frames_moved = (nframes_t) floor (_transport_speed * this_nframes); if (frames_moved < 0) { decrement_transport_position (-frames_moved); @@ -439,11 +439,11 @@ Session::transport_locked () const } bool -Session::follow_slave (jack_nframes_t nframes, jack_nframes_t offset) +Session::follow_slave (nframes_t nframes, nframes_t offset) { float slave_speed; - jack_nframes_t slave_transport_frame; - jack_nframes_t this_delta; + nframes_t slave_transport_frame; + nframes_t this_delta; int dir; bool starting; @@ -569,7 +569,7 @@ Session::follow_slave (jack_nframes_t nframes, jack_nframes_t offset) slave_state = Running; bool ok = true; - jack_nframes_t frame_delta = slave_transport_frame - _transport_frame; + nframes_t frame_delta = slave_transport_frame - _transport_frame; boost::shared_ptr dsl = diskstreams.reader(); @@ -591,7 +591,7 @@ Session::follow_slave (jack_nframes_t nframes, jack_nframes_t offset) /* XXX what? */ } - memset (delta_accumulator, 0, sizeof (jack_nframes_t) * delta_accumulator_size); + memset (delta_accumulator, 0, sizeof (nframes_t) * delta_accumulator_size); average_slave_delta = 0; this_delta = 0; } @@ -662,7 +662,7 @@ Session::follow_slave (jack_nframes_t nframes, jack_nframes_t offset) request_transport_speed (adjusted_speed); #if 1 - if ((jack_nframes_t) average_slave_delta > _slave->resolution()) { + if ((nframes_t) average_slave_delta > _slave->resolution()) { // cerr << "not locked\n"; goto silent_motion; } @@ -701,7 +701,7 @@ Session::follow_slave (jack_nframes_t nframes, jack_nframes_t offset) increment_transport_position (frames_moved); } - jack_nframes_t stop_limit; + nframes_t stop_limit; if (actively_recording()) { stop_limit = max_frames; @@ -723,12 +723,12 @@ Session::follow_slave (jack_nframes_t nframes, jack_nframes_t offset) } void -Session::process_without_events (jack_nframes_t nframes) +Session::process_without_events (nframes_t nframes) { bool session_needs_butler = false; - jack_nframes_t stop_limit; + nframes_t stop_limit; long frames_moved; - jack_nframes_t offset = 0; + nframes_t offset = 0; { if (post_transport_work & (PostTransportLocate|PostTransportStop)) { @@ -802,7 +802,7 @@ Session::process_without_events (jack_nframes_t nframes) } void -Session::process_audition (jack_nframes_t nframes) +Session::process_audition (nframes_t nframes) { Event* ev; boost::shared_ptr r = routes.reader (); @@ -842,9 +842,9 @@ Session::process_audition (jack_nframes_t nframes) } bool -Session::maybe_sync_start (jack_nframes_t& nframes, jack_nframes_t& offset) +Session::maybe_sync_start (nframes_t& nframes, nframes_t& offset) { - jack_nframes_t sync_offset; + nframes_t sync_offset; if (!waiting_for_sync_offset) { return false; diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 9d3ce28225..54c1b59f39 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -181,7 +181,7 @@ Session::first_stage_init (string fullpath, string snapshot_name) /* default short fade = 15ms */ - Crossfade::set_short_xfade_length ((jack_nframes_t) floor (Config->get_short_xfade_seconds() * frame_rate())); + Crossfade::set_short_xfade_length ((nframes_t) floor (Config->get_short_xfade_seconds() * frame_rate())); DestructiveFileSource::setup_standard_crossfades (frame_rate()); last_mmc_step.tv_sec = 0; @@ -433,7 +433,7 @@ Session::setup_raid_path (string path) } int -Session::create (bool& new_session, string* mix_template, jack_nframes_t initial_length) +Session::create (bool& new_session, string* mix_template, nframes_t initial_length) { string dir; diff --git a/libs/ardour/session_time.cc b/libs/ardour/session_time.cc index e8fbbdbc4e..dfaab9d4c4 100644 --- a/libs/ardour/session_time.cc +++ b/libs/ardour/session_time.cc @@ -41,7 +41,7 @@ using namespace PBD; /* BBT TIME*/ void -Session::bbt_time (jack_nframes_t when, BBT_Time& bbt) +Session::bbt_time (nframes_t when, BBT_Time& bbt) { _tempo_map->bbt_time (when, bbt); } @@ -51,7 +51,7 @@ Session::bbt_time (jack_nframes_t when, BBT_Time& bbt) void Session::sync_time_vars () { - _current_frame_rate = (jack_nframes_t) round (_base_frame_rate * (1.0 + (Config->get_video_pullup()/100.0))); + _current_frame_rate = (nframes_t) round (_base_frame_rate * (1.0 + (Config->get_video_pullup()/100.0))); _frames_per_hour = _current_frame_rate * 3600; _frames_per_smpte_frame = (double) _current_frame_rate / (double) Config->get_smpte_frames_per_second(); _smpte_frames_per_hour = (unsigned long) (Config->get_smpte_frames_per_second() * 3600.0); @@ -88,7 +88,7 @@ Session::set_smpte_type (float fps, bool drop_frames) } void -Session::set_smpte_offset (jack_nframes_t off) +Session::set_smpte_offset (nframes_t off) { _smpte_offset = off; last_smpte_valid = false; @@ -106,7 +106,7 @@ Session::set_smpte_offset_negative (bool neg) } void -Session::smpte_to_sample( SMPTE::Time& smpte, jack_nframes_t& sample, bool use_offset, bool use_subframes ) const +Session::smpte_to_sample( SMPTE::Time& smpte, nframes_t& sample, bool use_offset, bool use_subframes ) const { if (Config->get_smpte_drop_frames()) { // The drop frame format was created to better approximate the 30000/1001 = 29.97002997002997.... @@ -149,16 +149,16 @@ Session::smpte_to_sample( SMPTE::Time& smpte, jack_nframes_t& sample, bool use_o // Per Sigmond // Samples inside time dividable by 10 minutes (real time accurate) - jack_nframes_t base_samples = ((smpte.hours * 60 * 60) + ((smpte.minutes / 10) * 10 * 60)) * frame_rate(); + nframes_t base_samples = ((smpte.hours * 60 * 60) + ((smpte.minutes / 10) * 10 * 60)) * frame_rate(); // Samples inside time exceeding the nearest 10 minutes (always offset, see above) long exceeding_df_minutes = smpte.minutes % 10; long exceeding_df_seconds = (exceeding_df_minutes * 60) + smpte.seconds; long exceeding_df_frames = (30 * exceeding_df_seconds) + smpte.frames - (2 * exceeding_df_minutes); - jack_nframes_t exceeding_samples = (jack_nframes_t) rint(exceeding_df_frames * _frames_per_smpte_frame); + nframes_t exceeding_samples = (nframes_t) rint(exceeding_df_frames * _frames_per_smpte_frame); sample = base_samples + exceeding_samples; } else { // Non drop is easy: - sample = (((smpte.hours * 60 * 60) + (smpte.minutes * 60) + smpte.seconds) * frame_rate()) + (jack_nframes_t)rint(smpte.frames * _frames_per_smpte_frame); + sample = (((smpte.hours * 60 * 60) + (smpte.minutes * 60) + smpte.seconds) * frame_rate()) + (nframes_t)rint(smpte.frames * _frames_per_smpte_frame); } if (use_subframes) { @@ -189,9 +189,9 @@ Session::smpte_to_sample( SMPTE::Time& smpte, jack_nframes_t& sample, bool use_o void -Session::sample_to_smpte( jack_nframes_t sample, SMPTE::Time& smpte, bool use_offset, bool use_subframes ) const +Session::sample_to_smpte( nframes_t sample, SMPTE::Time& smpte, bool use_offset, bool use_subframes ) const { - jack_nframes_t offset_sample; + nframes_t offset_sample; if (!use_offset) { offset_sample = sample; @@ -283,7 +283,7 @@ Session::sample_to_smpte( jack_nframes_t sample, SMPTE::Time& smpte, bool use_of } void -Session::smpte_time (jack_nframes_t when, SMPTE::Time& smpte) +Session::smpte_time (nframes_t when, SMPTE::Time& smpte) { if (last_smpte_valid && when == last_smpte_when) { smpte = last_smpte; @@ -298,7 +298,7 @@ Session::smpte_time (jack_nframes_t when, SMPTE::Time& smpte) } void -Session::smpte_time_subframes (jack_nframes_t when, SMPTE::Time& smpte) +Session::smpte_time_subframes (nframes_t when, SMPTE::Time& smpte) { if (last_smpte_valid && when == last_smpte_when) { smpte = last_smpte; @@ -313,13 +313,13 @@ Session::smpte_time_subframes (jack_nframes_t when, SMPTE::Time& smpte) } void -Session::smpte_duration (jack_nframes_t when, SMPTE::Time& smpte) const +Session::smpte_duration (nframes_t when, SMPTE::Time& smpte) const { sample_to_smpte( when, smpte, false /* use_offset */, true /* use_subframes */ ); } void -Session::smpte_duration_string (char* buf, jack_nframes_t when) const +Session::smpte_duration_string (char* buf, nframes_t when) const { SMPTE::Time smpte; @@ -376,7 +376,7 @@ Session::jack_sync_callback (jack_transport_state_t state, void Session::jack_timebase_callback (jack_transport_state_t state, - jack_nframes_t nframes, + nframes_t nframes, jack_position_t* pos, int new_position) { @@ -454,8 +454,8 @@ Session::jack_timebase_callback (jack_transport_state_t state, #endif } -jack_nframes_t -Session::convert_to_frames_at (jack_nframes_t position, AnyTime& any) +nframes_t +Session::convert_to_frames_at (nframes_t position, AnyTime& any) { double secs; @@ -472,16 +472,16 @@ Session::convert_to_frames_at (jack_nframes_t position, AnyTime& any) secs += any.smpte.frames / Config->get_smpte_frames_per_second (); if (_smpte_offset_negative) { - return (jack_nframes_t) floor (secs * frame_rate()) - _smpte_offset; + return (nframes_t) floor (secs * frame_rate()) - _smpte_offset; } else { - return (jack_nframes_t) floor (secs * frame_rate()) + _smpte_offset; + return (nframes_t) floor (secs * frame_rate()) + _smpte_offset; } break; case AnyTime::Seconds: - return (jack_nframes_t) floor (any.seconds * frame_rate()); + return (nframes_t) floor (any.seconds * frame_rate()); break; case AnyTime::Frames: diff --git a/libs/ardour/session_timefx.cc b/libs/ardour/session_timefx.cc index 337a0c885c..d7274388aa 100644 --- a/libs/ardour/session_timefx.cc +++ b/libs/ardour/session_timefx.cc @@ -48,8 +48,8 @@ Session::tempoize_region (TimeStretchRequest& tsr) string region_name; string ident = X_("-TIMEFX-"); float percentage; - jack_nframes_t total_frames; - jack_nframes_t done; + nframes_t total_frames; + nframes_t done; /* the soundtouch code wants a *tempo* change percentage, which is of opposite sign to the length change. @@ -91,17 +91,17 @@ Session::tempoize_region (TimeStretchRequest& tsr) } try { - const jack_nframes_t bufsize = 16384; + const nframes_t bufsize = 16384; for (uint32_t i = 0; i < sources.size(); ++i) { gain_t gain_buffer[bufsize]; Sample buffer[bufsize]; - jack_nframes_t pos = 0; - jack_nframes_t this_read = 0; + nframes_t pos = 0; + nframes_t this_read = 0; st.clear(); while (tsr.running && pos < tsr.region->length()) { - jack_nframes_t this_time; + nframes_t this_time; this_time = min (bufsize, tsr.region->length() - pos); diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc index 963c232083..635540bb00 100644 --- a/libs/ardour/session_transport.cc +++ b/libs/ardour/session_transport.cc @@ -94,14 +94,14 @@ Session::request_stop (bool abort) } void -Session::request_locate (jack_nframes_t target_frame, bool with_roll) +Session::request_locate (nframes_t target_frame, bool with_roll) { Event *ev = new Event (with_roll ? Event::LocateRoll : Event::Locate, Event::Add, Event::Immediate, target_frame, 0, false); queue_event (ev); } void -Session::force_locate (jack_nframes_t target_frame, bool with_roll) +Session::force_locate (nframes_t target_frame, bool with_roll) { Event *ev = new Event (with_roll ? Event::LocateRoll : Event::Locate, Event::Add, Event::Immediate, target_frame, 0, true); queue_event (ev); @@ -209,7 +209,7 @@ Session::butler_transport_work () for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) { if (!(*i)->hidden()) { if ((*i)->speed() != 1.0f || (*i)->speed() != -1.0f) { - (*i)->seek ((jack_nframes_t) (_transport_frame * (double) (*i)->speed())); + (*i)->seek ((nframes_t) (_transport_frame * (double) (*i)->speed())); } else { (*i)->seek (_transport_frame); @@ -363,7 +363,7 @@ Session::non_realtime_stop (bool abort) for (DiskstreamList::iterator i = dsl->begin(); i != dsl->end(); ++i) { if (!(*i)->hidden()) { if ((*i)->speed() != 1.0f || (*i)->speed() != -1.0f) { - (*i)->seek ((jack_nframes_t) (_transport_frame * (double) (*i)->speed())); + (*i)->seek ((nframes_t) (_transport_frame * (double) (*i)->speed())); } else { (*i)->seek (_transport_frame); @@ -548,12 +548,12 @@ Session::flush_all_redirects () } void -Session::start_locate (jack_nframes_t target_frame, bool with_roll, bool with_flush, bool with_loop) +Session::start_locate (nframes_t target_frame, bool with_roll, bool with_flush, bool with_loop) { if (synced_to_jack()) { float sp; - jack_nframes_t pos; + nframes_t pos; _slave->speed_and_position (sp, pos); @@ -578,7 +578,7 @@ Session::start_locate (jack_nframes_t target_frame, bool with_roll, bool with_fl } void -Session::locate (jack_nframes_t target_frame, bool with_roll, bool with_flush, bool with_loop) +Session::locate (nframes_t target_frame, bool with_roll, bool with_flush, bool with_loop) { if (actively_recording()) { return; @@ -904,7 +904,7 @@ Session::post_transport () } void -Session::reset_rf_scale (jack_nframes_t motion) +Session::reset_rf_scale (nframes_t motion) { cumulative_rf_motion += motion; @@ -1077,7 +1077,7 @@ Session::setup_auto_play () /* locating/stopping is subject to delays for declicking. */ - jack_nframes_t requested_frame = (*i).end; + nframes_t requested_frame = (*i).end; if (requested_frame > current_block_size) { requested_frame -= current_block_size; @@ -1110,7 +1110,7 @@ Session::setup_auto_play () } void -Session::request_bounded_roll (jack_nframes_t start, jack_nframes_t end) +Session::request_bounded_roll (nframes_t start, nframes_t end) { request_stop (); Event *ev = new Event (Event::StopOnce, Event::Replace, Event::Immediate, end, 0.0); @@ -1174,8 +1174,8 @@ Session::update_latency_compensation (bool with_stop, bool abort) (!(post_transport_work & PostTransportLocate) || pending_locate_flush)); } - jack_nframes_t old_latency = (*i)->signal_latency (); - jack_nframes_t track_latency = (*i)->update_total_latency (); + nframes_t old_latency = (*i)->signal_latency (); + nframes_t track_latency = (*i)->update_total_latency (); if (old_latency != track_latency) { update_jack = true; diff --git a/libs/ardour/sndfilesource.cc b/libs/ardour/sndfilesource.cc index fa3a882aa4..340dd1fb08 100644 --- a/libs/ardour/sndfilesource.cc +++ b/libs/ardour/sndfilesource.cc @@ -23,6 +23,7 @@ #include #include +#include #include @@ -71,7 +72,7 @@ SndFileSource::SndFileSource (Session& s, string idstr, Flag flags) } } -SndFileSource::SndFileSource (Session& s, string idstr, SampleFormat sfmt, HeaderFormat hf, jack_nframes_t rate, Flag flags) +SndFileSource::SndFileSource (Session& s, string idstr, SampleFormat sfmt, HeaderFormat hf, nframes_t rate, Flag flags) : AudioFileSource (s, idstr, flags, sfmt, hf) { int fmt = 0; @@ -266,6 +267,14 @@ SndFileSource::~SndFileSource () if (sf) { sf_close (sf); sf = 0; + + /* stupid libsndfile updated the headers on close, + so touch the peakfile if it exists and has data + to make sure its time is as new as the audio + file. + */ + + touch_peakfile (); } if (interleave_buf) { @@ -283,18 +292,13 @@ SndFileSource::sample_rate () const return _info.samplerate; } -jack_nframes_t -SndFileSource::read_unlocked (Sample *dst, jack_nframes_t start, jack_nframes_t cnt) const +nframes_t +SndFileSource::read_unlocked (Sample *dst, nframes_t start, nframes_t cnt) const { int32_t nread; float *ptr; uint32_t real_cnt; - jack_nframes_t file_cnt; - - //destructive (tape) tracks need to offset reads and writes by the timeline position - if (_flags && ARDOUR::Destructive == ARDOUR::Destructive) { - start -= timeline_position; - } + nframes_t file_cnt; if (start > _length) { @@ -325,14 +329,14 @@ SndFileSource::read_unlocked (Sample *dst, jack_nframes_t start, jack_nframes_t } if (_info.channels == 1) { - jack_nframes_t ret = sf_read_float (sf, dst, file_cnt); + nframes_t ret = sf_read_float (sf, dst, file_cnt); _read_data_count = cnt * sizeof(float); return ret; } } if (file_cnt != cnt) { - jack_nframes_t delta = cnt - file_cnt; + nframes_t delta = cnt - file_cnt; memset (dst+file_cnt, 0, sizeof (Sample) * delta); } @@ -363,8 +367,8 @@ SndFileSource::read_unlocked (Sample *dst, jack_nframes_t start, jack_nframes_t return nread; } -jack_nframes_t -SndFileSource::write_unlocked (Sample *data, jack_nframes_t cnt) +nframes_t +SndFileSource::write_unlocked (Sample *data, nframes_t cnt) { if (!writable()) { return 0; @@ -376,7 +380,7 @@ SndFileSource::write_unlocked (Sample *data, jack_nframes_t cnt) return 0; } - jack_nframes_t oldlen; + nframes_t oldlen; int32_t frame_pos = _length; if (write_float (data, frame_pos, cnt) != cnt) { @@ -418,7 +422,7 @@ SndFileSource::write_unlocked (Sample *data, jack_nframes_t cnt) } int -SndFileSource::update_header (jack_nframes_t when, struct tm& now, time_t tnow) +SndFileSource::update_header (nframes_t when, struct tm& now, time_t tnow) { set_timeline_position (when); @@ -437,12 +441,11 @@ SndFileSource::flush_header () if (!writable() || (sf == 0)) { return -1; } - return (sf_command (sf, SFC_UPDATE_HEADER_NOW, 0, 0) != SF_TRUE); } int -SndFileSource::setup_broadcast_info (jack_nframes_t when, struct tm& now, time_t tnow) +SndFileSource::setup_broadcast_info (nframes_t when, struct tm& now, time_t tnow) { if (!writable()) { return -1; @@ -511,8 +514,8 @@ SndFileSource::set_header_timeline_position () } -jack_nframes_t -SndFileSource::write_float (Sample* data, jack_nframes_t frame_pos, jack_nframes_t cnt) +nframes_t +SndFileSource::write_float (Sample* data, nframes_t frame_pos, nframes_t cnt) { if (sf_seek (sf, frame_pos, SEEK_SET|SFM_WRITE) != frame_pos) { error << string_compose (_("%1: cannot seek to %2"), _path, frame_pos) << endmsg; @@ -526,7 +529,7 @@ SndFileSource::write_float (Sample* data, jack_nframes_t frame_pos, jack_nframes return cnt; } -jack_nframes_t +nframes_t SndFileSource::natural_position() const { return timeline_position; diff --git a/libs/ardour/source_factory.cc b/libs/ardour/source_factory.cc index c7539a1370..81a96491ce 100644 --- a/libs/ardour/source_factory.cc +++ b/libs/ardour/source_factory.cc @@ -130,7 +130,7 @@ SourceFactory::createReadable (Session& s, string idstr, AudioFileSource::Flag f #endif // HAVE_COREAUDIO boost::shared_ptr -SourceFactory::createWritable (Session& s, std::string path, bool destructive, jack_nframes_t rate, bool announce) +SourceFactory::createWritable (Session& s, std::string path, bool destructive, nframes_t rate, bool announce) { /* this might throw failed_constructor(), which is OK */ diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc index c2ff4f9a3a..3cc5420c67 100644 --- a/libs/ardour/tempo.cc +++ b/libs/ardour/tempo.cc @@ -47,7 +47,7 @@ const double Meter::ticks_per_beat = 1920.0; /***********************************************************************/ double -Meter::frames_per_bar (const Tempo& tempo, jack_nframes_t sr) const +Meter::frames_per_bar (const Tempo& tempo, nframes_t sr) const { return ((60.0 * sr * _beats_per_bar) / tempo.beats_per_minute()); } @@ -200,7 +200,7 @@ struct MetricSectionSorter { } }; -TempoMap::TempoMap (jack_nframes_t fr) +TempoMap::TempoMap (nframes_t fr) { metrics = new Metrics; _frame_rate = fr; @@ -509,8 +509,8 @@ TempoMap::timestamp_metrics () const Tempo* tempo; Meter *m; Tempo *t; - jack_nframes_t current; - jack_nframes_t section_frames; + nframes_t current; + nframes_t section_frames; BBT_Time start; BBT_Time end; @@ -542,7 +542,7 @@ TempoMap::timestamp_metrics () } TempoMap::Metric -TempoMap::metric_at (jack_nframes_t frame) const +TempoMap::metric_at (nframes_t frame) const { Metric m (first_meter(), first_tempo()); const Meter* meter; @@ -610,7 +610,7 @@ TempoMap::metric_at (BBT_Time bbt) const } void -TempoMap::bbt_time (jack_nframes_t frame, BBT_Time& bbt) const +TempoMap::bbt_time (nframes_t frame, BBT_Time& bbt) const { { Glib::RWLock::ReaderLock lm (lock); @@ -619,15 +619,15 @@ TempoMap::bbt_time (jack_nframes_t frame, BBT_Time& bbt) const } void -TempoMap::bbt_time_unlocked (jack_nframes_t frame, BBT_Time& bbt) const +TempoMap::bbt_time_unlocked (nframes_t frame, BBT_Time& bbt) const { bbt_time_with_metric (frame, bbt, metric_at (frame)); } void -TempoMap::bbt_time_with_metric (jack_nframes_t frame, BBT_Time& bbt, const Metric& metric) const +TempoMap::bbt_time_with_metric (nframes_t frame, BBT_Time& bbt, const Metric& metric) const { - jack_nframes_t frame_diff; + nframes_t frame_diff; uint32_t xtra_bars = 0; double xtra_beats = 0; @@ -667,7 +667,7 @@ TempoMap::bbt_time_with_metric (jack_nframes_t frame, BBT_Time& bbt, const Metri } -jack_nframes_t +nframes_t TempoMap::count_frames_between ( const BBT_Time& start, const BBT_Time& end) const { @@ -676,9 +676,9 @@ TempoMap::count_frames_between ( const BBT_Time& start, const BBT_Time& end) con */ - jack_nframes_t frames = 0; - jack_nframes_t start_frame = 0; - jack_nframes_t end_frame = 0; + nframes_t frames = 0; + nframes_t start_frame = 0; + nframes_t end_frame = 0; Metric m = metric_at(start); @@ -688,7 +688,7 @@ TempoMap::count_frames_between ( const BBT_Time& start, const BBT_Time& end) con + start.ticks/Meter::ticks_per_beat; - start_frame = m.frame() + (jack_nframes_t) rint( beat_offset * m.tempo().frames_per_beat(_frame_rate)); + start_frame = m.frame() + (nframes_t) rint( beat_offset * m.tempo().frames_per_beat(_frame_rate)); m = metric_at(end); @@ -697,7 +697,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() + (jack_nframes_t) rint(beat_offset * m.tempo().frames_per_beat(_frame_rate)); + end_frame = m.frame() + (nframes_t) rint(beat_offset * m.tempo().frames_per_beat(_frame_rate)); frames = end_frame - start_frame; @@ -705,12 +705,12 @@ TempoMap::count_frames_between ( const BBT_Time& start, const BBT_Time& end) con } -jack_nframes_t +nframes_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 */ - jack_nframes_t frames = 0; + nframes_t frames = 0; uint32_t bar = start.bars; double beat = (double) start.beats; double beats_counted = 0; @@ -739,13 +739,13 @@ TempoMap::count_frames_between_metrics (const Meter& meter, const Tempo& tempo, } } - frames = (jack_nframes_t) floor (beats_counted * beat_frames); + frames = (nframes_t) floor (beats_counted * beat_frames); return frames; } -jack_nframes_t +nframes_t TempoMap::frame_time (const BBT_Time& bbt) const { BBT_Time start ; /* 1|1|0 */ @@ -753,10 +753,10 @@ TempoMap::frame_time (const BBT_Time& bbt) const return count_frames_between ( start, bbt); } -jack_nframes_t -TempoMap::bbt_duration_at (jack_nframes_t pos, const BBT_Time& bbt, int dir) const +nframes_t +TempoMap::bbt_duration_at (nframes_t pos, const BBT_Time& bbt, int dir) const { - jack_nframes_t frames = 0; + nframes_t frames = 0; BBT_Time when; bbt_time(pos,when); @@ -769,11 +769,11 @@ TempoMap::bbt_duration_at (jack_nframes_t pos, const BBT_Time& bbt, int dir) con return frames; } -jack_nframes_t +nframes_t TempoMap::bbt_duration_at_unlocked (const BBT_Time& when, const BBT_Time& bbt, int dir) const { - jack_nframes_t frames = 0; + nframes_t frames = 0; double beats_per_bar; BBT_Time result; @@ -896,8 +896,8 @@ TempoMap::bbt_duration_at_unlocked (const BBT_Time& when, const BBT_Time& bbt, i -jack_nframes_t -TempoMap::round_to_bar (jack_nframes_t fr, int dir) +nframes_t +TempoMap::round_to_bar (nframes_t fr, int dir) { { Glib::RWLock::ReaderLock lm (lock); @@ -906,8 +906,8 @@ TempoMap::round_to_bar (jack_nframes_t fr, int dir) } -jack_nframes_t -TempoMap::round_to_beat (jack_nframes_t fr, int dir) +nframes_t +TempoMap::round_to_beat (nframes_t fr, int dir) { { Glib::RWLock::ReaderLock lm (lock); @@ -915,9 +915,9 @@ TempoMap::round_to_beat (jack_nframes_t fr, int dir) } } -jack_nframes_t +nframes_t -TempoMap::round_to_beat_subdivision (jack_nframes_t fr, int sub_num) +TempoMap::round_to_beat_subdivision (nframes_t fr, int sub_num) { BBT_Time the_beat; @@ -948,16 +948,16 @@ TempoMap::round_to_beat_subdivision (jack_nframes_t fr, int sub_num) TempoMap::BBTPointList::iterator i; TempoMap::BBTPointList *more_zoomed_bbt_points; - jack_nframes_t frame_one_beats_worth; - jack_nframes_t pos = 0; - jack_nframes_t next_pos = 0 ; + nframes_t frame_one_beats_worth; + nframes_t pos = 0; + nframes_t next_pos = 0 ; double tempo = 1; double frames_one_subdivisions_worth; bool fr_has_changed = false; int n; - frame_one_beats_worth = (jack_nframes_t) ::floor ((double) _frame_rate * 60 / 20 ); //one beat @ 20 bpm + frame_one_beats_worth = (nframes_t) ::floor ((double) _frame_rate * 60 / 20 ); //one beat @ 20 bpm { Glib::RWLock::ReaderLock lm (lock); more_zoomed_bbt_points = get_points((fr >= frame_one_beats_worth) ? @@ -982,7 +982,7 @@ TempoMap::round_to_beat_subdivision (jack_nframes_t fr, int sub_num) for (n = sub_num; n > 0; n--) { if (fr >= (pos + ((n - 0.5) * frames_one_subdivisions_worth))) { - fr = (jack_nframes_t) round(pos + (n * frames_one_subdivisions_worth)); + fr = (nframes_t) round(pos + (n * frames_one_subdivisions_worth)); if (fr > next_pos) { fr = next_pos; //take care of fractional beats that don't match the subdivision asked } @@ -1002,9 +1002,9 @@ TempoMap::round_to_beat_subdivision (jack_nframes_t fr, int sub_num) } -jack_nframes_t +nframes_t -TempoMap::round_to_type (jack_nframes_t frame, int dir, BBTPointType type) +TempoMap::round_to_type (nframes_t frame, int dir, BBTPointType type) { Metric metric = metric_at (frame); BBT_Time bbt; @@ -1055,7 +1055,7 @@ TempoMap::round_to_type (jack_nframes_t frame, int dir, BBTPointType type) } TempoMap::BBTPointList * -TempoMap::get_points (jack_nframes_t lower, jack_nframes_t upper) const +TempoMap::get_points (nframes_t lower, nframes_t upper) const { Metrics::const_iterator i; @@ -1071,7 +1071,7 @@ TempoMap::get_points (jack_nframes_t lower, jack_nframes_t upper) const double beat_frame; double beat_frames; double frames_per_bar; - jack_nframes_t limit; + nframes_t limit; meter = &first_meter (); tempo = &first_tempo (); @@ -1132,7 +1132,7 @@ TempoMap::get_points (jack_nframes_t lower, jack_nframes_t upper) const if (beat == 1) { if (current >= lower) { - points->push_back (BBTPoint (*meter, *tempo,(jack_nframes_t)rint(current), Bar, bar, 1)); + points->push_back (BBTPoint (*meter, *tempo,(nframes_t)rint(current), Bar, bar, 1)); } } @@ -1143,7 +1143,7 @@ TempoMap::get_points (jack_nframes_t lower, jack_nframes_t upper) const while (beat <= ceil( beats_per_bar) && beat_frame < limit) { if (beat_frame >= lower) { - points->push_back (BBTPoint (*meter, *tempo, (jack_nframes_t) rint(beat_frame), Beat, bar, beat)); + points->push_back (BBTPoint (*meter, *tempo, (nframes_t) rint(beat_frame), Beat, bar, beat)); } beat_frame += beat_frames; current+= beat_frames; @@ -1206,7 +1206,7 @@ TempoMap::get_points (jack_nframes_t lower, jack_nframes_t upper) const } const Tempo& -TempoMap::tempo_at (jack_nframes_t frame) +TempoMap::tempo_at (nframes_t frame) { Metric m (metric_at (frame)); return m.tempo(); @@ -1214,7 +1214,7 @@ TempoMap::tempo_at (jack_nframes_t frame) const Meter& -TempoMap::meter_at (jack_nframes_t frame) +TempoMap::meter_at (nframes_t frame) { Metric m (metric_at (frame)); return m.meter(); diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc index 17db545cf7..cfa7d71a23 100644 --- a/libs/ardour/track.cc +++ b/libs/ardour/track.cc @@ -88,7 +88,7 @@ Track::toggle_monitor_input () } } -jack_nframes_t +nframes_t Track::update_total_latency () { _own_latency = 0; @@ -218,7 +218,7 @@ Track::set_name (string str, void *src) } void -Track::set_latency_delay (jack_nframes_t longest_session_latency) +Track::set_latency_delay (nframes_t longest_session_latency) { Route::set_latency_delay (longest_session_latency); _diskstream->set_roll_delay (_roll_delay); diff --git a/libs/ardour/utils.cc b/libs/ardour/utils.cc index 83b0c3101e..574e7a6587 100644 --- a/libs/ardour/utils.cc +++ b/libs/ardour/utils.cc @@ -273,7 +273,7 @@ CFStringRefToStdString(CFStringRef stringRef) #endif // HAVE_COREAUDIO void -compute_equal_power_fades (jack_nframes_t nframes, float* in, float* out) +compute_equal_power_fades (nframes_t nframes, float* in, float* out) { double step; @@ -281,7 +281,7 @@ compute_equal_power_fades (jack_nframes_t nframes, float* in, float* out) in[0] = 0.0f; - for (jack_nframes_t i = 1; i < nframes - 1; ++i) { + for (nframes_t i = 1; i < nframes - 1; ++i) { in[i] = in[i-1] + step; } diff --git a/libs/ardour/vst_plugin.cc b/libs/ardour/vst_plugin.cc index 5dd32f2d51..e5a84bbad0 100644 --- a/libs/ardour/vst_plugin.cc +++ b/libs/ardour/vst_plugin.cc @@ -103,7 +103,7 @@ VSTPlugin::~VSTPlugin () } void -VSTPlugin::set_block_size (jack_nframes_t nframes) +VSTPlugin::set_block_size (nframes_t nframes) { deactivate (); _plugin->dispatcher (_plugin, effSetBlockSize, 0, nframes, NULL, 0.0f); @@ -357,7 +357,7 @@ VSTPlugin::describe_parameter (uint32_t param) return name; } -jack_nframes_t +nframes_t VSTPlugin::latency () const { return _plugin->initialDelay; @@ -376,7 +376,7 @@ VSTPlugin::automatable () const } int -VSTPlugin::connect_and_run (vector& bufs, uint32_t maxbuf, int32_t& in_index, int32_t& out_index, jack_nframes_t nframes, jack_nframes_t offset) +VSTPlugin::connect_and_run (vector& bufs, uint32_t maxbuf, int32_t& in_index, int32_t& out_index, nframes_t nframes, nframes_t offset) { float *ins[_plugin->numInputs]; float *outs[_plugin->numOutputs]; -- cgit v1.2.3