From a8da89d745c6a7e7d4c20dfcfb16b2537d767428 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 3 May 2007 23:28:57 +0000 Subject: optimize some performance bottlenecks; remove jack_nframes_t that crept back into the code git-svn-id: svn://localhost/ardour2/branches/midi@1779 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/amp.cc | 31 ++++++++------- libs/ardour/ardour/amp.h | 4 +- libs/ardour/ardour/audio_port.h | 17 +++++---- libs/ardour/ardour/audioengine.h | 2 - libs/ardour/ardour/audioregion.h | 8 ++-- libs/ardour/ardour/buffer.h | 33 ++++++++-------- libs/ardour/ardour/data_type.h | 1 - libs/ardour/ardour/io.h | 14 +++---- libs/ardour/ardour/meter.h | 2 +- libs/ardour/ardour/midi_diskstream.h | 20 +++++----- libs/ardour/ardour/midi_playlist.h | 4 +- libs/ardour/ardour/midi_port.h | 4 +- libs/ardour/ardour/midi_region.h | 34 ++++++++--------- libs/ardour/ardour/midi_ring_buffer.h | 12 +++--- libs/ardour/ardour/midi_source.h | 10 ++--- libs/ardour/ardour/midi_track.h | 22 +++++------ libs/ardour/ardour/port.h | 2 +- libs/ardour/ardour/region.h | 8 ++-- libs/ardour/ardour/session.h | 6 +-- libs/ardour/ardour/smf_source.h | 14 +++---- libs/ardour/ardour/source.h | 8 ++-- libs/ardour/audio_port.cc | 23 +---------- libs/ardour/audio_track.cc | 16 ++++---- libs/ardour/audioengine.cc | 68 ++++++++++++++++----------------- libs/ardour/automation_event.cc | 2 +- libs/ardour/buffer.cc | 4 +- libs/ardour/buffer_set.cc | 2 +- libs/ardour/control_protocol_manager.cc | 6 ++- libs/ardour/io.cc | 2 +- libs/ardour/meter.cc | 2 +- libs/ardour/midi_diskstream.cc | 46 +++++++++++----------- libs/ardour/midi_playlist.cc | 16 ++++---- libs/ardour/midi_port.cc | 10 ++--- libs/ardour/midi_region.cc | 34 ++++++++--------- libs/ardour/midi_source.cc | 8 ++-- libs/ardour/midi_track.cc | 18 ++++----- libs/ardour/panner.cc | 18 ++++----- libs/ardour/region.cc | 12 +++--- libs/ardour/route.cc | 8 ++-- libs/ardour/session.cc | 4 +- libs/ardour/session_click.cc | 4 +- libs/ardour/session_export.cc | 2 +- libs/ardour/session_midi.cc | 12 +++--- libs/ardour/session_process.cc | 8 ++-- libs/ardour/smf_source.cc | 14 +++---- libs/ardour/source.cc | 2 +- 46 files changed, 291 insertions(+), 306 deletions(-) diff --git a/libs/ardour/amp.cc b/libs/ardour/amp.cc index 8a73e5708e..ca1aa74bb5 100644 --- a/libs/ardour/amp.cc +++ b/libs/ardour/amp.cc @@ -28,27 +28,31 @@ namespace ARDOUR { /** Apply a declicked gain to the audio buffers of @a bufs */ void -Amp::run (BufferSet& bufs, jack_nframes_t nframes, gain_t initial, gain_t target, bool invert_polarity) +Amp::run (BufferSet& bufs, nframes_t nframes, gain_t initial, gain_t target, bool invert_polarity) { + if (nframes == 0) + return; + if (bufs.count().get(DataType::AUDIO) == 0) return; - assert(bufs.buffer_capacity(DataType::AUDIO) >= nframes); + // assert(bufs.buffer_capacity(DataType::AUDIO) >= nframes); // if we don't need to declick, defer to apply_simple_gain + if (initial == target) { - apply_simple_gain(bufs, nframes, invert_polarity ? -target : target); + for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i) { + apply_gain_to_buffer (i->data (), nframes, target); + } + return; } - const jack_nframes_t declick = std::min ((jack_nframes_t)128, nframes); + const nframes_t declick = std::min ((nframes_t)128, nframes); gain_t delta; double fractional_shift = -1.0/declick; double fractional_pos; gain_t polscale = invert_polarity ? -1.0f : 1.0f; - if (nframes == 0) - return; - if (target < initial) { /* fade out: remove more and more of delta from initial */ delta = -(initial - target); @@ -58,11 +62,11 @@ Amp::run (BufferSet& bufs, jack_nframes_t nframes, gain_t initial, gain_t target } for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i) { - Sample* const buffer = i->data(nframes); + Sample* const buffer = i->data(); 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; } @@ -78,20 +82,15 @@ Amp::run (BufferSet& bufs, jack_nframes_t nframes, gain_t initial, gain_t target if (target == 0.0) { memset (&buffer[declick], 0, sizeof (Sample) * (nframes - declick)); } else if (target != 1.0) { - for (jack_nframes_t nx = declick; nx < nframes; ++nx) { - buffer[nx] *= target; - } + apply_gain_to_buffer (&buffer[declick], nframes - declick, target); } } } } void -Amp::apply_simple_gain (BufferSet& bufs, jack_nframes_t nframes, gain_t target) +Amp::apply_simple_gain (BufferSet& bufs, nframes_t nframes, gain_t target) { - for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i) { - i->apply_gain(target, nframes); - } } diff --git a/libs/ardour/ardour/amp.h b/libs/ardour/ardour/amp.h index 7cdb302a3b..c3049c1e8b 100644 --- a/libs/ardour/ardour/amp.h +++ b/libs/ardour/ardour/amp.h @@ -31,9 +31,9 @@ class BufferSet; */ class Amp { public: - static void run (BufferSet& bufs, jack_nframes_t nframes, gain_t initial, gain_t target, bool invert_polarity); + static void run (BufferSet& bufs, nframes_t nframes, gain_t initial, gain_t target, bool invert_polarity); - static void apply_simple_gain(BufferSet& bufs, jack_nframes_t nframes, gain_t target); + static void apply_simple_gain(BufferSet& bufs, nframes_t nframes, gain_t target); }; diff --git a/libs/ardour/ardour/audio_port.h b/libs/ardour/ardour/audio_port.h index 07dc8da442..0e85e0e01b 100644 --- a/libs/ardour/ardour/audio_port.h +++ b/libs/ardour/ardour/audio_port.h @@ -38,8 +38,11 @@ class AudioPort : public Port { free (_port); } - void cycle_start(jack_nframes_t nframes); - void cycle_end(); + void cycle_start(nframes_t nframes) { + _buffer.set_data ((Sample*) jack_port_get_buffer (_port, nframes), nframes); + } + + void cycle_end() {} DataType type() const { return DataType(DataType::AUDIO); } @@ -72,8 +75,8 @@ class AudioPort : public Port { 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); protected: friend class AudioEngine; @@ -85,14 +88,14 @@ class AudioPort : public Port { AudioBuffer _buffer; - jack_nframes_t _overlen; + nframes_t _overlen; jack_default_audio_sample_t _peak; float _peak_db; uint32_t _short_overs; uint32_t _long_overs; - 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/audioengine.h b/libs/ardour/ardour/audioengine.h index 0263f83230..a95bc0472b 100644 --- a/libs/ardour/ardour/audioengine.h +++ b/libs/ardour/ardour/audioengine.h @@ -68,8 +68,6 @@ class AudioEngine : public sigc::trackable int start (); bool running() const { return _running; } - int run_process_cycle (ARDOUR::Session*, jack_nframes_t nframes); - Glib::Mutex& process_lock() { return _process_lock; } nframes_t frame_rate(); diff --git a/libs/ardour/ardour/audioregion.h b/libs/ardour/ardour/audioregion.h index e25278cce9..23841af095 100644 --- a/libs/ardour/ardour/audioregion.h +++ b/libs/ardour/ardour/audioregion.h @@ -176,10 +176,10 @@ class AudioRegion : public Region protected: int set_live_state (const XMLNode&, Change&, bool send); - virtual bool verify_start (jack_nframes_t); - virtual bool verify_start_and_length (jack_nframes_t, jack_nframes_t); - virtual bool verify_start_mutable (jack_nframes_t&_start); - virtual bool verify_length (jack_nframes_t); + virtual bool verify_start (nframes_t); + virtual bool verify_start_and_length (nframes_t, nframes_t); + virtual bool verify_start_mutable (nframes_t&_start); + virtual bool verify_length (nframes_t); /*virtual void recompute_at_start () = 0; virtual void recompute_at_end () = 0;*/ }; diff --git a/libs/ardour/ardour/buffer.h b/libs/ardour/ardour/buffer.h index 6000872bdd..b890afbb03 100644 --- a/libs/ardour/ardour/buffer.h +++ b/libs/ardour/ardour/buffer.h @@ -60,12 +60,12 @@ public: bool silent() const { return _silent; } /** Clear (eg zero, or empty) buffer starting at TIME @a offset */ - virtual void silence(jack_nframes_t len, jack_nframes_t offset=0) = 0; + virtual void silence(nframes_t len, nframes_t offset=0) = 0; /** Clear the entire buffer */ virtual void clear() { silence(_capacity, 0); } - virtual void read_from(const Buffer& src, jack_nframes_t offset, jack_nframes_t len) = 0; + virtual void read_from(const Buffer& src, nframes_t offset, nframes_t len) = 0; protected: Buffer(DataType type, size_t capacity) @@ -95,7 +95,7 @@ public: ~AudioBuffer(); - void silence(jack_nframes_t len, jack_nframes_t offset=0) + void silence(nframes_t len, nframes_t offset=0) { if (!_silent) { assert(_capacity > 0); @@ -108,25 +108,25 @@ public: } /** Read @a len frames FROM THE START OF @a src into self at @a offset */ - void read_from(const Buffer& src, jack_nframes_t len, jack_nframes_t offset) + void read_from(const Buffer& src, nframes_t len, nframes_t offset) { assert(_capacity > 0); assert(src.type() == _type == DataType::AUDIO); assert(offset + len <= _capacity); - memcpy(_data + offset, ((AudioBuffer&)src).data(len), sizeof(Sample) * len); + memcpy(_data + offset, ((AudioBuffer&)src).data(), sizeof(Sample) * len); _silent = src.silent(); } /** Accumulate (add)@a len frames FROM THE START OF @a src into self at @a offset */ - void accumulate_from(const AudioBuffer& src, jack_nframes_t len, jack_nframes_t offset) + void accumulate_from(const AudioBuffer& src, nframes_t len, nframes_t offset) { assert(_capacity > 0); assert(offset + len <= _capacity); Sample* const dst_raw = _data + offset; - const Sample* const src_raw = src.data(len); + const Sample* const src_raw = src.data(); - for (jack_nframes_t n = 0; n < len; ++n) { + for (nframes_t n = 0; n < len; ++n) { dst_raw[n] += src_raw[n]; } @@ -135,20 +135,20 @@ public: /** Accumulate (add) @a len frames FROM THE START OF @a src into self at @a offset * scaling by @a gain_coeff */ - void accumulate_with_gain_from(const AudioBuffer& src, jack_nframes_t len, jack_nframes_t offset, gain_t gain_coeff) + void accumulate_with_gain_from(const AudioBuffer& src, nframes_t len, nframes_t offset, gain_t gain_coeff) { assert(_capacity > 0); assert(offset + len <= _capacity); Sample* const dst_raw = _data + offset; - const Sample* const src_raw = src.data(len); + const Sample* const src_raw = src.data(); mix_buffers_with_gain (dst_raw, src_raw, len, gain_coeff); _silent = ( (src.silent() && _silent) || (_silent && gain_coeff == 0) ); } - void apply_gain(gain_t gain, jack_nframes_t len, jack_nframes_t offset=0) { + void apply_gain(gain_t gain, nframes_t len, nframes_t offset=0) { apply_gain_to_buffer (_data + offset, len, gain); } @@ -165,10 +165,13 @@ public: _silent = false; } - const Sample* data(jack_nframes_t nframes, jack_nframes_t offset=0) const + const Sample* data () const { return _data; } + Sample* data () { return _data; } + + const Sample* data(nframes_t nframes, nframes_t offset) const { assert(offset + nframes <= _capacity); return _data + offset; } - Sample* data(jack_nframes_t nframes, jack_nframes_t offset=0) + Sample* data (nframes_t nframes, nframes_t offset) { assert(offset + nframes <= _capacity); return _data + offset; } private: @@ -190,9 +193,9 @@ public: ~MidiBuffer(); - void silence(jack_nframes_t dur, jack_nframes_t offset=0); + void silence(nframes_t dur, nframes_t offset=0); - void read_from(const Buffer& src, jack_nframes_t nframes, jack_nframes_t offset); + void read_from(const Buffer& src, nframes_t nframes, nframes_t offset); bool push_back(const MidiEvent& event); diff --git a/libs/ardour/ardour/data_type.h b/libs/ardour/ardour/data_type.h index 3e461139b5..3818a8d74f 100644 --- a/libs/ardour/ardour/data_type.h +++ b/libs/ardour/ardour/data_type.h @@ -19,7 +19,6 @@ #ifndef __ardour_data_type_h__ #define __ardour_data_type_h__ -#include #include #include #include diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h index 51423e9ab2..5c746d7376 100644 --- a/libs/ardour/ardour/io.h +++ b/libs/ardour/ardour/io.h @@ -96,11 +96,11 @@ class IO : public PBD::StatefulDestructible virtual void silence (nframes_t, nframes_t offset); - void collect_input (BufferSet& bufs, jack_nframes_t nframes, jack_nframes_t offset); - void deliver_output (BufferSet& bufs, jack_nframes_t start_frame, jack_nframes_t end_frame, - 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 collect_input (BufferSet& bufs, nframes_t nframes, nframes_t offset); + void deliver_output (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, + 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 void set_gain (gain_t g, void *src); void inc_gain (gain_t delta, void *src); @@ -216,11 +216,11 @@ class IO : public PBD::StatefulDestructible /* automation */ - 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; } diff --git a/libs/ardour/ardour/meter.h b/libs/ardour/ardour/meter.h index 17379c3baa..ed38fc4f0a 100644 --- a/libs/ardour/ardour/meter.h +++ b/libs/ardour/ardour/meter.h @@ -41,7 +41,7 @@ public: void reset_max (); /** Compute peaks */ - void run (BufferSet& bufs, jack_nframes_t nframes, jack_nframes_t offset=0); + void run (BufferSet& bufs, nframes_t nframes, nframes_t offset=0); float peak_power (uint32_t n) { if (n < _visible_peak_power.size()) { diff --git a/libs/ardour/ardour/midi_diskstream.h b/libs/ardour/ardour/midi_diskstream.h index ee11b5e133..bc126ce364 100644 --- a/libs/ardour/ardour/midi_diskstream.h +++ b/libs/ardour/ardour/midi_diskstream.h @@ -68,7 +68,7 @@ class MidiDiskstream : public Diskstream float playback_buffer_load() const; float capture_buffer_load() const; - void get_playback(MidiBuffer& dst, jack_nframes_t start, jack_nframes_t end); + void get_playback(MidiBuffer& dst, nframes_t start, nframes_t end); void set_record_enabled (bool yn); @@ -99,21 +99,21 @@ class MidiDiskstream : 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: - int seek (jack_nframes_t which_sample, bool complete_refill = false); + int seek (nframes_t which_sample, bool complete_refill = false); protected: friend class MidiTrack; - 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: @@ -123,7 +123,7 @@ class MidiDiskstream : public Diskstream int do_refill_with_alloc(); - int read (jack_nframes_t& start, jack_nframes_t cnt, bool reversed); + int read (nframes_t& start, nframes_t cnt, bool reversed); void finish_capture (bool rec_monitors_input); void transport_stopped (struct tm&, time_t, bool abort); @@ -139,7 +139,7 @@ class MidiDiskstream : 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 engage_record_enable (); @@ -157,7 +157,7 @@ class MidiDiskstream : public Diskstream RingBufferNPT* _capture_transition_buf; //RingBufferNPT::rw_vector _playback_vector; //RingBufferNPT::rw_vector _capture_vector; - jack_nframes_t _last_flush_frame; + nframes_t _last_flush_frame; }; }; /* namespace ARDOUR */ diff --git a/libs/ardour/ardour/midi_playlist.h b/libs/ardour/ardour/midi_playlist.h index 492241d6b5..44f04b781b 100644 --- a/libs/ardour/ardour/midi_playlist.h +++ b/libs/ardour/ardour/midi_playlist.h @@ -41,13 +41,13 @@ public: MidiPlaylist (Session&, const XMLNode&, bool hidden = false); MidiPlaylist (Session&, string name, bool hidden = false); MidiPlaylist (boost::shared_ptr other, string name, bool hidden = false); - MidiPlaylist (boost::shared_ptr other, jack_nframes_t start, jack_nframes_t cnt, + MidiPlaylist (boost::shared_ptr other, nframes_t start, nframes_t cnt, string name, bool hidden = false); ~MidiPlaylist (); nframes_t read (MidiRingBuffer& buf, - jack_nframes_t start, jack_nframes_t cnt, uint32_t chan_n=0); + nframes_t start, nframes_t cnt, uint32_t chan_n=0); int set_state (const XMLNode&); UndoAction get_memento() const; diff --git a/libs/ardour/ardour/midi_port.h b/libs/ardour/ardour/midi_port.h index 1abfd80932..f2b734a903 100644 --- a/libs/ardour/ardour/midi_port.h +++ b/libs/ardour/ardour/midi_port.h @@ -47,7 +47,7 @@ class MidiPort : public Port { return _buffer; } - void cycle_start(jack_nframes_t nframes); + void cycle_start(nframes_t nframes); void cycle_end(); size_t capacity() { return _buffer.capacity(); } @@ -61,7 +61,7 @@ class MidiPort : public Port { /* engine isn't supposed to access below here */ MidiBuffer _buffer; - jack_nframes_t _nframes_this_cycle; + nframes_t _nframes_this_cycle; }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/midi_region.h b/libs/ardour/ardour/midi_region.h index 2fa39a37df..200599541e 100644 --- a/libs/ardour/ardour/midi_region.h +++ b/libs/ardour/ardour/midi_region.h @@ -50,16 +50,16 @@ class MidiRegion : public Region boost::shared_ptr midi_source (uint32_t n=0) const; - jack_nframes_t read_at (MidiRingBuffer& dst, - jack_nframes_t position, - jack_nframes_t dur, + nframes_t read_at (MidiRingBuffer& dst, + nframes_t position, + nframes_t dur, 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 (MidiRingBuffer& dst, - jack_nframes_t position, - jack_nframes_t dur, + nframes_t master_read_at (MidiRingBuffer& dst, + nframes_t position, + nframes_t dur, uint32_t chan_n=0) const; XMLNode& state (bool); @@ -72,10 +72,10 @@ class MidiRegion : public Region private: friend class RegionFactory; - MidiRegion (boost::shared_ptr, jack_nframes_t start, jack_nframes_t length); - MidiRegion (boost::shared_ptr, jack_nframes_t start, jack_nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags); - MidiRegion (SourceList &, jack_nframes_t start, jack_nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags); - MidiRegion (boost::shared_ptr, jack_nframes_t start, jack_nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags); + MidiRegion (boost::shared_ptr, nframes_t start, nframes_t length); + MidiRegion (boost::shared_ptr, nframes_t start, nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags); + MidiRegion (SourceList &, nframes_t start, nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags); + MidiRegion (boost::shared_ptr, nframes_t start, nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags); MidiRegion (boost::shared_ptr); MidiRegion (boost::shared_ptr, const XMLNode&); MidiRegion (SourceList &, const XMLNode&); @@ -84,12 +84,12 @@ class MidiRegion : public Region friend class Playlist; private: - jack_nframes_t _read_at (const SourceList&, MidiRingBuffer& dst, - jack_nframes_t position, - jack_nframes_t dur, + nframes_t _read_at (const SourceList&, MidiRingBuffer& dst, + nframes_t position, + nframes_t dur, 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; void recompute_at_start (); void recompute_at_end (); diff --git a/libs/ardour/ardour/midi_ring_buffer.h b/libs/ardour/ardour/midi_ring_buffer.h index e8b499397d..71f42d7182 100644 --- a/libs/ardour/ardour/midi_ring_buffer.h +++ b/libs/ardour/ardour/midi_ring_buffer.h @@ -94,10 +94,10 @@ public: /** Read events all events up to time @a end into @a out, leaving stamps intact. * Any events before @a start will be dropped. */ - size_t read(MidiBuffer& out, jack_nframes_t start, jack_nframes_t end); + size_t read(MidiBuffer& out, nframes_t start, nframes_t end); /** Write all events from @a in, applying @a offset to all time stamps */ - size_t write(const MidiBuffer& in, jack_nframes_t offset = 0); + size_t write(const MidiBuffer& in, nframes_t offset = 0); inline void clear_event(size_t index); @@ -128,7 +128,7 @@ MidiRingBuffer::clear_event(size_t index) inline size_t MidiRingBuffer::write (const MidiEvent& ev) { - //static jack_nframes_t last_write_time = 0; + //static nframes_t last_write_time = 0; assert(ev.size > 0); @@ -162,13 +162,13 @@ MidiRingBuffer::write (const MidiEvent& ev) } inline size_t -MidiRingBuffer::read(MidiBuffer& dst, jack_nframes_t start, jack_nframes_t end) +MidiRingBuffer::read(MidiBuffer& dst, nframes_t start, nframes_t end) { if (read_space() == 0) return 0; size_t priv_read_ptr = g_atomic_int_get(&_read_ptr); - jack_nframes_t time = _ev_buf[priv_read_ptr].time; + nframes_t time = _ev_buf[priv_read_ptr].time; size_t count = 0; size_t limit = read_space(); @@ -205,7 +205,7 @@ MidiRingBuffer::read(MidiBuffer& dst, jack_nframes_t start, jack_nframes_t end) } inline size_t -MidiRingBuffer::write(const MidiBuffer& in, jack_nframes_t offset) +MidiRingBuffer::write(const MidiBuffer& in, nframes_t offset) { size_t num_events = in.size(); size_t to_write = std::min(write_space(), num_events); diff --git a/libs/ardour/ardour/midi_source.h b/libs/ardour/ardour/midi_source.h index a035bf683e..5504db6ab6 100644 --- a/libs/ardour/ardour/midi_source.h +++ b/libs/ardour/ardour/midi_source.h @@ -47,8 +47,8 @@ class MidiSource : public Source MidiSource (Session& session, const XMLNode&); virtual ~MidiSource (); - virtual jack_nframes_t read (MidiRingBuffer& dst, jack_nframes_t start, jack_nframes_t cnt, jack_nframes_t stamp_offset) const; - virtual jack_nframes_t write (MidiRingBuffer& src, jack_nframes_t cnt); + virtual nframes_t read (MidiRingBuffer& dst, nframes_t start, nframes_t cnt, nframes_t stamp_offset) const; + virtual nframes_t write (MidiRingBuffer& src, nframes_t cnt); virtual void mark_for_remove() = 0; virtual void mark_streaming_write_completed () {} @@ -64,14 +64,14 @@ class MidiSource : public Source // The MIDI equivalent to "peaks" static int start_view_data_thread (); static void stop_view_data_thread (); - mutable sigc::signal ViewDataRangeReady; + mutable sigc::signal ViewDataRangeReady; XMLNode& get_state (); int set_state (const XMLNode&); protected: - virtual jack_nframes_t read_unlocked (MidiRingBuffer& dst, jack_nframes_t start, jack_nframes_t cnt, jack_nframes_t stamp_offset) const = 0; - virtual jack_nframes_t write_unlocked (MidiRingBuffer& dst, jack_nframes_t cnt) = 0; + virtual nframes_t read_unlocked (MidiRingBuffer& dst, nframes_t start, nframes_t cnt, nframes_t stamp_offset) const = 0; + virtual nframes_t write_unlocked (MidiRingBuffer& dst, nframes_t cnt) = 0; mutable Glib::Mutex _lock; string _captured_for; diff --git a/libs/ardour/ardour/midi_track.h b/libs/ardour/ardour/midi_track.h index 0347df5669..0dad40a973 100644 --- a/libs/ardour/ardour/midi_track.h +++ b/libs/ardour/ardour/midi_track.h @@ -39,18 +39,18 @@ public: int set_name (string str, void *src); - 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); void process_output_buffers (BufferSet& bufs, - 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); boost::shared_ptr midi_diskstream() const; @@ -60,16 +60,16 @@ public: int set_mode (TrackMode m); - void set_latency_delay (jack_nframes_t); + void set_latency_delay (nframes_t); int export_stuff (BufferSet& bufs, - jack_nframes_t nframes, jack_nframes_t end_frame); + 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); diff --git a/libs/ardour/ardour/port.h b/libs/ardour/ardour/port.h index 7891a0e6f2..cae198758b 100644 --- a/libs/ardour/ardour/port.h +++ b/libs/ardour/ardour/port.h @@ -41,7 +41,7 @@ class Port : public sigc::trackable { virtual DataType type() const = 0; - virtual void cycle_start(jack_nframes_t nframes) {} + virtual void cycle_start(nframes_t nframes) {} virtual void cycle_end() {} virtual Buffer& get_buffer() = 0; diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h index 716c7dec20..012fd9ce96 100644 --- a/libs/ardour/ardour/region.h +++ b/libs/ardour/ardour/region.h @@ -213,10 +213,10 @@ class Region : public PBD::StatefulDestructible, public boost::enable_shared_fro void maybe_uncopy (); void first_edit (); - virtual bool verify_start (jack_nframes_t); - virtual bool verify_start_and_length (jack_nframes_t, jack_nframes_t); - virtual bool verify_start_mutable (jack_nframes_t&_start); - virtual bool verify_length (jack_nframes_t); + virtual bool verify_start (nframes_t); + virtual bool verify_start_and_length (nframes_t, nframes_t); + virtual bool verify_start_mutable (nframes_t&_start); + virtual bool verify_length (nframes_t); virtual void recompute_at_start () = 0; virtual void recompute_at_end () = 0; diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 27bc781b79..f3e8d73de0 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -1319,13 +1319,13 @@ class Session : public PBD::StatefulDestructible /* cache the most-recently requested time conversions. This helps when we * have multiple clocks showing the same time (e.g. the transport frame) */ bool last_smpte_valid; - jack_nframes_t last_smpte_when; + nframes_t last_smpte_when; SMPTE::Time last_smpte; bool _send_smpte_update; ///< Flag to send a full frame (SMPTE) MTC message this cycle - int send_full_time_code(jack_nframes_t nframes); - int send_midi_time_code_for_cycle(jack_nframes_t nframes); + int send_full_time_code(nframes_t nframes); + int send_midi_time_code_for_cycle(nframes_t nframes); nframes_t adjust_apparent_position (nframes_t frames); diff --git a/libs/ardour/ardour/smf_source.h b/libs/ardour/ardour/smf_source.h index 98e78e3802..d422a8af9e 100644 --- a/libs/ardour/ardour/smf_source.h +++ b/libs/ardour/ardour/smf_source.h @@ -56,8 +56,8 @@ class SMFSource : public MidiSource { */ // FIXME and thus are useless for MIDI.. but make MidiDiskstream compile easier! :) - 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() {} @@ -68,7 +68,7 @@ class SMFSource : public MidiSource { void set_allow_remove_if_empty (bool yn); void mark_for_remove(); - int update_header (jack_nframes_t when, struct tm&, time_t); + int update_header (nframes_t when, struct tm&, time_t); int flush_header (); int flush_footer (); @@ -81,7 +81,7 @@ class SMFSource : public MidiSource { string take_id() const { return _take_id; } static void set_search_path (string); - static void set_header_position_offset (jack_nframes_t offset, bool negative); + static void set_header_position_offset (nframes_t offset, bool negative); XMLNode& get_state (); int set_state (const XMLNode&); @@ -90,8 +90,8 @@ class SMFSource : public MidiSource { int init (string idstr, bool must_exist); - jack_nframes_t read_unlocked (MidiRingBuffer& dst, jack_nframes_t start, jack_nframes_t cn, jack_nframes_t stamp_offset) const; - jack_nframes_t write_unlocked (MidiRingBuffer& dst, jack_nframes_t cnt); + nframes_t read_unlocked (MidiRingBuffer& dst, nframes_t start, nframes_t cn, nframes_t stamp_offset) const; + nframes_t write_unlocked (MidiRingBuffer& dst, nframes_t cnt); bool find (std::string path, bool must_exist, bool& is_new); bool removable() const; @@ -112,7 +112,7 @@ class SMFSource : public MidiSource { bool _allow_remove_if_empty; uint64_t _timeline_position; FILE* _fd; - jack_nframes_t _last_ev_time; // last frame time written, relative to source start + nframes_t _last_ev_time; // last frame time written, relative to source start uint32_t _track_size; uint32_t _header_size; // size of SMF header, including MTrk chunk header diff --git a/libs/ardour/ardour/source.h b/libs/ardour/ardour/source.h index 7b1179b81a..807ea089e6 100644 --- a/libs/ardour/ardour/source.h +++ b/libs/ardour/ardour/source.h @@ -52,9 +52,9 @@ class Source : public PBD::StatefulDestructible void stamp (time_t when) { _timestamp = when; } /** @return the number of items in this source */ - jack_nframes_t length() const { return _length; } + nframes_t length() const { return _length; } - virtual jack_nframes_t natural_position() const { return 0; } + virtual nframes_t natural_position() const { return 0; } virtual void mark_for_remove() = 0; virtual void mark_streaming_write_completed () = 0; @@ -74,13 +74,13 @@ class Source : public PBD::StatefulDestructible static sigc::signal SourceCreated; protected: - void update_length (jack_nframes_t pos, jack_nframes_t cnt); + void update_length (nframes_t pos, nframes_t cnt); Session& _session; string _name; DataType _type; time_t _timestamp; - jack_nframes_t _length; + nframes_t _length; Glib::Mutex playlist_lock; typedef std::map, uint32_t > PlaylistMap; diff --git a/libs/ardour/audio_port.cc b/libs/ardour/audio_port.cc index 2250c7f2a7..ae64995000 100644 --- a/libs/ardour/audio_port.cc +++ b/libs/ardour/audio_port.cc @@ -23,8 +23,8 @@ using namespace ARDOUR; using namespace std; -jack_nframes_t AudioPort::_short_over_length = 2; -jack_nframes_t AudioPort::_long_over_length = 10; +nframes_t AudioPort::_short_over_length = 2; +nframes_t AudioPort::_long_over_length = 10; AudioPort::AudioPort(jack_port_t* p) : Port(p) @@ -51,23 +51,4 @@ AudioPort::reset() reset_meters (); } -void -AudioPort::cycle_start (jack_nframes_t nframes) -{ - if (_flags & JackPortIsOutput) { - const bool silent = _buffer.silent(); - // FIXME: do nothing, we can cache the value (but capacity needs to be set for MIDI) - _buffer.set_data((Sample*)jack_port_get_buffer (_port, nframes), nframes); - if (silent) { - _buffer.silence(nframes); - } - } else { - _buffer.set_data((Sample*)jack_port_get_buffer (_port, nframes), nframes); - } -} -void -AudioPort::cycle_end() -{ - // whatever... -} diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc index 45ea853df4..7274082e8e 100644 --- a/libs/ardour/audio_track.cc +++ b/libs/ardour/audio_track.cc @@ -586,7 +586,7 @@ AudioTrack::roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, uint32_t i; for (i = 0, n = 1; i < limit; ++i, ++n) { - memcpy (bufs.get_audio(i).data(nframes), b, sizeof (Sample) * nframes); + memcpy (bufs.get_audio(i).data(), b, sizeof (Sample) * nframes); if (n < diskstream->n_channels().get(DataType::AUDIO)) { tmpb = diskstream->playback_buffer(n); if (tmpb!=0) { @@ -652,26 +652,26 @@ AudioTrack::export_stuff (BufferSet& buffers, nframes_t start, nframes_t nframes boost::shared_ptr apl = boost::dynamic_pointer_cast(diskstream->playlist()); assert(apl); - if (apl->read (buffers.get_audio(nframes).data(nframes), + if (apl->read (buffers.get_audio(nframes).data(), mix_buffer, gain_buffer, start, nframes) != nframes) { return -1; } assert(buffers.count().get(DataType::AUDIO) >= 1); uint32_t n=1; - Sample* b = buffers.get_audio(0).data(nframes); + Sample* b = buffers.get_audio(0).data(); BufferSet::audio_iterator bi = buffers.audio_begin(); ++bi; for ( ; bi != buffers.audio_end(); ++bi, ++n) { if (n < diskstream->n_channels().get(DataType::AUDIO)) { - if (apl->read (bi->data(nframes), mix_buffer, gain_buffer, start, nframes, n) != nframes) { + if (apl->read (bi->data(), mix_buffer, gain_buffer, start, nframes, n) != nframes) { return -1; } - b = bi->data(nframes); + b = bi->data(); } else { /* duplicate last across remaining buffers */ - memcpy (bi->data(nframes), b, sizeof (Sample) * nframes); + memcpy (bi->data(), b, sizeof (Sample) * nframes); } } @@ -700,7 +700,7 @@ AudioTrack::export_stuff (BufferSet& buffers, nframes_t start, nframes_t nframes _gain_automation_curve.get_vector (start, start + nframes, gain_automation, nframes); for (BufferSet::audio_iterator bi = buffers.audio_begin(); bi != buffers.audio_end(); ++bi) { - Sample *b = bi->data(nframes); + Sample *b = bi->data(); for (nframes_t n = 0; n < nframes; ++n) { b[n] *= gain_automation[n]; } @@ -709,7 +709,7 @@ AudioTrack::export_stuff (BufferSet& buffers, nframes_t start, nframes_t nframes } else { for (BufferSet::audio_iterator bi = buffers.audio_begin(); bi != buffers.audio_end(); ++bi) { - Sample *b = bi->data(nframes); + Sample *b = bi->data(); for (nframes_t n = 0; n < nframes; ++n) { b[n] *= this_gain; } diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc index 273829fa75..3b85ea2147 100644 --- a/libs/ardour/audioengine.cc +++ b/libs/ardour/audioengine.cc @@ -304,13 +304,26 @@ AudioEngine::process_callback (nframes_t nframes) return 0; } - if (run_process_cycle (session, nframes)) { - /* we were zombified, maybe because a ladspa plugin took - too long, or jackd exited, or something like that. - */ + boost::shared_ptr p = ports.reader(); + + // Prepare ports (ie read data if necessary) + for (Ports::iterator i = p->begin(); i != p->end(); ++i) { + (*i)->cycle_start (nframes); + } + + if (session) { + session->process (nframes); + } + + if (!_running) { _processed_frames = next_processed_frames; return 0; } + + // Finalize ports (ie write data if necessary) + for (Ports::iterator i = p->begin(); i != p->end(); ++i) { + (*i)->cycle_end (); + } if (last_monitor_check + monitor_check_interval < next_processed_frames) { @@ -336,28 +349,6 @@ AudioEngine::process_callback (nframes_t nframes) return 0; } -int -AudioEngine::run_process_cycle (Session* s, jack_nframes_t nframes) -{ - boost::shared_ptr p = ports.reader(); - - // Prepare ports (ie read data if necessary) - for (Ports::iterator i = p->begin(); i != p->end(); ++i) - (*i)->cycle_start (nframes); - - s->process (nframes); - - if (!_running) { - return -1; - } - - // Finalize ports (ie write data if necessary) - for (Ports::iterator i = p->begin(); i != p->end(); ++i) - (*i)->cycle_end (); - - return 0; -} - int AudioEngine::_sample_rate_callback (nframes_t nframes, void *arg) { @@ -456,14 +447,23 @@ AudioEngine::set_session (Session *s) can before we really start running. */ - run_process_cycle (session, blocksize); - run_process_cycle (session, blocksize); - run_process_cycle (session, blocksize); - run_process_cycle (session, blocksize); - run_process_cycle (session, blocksize); - run_process_cycle (session, blocksize); - run_process_cycle (session, blocksize); - run_process_cycle (session, blocksize); + boost::shared_ptr p = ports.reader(); + + for (Ports::iterator i = p->begin(); i != p->end(); ++i) + (*i)->cycle_start (blocksize); + + s->process (blocksize); + s->process (blocksize); + s->process (blocksize); + s->process (blocksize); + s->process (blocksize); + s->process (blocksize); + s->process (blocksize); + s->process (blocksize); + + for (Ports::iterator i = p->begin(); i != p->end(); ++i) + (*i)->cycle_end (); + } } diff --git a/libs/ardour/automation_event.cc b/libs/ardour/automation_event.cc index 341fa82091..cfac2e445f 100644 --- a/libs/ardour/automation_event.cc +++ b/libs/ardour/automation_event.cc @@ -1335,7 +1335,7 @@ AutomationList::set_state (const XMLNode& node) const XMLNodeList& elist = node.children(); XMLNodeConstIterator i; XMLProperty* prop; - jack_nframes_t x; + nframes_t x; double y; freeze (); diff --git a/libs/ardour/buffer.cc b/libs/ardour/buffer.cc index f13aa82207..7635ea2199 100644 --- a/libs/ardour/buffer.cc +++ b/libs/ardour/buffer.cc @@ -103,7 +103,7 @@ MidiBuffer::~MidiBuffer() * Note that offset and nframes refer to sample time, NOT buffer offsets or event counts. */ void -MidiBuffer::read_from(const Buffer& src, jack_nframes_t nframes, jack_nframes_t offset) +MidiBuffer::read_from(const Buffer& src, nframes_t nframes, nframes_t offset) { assert(src.type() == DataType::MIDI); const MidiBuffer& msrc = (MidiBuffer&)src; @@ -154,7 +154,7 @@ MidiBuffer::push_back(const MidiEvent& ev) void -MidiBuffer::silence(jack_nframes_t dur, jack_nframes_t offset) +MidiBuffer::silence(nframes_t dur, nframes_t offset) { // FIXME use parameters assert(offset == 0); diff --git a/libs/ardour/buffer_set.cc b/libs/ardour/buffer_set.cc index bbbf7e3b86..24af224845 100644 --- a/libs/ardour/buffer_set.cc +++ b/libs/ardour/buffer_set.cc @@ -151,7 +151,7 @@ BufferSet::buffer_capacity(DataType type) const // FIXME: make 'in' const void -BufferSet::read_from(BufferSet& in, jack_nframes_t nframes, jack_nframes_t offset) +BufferSet::read_from(BufferSet& in, nframes_t nframes, nframes_t offset) { assert(available() >= in.count()); diff --git a/libs/ardour/control_protocol_manager.cc b/libs/ardour/control_protocol_manager.cc index c79aa74698..00c05b2800 100644 --- a/libs/ardour/control_protocol_manager.cc +++ b/libs/ardour/control_protocol_manager.cc @@ -96,8 +96,10 @@ ControlProtocolManager::drop_session () for (list::iterator p = control_protocol_info.begin(); p != control_protocol_info.end(); ++p) { // otherwise the ControlProtocol instances are not recreated in set_session - (*p)->requested = true; - (*p)->protocol = 0; + if ((*p)->protocol) { + (*p)->requested = true; + (*p)->protocol = 0; + } } } } diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc index a9284d779c..67f365a400 100644 --- a/libs/ardour/io.cc +++ b/libs/ardour/io.cc @@ -1444,7 +1444,7 @@ IO::load_automation (string path) while (in.getline (line, sizeof(line), '\n')) { char type; - jack_nframes_t when; + nframes_t when; double value; if (++linecnt == 1) { diff --git a/libs/ardour/meter.cc b/libs/ardour/meter.cc index d571a9006c..bc1affa2c3 100644 --- a/libs/ardour/meter.cc +++ b/libs/ardour/meter.cc @@ -33,7 +33,7 @@ namespace ARDOUR { * be set to 0. */ void -PeakMeter::run (BufferSet& bufs, jack_nframes_t nframes, jack_nframes_t offset) +PeakMeter::run (BufferSet& bufs, nframes_t nframes, nframes_t offset) { size_t meterable = std::min(bufs.count().get(DataType::AUDIO), _peak_power.size()); diff --git a/libs/ardour/midi_diskstream.cc b/libs/ardour/midi_diskstream.cc index af4b18e3f7..552311115d 100644 --- a/libs/ardour/midi_diskstream.cc +++ b/libs/ardour/midi_diskstream.cc @@ -172,7 +172,7 @@ MidiDiskstream::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()); @@ -308,7 +308,7 @@ MidiDiskstream::set_destructive (bool yn) } void -MidiDiskstream::check_record_status (jack_nframes_t transport_frame, jack_nframes_t nframes, bool can_record) +MidiDiskstream::check_record_status (nframes_t transport_frame, nframes_t nframes, bool can_record) { // FIXME: waaay too much code to duplicate (AudioDiskstream) @@ -431,12 +431,12 @@ MidiDiskstream::check_record_status (jack_nframes_t transport_frame, jack_nframe } int -MidiDiskstream::process (jack_nframes_t transport_frame, jack_nframes_t nframes, jack_nframes_t offset, bool can_record, bool rec_monitors_input) +MidiDiskstream::process (nframes_t transport_frame, nframes_t nframes, nframes_t offset, bool can_record, bool rec_monitors_input) { // FIXME: waay too much code to duplicate (AudioDiskstream::process) 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; @@ -582,12 +582,12 @@ MidiDiskstream::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; } @@ -618,7 +618,7 @@ MidiDiskstream::process (jack_nframes_t transport_frame, jack_nframes_t nframes, } bool -MidiDiskstream::commit (jack_nframes_t nframes) +MidiDiskstream::commit (nframes_t nframes) { bool need_butler = false; @@ -674,7 +674,7 @@ MidiDiskstream::overwrite_existing_buffers () } int -MidiDiskstream::seek (jack_nframes_t frame, bool complete_refill) +MidiDiskstream::seek (nframes_t frame, bool complete_refill) { Glib::Mutex::Lock lm (state_lock); int ret = -1; @@ -696,7 +696,7 @@ MidiDiskstream::seek (jack_nframes_t frame, bool complete_refill) } int -MidiDiskstream::can_internal_playback_seek (jack_nframes_t distance) +MidiDiskstream::can_internal_playback_seek (nframes_t distance) { if (_playback_buf->read_space() < distance) { return false; @@ -706,7 +706,7 @@ MidiDiskstream::can_internal_playback_seek (jack_nframes_t distance) } int -MidiDiskstream::internal_playback_seek (jack_nframes_t distance) +MidiDiskstream::internal_playback_seek (nframes_t distance) { first_recordable_frame += distance; playback_sample += distance; @@ -716,13 +716,13 @@ MidiDiskstream::internal_playback_seek (jack_nframes_t distance) /** @a start is set to the new frame position (TIME) read up to */ int -MidiDiskstream::read (jack_nframes_t& start, jack_nframes_t dur, bool reversed) +MidiDiskstream::read (nframes_t& start, nframes_t dur, 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; + nframes_t loop_end = 0; + nframes_t loop_start = 0; + nframes_t loop_length = 0; Location *loc = 0; if (!reversed) { @@ -884,8 +884,8 @@ MidiDiskstream::do_refill () // So (read it, then) write it: - jack_nframes_t file_frame_tmp = file_frame; - jack_nframes_t to_read = min(disk_io_chunk_frames, (max_frames - file_frame)); + nframes_t file_frame_tmp = file_frame; + nframes_t to_read = min(disk_io_chunk_frames, (max_frames - file_frame)); // FIXME: read count? if (read (file_frame_tmp, to_read, reversed)) { @@ -917,7 +917,7 @@ MidiDiskstream::do_flush (Session::RunContext context, bool force_flush) int32_t ret = 0; // FIXME: I'd be lying if I said I knew what this thing was //RingBufferNPT::rw_vector transvec; - jack_nframes_t total; + nframes_t total; _write_data_count = 0; @@ -949,7 +949,7 @@ MidiDiskstream::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]); to_write = disk_io_chunk_frames; assert(!destructive()); @@ -977,7 +977,7 @@ MidiDiskstream::transport_stopped (struct tm& when, time_t twhen, bool abort_cap bool more_work = true; int err = 0; boost::shared_ptr region; - jack_nframes_t total_capture; + nframes_t total_capture; MidiRegion::SourceList srcs; MidiRegion::SourceList::iterator src; vector::iterator ci; @@ -1411,7 +1411,7 @@ MidiDiskstream::rename_write_sources () } void -MidiDiskstream::set_block_size (jack_nframes_t nframes) +MidiDiskstream::set_block_size (nframes_t nframes) { } @@ -1477,7 +1477,7 @@ MidiDiskstream::use_pending_capture_data (XMLNode& node) * so that an event at start has time = 0 */ void -MidiDiskstream::get_playback(MidiBuffer& dst, jack_nframes_t start, jack_nframes_t end) +MidiDiskstream::get_playback(MidiBuffer& dst, nframes_t start, nframes_t end) { dst.clear(); assert(dst.size() == 0); diff --git a/libs/ardour/midi_playlist.cc b/libs/ardour/midi_playlist.cc index 0352e1e910..d1b2a58e82 100644 --- a/libs/ardour/midi_playlist.cc +++ b/libs/ardour/midi_playlist.cc @@ -100,7 +100,7 @@ MidiPlaylist::MidiPlaylist (boost::shared_ptr other, string */ } -MidiPlaylist::MidiPlaylist (boost::shared_ptr other, jack_nframes_t start, jack_nframes_t dur, string name, bool hidden) +MidiPlaylist::MidiPlaylist (boost::shared_ptr other, nframes_t start, nframes_t dur, string name, bool hidden) : Playlist (other, start, dur, name, hidden) { /* this constructor does NOT notify others (session) */ @@ -118,9 +118,9 @@ struct RegionSortByLayer { }; /** Returns the number of frames in time duration read (eg could be large when 0 events are read) */ -jack_nframes_t -MidiPlaylist::read (MidiRingBuffer& dst, jack_nframes_t start, - jack_nframes_t dur, unsigned chan_n) +nframes_t +MidiPlaylist::read (MidiRingBuffer& dst, nframes_t start, + nframes_t dur, unsigned chan_n) { /* this function is never called from a realtime thread, so its OK to block (for short intervals). @@ -128,10 +128,10 @@ MidiPlaylist::read (MidiRingBuffer& dst, jack_nframes_t start, Glib::Mutex::Lock rm (region_lock); - jack_nframes_t ret = 0; - jack_nframes_t end = start + dur - 1; - //jack_nframes_t read_frames = 0; - //jack_nframes_t skip_frames = 0; + nframes_t ret = 0; + nframes_t end = start + dur - 1; + //nframes_t read_frames = 0; + //nframes_t skip_frames = 0; //_read_data_count = 0; diff --git a/libs/ardour/midi_port.cc b/libs/ardour/midi_port.cc index dc8b18a390..ccf63880e6 100644 --- a/libs/ardour/midi_port.cc +++ b/libs/ardour/midi_port.cc @@ -45,7 +45,7 @@ MidiPort::~MidiPort() } void -MidiPort::cycle_start (jack_nframes_t nframes) +MidiPort::cycle_start (nframes_t nframes) { _buffer.clear(); assert(_buffer.size() == 0); @@ -62,7 +62,7 @@ MidiPort::cycle_start (jack_nframes_t nframes) void* jack_buffer = jack_port_get_buffer(_port, nframes); - const jack_nframes_t event_count + const nframes_t event_count = jack_midi_get_event_count(jack_buffer); assert(event_count < _buffer.capacity()); @@ -70,7 +70,7 @@ MidiPort::cycle_start (jack_nframes_t nframes) MidiEvent ev; // FIXME: too slow, event struct is copied twice (here and MidiBuffer::push_back) - for (jack_nframes_t i=0; i < event_count; ++i) { + for (nframes_t i=0; i < event_count; ++i) { // This will fail to compile if we change MidiEvent to our own class jack_midi_event_get(static_cast(&ev), jack_buffer, i); @@ -100,13 +100,13 @@ MidiPort::cycle_end() void* jack_buffer = jack_port_get_buffer(_port, _nframes_this_cycle); - const jack_nframes_t event_count = _buffer.size(); + const nframes_t event_count = _buffer.size(); //if (event_count > 0) // cerr << "MIDIPort writing " << event_count << " events." << endl; jack_midi_clear_buffer(jack_buffer); - for (jack_nframes_t i=0; i < event_count; ++i) { + for (nframes_t i=0; i < event_count; ++i) { const jack_midi_event_t& ev = _buffer[i]; assert(ev.time < _nframes_this_cycle); jack_midi_event_write(jack_buffer, ev.time, ev.buffer, ev.size); diff --git a/libs/ardour/midi_region.cc b/libs/ardour/midi_region.cc index 47234d48d4..78c238233e 100644 --- a/libs/ardour/midi_region.cc +++ b/libs/ardour/midi_region.cc @@ -48,21 +48,21 @@ using namespace std; using namespace ARDOUR; /** Basic MidiRegion constructor (one channel) */ -MidiRegion::MidiRegion (boost::shared_ptr src, jack_nframes_t start, jack_nframes_t length) +MidiRegion::MidiRegion (boost::shared_ptr src, nframes_t start, nframes_t length) : Region (src, start, length, PBD::basename_nosuffix(src->name()), DataType::MIDI, 0, Region::Flag(Region::DefaultFlags|Region::External)) { assert(_name.find("/") == string::npos); } /* Basic MidiRegion constructor (one channel) */ -MidiRegion::MidiRegion (boost::shared_ptr src, jack_nframes_t start, jack_nframes_t length, const string& name, layer_t layer, Flag flags) +MidiRegion::MidiRegion (boost::shared_ptr src, nframes_t start, nframes_t length, const string& name, layer_t layer, Flag flags) : Region (src, start, length, name, DataType::MIDI, layer, flags) { assert(_name.find("/") == string::npos); } /* Basic MidiRegion constructor (many channels) */ -MidiRegion::MidiRegion (SourceList& srcs, jack_nframes_t start, jack_nframes_t length, const string& name, layer_t layer, Flag flags) +MidiRegion::MidiRegion (SourceList& srcs, nframes_t start, nframes_t length, const string& name, layer_t layer, Flag flags) : Region (srcs, start, length, name, DataType::MIDI, layer, flags) { assert(_name.find("/") == string::npos); @@ -70,7 +70,7 @@ MidiRegion::MidiRegion (SourceList& srcs, jack_nframes_t start, jack_nframes_t l /** Create a new MidiRegion, that is part of an existing one */ -MidiRegion::MidiRegion (boost::shared_ptr other, jack_nframes_t offset, jack_nframes_t length, const string& name, layer_t layer, Flag flags) +MidiRegion::MidiRegion (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) { assert(_name.find("/") == string::npos); @@ -108,31 +108,31 @@ MidiRegion::~MidiRegion () { } -jack_nframes_t -MidiRegion::read_at (MidiRingBuffer& out, jack_nframes_t position, - jack_nframes_t dur, - uint32_t chan_n, jack_nframes_t read_frames, jack_nframes_t skip_frames) const +nframes_t +MidiRegion::read_at (MidiRingBuffer& out, nframes_t position, + nframes_t dur, + uint32_t chan_n, nframes_t read_frames, nframes_t skip_frames) const { return _read_at (_sources, out, position, dur, chan_n, read_frames, skip_frames); } -jack_nframes_t -MidiRegion::master_read_at (MidiRingBuffer& out, jack_nframes_t position, - jack_nframes_t dur, uint32_t chan_n) const +nframes_t +MidiRegion::master_read_at (MidiRingBuffer& out, nframes_t position, + nframes_t dur, uint32_t chan_n) const { return _read_at (_master_sources, out, position, dur, chan_n, 0, 0); } -jack_nframes_t +nframes_t MidiRegion::_read_at (const SourceList& srcs, MidiRingBuffer& dst, - jack_nframes_t position, jack_nframes_t dur, - uint32_t chan_n, jack_nframes_t read_frames, jack_nframes_t skip_frames) const + nframes_t position, nframes_t dur, + uint32_t chan_n, nframes_t read_frames, nframes_t skip_frames) const { // cerr << _name << "._read_at(" << position << ") - " << _position << endl; - jack_nframes_t internal_offset = 0; - jack_nframes_t src_offset = 0; - jack_nframes_t to_read = 0; + nframes_t internal_offset = 0; + nframes_t src_offset = 0; + nframes_t to_read = 0; /* precondition: caller has verified that we cover the desired section */ diff --git a/libs/ardour/midi_source.cc b/libs/ardour/midi_source.cc index de2f6b1c5d..d73520134a 100644 --- a/libs/ardour/midi_source.cc +++ b/libs/ardour/midi_source.cc @@ -90,15 +90,15 @@ MidiSource::set_state (const XMLNode& node) return 0; } -jack_nframes_t -MidiSource::read (MidiRingBuffer& dst, jack_nframes_t start, jack_nframes_t cnt, jack_nframes_t stamp_offset) const +nframes_t +MidiSource::read (MidiRingBuffer& dst, nframes_t start, nframes_t cnt, nframes_t stamp_offset) const { Glib::Mutex::Lock lm (_lock); return read_unlocked (dst, start, cnt, stamp_offset); } -jack_nframes_t -MidiSource::write (MidiRingBuffer& dst, jack_nframes_t cnt) +nframes_t +MidiSource::write (MidiRingBuffer& dst, nframes_t cnt) { Glib::Mutex::Lock lm (_lock); return write_unlocked (dst, cnt); diff --git a/libs/ardour/midi_track.cc b/libs/ardour/midi_track.cc index 26441203a3..70638d1455 100644 --- a/libs/ardour/midi_track.cc +++ b/libs/ardour/midi_track.cc @@ -352,7 +352,7 @@ MidiTrack::set_state_part_two () } int -MidiTrack::no_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, jack_nframes_t offset, +MidiTrack::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().get(DataType::MIDI) == 0) { @@ -433,7 +433,7 @@ MidiTrack::no_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nfr } int -MidiTrack::roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, jack_nframes_t offset, int declick, +MidiTrack::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; @@ -448,7 +448,7 @@ MidiTrack::roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframe return 0; } - jack_nframes_t transport_frame = _session.transport_frame(); + nframes_t transport_frame = _session.transport_frame(); if ((nframes = check_initial_delay (nframes, offset, transport_frame)) == 0) { /* need to do this so that the diskstream sets its @@ -507,7 +507,7 @@ MidiTrack::roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframe } int -MidiTrack::silent_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, jack_nframes_t offset, +MidiTrack::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().get(DataType::MIDI) == 0 && _redirects.empty()) { @@ -529,8 +529,8 @@ MidiTrack::silent_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack void MidiTrack::process_output_buffers (BufferSet& bufs, - 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) { /* There's no such thing as a MIDI bus for the time being, to avoid diverging from trunk @@ -578,13 +578,13 @@ MidiTrack::set_name (string str, void *src) } int -MidiTrack::export_stuff (BufferSet& bufs, jack_nframes_t nframes, jack_nframes_t end_frame) +MidiTrack::export_stuff (BufferSet& bufs, nframes_t nframes, nframes_t end_frame) { return -1; } void -MidiTrack::set_latency_delay (jack_nframes_t longest_session_latency) +MidiTrack::set_latency_delay (nframes_t longest_session_latency) { Route::set_latency_delay (longest_session_latency); _diskstream->set_roll_delay (_roll_delay); @@ -600,7 +600,7 @@ MidiTrack::bounce (InterThreadInfo& itt) void -MidiTrack::bounce_range (jack_nframes_t start, jack_nframes_t end, InterThreadInfo& itt) +MidiTrack::bounce_range (nframes_t start, nframes_t end, InterThreadInfo& itt) { throw; //vector srcs; diff --git a/libs/ardour/panner.cc b/libs/ardour/panner.cc index d3c0dc8d4e..2690ac868d 100644 --- a/libs/ardour/panner.cc +++ b/libs/ardour/panner.cc @@ -244,7 +244,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; @@ -281,11 +281,11 @@ BaseStereoPanner::distribute (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gain return; } - Sample* const src = srcbuf.data(nframes); + Sample* const src = srcbuf.data(); /* LEFT */ - dst = obufs.get_audio(0).data(nframes); + dst = obufs.get_audio(0).data(); if (fabsf ((delta = (left - desired_left))) > 0.002) { // about 1 degree of arc @@ -335,7 +335,7 @@ BaseStereoPanner::distribute (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gain /* RIGHT */ - dst = obufs.get_audio(1).data(nframes); + dst = obufs.get_audio(1).data(); if (fabsf ((delta = (right - desired_right))) > 0.002) { // about 1 degree of arc @@ -434,7 +434,7 @@ EqualPowerStereoPanner::distribute_automated (AudioBuffer& srcbuf, BufferSet& ob Sample* dst; pan_t* pbuf; - Sample* const src = srcbuf.data(nframes); + Sample* const src = srcbuf.data(); /* fetch positional data */ @@ -473,7 +473,7 @@ EqualPowerStereoPanner::distribute_automated (AudioBuffer& srcbuf, BufferSet& ob /* LEFT */ - dst = obufs.get_audio(0).data(nframes); + dst = obufs.get_audio(0).data(); pbuf = buffers[0]; for (nframes_t n = 0; n < nframes; ++n) { @@ -484,7 +484,7 @@ EqualPowerStereoPanner::distribute_automated (AudioBuffer& srcbuf, BufferSet& ob /* RIGHT */ - dst = obufs.get_audio(1).data(nframes); + dst = obufs.get_audio(1).data(); pbuf = buffers[1]; for (nframes_t n = 0; n < nframes; ++n) { @@ -642,12 +642,12 @@ Multi2dPanner::distribute (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gain_co return; } - Sample* const src = srcbuf.data(nframes); + Sample* const src = srcbuf.data(); for (n = 0, o = parent.outputs.begin(); o != parent.outputs.end(); ++o, ++n) { - dst = obufs.get_audio(n).data(nframes); + dst = obufs.get_audio(n).data(); #ifdef CAN_INTERP if (fabsf ((delta = (left_interp - desired_left))) > 0.002) { // about 1 degree of arc diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index b972c20589..e5125d8629 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -50,7 +50,7 @@ Change Region::LayerChanged = ARDOUR::new_change (); Change Region::HiddenChanged = ARDOUR::new_change (); /** Basic Region constructor (single source) */ -Region::Region (boost::shared_ptr src, jack_nframes_t start, jack_nframes_t length, const string& name, DataType type, layer_t layer, Region::Flag flags) +Region::Region (boost::shared_ptr src, nframes_t start, nframes_t length, const string& name, DataType type, layer_t layer, Region::Flag flags) : _name(name) , _type(type) , _flags(flags) @@ -73,7 +73,7 @@ Region::Region (boost::shared_ptr src, jack_nframes_t start, jack_nframe } /** Basic Region constructor (many sources) */ -Region::Region (SourceList& srcs, jack_nframes_t start, jack_nframes_t length, const string& name, DataType type, layer_t layer, Region::Flag flags) +Region::Region (SourceList& srcs, nframes_t start, nframes_t length, const string& name, DataType type, layer_t layer, Region::Flag flags) : _name(name) , _type(type) , _flags(flags) @@ -1191,7 +1191,7 @@ Region::source_equivalent (boost::shared_ptr other) const } bool -Region::verify_length (jack_nframes_t len) +Region::verify_length (nframes_t len) { for (uint32_t n=0; n < _sources.size(); ++n) { if (_start > _sources[n]->length() - len) { @@ -1202,7 +1202,7 @@ Region::verify_length (jack_nframes_t len) } bool -Region::verify_start_and_length (jack_nframes_t new_start, jack_nframes_t new_length) +Region::verify_start_and_length (nframes_t new_start, nframes_t new_length) { for (uint32_t n=0; n < _sources.size(); ++n) { if (new_length > _sources[n]->length() - new_start) { @@ -1212,7 +1212,7 @@ Region::verify_start_and_length (jack_nframes_t new_start, jack_nframes_t new_le return true; } bool -Region::verify_start (jack_nframes_t pos) +Region::verify_start (nframes_t pos) { for (uint32_t n=0; n < _sources.size(); ++n) { if (pos > _sources[n]->length() - _length) { @@ -1223,7 +1223,7 @@ Region::verify_start (jack_nframes_t pos) } bool -Region::verify_start_mutable (jack_nframes_t& new_start) +Region::verify_start_mutable (nframes_t& new_start) { for (uint32_t n=0; n < _sources.size(); ++n) { if (new_start > _sources[n]->length() - _length) { diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index b161afa6a5..e78706b71a 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -459,7 +459,7 @@ Route::process_output_buffers (BufferSet& bufs, if (_phase_invert) { for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i) { - Sample* const sp = i->data(nframes); + Sample* const sp = i->data(); for (nframes_t nx = 0; nx < nframes; ++nx) { sp[nx] *= -gab[nx]; @@ -467,7 +467,7 @@ Route::process_output_buffers (BufferSet& bufs, } } else { for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i) { - Sample* const sp = i->data(nframes); + Sample* const sp = i->data(); for (nframes_t nx = 0; nx < nframes; ++nx) { sp[nx] *= gab[nx]; @@ -505,7 +505,7 @@ Route::process_output_buffers (BufferSet& bufs, } for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i) { - Sample* const sp = i->data(nframes); + Sample* const sp = i->data(); apply_gain_to_buffer(sp,nframes,this_gain); } @@ -699,7 +699,7 @@ Route::passthru (nframes_t start_frame, nframes_t end_frame, nframes_t nframes, } void -Route::passthru_silence (jack_nframes_t start_frame, jack_nframes_t end_frame, jack_nframes_t nframes, jack_nframes_t offset, int declick, bool meter) +Route::passthru_silence (nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset, int declick, bool meter) { process_output_buffers (_session.get_silent_buffers (n_process_buffers()), start_frame, end_frame, nframes, offset, true, declick, meter); } diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 00c8deb36b..9e382a6a6e 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -1380,7 +1380,7 @@ Session::set_frame_rate (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 // SndFileSource::setup_standard_crossfades (frames_per_second); @@ -4097,7 +4097,7 @@ Session::write_one_audio_track (AudioTrack& track, nframes_t start, nframes_t le boost::shared_ptr afs = boost::dynamic_pointer_cast(*src); if (afs) { - if (afs->write (buffers.get_audio(n).data(this_chunk), this_chunk) != this_chunk) { + if (afs->write (buffers.get_audio(n).data(), this_chunk) != this_chunk) { goto out; } } diff --git a/libs/ardour/session_click.cc b/libs/ardour/session_click.cc index 9dccce04f2..fb51f22564 100644 --- a/libs/ardour/session_click.cc +++ b/libs/ardour/session_click.cc @@ -53,10 +53,10 @@ Session::click (nframes_t start, nframes_t nframes, nframes_t offset) return; } - const jack_nframes_t end = start + (jack_nframes_t)floor(nframes * _transport_speed); + const nframes_t end = start + (nframes_t)floor(nframes * _transport_speed); BufferSet& bufs = get_scratch_buffers(ChanCount(DataType::AUDIO, 1)); - buf = bufs.get_audio(0).data(nframes); + buf = bufs.get_audio(0).data(); points = _tempo_map->get_points (start, end); if (points == 0) { diff --git a/libs/ardour/session_export.cc b/libs/ardour/session_export.cc index e2d79b86d3..b0addd21f6 100644 --- a/libs/ardour/session_export.cc +++ b/libs/ardour/session_export.cc @@ -589,7 +589,7 @@ Session::process_export (nframes_t nframes, AudioExportSpecification* spec) cerr << "FIXME: Non-audio export" << endl; continue; } - Sample* port_buffer = port->get_audio_buffer().data(nframes); + Sample* port_buffer = port->get_audio_buffer().data(); /* now interleave the data from the channel into the float buffer */ diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc index 7d20a05b45..7f88766b63 100644 --- a/libs/ardour/session_midi.cc +++ b/libs/ardour/session_midi.cc @@ -763,7 +763,7 @@ Session::change_midi_ports () * have been called with the appropriate nframes parameter this cycle. */ int -Session::send_full_time_code(jack_nframes_t nframes) +Session::send_full_time_code(nframes_t nframes) { /* This function could easily send at a given frame offset, but would * that be useful? Does ardour do sub-block accurate locating? [DR] */ @@ -787,7 +787,7 @@ Session::send_full_time_code(jack_nframes_t nframes) 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; } // Compensate for audio latency @@ -828,7 +828,7 @@ Session::send_full_time_code(jack_nframes_t nframes) * earlier already this cycle by send_full_time_code) */ int -Session::send_midi_time_code_for_cycle(jack_nframes_t nframes) +Session::send_midi_time_code_for_cycle(nframes_t nframes) { assert (next_quarter_frame_to_send >= 0); assert (next_quarter_frame_to_send <= 7); @@ -845,7 +845,7 @@ Session::send_midi_time_code_for_cycle(jack_nframes_t nframes) } /* Duration of one quarter frame */ - jack_nframes_t quarter_frame_duration = ((long) _frames_per_smpte_frame) >> 2; + nframes_t quarter_frame_duration = ((long) _frames_per_smpte_frame) >> 2; //cerr << "(MTC) TR: " << _transport_frame << " - SF: " << outbound_mtc_smpte_frame //<< " - NQ: " << next_quarter_frame_to_send << " - FD" << quarter_frame_duration << endl; @@ -888,14 +888,14 @@ Session::send_midi_time_code_for_cycle(jack_nframes_t nframes) break; } - const jack_nframes_t msg_time = (outbound_mtc_smpte_frame + const nframes_t msg_time = (outbound_mtc_smpte_frame + (quarter_frame_duration * next_quarter_frame_to_send)); // This message must fall within this block or something is broken assert(msg_time >= _transport_frame); assert(msg_time < _transport_frame + nframes); - jack_nframes_t out_stamp = msg_time - _transport_frame; + nframes_t out_stamp = msg_time - _transport_frame; assert(out_stamp < nframes); if (!_mtc_port->midimsg (mtc_msg, 2, out_stamp)) { diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc index f0c4a29aa9..4f82de1c0e 100644 --- a/libs/ardour/session_process.cc +++ b/libs/ardour/session_process.cc @@ -130,8 +130,8 @@ Session::process_routes (nframes_t nframes, nframes_t offset) record_active = actively_recording(); // || (get_record_enabled() && get_punch_in()); - const jack_nframes_t start_frame = _transport_frame; - const jack_nframes_t end_frame = _transport_frame + (jack_nframes_t)floor(nframes * _transport_speed); + const nframes_t start_frame = _transport_frame; + const nframes_t end_frame = _transport_frame + (nframes_t)floor(nframes * _transport_speed); for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { @@ -176,8 +176,8 @@ Session::silent_process_routes (nframes_t nframes, nframes_t offset) declick = -1; } - const jack_nframes_t start_frame = _transport_frame; - const jack_nframes_t end_frame = _transport_frame + lrintf(nframes * _transport_speed); + const nframes_t start_frame = _transport_frame; + const nframes_t end_frame = _transport_frame + lrintf(nframes * _transport_speed); for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { diff --git a/libs/ardour/smf_source.cc b/libs/ardour/smf_source.cc index aca8cf5a25..d41b47bd68 100644 --- a/libs/ardour/smf_source.cc +++ b/libs/ardour/smf_source.cc @@ -163,7 +163,7 @@ SMFSource::open() } int -SMFSource::update_header (jack_nframes_t when, struct tm&, time_t) +SMFSource::update_header (nframes_t when, struct tm&, time_t) { _timeline_position = when; return flush_header(); @@ -220,7 +220,7 @@ SMFSource::flush_footer() */ /* long -SMFSource::find_first_event_after(jack_nframes_t start) +SMFSource::find_first_event_after(nframes_t start) { // FIXME: obviously this is slooow @@ -287,12 +287,12 @@ SMFSource::read_event(MidiEvent& ev) const return ev.size; } -jack_nframes_t -SMFSource::read_unlocked (MidiRingBuffer& dst, jack_nframes_t start, jack_nframes_t cnt, jack_nframes_t stamp_offset) const +nframes_t +SMFSource::read_unlocked (MidiRingBuffer& dst, nframes_t start, nframes_t cnt, nframes_t stamp_offset) const { //cerr << "SMF - read " << start << ", count=" << cnt << ", offset=" << stamp_offset << endl; - jack_nframes_t time = 0; + nframes_t time = 0; // FIXME: ugh unsigned char ev_buf[MidiBuffer::max_event_size()]; @@ -334,8 +334,8 @@ SMFSource::read_unlocked (MidiRingBuffer& dst, jack_nframes_t start, jack_nframe return cnt; } -jack_nframes_t -SMFSource::write_unlocked (MidiRingBuffer& src, jack_nframes_t cnt) +nframes_t +SMFSource::write_unlocked (MidiRingBuffer& src, nframes_t cnt) { //cerr << "SMF WRITE -- " << _length << "--" << cnt << endl; diff --git a/libs/ardour/source.cc b/libs/ardour/source.cc index 86afe4cb8d..21cd871cbf 100644 --- a/libs/ardour/source.cc +++ b/libs/ardour/source.cc @@ -122,7 +122,7 @@ Source::set_state (const XMLNode& node) } void -Source::update_length (jack_nframes_t pos, jack_nframes_t cnt) +Source::update_length (nframes_t pos, nframes_t cnt) { if (pos + cnt > _length) { _length = pos+cnt; -- cgit v1.2.3