summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2009-04-23 17:48:37 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2009-04-23 17:48:37 +0000
commit28368793415ba934132994d8c10a5e149c1a8d9d (patch)
tree818d5f406e0c9b6f95f43faae0ff88d885a59ad6 /libs/ardour
parent0a22716b74d52fcbef37bebf529048f7f3bc79e0 (diff)
remove offset from process callback tree. some breakage may have occured. yes, really.
git-svn-id: svn://localhost/ardour2/branches/3.0@4999 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/audio_buffer.h87
-rw-r--r--libs/ardour/ardour/audio_diskstream.h2
-rw-r--r--libs/ardour/ardour/audio_port.h11
-rw-r--r--libs/ardour/ardour/audio_track.h6
-rw-r--r--libs/ardour/ardour/audioengine.h2
-rw-r--r--libs/ardour/ardour/buffer.h8
-rw-r--r--libs/ardour/ardour/buffer_set.h4
-rw-r--r--libs/ardour/ardour/diskstream.h2
-rw-r--r--libs/ardour/ardour/io.h21
-rw-r--r--libs/ardour/ardour/io_processor.h6
-rw-r--r--libs/ardour/ardour/meter.h2
-rw-r--r--libs/ardour/ardour/midi_buffer.h7
-rw-r--r--libs/ardour/ardour/midi_diskstream.h4
-rw-r--r--libs/ardour/ardour/midi_port.h15
-rw-r--r--libs/ardour/ardour/midi_track.h11
-rw-r--r--libs/ardour/ardour/panner.h4
-rw-r--r--libs/ardour/ardour/plugin_insert.h4
-rw-r--r--libs/ardour/ardour/port.h24
-rw-r--r--libs/ardour/ardour/port_insert.h2
-rw-r--r--libs/ardour/ardour/processor.h6
-rw-r--r--libs/ardour/ardour/route.h22
-rw-r--r--libs/ardour/ardour/send.h2
-rw-r--r--libs/ardour/ardour/session.h22
-rw-r--r--libs/ardour/ardour/track.h6
-rw-r--r--libs/ardour/audio_buffer.cc38
-rw-r--r--libs/ardour/audio_diskstream.cc9
-rw-r--r--libs/ardour/audio_port.cc54
-rw-r--r--libs/ardour/audio_track.cc51
-rw-r--r--libs/ardour/audioengine.cc36
-rw-r--r--libs/ardour/auditioner.cc6
-rw-r--r--libs/ardour/buffer.cc6
-rw-r--r--libs/ardour/buffer_set.cc4
-rw-r--r--libs/ardour/io.cc74
-rw-r--r--libs/ardour/io_processor.cc4
-rw-r--r--libs/ardour/ladspa_plugin.cc4
-rw-r--r--libs/ardour/lv2_plugin.cc8
-rw-r--r--libs/ardour/meter.cc4
-rw-r--r--libs/ardour/midi_buffer.cc55
-rw-r--r--libs/ardour/midi_diskstream.cc22
-rw-r--r--libs/ardour/midi_port.cc63
-rw-r--r--libs/ardour/midi_track.cc85
-rw-r--r--libs/ardour/panner.cc44
-rw-r--r--libs/ardour/plugin_insert.cc11
-rw-r--r--libs/ardour/port.cc3
-rw-r--r--libs/ardour/port_insert.cc9
-rw-r--r--libs/ardour/route.cc120
-rw-r--r--libs/ardour/send.cc8
-rw-r--r--libs/ardour/session.cc13
-rw-r--r--libs/ardour/session_click.cc6
-rw-r--r--libs/ardour/session_process.cc81
50 files changed, 552 insertions, 546 deletions
diff --git a/libs/ardour/ardour/audio_buffer.h b/libs/ardour/ardour/audio_buffer.h
index adcfb962f0..ca1b36e0b1 100644
--- a/libs/ardour/ardour/audio_buffer.h
+++ b/libs/ardour/ardour/audio_buffer.h
@@ -28,78 +28,86 @@ class AudioBuffer : public Buffer
{
public:
AudioBuffer(size_t capacity);
-
~AudioBuffer();
- void silence(nframes_t len, nframes_t offset = 0) {
+ void silence (nframes_t len, nframes_t offset = 0) {
if (!_silent) {
assert(_capacity > 0);
assert(offset + len <= _capacity);
memset(_data + offset, 0, sizeof (Sample) * len);
- if (offset == 0 && len == _capacity) {
+ if (len == _capacity) {
_silent = true;
}
}
+ _written = true;
}
- /** Read @a len frames FROM THE START OF @a src into self at @a offset */
- void read_from(const Buffer& src, nframes_t len, nframes_t offset) {
+ /** Read @a len frames @a src starting at @a src_offset into self starting at @ dst_offset*/
+ void read_from (const Buffer& src, nframes_t len, nframes_t dst_offset = 0, nframes_t src_offset = 0) {
assert(&src != this);
assert(_capacity > 0);
assert(src.type() == DataType::AUDIO);
- assert(offset + len <= _capacity);
- memcpy(_data + offset, ((AudioBuffer&)src).data(), sizeof(Sample) * len);
- _silent = src.silent();
+ assert(len <= _capacity);
+ memcpy(_data + dst_offset, ((AudioBuffer&)src).data() + src_offset, sizeof(Sample) * len);
+ if (dst_offset == 0 && src_offset == 0 && len == _capacity) {
+ _silent = src.silent();
+ } else {
+ _silent = _silent && src.silent();
+ }
+ _written = true;
}
- /** Accumulate (add)@a len frames FROM THE START OF @a src into self at @a offset */
- void accumulate_from(const AudioBuffer& src, nframes_t len, nframes_t offset) {
+ /** Acumulate (add) @a len frames @a src starting at @a src_offset into self starting at @ dst_offset*/
+ void accumulate_from (const AudioBuffer& src, nframes_t len, nframes_t dst_offset = 0, nframes_t src_offset = 0) {
assert(_capacity > 0);
- assert(offset + len <= _capacity);
+ assert(len <= _capacity);
- Sample* const dst_raw = _data + offset;
- const Sample* const src_raw = src.data();
+ Sample* const dst_raw = _data + dst_offset;
+ const Sample* const src_raw = src.data() + src_offset;
mix_buffers_no_gain(dst_raw, src_raw, len);
_silent = (src.silent() && _silent);
+ _written = true;
}
- /** Accumulate (add) @a len frames FROM THE START OF @a src into self at @a offset
+ /** Acumulate (add) @a len frames @a src starting at @a src_offset into self starting at @ dst_offset
* scaling by @a gain_coeff */
- void accumulate_with_gain_from(const AudioBuffer& src, nframes_t len, nframes_t offset, gain_t gain_coeff) {
+ void accumulate_with_gain_from (const AudioBuffer& src, nframes_t len, gain_t gain_coeff, nframes_t dst_offset = 0, nframes_t src_offset = 0) {
assert(_capacity > 0);
- assert(offset + len <= _capacity);
+ assert(len <= _capacity);
if (src.silent()) {
return;
}
- Sample* const dst_raw = _data + offset;
- const Sample* const src_raw = src.data();
+ Sample* const dst_raw = _data + dst_offset;
+ const Sample* const src_raw = src.data() + src_offset;
mix_buffers_with_gain (dst_raw, src_raw, len, gain_coeff);
_silent = ( (src.silent() && _silent) || (_silent && gain_coeff == 0) );
+ _written = true;
}
- /** Accumulate (add) @a len frames FROM THE START OF @a src into self at @a offset
+ /** Accumulate (add) @a len frames FROM THE START OF @a src into self
* scaling by @a gain_coeff */
- void accumulate_with_gain_from(const Sample* src_raw, nframes_t len, nframes_t offset, gain_t gain_coeff) {
+ void accumulate_with_gain_from (const Sample* src_raw, nframes_t len, gain_t gain_coeff, nframes_t dst_offset = 0) {
assert(_capacity > 0);
- assert(offset + len <= _capacity);
+ assert(len <= _capacity);
- Sample* const dst_raw = _data + offset;
+ Sample* const dst_raw = _data + dst_offset;
mix_buffers_with_gain (dst_raw, src_raw, len, gain_coeff);
_silent = (_silent && gain_coeff == 0);
+ _written = true;
}
- void apply_gain(gain_t gain, nframes_t len, nframes_t offset=0) {
- apply_gain_to_buffer (_data + offset, len, gain);
+ void apply_gain (gain_t gain, nframes_t len) {
+ apply_gain_to_buffer (_data, len, gain);
}
/** Set the data contained by this buffer manually (for setting directly to jack buffer).
@@ -112,6 +120,7 @@ public:
_size = size;
_data = data;
_silent = false;
+ _written = false;
}
/** Reallocate the buffer used internally to handle at least @nframes of data
@@ -120,33 +129,25 @@ public:
*/
void resize (size_t nframes);
- 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 (nframes_t nframes, nframes_t offset)
- { assert(offset + nframes <= _capacity); return _data + offset; }
- void replace_data (size_t nframes);
-
- void drop_data () {
- assert (_owns_data);
- assert (_data);
+ const Sample* data (nframes_t offset = 0) const {
+ assert(offset <= _capacity);
+ return _data + offset;
+ }
- free (_data);
- _data = 0;
- _size = 0;
- _capacity = 0;
- _silent = false;
+ Sample* data (nframes_t offset = 0) {
+ assert(offset <= _capacity);
+ return _data + offset;
}
- void copy_to_internal (Sample* p, nframes_t cnt, nframes_t offset);
+ void prepare () { _written = false; }
+ bool written() const { return _written; }
private:
bool _owns_data;
+ bool _written;
Sample* _data; ///< Actual buffer contents
+
};
diff --git a/libs/ardour/ardour/audio_diskstream.h b/libs/ardour/ardour/audio_diskstream.h
index 4f22efd535..7f4cdce6ec 100644
--- a/libs/ardour/ardour/audio_diskstream.h
+++ b/libs/ardour/ardour/audio_diskstream.h
@@ -215,7 +215,7 @@ class AudioDiskstream : public Diskstream
protected:
friend class AudioTrack;
- int process (nframes_t transport_frame, nframes_t nframes, nframes_t offset, bool can_record, bool rec_monitors_input);
+ int process (nframes_t transport_frame, nframes_t nframes, bool can_record, bool rec_monitors_input);
bool commit (nframes_t nframes);
private:
diff --git a/libs/ardour/ardour/audio_port.h b/libs/ardour/ardour/audio_port.h
index b928a3587d..85bac1f286 100644
--- a/libs/ardour/ardour/audio_port.h
+++ b/libs/ardour/ardour/audio_port.h
@@ -35,14 +35,15 @@ class AudioPort : public Port
return DataType::AUDIO;
}
- void cycle_start (nframes_t, nframes_t);
- void cycle_end (nframes_t, nframes_t);
+ void cycle_start (nframes_t);
+ void cycle_end (nframes_t);
+ void cycle_split ();
- Buffer& get_buffer (nframes_t nframes, nframes_t offset) {
+ Buffer& get_buffer (nframes_t nframes, nframes_t offset = 0) {
return get_audio_buffer (nframes, offset);
}
- AudioBuffer& get_audio_buffer (nframes_t, nframes_t);
+ AudioBuffer& get_audio_buffer (nframes_t nframes, nframes_t offset = 0);
protected:
friend class AudioEngine;
@@ -50,8 +51,8 @@ class AudioPort : public Port
AudioPort (std::string const &, Flags);
private:
- bool _buffer_data_set;
AudioBuffer* _buffer;
+
};
} // namespace ARDOUR
diff --git a/libs/ardour/ardour/audio_track.h b/libs/ardour/ardour/audio_track.h
index bea763a176..22092b5e1b 100644
--- a/libs/ardour/ardour/audio_track.h
+++ b/libs/ardour/ardour/audio_track.h
@@ -40,13 +40,13 @@ class AudioTrack : public Track
bool can_use_mode (TrackMode m, bool& bounce_required);
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 declick, 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);
+ bool state_changing, 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);
+ bool can_record, bool rec_monitors_input);
boost::shared_ptr<AudioDiskstream> audio_diskstream() const;
diff --git a/libs/ardour/ardour/audioengine.h b/libs/ardour/ardour/audioengine.h
index 5c9317ae7b..54154141f6 100644
--- a/libs/ardour/ardour/audioengine.h
+++ b/libs/ardour/ardour/audioengine.h
@@ -123,6 +123,8 @@ class AudioEngine : public sigc::trackable
Port *register_input_port (DataType, const std::string& portname);
Port *register_output_port (DataType, const std::string& portname);
int unregister_port (Port &);
+
+ void split_cycle (nframes_t offset);
int connect (const std::string& source, const std::string& destination);
int disconnect (const std::string& source, const std::string& destination);
diff --git a/libs/ardour/ardour/buffer.h b/libs/ardour/ardour/buffer.h
index 1b673503e3..da75556877 100644
--- a/libs/ardour/ardour/buffer.h
+++ b/libs/ardour/ardour/buffer.h
@@ -67,15 +67,15 @@ public:
* The buffer is not silent after this operation. the @a capacity argument
* passed to the constructor must have been non-zero.
*/
- virtual void resize(size_t) = 0;
+ virtual void resize (size_t) = 0;
- /** Clear (eg zero, or empty) buffer starting at TIME @a offset */
- virtual void silence(nframes_t len, nframes_t offset=0) = 0;
+ /** Clear (eg zero, or empty) buffer */
+ 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, nframes_t offset, nframes_t len) = 0;
+ virtual void read_from (const Buffer& src, nframes_t len, nframes_t dst_offset = 0, nframes_t src_offset = 0) = 0;
protected:
Buffer(DataType type, size_t capacity)
diff --git a/libs/ardour/ardour/buffer_set.h b/libs/ardour/ardour/buffer_set.h
index 28350d8d2f..f02470c3e8 100644
--- a/libs/ardour/ardour/buffer_set.h
+++ b/libs/ardour/ardour/buffer_set.h
@@ -53,7 +53,7 @@ public:
void clear();
- void attach_buffers(PortSet& ports, nframes_t nframes, nframes_t offset);
+ void attach_buffers(PortSet& ports, nframes_t nframes, nframes_t offset = 0);
void ensure_buffers(const ChanCount& count, size_t buffer_capacity);
void ensure_buffers(DataType type, size_t num_buffers, size_t buffer_capacity);
@@ -81,7 +81,7 @@ public:
return (MidiBuffer&)get(DataType::MIDI, i);
}
- void read_from(BufferSet& in, jack_nframes_t nframes, jack_nframes_t offset=0);
+ void read_from(BufferSet& in, nframes_t nframes);
// ITERATORS
// FIXME: possible to combine these? templates?
diff --git a/libs/ardour/ardour/diskstream.h b/libs/ardour/ardour/diskstream.h
index a5a98338da..56400360d2 100644
--- a/libs/ardour/ardour/diskstream.h
+++ b/libs/ardour/ardour/diskstream.h
@@ -188,7 +188,7 @@ class Diskstream : public SessionObject, public boost::noncopyable
friend class Track;
virtual void prepare ();
- virtual int process (nframes_t transport_frame, nframes_t nframes, nframes_t offset, bool can_record, bool rec_monitors_input) = 0;
+ virtual int process (nframes_t transport_frame, nframes_t nframes, 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 */
diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h
index 709a5368db..6b309bf50c 100644
--- a/libs/ardour/ardour/io.h
+++ b/libs/ardour/ardour/io.h
@@ -101,13 +101,11 @@ class IO : public SessionObject, public AutomatableControls, public Latent
bool set_name (const string& str);
- virtual void silence (nframes_t, nframes_t offset);
+ virtual void silence (nframes_t);
- 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);
+ void collect_input (BufferSet& bufs, nframes_t nframes);
+ void deliver_output (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes);
+ void just_meter_input (nframes_t start_frame, nframes_t end_frame, nframes_t nframes);
BufferSet& output_buffers() { return *_output_buffers; }
@@ -213,6 +211,7 @@ class IO : public SessionObject, public AutomatableControls, public Latent
/// raised when the number of input or output ports changes
static sigc::signal<void,ChanCount> PortCountChanged;
static sigc::signal<int> PortsCreated;
+ static sigc::signal<void,nframes_t> CycleStart;
static void update_meters();
static std::string name_from_state (const XMLNode&);
@@ -287,9 +286,10 @@ class IO : public SessionObject, public AutomatableControls, public Latent
bool _denormal_protection;
XMLNode* deferred_state;
DataType _default_type;
+ nframes_t _output_offset;
- virtual void prepare_inputs (nframes_t nframes, nframes_t offset);
- virtual void flush_outputs (nframes_t nframes, nframes_t offset);
+ virtual void prepare_inputs (nframes_t nframes);
+ virtual void flush_outputs (nframes_t nframes);
virtual void set_deferred_state() {}
@@ -310,13 +310,16 @@ class IO : public SessionObject, public AutomatableControls, public Latent
int set_inputs (const string& str);
int set_outputs (const string& str);
+ void increment_output_offset (nframes_t);
+ void cycle_start (nframes_t);
+
static bool connecting_legal;
static bool ports_legal;
private:
static bool panners_legal;
- void copy_to_outputs (BufferSet& bufs, DataType type, nframes_t nframes, nframes_t offset);
+ void copy_to_outputs (BufferSet& bufs, DataType type, nframes_t nframes);
int connecting_became_legal ();
int panners_became_legal ();
diff --git a/libs/ardour/ardour/io_processor.h b/libs/ardour/ardour/io_processor.h
index d571821080..1a12a3271e 100644
--- a/libs/ardour/ardour/io_processor.h
+++ b/libs/ardour/ardour/io_processor.h
@@ -60,10 +60,8 @@ class IOProcessor : public Processor
virtual void automation_snapshot (nframes_t now, bool force);
- virtual void run_in_place (BufferSet& in, nframes_t start, nframes_t end,
- nframes_t nframes, nframes_t offset) = 0;
-
- void silence (nframes_t nframes, nframes_t offset);
+ virtual void run_in_place (BufferSet& in, nframes_t start, nframes_t end, nframes_t nframes) = 0;
+ void silence (nframes_t nframes);
sigc::signal<void,IOProcessor*,bool> AutomationPlaybackChanged;
sigc::signal<void,IOProcessor*,uint32_t> AutomationChanged;
diff --git a/libs/ardour/ardour/meter.h b/libs/ardour/ardour/meter.h
index 99aacfeb15..972e1b6760 100644
--- a/libs/ardour/ardour/meter.h
+++ b/libs/ardour/ardour/meter.h
@@ -44,7 +44,7 @@ public:
bool configure_io (ChanCount in, ChanCount out);
/** Compute peaks */
- void run_in_place (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset);
+ void run_in_place (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes);
float peak_power (uint32_t n) {
if (n < _visible_peak_power.size()) {
diff --git a/libs/ardour/ardour/midi_buffer.h b/libs/ardour/ardour/midi_buffer.h
index 9c2ee466d3..70e2203df4 100644
--- a/libs/ardour/ardour/midi_buffer.h
+++ b/libs/ardour/ardour/midi_buffer.h
@@ -37,9 +37,8 @@ public:
MidiBuffer(size_t capacity);
~MidiBuffer();
- void silence(nframes_t dur, nframes_t offset=0);
-
- void read_from(const Buffer& src, nframes_t nframes, nframes_t offset);
+ void silence (nframes_t nframes, nframes_t offset = 0);
+ void read_from (const Buffer& src, nframes_t nframes, nframes_t dst_offset = 0, nframes_t src_offset = 0);
void copy(const MidiBuffer& copy);
@@ -54,7 +53,7 @@ public:
template<typename BufferType, typename EventType>
struct iterator_base {
- iterator_base<BufferType, EventType>(BufferType& b, size_t o) : buffer(b), offset(o) {}
+ iterator_base<BufferType, EventType>(BufferType& b, nframes_t o) : buffer(b), offset(o) {}
inline EventType operator*() const {
uint8_t* ev_start = buffer._data + offset + sizeof(TimeType);
int event_size = Evoral::midi_event_size(ev_start);
diff --git a/libs/ardour/ardour/midi_diskstream.h b/libs/ardour/ardour/midi_diskstream.h
index 9632c1566a..26198e1c62 100644
--- a/libs/ardour/ardour/midi_diskstream.h
+++ b/libs/ardour/ardour/midi_diskstream.h
@@ -65,7 +65,7 @@ class MidiDiskstream : public Diskstream
float playback_buffer_load() const;
float capture_buffer_load() const;
- void get_playback(MidiBuffer& dst, nframes_t start, nframes_t end, nframes_t offset);
+ void get_playback(MidiBuffer& dst, nframes_t start, nframes_t end);
void set_record_enabled (bool yn);
@@ -136,7 +136,7 @@ class MidiDiskstream : public Diskstream
protected:
friend class MidiTrack;
- int process (nframes_t transport_frame, nframes_t nframes, nframes_t offset, bool can_record, bool rec_monitors_input);
+ int process (nframes_t transport_frame, nframes_t nframes, bool can_record, bool rec_monitors_input);
bool commit (nframes_t nframes);
static nframes_t midi_readahead;
diff --git a/libs/ardour/ardour/midi_port.h b/libs/ardour/ardour/midi_port.h
index f27789da5f..2f3d8d1647 100644
--- a/libs/ardour/ardour/midi_port.h
+++ b/libs/ardour/ardour/midi_port.h
@@ -36,15 +36,16 @@ class MidiPort : public Port {
return DataType::MIDI;
}
- void cycle_start (nframes_t nframes, nframes_t offset);
- void cycle_end (nframes_t nframes, nframes_t offset);
- void flush_buffers (nframes_t nframes, nframes_t offset);
+ void cycle_start (nframes_t nframes);
+ void cycle_end (nframes_t nframes);
+ void cycle_split ();
+ void flush_buffers (nframes_t nframes, nframes_t offset = 0);
- Buffer& get_buffer (nframes_t nframes, nframes_t offset) {
+ Buffer& get_buffer (nframes_t nframes, nframes_t offset = 0) {
return get_midi_buffer (nframes, offset);
}
-
- MidiBuffer& get_midi_buffer (nframes_t nframes, nframes_t offset);
+
+ MidiBuffer& get_midi_buffer (nframes_t nframes, nframes_t offset = 0);
protected:
friend class AudioEngine;
@@ -52,9 +53,9 @@ class MidiPort : public Port {
MidiPort (const std::string& name, Flags);
private:
-
MidiBuffer* _buffer;
bool _has_been_mixed_down;
+
};
} // namespace ARDOUR
diff --git a/libs/ardour/ardour/midi_track.h b/libs/ardour/ardour/midi_track.h
index 174ad87823..424b9d2c92 100644
--- a/libs/ardour/ardour/midi_track.h
+++ b/libs/ardour/ardour/midi_track.h
@@ -39,17 +39,17 @@ public:
~MidiTrack ();
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 declick, 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);
+ bool state_changing, 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);
+ bool can_record, bool rec_monitors_input);
void process_output_buffers (BufferSet& bufs,
nframes_t start_frame, nframes_t end_frame,
- nframes_t nframes, nframes_t offset, bool with_redirects, int declick,
+ nframes_t nframes, bool with_redirects, int declick,
bool meter);
boost::shared_ptr<MidiDiskstream> midi_diskstream() const;
@@ -96,8 +96,7 @@ protected:
int _set_state (const XMLNode&, bool call_base);
private:
- void write_controller_messages(MidiBuffer& buf,
- nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset);
+ void write_controller_messages(MidiBuffer& buf, nframes_t start_frame, nframes_t end_frame, nframes_t nframes);
int set_diskstream (boost::shared_ptr<MidiDiskstream> ds);
void use_new_diskstream ();
diff --git a/libs/ardour/ardour/panner.h b/libs/ardour/ardour/panner.h
index 7bdb33056c..2e7a73561e 100644
--- a/libs/ardour/ardour/panner.h
+++ b/libs/ardour/ardour/panner.h
@@ -218,7 +218,7 @@ class Panner : public Processor
bool is_out_of_place () const { return true; }
bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const { return true; };
- void run_out_of_place(BufferSet& src, BufferSet& dest, nframes_t start_frame, nframes_t end_frames, nframes_t nframes, nframes_t offset);
+ void run_out_of_place(BufferSet& src, BufferSet& dest, nframes_t start_frame, nframes_t end_frames, nframes_t nframes);
//void* get_inline_gui() const = 0;
//void* get_full_gui() const = 0;
@@ -301,7 +301,7 @@ class Panner : public Processor
/* disallow copy construction */
Panner (Panner const &);
- void distribute_no_automation(BufferSet& src, BufferSet& dest, nframes_t nframes, nframes_t offset, gain_t gain_coeff);
+ void distribute_no_automation(BufferSet& src, BufferSet& dest, nframes_t nframes, gain_t gain_coeff);
std::vector<StreamPanner*> _streampanners;
uint32_t current_outs;
bool _linked;
diff --git a/libs/ardour/ardour/plugin_insert.h b/libs/ardour/ardour/plugin_insert.h
index 0d3534a2b8..e3204fc6b3 100644
--- a/libs/ardour/ardour/plugin_insert.h
+++ b/libs/ardour/ardour/plugin_insert.h
@@ -54,7 +54,7 @@ class PluginInsert : public Processor
XMLNode& get_state(void);
int set_state(const XMLNode&);
- void run_in_place (BufferSet& in, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset);
+ void run_in_place (BufferSet& in, nframes_t start_frame, nframes_t end_frame, nframes_t nframes);
void silence (nframes_t nframes, nframes_t offset);
void activate ();
@@ -136,7 +136,7 @@ class PluginInsert : public Processor
BufferSet _signal_analysis_input_bufferset;
BufferSet _signal_analysis_output_bufferset;
- void automation_run (BufferSet& bufs, nframes_t nframes, nframes_t offset);
+ void automation_run (BufferSet& bufs, nframes_t nframes);
void connect_and_run (BufferSet& bufs, nframes_t nframes, nframes_t offset, bool with_auto, nframes_t now = 0);
void init ();
diff --git a/libs/ardour/ardour/port.h b/libs/ardour/ardour/port.h
index cf54c5065b..0c77eb15dd 100644
--- a/libs/ardour/ardour/port.h
+++ b/libs/ardour/ardour/port.h
@@ -44,6 +44,18 @@ public:
virtual ~Port ();
+ static nframes_t port_offset() { return _port_offset; }
+
+ static void set_port_offset (nframes_t off) {
+ _port_offset = off;
+ }
+ static void increment_port_offset (nframes_t n) {
+ _port_offset += n;
+ }
+ static void set_buffer_size (nframes_t sz) {
+ _buffer_size = sz;
+ }
+
/** @return Port short name */
std::string name () const {
return _name;
@@ -91,10 +103,11 @@ public:
virtual void reset ();
virtual DataType type () const = 0;
- virtual void cycle_start (nframes_t, nframes_t) = 0;
- virtual void cycle_end (nframes_t, nframes_t) = 0;
- virtual Buffer& get_buffer (nframes_t, nframes_t) = 0;
- virtual void flush_buffers (nframes_t, nframes_t) {}
+ virtual void cycle_start (nframes_t) = 0;
+ virtual void cycle_end (nframes_t) = 0;
+ virtual void cycle_split () = 0;
+ virtual Buffer& get_buffer (nframes_t nframes, nframes_t offset = 0) = 0;
+ virtual void flush_buffers (nframes_t, nframes_t offset = 0) {}
static void set_engine (AudioEngine *);
@@ -106,6 +119,9 @@ protected:
jack_port_t* _jack_port; ///< JACK port
+ static nframes_t _port_offset;
+ static nframes_t _buffer_size;
+
static AudioEngine* _engine; ///< the AudioEngine
private:
diff --git a/libs/ardour/ardour/port_insert.h b/libs/ardour/ardour/port_insert.h
index dcf2e8dfb2..27d251cc45 100644
--- a/libs/ardour/ardour/port_insert.h
+++ b/libs/ardour/ardour/port_insert.h
@@ -50,7 +50,7 @@ class PortInsert : public IOProcessor
void init ();
- void run_in_place (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset);
+ void run_in_place (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes);
nframes_t signal_latency() const;
diff --git a/libs/ardour/ardour/processor.h b/libs/ardour/ardour/processor.h
index dce55e018e..24d3cd93c7 100644
--- a/libs/ardour/ardour/processor.h
+++ b/libs/ardour/ardour/processor.h
@@ -72,13 +72,13 @@ class Processor : public SessionObject, public AutomatableControls, public Laten
virtual void run_in_place (BufferSet& bufs,
nframes_t start_frame, nframes_t end_frame,
- nframes_t nframes, nframes_t offset) { assert(is_in_place()); }
+ nframes_t nframes) { assert(is_in_place()); }
virtual void run_out_of_place (BufferSet& input, BufferSet& output,
nframes_t start_frame, nframes_t end_frame,
- nframes_t nframes, nframes_t offset) { assert(is_out_of_place()); }
+ nframes_t nframes) { assert(is_out_of_place()); }
- virtual void silence (nframes_t nframes, nframes_t offset) {}
+ virtual void silence (nframes_t nframes) {}
void activate () { _active = true; ActiveChanged(); }
void deactivate () { _active = false; ActiveChanged(); }
diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h
index 2319cadb57..183be9c4c8 100644
--- a/libs/ardour/ardour/route.h
+++ b/libs/ardour/ardour/route.h
@@ -91,13 +91,13 @@ class Route : public IO
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);
+ int declick, 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);
+ bool state_changing, 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);
+ bool can_record, bool rec_monitors_input);
virtual void toggle_monitor_input ();
virtual bool can_record() { return false; }
@@ -273,16 +273,16 @@ class Route : public IO
void curve_reallocate ();
protected:
- nframes_t check_initial_delay (nframes_t, nframes_t&, nframes_t&);
+ nframes_t check_initial_delay (nframes_t, nframes_t&);
void passthru (nframes_t start_frame, nframes_t end_frame,
- nframes_t nframes, nframes_t offset, int declick, bool meter_inputs);
+ nframes_t nframes, int declick, bool meter_inputs);
virtual void process_output_buffers (BufferSet& bufs,
- nframes_t start_frame, nframes_t end_frame,
- nframes_t nframes, nframes_t offset, bool with_processors, int declick,
- bool meter);
-
+ nframes_t start_frame, nframes_t end_frame,
+ nframes_t nframes, bool with_processors, int declick,
+ bool meter);
+
Flag _flags;
int _pending_declick;
MeterPoint _meter_point;
@@ -326,10 +326,10 @@ class Route : public IO
virtual XMLNode& state(bool);
void passthru_silence (nframes_t start_frame, nframes_t end_frame,
- nframes_t nframes, nframes_t offset, int declick,
+ nframes_t nframes, int declick,
bool meter);
- void silence (nframes_t nframes, nframes_t offset);
+ void silence (nframes_t nframes);
sigc::connection input_signal_connection;
diff --git a/libs/ardour/ardour/send.h b/libs/ardour/ardour/send.h
index ed37094bf3..2e7d2c239c 100644
--- a/libs/ardour/ardour/send.h
+++ b/libs/ardour/ardour/send.h
@@ -43,7 +43,7 @@ class Send : public IOProcessor
ChanCount output_streams() const;
ChanCount input_streams () const;
- void run_in_place (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset);
+ void run_in_place (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes);
void activate() {}
void deactivate () {}
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index dc43e08a2d..c2e7e23476 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -1077,14 +1077,11 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
nframes_t slave_wait_end;
void reset_slave_state ();
- bool follow_slave (nframes_t, nframes_t);
+ bool follow_slave (nframes_t);
void calculate_moving_average_of_slave_delta(int dir, nframes_t this_delta);
- void track_slave_state(
- float slave_speed,
- nframes_t slave_transport_frame,
- nframes_t this_delta,
- bool starting);
- void follow_slave_silently(nframes_t nframes, nframes_t offset, float slave_speed);
+ void track_slave_state(float slave_speed, nframes_t slave_transport_frame,
+ nframes_t this_delta, bool starting);
+ void follow_slave_silently(nframes_t nframes, float slave_speed);
void set_slave_source (SlaveSource);
@@ -1105,8 +1102,8 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
void prepare_diskstreams ();
void commit_diskstreams (nframes_t, bool& session_requires_butler);
- int process_routes (nframes_t, nframes_t);
- int silent_process_routes (nframes_t, nframes_t);
+ int process_routes (nframes_t);
+ int silent_process_routes (nframes_t);
bool get_rec_monitors_input () {
if (actively_recording()) {
@@ -1140,7 +1137,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
return false;
}
- bool maybe_sync_start (nframes_t&, nframes_t&);
+ bool maybe_sync_start (nframes_t&);
void check_declick_out ();
@@ -1385,7 +1382,8 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
void reset_record_status ();
- int no_roll (nframes_t nframes, nframes_t offset);
+ int no_roll (nframes_t nframes);
+ int fail_roll (nframes_t nframes);
bool non_realtime_work_pending() const { return static_cast<bool>(post_transport_work); }
bool process_can_proceed() const { return !(post_transport_work & ProcessCannotProceedMask); }
@@ -1673,7 +1671,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
Click *get_click();
void setup_click_sounds (int which);
void clear_clicks ();
- void click (nframes_t start, nframes_t nframes, nframes_t offset);
+ void click (nframes_t start, nframes_t nframes);
vector<Route*> master_outs;
diff --git a/libs/ardour/ardour/track.h b/libs/ardour/ardour/track.h
index 42e992c220..29a4aa8e25 100644
--- a/libs/ardour/ardour/track.h
+++ b/libs/ardour/ardour/track.h
@@ -46,13 +46,13 @@ class Track : public Route
sigc::signal<void> TrackModeChanged;
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;
+ int declick, 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;
+ bool state_changing, 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;
+ bool can_record, bool rec_monitors_input) = 0;
void toggle_monitor_input ();
diff --git a/libs/ardour/audio_buffer.cc b/libs/ardour/audio_buffer.cc
index 7a6767dd32..c5717f0528 100644
--- a/libs/ardour/audio_buffer.cc
+++ b/libs/ardour/audio_buffer.cc
@@ -16,18 +16,14 @@
675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <errno.h>
+
#include "ardour/audio_buffer.h"
#include "pbd/error.h"
-#include <errno.h>
+#include "pbd/malign.h"
#include "i18n.h"
-#ifdef __x86_64__
-static const int CPU_CACHE_ALIGN = 64;
-#else
-static const int CPU_CACHE_ALIGN = 16; /* arguably 32 on most arches, but it matters less */
-#endif
-
using namespace PBD;
using namespace ARDOUR;
@@ -50,19 +46,6 @@ AudioBuffer::~AudioBuffer()
free(_data);
}
-/* called to replace a pointer to an external buffer (e.g. JACK) with
- buffer-owned memory.
-*/
-
-void
-AudioBuffer::replace_data (size_t capacity)
-{
- _owns_data = true;
- _data = 0;
- _capacity = 0; // force reallocation
- resize (capacity);
-}
-
void
AudioBuffer::resize (size_t size)
{
@@ -83,20 +66,7 @@ AudioBuffer::resize (size_t size)
_size = size;
_silent = false;
-#ifdef NO_POSIX_MEMALIGN
- _data = (Sample *) malloc(sizeof(Sample) * _capacity);
-#else
- if (posix_memalign((void**)&_data, CPU_CACHE_ALIGN, sizeof(Sample) * _capacity)) {
- fatal << string_compose (_("Memory allocation error: posix_memalign (%1 * %2) failed (%3)"),
- CPU_CACHE_ALIGN, sizeof (Sample) * _capacity, strerror (errno)) << endmsg;
- }
-#endif
-
+ cache_aligned_malloc ((void**) &_data, sizeof (Sample) * _capacity);
}
-void
-AudioBuffer::copy_to_internal (Sample* p, nframes_t cnt, nframes_t offset)
-{
- memcpy (_data + offset, p, sizeof(Sample*) * cnt);
-}
diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc
index 94c52c5976..960112a997 100644
--- a/libs/ardour/audio_diskstream.cc
+++ b/libs/ardour/audio_diskstream.cc
@@ -513,7 +513,7 @@ AudioDiskstream::check_record_status (nframes_t transport_frame, nframes_t nfram
}
int
-AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, nframes_t offset, bool can_record, bool rec_monitors_input)
+AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can_record, bool rec_monitors_input)
{
uint32_t n;
boost::shared_ptr<ChannelList> c = channels.reader();
@@ -658,8 +658,9 @@ AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, nframes_
AudioPort* const ap = _io->audio_input(n);
assert(ap);
- assert(rec_nframes <= ap->get_audio_buffer( nframes, offset ).capacity());
- memcpy (chaninfo->current_capture_buffer, ap->get_audio_buffer( nframes, offset ).data(rec_nframes, offset + rec_offset), sizeof (Sample) * rec_nframes);
+ assert(rec_nframes <= ap->get_audio_buffer(nframes).capacity());
+ memcpy (chaninfo->current_capture_buffer, ap->get_audio_buffer (rec_nframes).data(rec_offset), sizeof (Sample) * rec_nframes);
+
} else {
@@ -673,7 +674,7 @@ AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, nframes_
AudioPort* const ap = _io->audio_input(n);
assert(ap);
- Sample* buf = ap->get_audio_buffer( nframes, offset ).data(nframes, offset);
+ Sample* buf = ap->get_audio_buffer(nframes).data();
nframes_t first = chaninfo->capture_vector.len[0];
memcpy (chaninfo->capture_wrap_buffer, buf, sizeof (Sample) * first);
diff --git a/libs/ardour/audio_port.cc b/libs/ardour/audio_port.cc
index c9d28dcb41..c62d31a6d0 100644
--- a/libs/ardour/audio_port.cc
+++ b/libs/ardour/audio_port.cc
@@ -27,7 +27,6 @@ using namespace std;
AudioPort::AudioPort (const std::string& name, Flags flags)
: Port (name, DataType::AUDIO, flags)
- , _buffer_data_set (false)
, _buffer (new AudioBuffer (0))
{
assert (name.find_first_of (':') == string::npos);
@@ -39,7 +38,7 @@ AudioPort::~AudioPort ()
}
void
-AudioPort::cycle_start (nframes_t nframes, nframes_t offset)
+AudioPort::cycle_start (nframes_t nframes)
{
/* caller must hold process lock */
@@ -50,36 +49,51 @@ AudioPort::cycle_start (nframes_t nframes, nframes_t offset)
happen when Port::get_buffer() is called.
*/
- if (sends_output() && !_buffer_data_set) {
-
- _buffer->set_data ((Sample *) jack_port_get_buffer (_jack_port, nframes) + offset, nframes);
- _buffer_data_set = true;
-
+ if (sends_output()) {
+
+ /* Notice that cycle_start() is always run with the *entire* process cycle frame count,
+ so we do not bother to apply _port_offset here - we always want the address of the
+ entire JACK port buffer. We are not collecting data here - just noting the
+ address where we will write data later in the process cycle.
+ */
+
+ _buffer->set_data ((Sample *) jack_port_get_buffer (_jack_port, nframes), nframes);
+ _buffer->prepare ();
}
+}
- if (receives_input()) {
- _buffer_data_set = false;
- } else {
- _buffer->silence (nframes, offset);
+void
+AudioPort::cycle_end (nframes_t nframes)
+{
+ if (sends_output() && !_buffer->written()) {
+ _buffer->silence (nframes);
}
}
-AudioBuffer &
+void
+AudioPort::cycle_split ()
+{
+}
+
+AudioBuffer&
AudioPort::get_audio_buffer (nframes_t nframes, nframes_t offset)
{
/* caller must hold process lock */
- if (receives_input () && !_buffer_data_set) {
+ if (receives_input ()) {
+
+ /* Get a pointer to the audio data @ offset + _port_offset within the JACK port buffer and store
+ it in our _buffer member.
- _buffer->set_data ((Sample *) jack_port_get_buffer (_jack_port, nframes) + offset, nframes);
-
+ Note that offset is expected to be zero in almost all cases.
+ */
+
+ _buffer->set_data ((Sample *) jack_port_get_buffer (_jack_port, nframes) + offset + _port_offset, nframes);
}
+ /* output ports set their _buffer data information during ::cycle_start()
+ */
+
return *_buffer;
}
-void
-AudioPort::cycle_end (nframes_t nframes, nframes_t offset)
-{
- _buffer_data_set = false;
-}
diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc
index 25161ea249..d814709798 100644
--- a/libs/ardour/audio_track.cc
+++ b/libs/ardour/audio_track.cc
@@ -453,7 +453,7 @@ AudioTrack::set_state_part_two ()
}
int
-AudioTrack::no_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nframes_t offset,
+AudioTrack::no_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
bool session_state_changing, bool can_record, bool rec_monitors_input)
{
if (n_outputs().n_total() == 0) {
@@ -461,7 +461,7 @@ AudioTrack::no_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_fra
}
if (!_active) {
- silence (nframes, offset);
+ silence (nframes);
return 0;
}
@@ -469,7 +469,7 @@ AudioTrack::no_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_fra
/* XXX is this safe to do against transport state changes? */
- passthru_silence (start_frame, end_frame, nframes, offset, 0, false);
+ passthru_silence (start_frame, end_frame, nframes, 0, false);
return 0;
}
@@ -518,12 +518,12 @@ AudioTrack::no_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_fra
*/
if (_have_internal_generator) {
- passthru_silence (start_frame, end_frame, nframes, offset, 0, true);
+ passthru_silence (start_frame, end_frame, nframes, 0, true);
} else {
if (_meter_point == MeterInput) {
- just_meter_input (start_frame, end_frame, nframes, offset);
+ just_meter_input (start_frame, end_frame, nframes);
}
- passthru_silence (start_frame, end_frame, nframes, offset, 0, false);
+ passthru_silence (start_frame, end_frame, nframes, 0, false);
}
} else {
@@ -531,14 +531,14 @@ AudioTrack::no_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_fra
/* we're sending signal, but we may still want to meter the input.
*/
- passthru (start_frame, end_frame, nframes, offset, 0, (_meter_point == MeterInput));
+ passthru (start_frame, end_frame, nframes, 0, (_meter_point == MeterInput));
}
return 0;
}
int
-AudioTrack::roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nframes_t offset, int declick,
+AudioTrack::roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, int declick,
bool can_record, bool rec_monitors_input)
{
int dret;
@@ -562,36 +562,35 @@ AudioTrack::roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
}
if (!_active) {
- silence (nframes, offset);
+ silence (nframes);
return 0;
}
transport_frame = _session.transport_frame();
- prepare_inputs( nframes, offset );
+ prepare_inputs (nframes);
+
+ if ((nframes = check_initial_delay (nframes, transport_frame)) == 0) {
- if ((nframes = check_initial_delay (nframes, offset, transport_frame)) == 0) {
/* need to do this so that the diskstream sets its
playback distance to zero, thus causing diskstream::commit
to do nothing.
*/
- return diskstream->process (transport_frame, 0, 0, can_record, rec_monitors_input);
+ return diskstream->process (transport_frame, 0, can_record, rec_monitors_input);
}
_silent = false;
apply_gain_automation = false;
- if ((dret = diskstream->process (transport_frame, nframes, offset, can_record, rec_monitors_input)) != 0) {
-
- silence (nframes, offset);
-
+ if ((dret = diskstream->process (transport_frame, nframes, can_record, rec_monitors_input)) != 0) {
+ silence (nframes);
return dret;
}
/* special condition applies */
if (_meter_point == MeterInput) {
- just_meter_input (start_frame, end_frame, nframes, offset);
+ just_meter_input (start_frame, end_frame, nframes);
}
if (diskstream->record_enabled() && !can_record && !Config->get_auto_input()) {
@@ -600,7 +599,7 @@ AudioTrack::roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
at least potentially (depending on monitoring options)
*/
- passthru (start_frame, end_frame, nframes, offset, 0, true);
+ passthru (start_frame, end_frame, nframes, 0, true);
} else if ((b = diskstream->playback_buffer(0)) != 0) {
@@ -696,18 +695,18 @@ AudioTrack::roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
}
}
- process_output_buffers (bufs, start_frame, end_frame, nframes, offset, (!_session.get_record_enabled() || !Config->get_do_not_record_plugins()), declick, (_meter_point != MeterInput));
+ process_output_buffers (bufs, start_frame, end_frame, nframes, (!_session.get_record_enabled() || !Config->get_do_not_record_plugins()), declick, (_meter_point != MeterInput));
} else {
/* problem with the diskstream; just be quiet for a bit */
- silence (nframes, offset);
+ silence (nframes);
}
return 0;
}
int
-AudioTrack::silent_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nframes_t offset,
+AudioTrack::silent_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
bool can_record, bool rec_monitors_input)
{
if (n_outputs().n_total() == 0 && _processors.empty()) {
@@ -715,16 +714,16 @@ AudioTrack::silent_roll (nframes_t nframes, nframes_t start_frame, nframes_t end
}
if (!_active) {
- silence (nframes, offset);
+ silence (nframes);
return 0;
}
_silent = true;
apply_gain_automation = false;
- silence (nframes, offset);
+ silence (nframes);
- return audio_diskstream()->process (_session.transport_frame() + offset, nframes, offset, can_record, rec_monitors_input);
+ return audio_diskstream()->process (_session.transport_frame(), nframes, can_record, rec_monitors_input);
}
int
@@ -781,7 +780,7 @@ AudioTrack::export_stuff (BufferSet& buffers, nframes_t start, nframes_t nframes
if ((processor = boost::dynamic_pointer_cast<Processor>(*i)) != 0) {
switch (processor->placement()) {
case PreFader:
- processor->run_in_place (buffers, start, start+nframes, nframes, 0);
+ processor->run_in_place (buffers, start, start+nframes, nframes);
break;
case PostFader:
post_fader_work = true;
@@ -821,7 +820,7 @@ AudioTrack::export_stuff (BufferSet& buffers, nframes_t start, nframes_t nframes
case PreFader:
break;
case PostFader:
- processor->run_in_place (buffers, start, start+nframes, nframes, 0);
+ processor->run_in_place (buffers, start, start+nframes, nframes);
break;
}
}
diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc
index e0be9af6d9..8ca85c4fe8 100644
--- a/libs/ardour/audioengine.cc
+++ b/libs/ardour/audioengine.cc
@@ -300,6 +300,22 @@ AudioEngine::_freewheel_callback (int onoff, void *arg)
static_cast<AudioEngine*>(arg)->_freewheeling = onoff;
}
+void
+AudioEngine::split_cycle (nframes_t offset)
+{
+ /* caller must hold process lock */
+
+ Port::increment_port_offset (offset);
+
+ /* tell all Ports that we're going to start a new (split) cycle */
+
+ boost::shared_ptr<Ports> p = ports.reader();
+
+ for (Ports::iterator i = p->begin(); i != p->end(); ++i) {
+ (*i)->cycle_split ();
+ }
+}
+
/** Method called by JACK (via _process_callback) which says that there
* is work to be done.
* @param nframes Number of frames to process.
@@ -336,10 +352,17 @@ AudioEngine::process_callback (nframes_t nframes)
return 0;
}
+ /* tell all IO objects that we're starting a new cycle */
+
+ IO::CycleStart (nframes);
+ Port::set_port_offset (0);
+
+ /* tell all Ports that we're starting a new cycle */
+
boost::shared_ptr<Ports> p = ports.reader();
for (Ports::iterator i = p->begin(); i != p->end(); ++i) {
- (*i)->cycle_start (nframes, 0);
+ (*i)->cycle_start (nframes);
}
if (_freewheeling) {
@@ -392,16 +415,17 @@ AudioEngine::process_callback (nframes_t nframes)
Port *port = (*i);
if (port->sends_output()) {
- port->get_buffer(nframes, 0 ).silence(nframes);
+ port->get_buffer(nframes).silence(nframes);
}
}
}
- // Finalize ports (ie write data if necessary)
+ // Finalize ports
for (Ports::iterator i = p->begin(); i != p->end(); ++i) {
- (*i)->cycle_end (nframes, 0);
+ (*i)->cycle_end (nframes);
}
+
_processed_frames = next_processed_frames;
return 0;
}
@@ -508,7 +532,7 @@ AudioEngine::set_session (Session *s)
boost::shared_ptr<Ports> p = ports.reader();
for (Ports::iterator i = p->begin(); i != p->end(); ++i) {
- (*i)->cycle_start (blocksize, 0);
+ (*i)->cycle_start (blocksize);
}
s->process (blocksize);
@@ -521,7 +545,7 @@ AudioEngine::set_session (Session *s)
s->process (blocksize);
for (Ports::iterator i = p->begin(); i != p->end(); ++i) {
- (*i)->cycle_end (blocksize, 0);
+ (*i)->cycle_end (blocksize);
}
}
}
diff --git a/libs/ardour/auditioner.cc b/libs/ardour/auditioner.cc
index f499bbf612..a0abe860fb 100644
--- a/libs/ardour/auditioner.cc
+++ b/libs/ardour/auditioner.cc
@@ -175,7 +175,7 @@ Auditioner::play_audition (nframes_t nframes)
int ret;
if (g_atomic_int_get (&_active) == 0) {
- silence (nframes, 0);
+ silence (nframes);
return 0;
}
@@ -183,8 +183,8 @@ Auditioner::play_audition (nframes_t nframes)
_diskstream->prepare ();
- if ((ret = roll (this_nframes, current_frame, current_frame + nframes, 0, false, false, false)) != 0) {
- silence (nframes, 0);
+ if ((ret = roll (this_nframes, current_frame, current_frame + nframes, false, false, false)) != 0) {
+ silence (nframes);
return ret;
}
diff --git a/libs/ardour/buffer.cc b/libs/ardour/buffer.cc
index 14154810da..21803c3854 100644
--- a/libs/ardour/buffer.cc
+++ b/libs/ardour/buffer.cc
@@ -20,12 +20,6 @@
#include "ardour/audio_buffer.h"
#include "ardour/midi_buffer.h"
-#ifdef __x86_64__
-static const int CPU_CACHE_ALIGN = 64;
-#else
-static const int CPU_CACHE_ALIGN = 16; /* arguably 32 on most arches, but it matters less */
-#endif
-
namespace ARDOUR {
diff --git a/libs/ardour/buffer_set.cc b/libs/ardour/buffer_set.cc
index a2dd110941..dfc607ec03 100644
--- a/libs/ardour/buffer_set.cc
+++ b/libs/ardour/buffer_set.cc
@@ -158,7 +158,7 @@ BufferSet::buffer_capacity(DataType type) const
// FIXME: make 'in' const
void
-BufferSet::read_from(BufferSet& in, nframes_t nframes, nframes_t offset)
+BufferSet::read_from (BufferSet& in, nframes_t nframes)
{
assert(available() >= in.count());
@@ -166,7 +166,7 @@ BufferSet::read_from(BufferSet& in, nframes_t nframes, nframes_t offset)
for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
BufferSet::iterator o = begin(*t);
for (BufferSet::iterator i = in.begin(*t); i != in.end(*t); ++i, ++o) {
- o->read_from(*i, nframes, offset);
+ o->read_from (*i, nframes);
}
}
diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc
index 27555c119e..7e77996d39 100644
--- a/libs/ardour/io.cc
+++ b/libs/ardour/io.cc
@@ -75,6 +75,7 @@ sigc::signal<int> IO::PortsLegal;
sigc::signal<int> IO::PannersLegal;
sigc::signal<void,ChanCount> IO::PortCountChanged;
sigc::signal<int> IO::PortsCreated;
+sigc::signal<void,nframes_t> IO::CycleStart;
Glib::StaticMutex IO::m_meter_signal_lock = GLIBMM_STATIC_MUTEX_INIT;
@@ -152,6 +153,9 @@ IO::IO (Session& s, const string& name,
m_meter_connection = Meter.connect (mem_fun (*this, &IO::meter));
}
+ _output_offset = 0;
+ CycleStart.connect (mem_fun (*this, &IO::cycle_start));
+
_session.add_controllable (_gain_control);
setup_bundles_for_inputs_and_outputs ();
@@ -190,6 +194,9 @@ IO::IO (Session& s, const XMLNode& node, DataType dt)
m_meter_connection = Meter.connect (mem_fun (*this, &IO::meter));
}
+ _output_offset = 0;
+ CycleStart.connect (mem_fun (*this, &IO::cycle_start));
+
_session.add_controllable (_gain_control);
setup_bundles_for_inputs_and_outputs ();
@@ -217,12 +224,12 @@ IO::~IO ()
}
void
-IO::silence (nframes_t nframes, nframes_t offset)
+IO::silence (nframes_t nframes)
{
/* io_lock, not taken: function must be called from Session::process() calltree */
for (PortSet::iterator i = _outputs.begin(); i != _outputs.end(); ++i) {
- i->get_buffer(nframes,offset).silence (nframes, offset);
+ i->get_buffer(nframes).silence (nframes);
}
}
@@ -232,7 +239,7 @@ IO::silence (nframes_t nframes, nframes_t offset)
* to the outputs, eg applying gain or pan or whatever else needs to be done.
*/
void
-IO::deliver_output (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset)
+IO::deliver_output (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes)
{
// FIXME: type specific code doesn't actually need to be here, it will go away in time
@@ -262,7 +269,7 @@ IO::deliver_output (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame,
can use the output buffers.
*/
- output_buffers().attach_buffers (_outputs, nframes, offset);
+ output_buffers().attach_buffers (_outputs, nframes, _output_offset);
// Use the panner to distribute audio to output port buffers
@@ -272,23 +279,23 @@ IO::deliver_output (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame,
cycle. XXX fix me to not waste cycles and do memory allocation etc.
*/
- _panner->run_out_of_place(bufs, output_buffers(), start_frame, end_frame, nframes, offset);
+ _panner->run_out_of_place(bufs, output_buffers(), start_frame, end_frame, nframes);
} else {
/* do a 1:1 copy of data to output ports */
if (bufs.count().n_audio() > 0 && _outputs.count().n_audio () > 0) {
- copy_to_outputs (bufs, DataType::AUDIO, nframes, offset);
+ copy_to_outputs (bufs, DataType::AUDIO, nframes);
}
if (bufs.count().n_midi() > 0 && _outputs.count().n_midi () > 0) {
- copy_to_outputs (bufs, DataType::MIDI, nframes, offset);
+ copy_to_outputs (bufs, DataType::MIDI, nframes);
}
}
}
void
-IO::copy_to_outputs (BufferSet& bufs, DataType type, nframes_t nframes, nframes_t offset)
+IO::copy_to_outputs (BufferSet& bufs, DataType type, nframes_t nframes)
{
// Copy any buffers 1:1 to outputs
@@ -298,9 +305,8 @@ IO::copy_to_outputs (BufferSet& bufs, DataType type, nframes_t nframes, nframes_
while (i != bufs.end(type) && o != _outputs.end (type)) {
- Buffer& port_buffer (o->get_buffer (nframes, offset));
- port_buffer.read_from (*i, nframes, offset);
-
+ Buffer& port_buffer (o->get_buffer (nframes));
+ port_buffer.read_from (*i, nframes, _output_offset);
prev = i;
++i;
++o;
@@ -309,14 +315,14 @@ IO::copy_to_outputs (BufferSet& bufs, DataType type, nframes_t nframes, nframes_
/* extra outputs get a copy of the last buffer */
while (o != _outputs.end(type)) {
- Buffer& port_buffer (o->get_buffer (nframes, offset));
- port_buffer.read_from(*prev, nframes, offset);
+ Buffer& port_buffer (o->get_buffer (nframes));
+ port_buffer.read_from (*prev, nframes, _output_offset);
++o;
}
}
void
-IO::collect_input (BufferSet& outs, nframes_t nframes, nframes_t offset)
+IO::collect_input (BufferSet& outs, nframes_t nframes)
{
assert(outs.available() >= n_inputs());
@@ -330,22 +336,19 @@ IO::collect_input (BufferSet& outs, nframes_t nframes, nframes_t offset)
BufferSet::iterator o = outs.begin(*t);
PortSet::iterator e = _inputs.end (*t);
for (PortSet::iterator i = _inputs.begin(*t); i != e; ++i, ++o) {
- Buffer& b (i->get_buffer (nframes,offset));
- o->read_from (b, nframes, offset);
+ Buffer& b (i->get_buffer (nframes));
+ o->read_from (b, nframes);
}
}
}
void
-IO::just_meter_input (nframes_t start_frame, nframes_t end_frame,
- nframes_t nframes, nframes_t offset)
+IO::just_meter_input (nframes_t start_frame, nframes_t end_frame, nframes_t nframes)
{
BufferSet& bufs = _session.get_scratch_buffers (n_inputs());
-
- collect_input (bufs, nframes, offset);
-
- _meter->run_in_place(bufs, start_frame, end_frame, nframes, offset);
+ collect_input (bufs, nframes);
+ _meter->run_in_place (bufs, start_frame, end_frame, nframes);
}
@@ -2739,25 +2742,19 @@ IO::UserBundleInfo::UserBundleInfo (IO* io, boost::shared_ptr<UserBundle> b)
}
void
-IO::prepare_inputs (nframes_t nframes, nframes_t offset)
+IO::prepare_inputs (nframes_t nframes)
{
/* io_lock, not taken: function must be called from Session::process() calltree */
}
void
-IO::flush_outputs (nframes_t nframes, nframes_t offset)
+IO::flush_outputs (nframes_t nframes)
{
/* io_lock, not taken: function must be called from Session::process() calltree */
- for (PortSet::iterator i = _outputs.begin(); i != _outputs.end(); ++i) {
-
- /* Only run cycle_start() on output ports, because
- inputs must be done in the correct processing order,
- which requires interleaving with route processing.
- */
- (*i).flush_buffers (nframes, offset);
+ for (PortSet::iterator i = _outputs.begin(); i != _outputs.end(); ++i) {
+ (*i).flush_buffers (nframes, _output_offset);
}
-
}
std::string
@@ -2799,3 +2796,16 @@ IO::set_name_in_state (XMLNode& node, const string& new_name)
node.add_property ("name", new_name);
}
}
+
+void
+IO::cycle_start (nframes_t nframes)
+{
+ _output_offset = 0;
+}
+
+void
+IO::increment_output_offset (nframes_t n)
+{
+ _output_offset += n;
+}
+
diff --git a/libs/ardour/io_processor.cc b/libs/ardour/io_processor.cc
index 0210f1d2d4..53ad91b9bf 100644
--- a/libs/ardour/io_processor.cc
+++ b/libs/ardour/io_processor.cc
@@ -117,9 +117,9 @@ IOProcessor::set_state (const XMLNode& node)
}
void
-IOProcessor::silence (nframes_t nframes, nframes_t offset)
+IOProcessor::silence (nframes_t nframes)
{
- _io->silence(nframes, offset);
+ _io->silence (nframes);
}
ChanCount
diff --git a/libs/ardour/ladspa_plugin.cc b/libs/ardour/ladspa_plugin.cc
index a765be9861..f287414fe5 100644
--- a/libs/ardour/ladspa_plugin.cc
+++ b/libs/ardour/ladspa_plugin.cc
@@ -520,7 +520,7 @@ LadspaPlugin::connect_and_run (BufferSet& bufs, uint32_t& in_index, uint32_t& ou
if (LADSPA_IS_PORT_AUDIO (port_descriptor(port_index))) {
if (LADSPA_IS_PORT_INPUT (port_descriptor(port_index))) {
const size_t index = min(in_index, nbufs - 1);
- connect_port (port_index, bufs.get_audio(index).data(nframes, offset));
+ connect_port (port_index, bufs.get_audio(index).data(offset));
//cerr << this << ' ' << name() << " @ " << offset << " inport " << in_index << " = buf "
// << min((uint32_t)in_index,nbufs) << " = " << &bufs[min((uint32_t)in_index,nbufs)][offset] << endl;
in_index++;
@@ -528,7 +528,7 @@ LadspaPlugin::connect_and_run (BufferSet& bufs, uint32_t& in_index, uint32_t& ou
} else if (LADSPA_IS_PORT_OUTPUT (port_descriptor (port_index))) {
const size_t index = min(out_index,nbufs - 1);
- connect_port (port_index, bufs.get_audio(index).data(nframes, offset));
+ connect_port (port_index, bufs.get_audio(index).data(offset));
// cerr << this << ' ' << name() << " @ " << offset << " outport " << out_index << " = buf "
// << min((uint32_t)out_index,nbufs) << " = " << &bufs[min((uint32_t)out_index,nbufs)][offset] << endl;
out_index++;
diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc
index db3e82e2b5..6fdb6022d3 100644
--- a/libs/ardour/lv2_plugin.cc
+++ b/libs/ardour/lv2_plugin.cc
@@ -466,12 +466,12 @@ LV2Plugin::connect_and_run (BufferSet& bufs, uint32_t& in_index, uint32_t& out_i
if (parameter_is_input(port_index)) {
const size_t index = min(in_index, nbufs - 1);
slv2_instance_connect_port(_instance, port_index,
- bufs.get_audio(index).data(nframes, offset));
+ bufs.get_audio(index).data(offset));
in_index++;
} else if (parameter_is_output(port_index)) {
const size_t index = min(out_index,nbufs - 1);
slv2_instance_connect_port(_instance, port_index,
- bufs.get_audio(index).data(nframes, offset));
+ bufs.get_audio(index).data(offset));
out_index++;
}
} else if (parameter_is_midi(port_index)) {
@@ -479,14 +479,14 @@ LV2Plugin::connect_and_run (BufferSet& bufs, uint32_t& in_index, uint32_t& out_i
if (parameter_is_input(port_index)) {
//const size_t index = min(in_index, nbufs - 1);
//slv2_instance_connect_port(_instance, port_index,
- // bufs.get_midi(index).data(nframes, offset));
+ // bufs.get_midi(index).data(offset));
// FIXME: hope it's connection optional...
slv2_instance_connect_port(_instance, port_index, NULL);
in_index++;
} else if (parameter_is_output(port_index)) {
//const size_t index = min(out_index,nbufs - 1);
//slv2_instance_connect_port(_instance, port_index,
- // bufs.get_midi(index).data(nframes, offset));
+ss // bufs.get_midi(index).data(offset));
// FIXME: hope it's connection optional...
slv2_instance_connect_port(_instance, port_index, NULL);
out_index++;
diff --git a/libs/ardour/meter.cc b/libs/ardour/meter.cc
index 73ceb4b78e..bdb8fec708 100644
--- a/libs/ardour/meter.cc
+++ b/libs/ardour/meter.cc
@@ -36,7 +36,7 @@ namespace ARDOUR {
* be set to 0.
*/
void
-PeakMeter::run_in_place (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset)
+PeakMeter::run_in_place (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes)
{
uint32_t n = 0;
uint32_t meterable = std::min(bufs.count().n_total(), (uint32_t)_peak_power.size());
@@ -70,7 +70,7 @@ PeakMeter::run_in_place (BufferSet& bufs, nframes_t start_frame, nframes_t end_f
// Meter what we have (audio)
for ( ; n < limit; ++n) {
- _peak_power[n] = compute_peak (bufs.get_audio(n).data(nframes, offset), nframes, _peak_power[n]);
+ _peak_power[n] = compute_peak (bufs.get_audio(n).data(), nframes, _peak_power[n]);
}
// Zero any excess peaks
diff --git a/libs/ardour/midi_buffer.cc b/libs/ardour/midi_buffer.cc
index 7960edf565..e6a6fbf447 100644
--- a/libs/ardour/midi_buffer.cc
+++ b/libs/ardour/midi_buffer.cc
@@ -18,18 +18,12 @@
*/
#include <iostream>
+#include "pbd/malign.h"
#include "ardour/midi_buffer.h"
-#ifdef __x86_64__
-static const int CPU_CACHE_ALIGN = 64;
-#else
-static const int CPU_CACHE_ALIGN = 16; /* arguably 32 on most arches, but it matters less */
-#endif
-
using namespace std;
using namespace ARDOUR;
-
// FIXME: mirroring for MIDI buffers?
MidiBuffer::MidiBuffer(size_t capacity)
: Buffer(DataType::MIDI, capacity)
@@ -60,12 +54,8 @@ MidiBuffer::resize(size_t size)
_size = 0;
_capacity = size;
+ cache_aligned_malloc ((void**) &_data, _capacity);
-#ifdef NO_POSIX_MEMALIGN
- _data = (uint8_t*)malloc(_capacity);
-#else
- posix_memalign((void**)&_data, CPU_CACHE_ALIGN, _capacity);
-#endif
assert(_data);
}
@@ -84,40 +74,32 @@ MidiBuffer::copy(const MidiBuffer& copy)
* Note that offset and nframes refer to sample time, NOT buffer offsets or event counts.
*/
void
-MidiBuffer::read_from(const Buffer& src, nframes_t nframes, nframes_t offset)
+MidiBuffer::read_from (const Buffer& src, nframes_t nframes, nframes_t dst_offset, nframes_t src_offset)
{
- assert(src.type() == DataType::MIDI);
- assert(&src != this);
+ assert (src.type() == DataType::MIDI);
+ assert (&src != this);
- const MidiBuffer& msrc = (MidiBuffer&)src;
+ const MidiBuffer& msrc = (MidiBuffer&) src;
- assert(_capacity >= msrc.size());
+ assert (_capacity >= msrc.size());
- if (offset == 0) {
- clear();
- assert(_size == 0);
+ if (dst_offset == 0) {
+ clear ();
+ assert (_size == 0);
}
+
+ /* XXX use dst_offset somehow */
for (MidiBuffer::const_iterator i = msrc.begin(); i != msrc.end(); ++i) {
const Evoral::MIDIEvent<TimeType> ev(*i, false);
- /*cout << this << " MidiBuffer::read_from event type: " << int(ev.type())
- << " time: " << ev.time() << " size: " << ev.size()
- << " status: " << (int)*ev.buffer() << " buffer size: " << _size << endl;*/
- if (ev.time() < offset) {
- //cout << "MidiBuffer::read_from skipped event before " << offset << endl;
- } else if (ev.time() < (nframes + offset)) {
- //cout << "MidiBuffer::read_from appending event" << endl;
- push_back(ev);
- } else {
- //cerr << "MidiBuffer::read_from skipped event after "
- // << nframes << " + " << offset << endl;
+ if (ev.time() >= src_offset && ev.time() < (nframes+src_offset)) {
+ push_back (ev);
}
}
_silent = src.silent();
}
-
/** Push an event into the buffer.
*
* Note that the raw MIDI pointed to by ev will be COPIED and unmodified.
@@ -217,12 +199,11 @@ MidiBuffer::reserve(TimeType time, size_t size)
void
-MidiBuffer::silence(nframes_t dur, nframes_t offset)
+MidiBuffer::silence (nframes_t nframes, nframes_t offset)
{
- // FIXME use parameters
- if (offset != 0) {
- cerr << "WARNING: MidiBuffer::silence w/ offset != 0 (not implemented)" << endl;
- }
+ /* XXX iterate over existing events, find all in range given by offset & nframes,
+ and delete them.
+ */
_size = 0;
_silent = true;
diff --git a/libs/ardour/midi_diskstream.cc b/libs/ardour/midi_diskstream.cc
index 4acbb63f37..b7ae01353a 100644
--- a/libs/ardour/midi_diskstream.cc
+++ b/libs/ardour/midi_diskstream.cc
@@ -416,7 +416,7 @@ MidiDiskstream::check_record_status (nframes_t transport_frame, nframes_t nframe
}
int
-MidiDiskstream::process (nframes_t transport_frame, nframes_t nframes, nframes_t offset, bool can_record, bool rec_monitors_input)
+MidiDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can_record, bool rec_monitors_input)
{
// FIXME: waay too much code to duplicate (AudioDiskstream::process)
int ret = -1;
@@ -520,7 +520,7 @@ MidiDiskstream::process (nframes_t transport_frame, nframes_t nframes, nframes_t
if (nominally_recording || rec_nframes) {
// Pump entire port buffer into the ring buffer (FIXME: split cycles?)
- MidiBuffer& buf = _source_port->get_midi_buffer(nframes, offset);
+ MidiBuffer& buf = _source_port->get_midi_buffer(nframes);
for (MidiBuffer::iterator i = buf.begin(); i != buf.end(); ++i) {
const Evoral::MIDIEvent<MidiBuffer::TimeType> ev(*i, false);
assert(ev.buffer());
@@ -1476,12 +1476,10 @@ MidiDiskstream::use_pending_capture_data (XMLNode& node)
* so that an event at \a start has time = 0
*/
void
-MidiDiskstream::get_playback(MidiBuffer& dst, nframes_t start, nframes_t end, nframes_t offset)
+MidiDiskstream::get_playback (MidiBuffer& dst, nframes_t start, nframes_t end)
{
- if (offset == 0) {
- dst.clear();
- assert(dst.size() == 0);
- }
+ dst.clear();
+ assert(dst.size() == 0);
// Reverse. ... We just don't do reverse, ok? Back off.
if (end <= start) {
@@ -1491,13 +1489,13 @@ MidiDiskstream::get_playback(MidiBuffer& dst, nframes_t start, nframes_t end, nf
// Check only events added this offset cycle
MidiBuffer::iterator this_cycle_start = dst.end();
- // Translates stamps to be relative to start, but add offset.
+ // Translates stamps to be relative to start
#if 1
- _playback_buf->read(dst, start, end, offset);
+ _playback_buf->read(dst, start, end);
#else
- const size_t events_read = _playback_buf->read(dst, start, end, offset);
+ const size_t events_read = _playback_buf->read(dst, start, end);
cout << "frames read = " << frames_read << " events read = " << events_read
- << " end = " << end << " start = " << start << " offset = " << offset
+ << " end = " << end << " start = " << start
<< " readspace " << _playback_buf->read_space()
<< " writespace " << _playback_buf->write_space() << endl;
#endif
@@ -1508,7 +1506,7 @@ MidiDiskstream::get_playback(MidiBuffer& dst, nframes_t start, nframes_t end, nf
// Feed the data through the MidiStateTracker
// If it detects a LoopEvent it will add necessary note offs
if (_midi_state_tracker.track(this_cycle_start, dst.end())) {
- _midi_state_tracker.resolve_notes(dst, end-start - 1 + offset);
+ _midi_state_tracker.resolve_notes(dst, end-start - 1);
}
}
diff --git a/libs/ardour/midi_port.cc b/libs/ardour/midi_port.cc
index cf77146699..f2f347a076 100644
--- a/libs/ardour/midi_port.cc
+++ b/libs/ardour/midi_port.cc
@@ -41,7 +41,7 @@ MidiPort::~MidiPort()
void
-MidiPort::cycle_start (nframes_t nframes, nframes_t offset)
+MidiPort::cycle_start (nframes_t nframes)
{
_buffer->clear ();
assert (_buffer->size () == 0);
@@ -55,25 +55,31 @@ MidiBuffer &
MidiPort::get_midi_buffer (nframes_t nframes, nframes_t offset)
{
if (_has_been_mixed_down) {
- return *_buffer;
+ return *_buffer;
}
if (receives_input ()) {
-
+
void* jack_buffer = jack_port_get_buffer (_jack_port, nframes);
const nframes_t event_count = jack_midi_get_event_count(jack_buffer);
assert (event_count < _buffer->capacity());
+
+ /* suck all relevant MIDI events from the JACK MIDI port buffer
+ into our MidiBuffer
+ */
- jack_midi_event_t ev;
-
+ nframes_t off = offset + _port_offset;
+
for (nframes_t i = 0; i < event_count; ++i) {
+ jack_midi_event_t ev;
+
jack_midi_event_get (&ev, jack_buffer, i);
- // i guess this should do but i leave it off to test the rest first.
- //if (ev.time > offset && ev.time < offset+nframes)
- _buffer->push_back (ev);
+ if (ev.time > off && ev.time < off+nframes) {
+ _buffer->push_back (ev);
+ }
}
if (nframes) {
@@ -81,7 +87,7 @@ MidiPort::get_midi_buffer (nframes_t nframes, nframes_t offset)
}
} else {
- _buffer->silence (nframes, offset);
+ _buffer->silence (nframes);
}
if (nframes) {
@@ -93,47 +99,34 @@ MidiPort::get_midi_buffer (nframes_t nframes, nframes_t offset)
void
-MidiPort::cycle_end (nframes_t nframes, nframes_t offset)
+MidiPort::cycle_end (nframes_t nframes)
{
-#if 0
-
- if (sends_output ()) {
- /* FIXME: offset */
-
- // We're an output - copy events from source buffer to Jack buffer
-
- void* jack_buffer = jack_port_get_buffer (_jack_port, nframes);
-
- jack_midi_clear_buffer (jack_buffer);
-
- for (MidiBuffer::iterator i = _buffer->begin(); i != _buffer->end(); ++i) {
- const Evoral::Event& ev = *i;
-
- // event times should be frames, relative to cycle start
- assert(ev.time() >= 0);
- assert(ev.time() < nframes);
- jack_midi_event_write (jack_buffer, (jack_nframes_t) ev.time(), ev.buffer(), ev.size());
- }
- }
-#endif
+ _has_been_mixed_down = false;
+}
+void
+MidiPort::cycle_split ()
+{
_has_been_mixed_down = false;
}
void
MidiPort::flush_buffers (nframes_t nframes, nframes_t offset)
{
- /* FIXME: offset */
-
if (sends_output ()) {
void* jack_buffer = jack_port_get_buffer (_jack_port, nframes);
for (MidiBuffer::iterator i = _buffer->begin(); i != _buffer->end(); ++i) {
const Evoral::Event<nframes_t>& ev = *i;
+
// event times are in frames, relative to cycle start
- assert(ev.time() < (nframes+offset));
- if (ev.time() >= offset) {
+
+ // XXX split cycle start or cycle start?
+
+ assert(ev.time() < (nframes+offset+_port_offset));
+
+ if (ev.time() >= offset + _port_offset) {
jack_midi_event_write (jack_buffer, (jack_nframes_t) ev.time(), ev.buffer(), ev.size());
}
}
diff --git a/libs/ardour/midi_track.cc b/libs/ardour/midi_track.cc
index 3d50f10c5e..3b16f25f9e 100644
--- a/libs/ardour/midi_track.cc
+++ b/libs/ardour/midi_track.cc
@@ -371,22 +371,22 @@ MidiTrack::set_state_part_two ()
}
int
-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)
+MidiTrack::no_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
+ bool session_state_changing, bool can_record, bool rec_monitors_input)
{
if (n_outputs().n_midi() == 0) {
return 0;
}
if (!_active) {
- silence (nframes, offset);
+ silence (nframes);
}
if (session_state_changing) {
/* XXX is this safe to do against transport state changes? */
- passthru_silence (start_frame, end_frame, nframes, offset, 0, false);
+ passthru_silence (start_frame, end_frame, nframes, 0, false);
return 0;
}
@@ -430,12 +430,12 @@ MidiTrack::no_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_fram
*/
if (_have_internal_generator) {
- passthru_silence (start_frame, end_frame, nframes, offset, 0, true);
+ passthru_silence (start_frame, end_frame, nframes, 0, true);
} else {
if (_meter_point == MeterInput) {
- just_meter_input (start_frame, end_frame, nframes, offset);
+ just_meter_input (start_frame, end_frame, nframes);
}
- passthru_silence (start_frame, end_frame, nframes, offset, 0, false);
+ passthru_silence (start_frame, end_frame, nframes, 0, false);
}
} else {
@@ -443,25 +443,22 @@ MidiTrack::no_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_fram
/* we're sending signal, but we may still want to meter the input.
*/
- passthru (start_frame, end_frame, nframes, offset, 0, (_meter_point == MeterInput));
+ passthru (start_frame, end_frame, nframes, 0, (_meter_point == MeterInput));
}
- flush_outputs( nframes, offset );
+ flush_outputs (nframes);
return 0;
}
int
-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)
+MidiTrack::roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, int declick,
+ bool can_record, bool rec_monitors_input)
{
int dret;
boost::shared_ptr<MidiDiskstream> diskstream = midi_diskstream();
- // I guess this is the right place to call cycle_start for our ports.
- // but it actually sucks, to directly mess with the IO.... oh well.
-
- prepare_inputs( nframes, offset );
+ prepare_inputs (nframes);
{
Glib::RWLock::ReaderLock lm (_processor_lock, Glib::TRY_LOCK);
@@ -477,26 +474,26 @@ MidiTrack::roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
}
if (!_active) {
- silence (nframes, offset);
+ silence (nframes);
return 0;
}
nframes_t transport_frame = _session.transport_frame();
- if ((nframes = check_initial_delay (nframes, offset, transport_frame)) == 0) {
+ if ((nframes = check_initial_delay (nframes, transport_frame)) == 0) {
/* need to do this so that the diskstream sets its
playback distance to zero, thus causing diskstream::commit
to do nothing.
*/
- return diskstream->process (transport_frame, 0, 0, can_record, rec_monitors_input);
+ return diskstream->process (transport_frame, 0, can_record, rec_monitors_input);
}
_silent = false;
- if ((dret = diskstream->process (transport_frame, nframes, offset, can_record, rec_monitors_input)) != 0) {
+ if ((dret = diskstream->process (transport_frame, nframes, can_record, rec_monitors_input)) != 0) {
- silence (nframes, offset);
+ silence (nframes);
return dret;
}
@@ -504,7 +501,7 @@ MidiTrack::roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
/* special condition applies */
if (_meter_point == MeterInput) {
- just_meter_input (start_frame, end_frame, nframes, offset);
+ just_meter_input (start_frame, end_frame, nframes);
}
if (diskstream->record_enabled() && !can_record && !Config->get_auto_input()) {
@@ -513,7 +510,7 @@ MidiTrack::roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
at least potentially (depending on monitoring options)
*/
- passthru (start_frame, end_frame, nframes, offset, 0, true);
+ passthru (start_frame, end_frame, nframes, 0, true);
} else {
/*
@@ -530,51 +527,51 @@ MidiTrack::roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
//const size_t limit = n_process_buffers().n_audio();
BufferSet& bufs = _session.get_scratch_buffers (n_process_buffers());
- diskstream->get_playback(bufs.get_midi(0), start_frame, end_frame, offset);
+ diskstream->get_playback(bufs.get_midi(0), start_frame, end_frame);
- process_output_buffers (bufs, start_frame, end_frame, nframes, offset,
- (!_session.get_record_enabled() || !Config->get_do_not_record_plugins()), declick, (_meter_point != MeterInput));
+ process_output_buffers (bufs, start_frame, end_frame, nframes,
+ (!_session.get_record_enabled() || !Config->get_do_not_record_plugins()), declick, (_meter_point != MeterInput));
}
- flush_outputs( nframes, offset );
+ flush_outputs (nframes);
return 0;
}
int
-MidiTrack::silent_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nframes_t offset,
- bool can_record, bool rec_monitors_input)
+MidiTrack::silent_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
+ bool can_record, bool rec_monitors_input)
{
if (n_outputs().n_midi() == 0 && _processors.empty()) {
return 0;
}
if (!_active) {
- silence (nframes, offset);
+ silence (nframes);
return 0;
}
_silent = true;
apply_gain_automation = false;
- silence (nframes, offset);
+ silence (nframes);
- return midi_diskstream()->process (_session.transport_frame() + offset, nframes, offset, can_record, rec_monitors_input);
+ return midi_diskstream()->process (_session.transport_frame(), nframes, can_record, rec_monitors_input);
}
void
MidiTrack::process_output_buffers (BufferSet& bufs,
- nframes_t start_frame, nframes_t end_frame,
- nframes_t nframes, nframes_t offset, bool with_processors, int declick,
- bool meter)
+ nframes_t start_frame, nframes_t end_frame,
+ nframes_t nframes, bool with_processors, int declick,
+ bool meter)
{
/* There's no such thing as a MIDI bus for the time being.
* We'll do all the MIDI route work here for now, but the long-term goal is to have
* Route::process_output_buffers handle everything */
if (meter && (_meter_point == MeterInput || _meter_point == MeterPreFader)) {
- _meter->run_in_place(bufs, start_frame, end_frame, nframes, offset);
+ _meter->run_in_place(bufs, start_frame, end_frame, nframes);
}
// Run all processors
@@ -582,33 +579,35 @@ MidiTrack::process_output_buffers (BufferSet& bufs,
Glib::RWLock::ReaderLock rm (_processor_lock, Glib::TRY_LOCK);
if (rm.locked()) {
for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
- (*i)->run_in_place (bufs, start_frame, end_frame, nframes, offset);
+ (*i)->run_in_place (bufs, start_frame, end_frame, nframes);
}
}
}
if (meter && (_meter_point == MeterPostFader)) {
- _meter->run_in_place(bufs, start_frame, end_frame, nframes, offset);
+ _meter->run_in_place(bufs, start_frame, end_frame, nframes);
}
// Main output stage
if (muted()) {
- IO::silence(nframes, offset);
+ IO::silence (nframes);
} else {
// Write 'automation' controllers (e.g. CC events from a UI slider)
- write_controller_messages(bufs.get_midi(0), start_frame, end_frame, nframes, offset);
+ write_controller_messages(bufs.get_midi(0), start_frame, end_frame, nframes);
- deliver_output(bufs, start_frame, end_frame, nframes, offset);
+ deliver_output(bufs, start_frame, end_frame, nframes);
}
}
void
-MidiTrack::write_controller_messages(MidiBuffer& output_buf, nframes_t start, nframes_t end,
- nframes_t nframes, nframes_t offset)
+MidiTrack::write_controller_messages(MidiBuffer& output_buf, nframes_t start, nframes_t end, nframes_t nframes)
{
// Append immediate events (UI controls)
- _immediate_events.read(output_buf, 0, 0, offset + nframes - 1); // all stamps = 0
+
+ // XXX TAKE _port_offset in Port into account???
+
+ _immediate_events.read (output_buf, 0, 0, nframes - 1); // all stamps = 0
}
int
diff --git a/libs/ardour/panner.cc b/libs/ardour/panner.cc
index 2492d157bc..a00edfdd3f 100644
--- a/libs/ardour/panner.cc
+++ b/libs/ardour/panner.cc
@@ -1267,7 +1267,7 @@ Panner::set_position (float xpos, float ypos, float zpos, StreamPanner& orig)
}
void
-Panner::distribute_no_automation (BufferSet& inbufs, BufferSet& outbufs, nframes_t nframes, nframes_t offset, gain_t gain_coeff)
+Panner::distribute_no_automation (BufferSet& inbufs, BufferSet& outbufs, nframes_t nframes, gain_t gain_coeff)
{
if (outbufs.count().n_audio() == 0) {
// Don't want to lose audio...
@@ -1288,37 +1288,37 @@ Panner::distribute_no_automation (BufferSet& inbufs, BufferSet& outbufs, nframes
/* only one output, and gain was zero, so make it silent */
- dst.silence(offset);
+ dst.silence (nframes);
} else if (gain_coeff == 1.0f){
/* mix all buffers into the output */
// copy the first
- dst.read_from(inbufs.get_audio(0), nframes, offset);
+ dst.read_from(inbufs.get_audio(0), nframes);
// accumulate starting with the second
- if (inbufs.count().n_audio() > 0) {
- BufferSet::audio_iterator i = inbufs.audio_begin();
- for (++i; i != inbufs.audio_end(); ++i) {
- dst.accumulate_from(*i, nframes, offset);
- }
- }
+ if (inbufs.count().n_audio() > 0) {
+ BufferSet::audio_iterator i = inbufs.audio_begin();
+ for (++i; i != inbufs.audio_end(); ++i) {
+ dst.accumulate_from(*i, nframes);
+ }
+ }
} else {
/* mix all buffers into the output, scaling them all by the gain */
// copy the first
- dst.read_from(inbufs.get_audio(0), nframes, offset);
+ dst.read_from(inbufs.get_audio(0), nframes);
// accumulate (with gain) starting with the second
- if (inbufs.count().n_audio() > 0) {
- BufferSet::audio_iterator i = inbufs.audio_begin();
- for (++i; i != inbufs.audio_end(); ++i) {
- dst.accumulate_with_gain_from(*i, nframes, offset, gain_coeff);
- }
- }
+ if (inbufs.count().n_audio() > 0) {
+ BufferSet::audio_iterator i = inbufs.audio_begin();
+ for (++i; i != inbufs.audio_end(); ++i) {
+ dst.accumulate_with_gain_from(*i, nframes, gain_coeff);
+ }
+ }
}
@@ -1327,7 +1327,7 @@ Panner::distribute_no_automation (BufferSet& inbufs, BufferSet& outbufs, nframes
/* the terrible silence ... */
for (BufferSet::audio_iterator i = outbufs.audio_begin(); i != outbufs.audio_end(); ++i) {
- i->silence(nframes, offset);
+ i->silence(nframes);
}
BufferSet::audio_iterator i = inbufs.audio_begin();
@@ -1338,7 +1338,7 @@ Panner::distribute_no_automation (BufferSet& inbufs, BufferSet& outbufs, nframes
}
void
-Panner::run_out_of_place (BufferSet& inbufs, BufferSet& outbufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset)
+Panner::run_out_of_place (BufferSet& inbufs, BufferSet& outbufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes)
{
if (outbufs.count().n_audio() == 0) {
// Failing to deliver audio we were asked to deliver is a bug
@@ -1360,7 +1360,7 @@ Panner::run_out_of_place (BufferSet& inbufs, BufferSet& outbufs, nframes_t start
gain_coeff = speed_quietning;
}
- distribute_no_automation(inbufs, outbufs, nframes, offset, gain_coeff);
+ distribute_no_automation(inbufs, outbufs, nframes, gain_coeff);
return;
}
@@ -1373,12 +1373,12 @@ Panner::run_out_of_place (BufferSet& inbufs, BufferSet& outbufs, nframes_t start
// FIXME: apply gain automation?
// copy the first
- dst.read_from(inbufs.get_audio(0), nframes, offset);
+ dst.read_from(inbufs.get_audio(0), nframes);
// accumulate starting with the second
BufferSet::audio_iterator i = inbufs.audio_begin();
for (++i; i != inbufs.audio_end(); ++i) {
- dst.accumulate_from(*i, nframes, offset);
+ dst.accumulate_from(*i, nframes);
}
return;
@@ -1389,7 +1389,7 @@ Panner::run_out_of_place (BufferSet& inbufs, BufferSet& outbufs, nframes_t start
/* the terrible silence ... */
for (BufferSet::audio_iterator i = outbufs.audio_begin(); i != outbufs.audio_end(); ++i) {
- i->silence(nframes, offset);
+ i->silence(nframes);
}
BufferSet::audio_iterator i = inbufs.audio_begin();
diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc
index 19e981e3f3..c516cd1174 100644
--- a/libs/ardour/plugin_insert.cc
+++ b/libs/ardour/plugin_insert.cc
@@ -365,14 +365,14 @@ PluginInsert::silence (nframes_t nframes, nframes_t offset)
}
void
-PluginInsert::run_in_place (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset)
+PluginInsert::run_in_place (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes)
{
if (active()) {
if (_session.transport_rolling()) {
- automation_run (bufs, nframes, offset);
+ automation_run (bufs, nframes);
} else {
- connect_and_run (bufs, nframes, offset, false);
+ connect_and_run (bufs, nframes, 9, false);
}
} else {
@@ -386,7 +386,7 @@ PluginInsert::run_in_place (BufferSet& bufs, nframes_t start_frame, nframes_t en
/* not active, but something has make up for any channel count increase */
for (uint32_t n = out - in; n < out; ++n) {
- memcpy (bufs.get_audio(n).data(nframes, offset), bufs.get_audio(in - 1).data(nframes, offset), sizeof (Sample) * nframes);
+ memcpy (bufs.get_audio(n).data(), bufs.get_audio(in - 1).data(), sizeof (Sample) * nframes);
}
}
@@ -428,11 +428,12 @@ PluginInsert::get_parameter (Evoral::Parameter param)
}
void
-PluginInsert::automation_run (BufferSet& bufs, nframes_t nframes, nframes_t offset)
+PluginInsert::automation_run (BufferSet& bufs, nframes_t nframes)
{
Evoral::ControlEvent next_event (0, 0.0f);
nframes_t now = _session.transport_frame ();
nframes_t end = now + nframes;
+ nframes_t offset = 0;
Glib::Mutex::Lock lm (data().control_lock(), Glib::TRY_LOCK);
diff --git a/libs/ardour/port.cc b/libs/ardour/port.cc
index 8078dfbe08..d5021026de 100644
--- a/libs/ardour/port.cc
+++ b/libs/ardour/port.cc
@@ -30,6 +30,8 @@ using namespace std;
using namespace ARDOUR;
AudioEngine* Port::_engine = 0;
+nframes_t Port::_port_offset = 0;
+nframes_t Port::_buffer_size = 0;
/** @param n Port short name */
Port::Port (std::string const & n, DataType t, Flags f)
@@ -260,3 +262,4 @@ Port::set_latency (nframes_t n)
{
jack_port_set_latency (_jack_port, n);
}
+
diff --git a/libs/ardour/port_insert.cc b/libs/ardour/port_insert.cc
index 5559ac0e04..8f53be8534 100644
--- a/libs/ardour/port_insert.cc
+++ b/libs/ardour/port_insert.cc
@@ -77,7 +77,7 @@ PortInsert::~PortInsert ()
}
void
-PortInsert::run_in_place (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset)
+PortInsert::run_in_place (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes)
{
if (_io->n_outputs().n_total() == 0) {
return;
@@ -85,13 +85,12 @@ PortInsert::run_in_place (BufferSet& bufs, nframes_t start_frame, nframes_t end_
if (!active()) {
/* deliver silence */
- _io->silence (nframes, offset);
+ _io->silence (nframes);
return;
}
- _io->deliver_output(bufs, start_frame, end_frame, nframes, offset);
-
- _io->collect_input(bufs, nframes, offset);
+ _io->deliver_output (bufs, start_frame, end_frame, nframes);
+ _io->collect_input (bufs, nframes);
}
XMLNode&
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index 04b4974ceb..907bb57a60 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -285,15 +285,14 @@ Route::set_gain (gain_t val, void *src)
* @param start_frame Initial transport frame
* @param end_frame Final transport frame
* @param nframes Number of frames to output (to ports)
- * @param offset Output offset (of port buffers, for split cycles)
*
* Note that (end_frame - start_frame) may not be equal to nframes when the
* transport speed isn't 1.0 (eg varispeed).
*/
void
Route::process_output_buffers (BufferSet& bufs,
- nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset,
- bool with_processors, int declick, bool meter)
+ nframes_t start_frame, nframes_t end_frame, nframes_t nframes,
+ bool with_processors, int declick, bool meter)
{
// This is definitely very audio-only for now
assert(_default_type == DataType::AUDIO);
@@ -369,7 +368,7 @@ Route::process_output_buffers (BufferSet& bufs,
----------------------------------------------------------------------------------------- */
if (meter && (_meter_point == MeterInput)) {
- _meter->run_in_place(bufs, start_frame, end_frame, nframes, offset);
+ _meter->run_in_place(bufs, start_frame, end_frame, nframes);
}
if (!_soloed && _mute_affects_pre_fader && (mute_gain != dmg)) {
@@ -400,11 +399,11 @@ Route::process_output_buffers (BufferSet& bufs,
) {
- co->silence (nframes, offset);
+ co->silence (nframes);
} else {
- co->deliver_output (bufs, start_frame, end_frame, nframes, offset);
+ co->deliver_output (bufs, start_frame, end_frame, nframes);
}
}
@@ -418,7 +417,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();
- for (nframes_t nx = offset; nx < nframes + offset; ++nx) {
+ for (nframes_t nx = 0; nx < nframes; ++nx) {
sp[nx] += 1.0e-27f;
}
}
@@ -435,7 +434,7 @@ Route::process_output_buffers (BufferSet& bufs,
for (i = _processors.begin(); i != _processors.end(); ++i) {
switch ((*i)->placement()) {
case PreFader:
- (*i)->run_in_place (bufs, start_frame, end_frame, nframes, offset);
+ (*i)->run_in_place (bufs, start_frame, end_frame, nframes);
break;
case PostFader:
post_fader_work = true;
@@ -446,7 +445,7 @@ Route::process_output_buffers (BufferSet& bufs,
for (i = _processors.begin(); i != _processors.end(); ++i) {
switch ((*i)->placement()) {
case PreFader:
- (*i)->silence (nframes, offset);
+ (*i)->silence (nframes);
break;
case PostFader:
post_fader_work = true;
@@ -475,7 +474,7 @@ Route::process_output_buffers (BufferSet& bufs,
----------------------------------------------------------------------------------------- */
if (meter && (_meter_point == MeterPreFader)) {
- _meter->run_in_place(bufs, start_frame, end_frame, nframes, offset);
+ _meter->run_in_place(bufs, start_frame, end_frame, nframes);
}
@@ -499,11 +498,11 @@ Route::process_output_buffers (BufferSet& bufs,
) {
- co->silence (nframes, offset);
+ co->silence (nframes);
} else {
- co->deliver_output (bufs, start_frame, end_frame, nframes, offset);
+ co->deliver_output (bufs, start_frame, end_frame, nframes);
}
}
@@ -608,7 +607,7 @@ Route::process_output_buffers (BufferSet& bufs,
case PreFader:
break;
case PostFader:
- (*i)->run_in_place (bufs, start_frame, end_frame, nframes, offset);
+ (*i)->run_in_place (bufs, start_frame, end_frame, nframes);
break;
}
}
@@ -618,7 +617,7 @@ Route::process_output_buffers (BufferSet& bufs,
case PreFader:
break;
case PostFader:
- (*i)->silence (nframes, offset);
+ (*i)->silence (nframes);
break;
}
}
@@ -660,11 +659,11 @@ Route::process_output_buffers (BufferSet& bufs,
) {
- co->silence (nframes, offset);
+ co->silence (nframes);
} else {
- co->deliver_output (bufs, start_frame, end_frame, nframes, offset);
+ co->deliver_output (bufs, start_frame, end_frame, nframes);
}
}
@@ -692,7 +691,7 @@ Route::process_output_buffers (BufferSet& bufs,
} else if (no_monitor && record_enabled()
&& (!Config->get_auto_input() || _session.actively_recording())) {
- IO::silence (nframes, offset);
+ IO::silence (nframes);
} else {
@@ -718,11 +717,11 @@ Route::process_output_buffers (BufferSet& bufs,
peak_meter().reset();
}
- IO::silence (nframes, offset);
+ IO::silence (nframes);
} else {
- deliver_output(bufs, start_frame, end_frame, nframes, offset);
+ deliver_output(bufs, start_frame, end_frame, nframes);
}
@@ -736,7 +735,7 @@ Route::process_output_buffers (BufferSet& bufs,
if ((_gain == 0 && !apply_gain_automation) || dmg == 0) {
_meter->reset();
} else {
- _meter->run_in_place(output_buffers(), start_frame, end_frame, nframes, offset);
+ _meter->run_in_place(output_buffers(), start_frame, end_frame, nframes);
}
}
}
@@ -748,15 +747,14 @@ Route::process_output_buffers (BufferSet& bufs,
* @param start_frame Initial transport frame
* @param end_frame Final transport frame
* @param nframes Number of frames to output (to ports)
- * @param offset Output offset (of port buffers, for split cycles)
*
* Note that (end_frame - start_frame) may not be equal to nframes when the
* transport speed isn't 1.0 (eg varispeed).
*/
void
Route::process_output_buffers (BufferSet& bufs,
- nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset,
- bool with_processors, int declick, bool meter)
+ nframes_t start_frame, nframes_t end_frame, nframes_t nframes,
+ bool with_processors, int declick, bool meter)
{
// This is definitely very audio-only for now
assert(_default_type == DataType::AUDIO);
@@ -822,7 +820,7 @@ Route::process_output_buffers (BufferSet& bufs,
{
Glib::RWLock::ReaderLock rm (_processor_lock, Glib::TRY_LOCK);
for (i = processors.begin(); i != processors.end(); ++i) {
- (*i)->run_in_place (bufs, start_frame, end_frame, nframes, offset);
+ (*i)->run_in_place (bufs, start_frame, end_frame, nframes);
}
}
@@ -832,7 +830,7 @@ Route::process_output_buffers (BufferSet& bufs,
----------------------------------------------------------------------------------------- */
if (meter && (_meter_point == MeterInput)) {
- _meter->run_in_place(bufs, start_frame, end_frame, nframes, offset);
+ _meter->run_in_place(bufs, start_frame, end_frame, nframes);
}
if (!_soloed && _mute_affects_pre_fader && (mute_gain != dmg)) {
@@ -869,11 +867,11 @@ Route::process_output_buffers (BufferSet& bufs,
) {
- co->silence (nframes, offset);
+ co->silence (nframes);
} else {
- co->deliver_output (bufs, start_frame, end_frame, nframes, offset);
+ co->deliver_output (bufs, start_frame, end_frame, nframes);
}
}
@@ -987,11 +985,11 @@ Route::process_output_buffers (BufferSet& bufs,
) {
- co->silence (nframes, offset);
+ co->silence (nframes);
} else {
- co->deliver_output (bufs, start_frame, end_frame, nframes, offset);
+ co->deliver_output (bufs, start_frame, end_frame, nframes);
}
}
@@ -1009,7 +1007,7 @@ Route::process_output_buffers (BufferSet& bufs,
} else if (no_monitor && record_enabled()
&& (!Config->get_auto_input() || _session.actively_recording())) {
- IO::silence (nframes, offset);
+ IO::silence (nframes);
} else {
@@ -1035,11 +1033,11 @@ Route::process_output_buffers (BufferSet& bufs,
peak_meter().reset();
}
- IO::silence (nframes, offset);
+ IO::silence (nframes);
} else {
- deliver_output(bufs, start_frame, end_frame, nframes, offset);
+ deliver_output(bufs, start_frame, end_frame, nframes);
}
@@ -1055,28 +1053,28 @@ Route::n_process_buffers ()
}
void
-Route::passthru (nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset, int declick, bool meter_first)
+Route::passthru (nframes_t start_frame, nframes_t end_frame, nframes_t nframes, int declick, bool meter_first)
{
BufferSet& bufs = _session.get_scratch_buffers(n_process_buffers());
_silent = false;
- collect_input (bufs, nframes, offset);
+ collect_input (bufs, nframes);
if (meter_first) {
- _meter->run_in_place(bufs, start_frame, end_frame, nframes, offset);
+ _meter->run_in_place(bufs, start_frame, end_frame, nframes);
meter_first = false;
} else {
meter_first = true;
}
- process_output_buffers (bufs, start_frame, end_frame, nframes, offset, true, declick, meter_first);
+ process_output_buffers (bufs, start_frame, end_frame, nframes, true, declick, meter_first);
}
void
-Route::passthru_silence (nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset, int declick, bool meter)
+Route::passthru_silence (nframes_t start_frame, nframes_t end_frame, nframes_t nframes, int declick, bool meter)
{
- process_output_buffers (_session.get_silent_buffers (n_process_buffers()), start_frame, end_frame, nframes, offset, true, declick, meter);
+ process_output_buffers (_session.get_silent_buffers (n_process_buffers()), start_frame, end_frame, nframes, true, declick, meter);
}
void
@@ -2428,14 +2426,14 @@ Route::curve_reallocate ()
}
void
-Route::silence (nframes_t nframes, nframes_t offset)
+Route::silence (nframes_t nframes)
{
if (!_silent) {
- IO::silence (nframes, offset);
+ IO::silence (nframes);
if (_control_outs) {
- _control_outs->silence (nframes, offset);
+ _control_outs->silence (nframes);
}
{
@@ -2449,10 +2447,10 @@ Route::silence (nframes_t nframes, nframes_t offset)
continue;
}
- (*i)->silence (nframes, offset);
+ (*i)->silence (nframes);
}
- if (nframes == _session.get_block_size() && offset == 0) {
+ if (nframes == _session.get_block_size()) {
// _silent = true;
}
}
@@ -2738,46 +2736,48 @@ Route::pans_required () const
}
int
-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)
+Route::no_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
+ bool session_state_changing, bool can_record, bool rec_monitors_input)
{
if (n_outputs().n_total() == 0) {
return 0;
}
if (session_state_changing || !_active) {
- silence (nframes, offset);
+ silence (nframes);
return 0;
}
apply_gain_automation = false;
if (n_inputs().n_total()) {
- passthru (start_frame, end_frame, nframes, offset, 0, false);
+ passthru (start_frame, end_frame, nframes, 0, false);
} else {
- silence (nframes, offset);
+ silence (nframes);
}
return 0;
}
nframes_t
-Route::check_initial_delay (nframes_t nframes, nframes_t& offset, nframes_t& transport_frame)
+Route::check_initial_delay (nframes_t nframes, nframes_t& transport_frame)
{
if (_roll_delay > nframes) {
_roll_delay -= nframes;
- silence (nframes, offset);
+ silence (nframes);
/* transport frame is not legal for caller to use */
return 0;
} else if (_roll_delay > 0) {
nframes -= _roll_delay;
-
- silence (_roll_delay, offset);
-
- offset += _roll_delay;
+ silence (_roll_delay);
+ /* we've written _roll_delay of samples into the
+ output ports, so make a note of that for
+ future reference.
+ */
+ increment_output_offset (_roll_delay);
transport_frame += _roll_delay;
_roll_delay = 0;
@@ -2787,7 +2787,7 @@ Route::check_initial_delay (nframes_t nframes, nframes_t& offset, nframes_t& tra
}
int
-Route::roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nframes_t offset, int declick,
+Route::roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, int declick,
bool can_record, bool rec_monitors_input)
{
{
@@ -2800,13 +2800,13 @@ Route::roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nfra
}
if ((n_outputs().n_total() == 0 && _processors.empty()) || n_inputs().n_total() == 0 || !_active) {
- silence (nframes, offset);
+ silence (nframes);
return 0;
}
nframes_t unused = 0;
- if ((nframes = check_initial_delay (nframes, offset, unused)) == 0) {
+ if ((nframes = check_initial_delay (nframes, unused)) == 0) {
return 0;
}
@@ -2826,16 +2826,16 @@ Route::roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nfra
}
}
- passthru (start_frame, end_frame, nframes, offset, declick, false);
+ passthru (start_frame, end_frame, nframes, declick, false);
return 0;
}
int
-Route::silent_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nframes_t offset,
+Route::silent_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
bool can_record, bool rec_monitors_input)
{
- silence (nframes, offset);
+ silence (nframes);
return 0;
}
diff --git a/libs/ardour/send.cc b/libs/ardour/send.cc
index c41ca770f8..ef6f954dd2 100644
--- a/libs/ardour/send.cc
+++ b/libs/ardour/send.cc
@@ -109,7 +109,7 @@ Send::set_state(const XMLNode& node)
}
void
-Send::run_in_place (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset)
+Send::run_in_place (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes)
{
if (active()) {
@@ -121,18 +121,18 @@ Send::run_in_place (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame,
sendbufs.read_from(bufs, nframes);
assert(sendbufs.count() == bufs.count());
- _io->deliver_output (sendbufs, start_frame, end_frame, nframes, offset);
+ _io->deliver_output (sendbufs, start_frame, end_frame, nframes);
if (_metering) {
if (_io->effective_gain() == 0) {
_io->peak_meter().reset();
} else {
- _io->peak_meter().run_in_place(_io->output_buffers(), start_frame, end_frame, nframes, offset);
+ _io->peak_meter().run_in_place(_io->output_buffers(), start_frame, end_frame, nframes);
}
}
} else {
- _io->silence (nframes, offset);
+ _io->silence (nframes);
if (_metering) {
_io->peak_meter().reset();
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index f2e1b2a730..e2e38a17c5 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -92,12 +92,6 @@ using namespace ARDOUR;
using namespace PBD;
using boost::shared_ptr;
-#ifdef __x86_64__
-static const int CPU_CACHE_ALIGN = 64;
-#else
-static const int CPU_CACHE_ALIGN = 16; /* arguably 32 on most arches, but it matters less */
-#endif
-
bool Session::_disable_all_loaded_plugins = false;
sigc::signal<void,std::string> Session::Dialog;
@@ -3847,15 +3841,18 @@ Session::tempo_map_changed (Change ignored)
void
Session::ensure_buffers (ChanCount howmany)
{
- if (current_block_size == 0)
+ if (current_block_size == 0) {
return; // too early? (is this ok?)
+ }
// We need at least 2 MIDI scratch buffers to mix/merge
- if (howmany.n_midi() < 2)
+ if (howmany.n_midi() < 2) {
howmany.set_midi(2);
+ }
// FIXME: JACK needs to tell us maximum MIDI buffer size
// Using nasty assumption (max # events == nframes) for now
+
_scratch_buffers->ensure_buffers(howmany, current_block_size);
_mix_buffers->ensure_buffers(howmany, current_block_size);
_silent_buffers->ensure_buffers(howmany, current_block_size);
diff --git a/libs/ardour/session_click.cc b/libs/ardour/session_click.cc
index 6127843d47..cbe085b82d 100644
--- a/libs/ardour/session_click.cc
+++ b/libs/ardour/session_click.cc
@@ -38,7 +38,7 @@ using namespace PBD;
Pool Session::Click::pool ("click", sizeof (Click), 128);
void
-Session::click (nframes_t start, nframes_t nframes, nframes_t offset)
+Session::click (nframes_t start, nframes_t nframes)
{
TempoMap::BBTPointList *points;
Sample *buf;
@@ -50,7 +50,7 @@ Session::click (nframes_t start, nframes_t nframes, nframes_t offset)
Glib::RWLock::WriterLock clickm (click_lock, Glib::TRY_LOCK);
if (!clickm.locked() || _transport_speed != 1.0 || !_clicking || click_data == 0) {
- _click_io->silence (nframes, offset);
+ _click_io->silence (nframes);
return;
}
@@ -127,7 +127,7 @@ Session::click (nframes_t start, nframes_t nframes, nframes_t offset)
i = next;
}
- _click_io->deliver_output (bufs, start, end, nframes, offset);
+ _click_io->deliver_output (bufs, start, end, nframes);
}
void
diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc
index 72fe634bb2..eb192f6dc9 100644
--- a/libs/ardour/session_process.cc
+++ b/libs/ardour/session_process.cc
@@ -94,7 +94,13 @@ Session::prepare_diskstreams ()
}
int
-Session::no_roll (nframes_t nframes, nframes_t offset)
+Session::fail_roll (nframes_t nframes)
+{
+ return no_roll (nframes);
+}
+
+int
+Session::no_roll (nframes_t nframes)
{
nframes_t end_frame = _transport_frame + nframes; // FIXME: varispeed + no_roll ??
int ret = 0;
@@ -102,7 +108,7 @@ Session::no_roll (nframes_t nframes, nframes_t offset)
boost::shared_ptr<RouteList> r = routes.reader ();
if (_click_io) {
- _click_io->silence (nframes, offset);
+ _click_io->silence (nframes);
}
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
@@ -113,7 +119,7 @@ Session::no_roll (nframes_t nframes, nframes_t offset)
(*i)->set_pending_declick (declick);
- if ((*i)->no_roll (nframes, _transport_frame, end_frame, offset, non_realtime_work_pending(),
+ if ((*i)->no_roll (nframes, _transport_frame, end_frame, non_realtime_work_pending(),
actively_recording(), declick)) {
error << string_compose(_("Session: error in no roll for %1"), (*i)->name()) << endmsg;
ret = -1;
@@ -125,7 +131,7 @@ Session::no_roll (nframes_t nframes, nframes_t offset)
}
int
-Session::process_routes (nframes_t nframes, nframes_t offset)
+Session::process_routes (nframes_t nframes)
{
bool record_active;
int declick = get_transport_declick_required();
@@ -152,7 +158,7 @@ Session::process_routes (nframes_t nframes, nframes_t offset)
(*i)->set_pending_declick (declick);
- if ((ret = (*i)->roll (nframes, start_frame, end_frame, offset, declick, record_active, rec_monitors)) < 0) {
+ if ((ret = (*i)->roll (nframes, start_frame, end_frame, declick, record_active, rec_monitors)) < 0) {
/* we have to do this here. Route::roll() for an AudioTrack will have called AudioDiskstream::process(),
and the DS will expect AudioDiskstream::commit() to be called. but we're aborting from that
@@ -173,7 +179,7 @@ Session::process_routes (nframes_t nframes, nframes_t offset)
}
int
-Session::silent_process_routes (nframes_t nframes, nframes_t offset)
+Session::silent_process_routes (nframes_t nframes)
{
bool record_active = actively_recording();
int declick = get_transport_declick_required();
@@ -196,7 +202,7 @@ Session::silent_process_routes (nframes_t nframes, nframes_t offset)
continue;
}
- if ((ret = (*i)->silent_roll (nframes, start_frame, end_frame, offset, record_active, rec_monitors)) < 0) {
+ if ((ret = (*i)->silent_roll (nframes, start_frame, end_frame, record_active, rec_monitors)) < 0) {
/* we have to do this here. Route::roll() for an AudioTrack will have called AudioDiskstream::process(),
and the DS will expect AudioDiskstream::commit() to be called. but we're aborting from that
@@ -236,7 +242,7 @@ Session::commit_diskstreams (nframes_t nframes, bool &needs_butler)
also runs commit() for every diskstream.
*/
- if ((dret = (*i)->process (_transport_frame, nframes, 0, actively_recording(), get_rec_monitors_input())) == 0) {
+ if ((dret = (*i)->process (_transport_frame, nframes, actively_recording(), get_rec_monitors_input())) == 0) {
if ((*i)->commit (nframes)) {
needs_butler = true;
}
@@ -271,7 +277,6 @@ Session::process_with_events (nframes_t nframes)
Event* ev;
nframes_t this_nframes;
nframes_t end_frame;
- nframes_t offset;
bool session_needs_butler = false;
nframes_t stop_limit;
long frames_moved;
@@ -279,7 +284,7 @@ Session::process_with_events (nframes_t nframes)
/* make sure the auditioner is silent */
if (auditioner) {
- auditioner->silence (nframes, 0);
+ auditioner->silence (nframes);
}
/* handle any pending events */
@@ -339,13 +344,13 @@ Session::process_with_events (nframes_t nframes)
}
if (!_exporting && _slave) {
- if (!follow_slave (nframes, 0)) {
+ if (!follow_slave (nframes)) {
return;
}
}
if (_transport_speed == 0) {
- no_roll (nframes, 0);
+ no_roll (nframes);
return;
}
@@ -365,7 +370,7 @@ Session::process_with_events (nframes_t nframes)
}
if (maybe_stop (stop_limit)) {
- no_roll (nframes, 0);
+ no_roll (nframes);
return;
}
@@ -373,10 +378,10 @@ Session::process_with_events (nframes_t nframes)
the_next_one = next_event;
++the_next_one;
- offset = 0;
-
/* yes folks, here it is, the actual loop where we really truly
- process some audio */
+ process some audio
+ */
+
while (nframes) {
this_nframes = nframes; /* real (jack) time relative */
@@ -390,20 +395,19 @@ Session::process_with_events (nframes_t nframes)
if (this_nframes) {
- click (_transport_frame, nframes, offset);
+ click (_transport_frame, this_nframes);
/* now process frames between now and the first event in this block */
prepare_diskstreams ();
- if (process_routes (this_nframes, offset)) {
- no_roll (nframes, 0);
+ if (process_routes (this_nframes)) {
+ fail_roll (nframes);
return;
}
commit_diskstreams (this_nframes, session_needs_butler);
nframes -= this_nframes;
- offset += this_nframes;
if (frames_moved < 0) {
decrement_transport_position (-frames_moved);
@@ -415,6 +419,8 @@ Session::process_with_events (nframes_t nframes)
check_declick_out ();
}
+ _engine.split_cycle (this_nframes);
+
/* now handle this event and all others scheduled for the same time */
while (this_event && this_event->action_frame == _transport_frame) {
@@ -431,7 +437,7 @@ Session::process_with_events (nframes_t nframes)
/* if an event left our state changing, do the right thing */
if (nframes && non_realtime_work_pending()) {
- no_roll (nframes, offset);
+ no_roll (nframes);
break;
}
@@ -470,7 +476,7 @@ Session::transport_locked () const
}
bool
-Session::follow_slave (nframes_t nframes, nframes_t offset)
+Session::follow_slave (nframes_t nframes)
{
double slave_speed;
nframes_t slave_transport_frame;
@@ -590,14 +596,14 @@ Session::follow_slave (nframes_t nframes, nframes_t offset)
cerr << "reached silent_motion:" <<endl;
#endif
- follow_slave_silently(nframes, offset, slave_speed);
+ follow_slave_silently (nframes, slave_speed);
noroll:
/* don't move at all */
#ifdef DEBUG_SLAVES
cerr << "reached no_roll:" <<endl;
#endif
- no_roll (nframes, 0);
+ no_roll (nframes);
return false;
}
@@ -746,7 +752,7 @@ Session::track_slave_state(
}
void
-Session::follow_slave_silently(nframes_t nframes, nframes_t offset, float slave_speed)
+Session::follow_slave_silently (nframes_t nframes, float slave_speed)
{
if (slave_speed && _transport_speed) {
@@ -757,7 +763,7 @@ Session::follow_slave_silently(nframes_t nframes, nframes_t offset, float slave_
bool need_butler;
prepare_diskstreams ();
- silent_process_routes (nframes, offset);
+ silent_process_routes (nframes);
commit_diskstreams (nframes, need_butler);
if (need_butler) {
@@ -794,7 +800,6 @@ Session::process_without_events (nframes_t nframes)
bool session_needs_butler = false;
nframes_t stop_limit;
long frames_moved;
- nframes_t offset = 0;
if (!process_can_proceed()) {
_silent = true;
@@ -802,13 +807,13 @@ Session::process_without_events (nframes_t nframes)
}
if (!_exporting && _slave) {
- if (!follow_slave (nframes, 0)) {
+ if (!follow_slave (nframes)) {
return;
}
}
if (_transport_speed == 0) {
- no_roll (nframes, 0);
+ fail_roll (nframes);
return;
}
@@ -827,15 +832,15 @@ Session::process_without_events (nframes_t nframes)
}
if (maybe_stop (stop_limit)) {
- no_roll (nframes, 0);
+ fail_roll (nframes);
return;
}
- if (maybe_sync_start (nframes, offset)) {
+ if (maybe_sync_start (nframes)) {
return;
}
- click (_transport_frame, nframes, offset);
+ click (_transport_frame, nframes);
prepare_diskstreams ();
@@ -849,8 +854,8 @@ Session::process_without_events (nframes_t nframes)
calculate_varispeed_playback_distance(nframes, phase, phi, target_phi);
}
- if (process_routes (nframes, offset)) {
- no_roll (nframes, offset);
+ if (process_routes (nframes)) {
+ fail_roll (nframes);
return;
}
@@ -880,7 +885,7 @@ Session::process_audition (nframes_t nframes)
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
if (!(*i)->is_hidden()) {
- (*i)->silence (nframes, 0);
+ (*i)->silence (nframes);
}
}
@@ -914,7 +919,7 @@ Session::process_audition (nframes_t nframes)
}
bool
-Session::maybe_sync_start (nframes_t& nframes, nframes_t& offset)
+Session::maybe_sync_start (nframes_t& nframes)
{
nframes_t sync_offset;
@@ -929,9 +934,9 @@ Session::maybe_sync_start (nframes_t& nframes, nframes_t& offset)
is left to do.
*/
- no_roll (sync_offset, 0);
+ no_roll (sync_offset);
nframes -= sync_offset;
- offset += sync_offset;
+ Port::increment_port_offset (sync_offset);
waiting_for_sync_offset = false;
if (nframes == 0) {