/** Apply a declicked gain to the audio buffers of @a bufs */
void
-Amp::run (BufferSet& bufs, jack_nframes_t nframes, gain_t initial, gain_t target, bool invert_polarity)
+Amp::run (BufferSet& bufs, nframes_t nframes, gain_t initial, gain_t target, bool invert_polarity)
{
+ if (nframes == 0)
+ return;
+
if (bufs.count().get(DataType::AUDIO) == 0)
return;
- assert(bufs.buffer_capacity(DataType::AUDIO) >= nframes);
+ // assert(bufs.buffer_capacity(DataType::AUDIO) >= nframes);
// if we don't need to declick, defer to apply_simple_gain
+
if (initial == target) {
- apply_simple_gain(bufs, nframes, invert_polarity ? -target : target);
+ for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i) {
+ apply_gain_to_buffer (i->data (), nframes, target);
+ }
+ return;
}
- const jack_nframes_t declick = std::min ((jack_nframes_t)128, nframes);
+ const nframes_t declick = std::min ((nframes_t)128, nframes);
gain_t delta;
double fractional_shift = -1.0/declick;
double fractional_pos;
gain_t polscale = invert_polarity ? -1.0f : 1.0f;
- if (nframes == 0)
- return;
-
if (target < initial) {
/* fade out: remove more and more of delta from initial */
delta = -(initial - target);
}
for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i) {
- Sample* const buffer = i->data(nframes);
+ Sample* const buffer = i->data();
fractional_pos = 1.0;
- for (jack_nframes_t nx = 0; nx < declick; ++nx) {
+ for (nframes_t nx = 0; nx < declick; ++nx) {
buffer[nx] *= polscale * (initial + (delta * (0.5 + 0.5 * cos (M_PI * fractional_pos))));
fractional_pos += fractional_shift;
}
if (target == 0.0) {
memset (&buffer[declick], 0, sizeof (Sample) * (nframes - declick));
} else if (target != 1.0) {
- for (jack_nframes_t nx = declick; nx < nframes; ++nx) {
- buffer[nx] *= target;
- }
+ apply_gain_to_buffer (&buffer[declick], nframes - declick, target);
}
}
}
}
void
-Amp::apply_simple_gain (BufferSet& bufs, jack_nframes_t nframes, gain_t target)
+Amp::apply_simple_gain (BufferSet& bufs, nframes_t nframes, gain_t target)
{
- for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i) {
- i->apply_gain(target, nframes);
- }
}
*/
class Amp {
public:
- static void run (BufferSet& bufs, jack_nframes_t nframes, gain_t initial, gain_t target, bool invert_polarity);
+ static void run (BufferSet& bufs, nframes_t nframes, gain_t initial, gain_t target, bool invert_polarity);
- static void apply_simple_gain(BufferSet& bufs, jack_nframes_t nframes, gain_t target);
+ static void apply_simple_gain(BufferSet& bufs, nframes_t nframes, gain_t target);
};
free (_port);
}
- void cycle_start(jack_nframes_t nframes);
- void cycle_end();
+ void cycle_start(nframes_t nframes) {
+ _buffer.set_data ((Sample*) jack_port_get_buffer (_port, nframes), nframes);
+ }
+
+ void cycle_end() {}
DataType type() const { return DataType(DataType::AUDIO); }
uint32_t short_overs () const { return _short_overs; }
uint32_t long_overs () const { return _long_overs; }
- static void set_short_over_length (jack_nframes_t);
- static void set_long_over_length (jack_nframes_t);
+ static void set_short_over_length (nframes_t);
+ static void set_long_over_length (nframes_t);
protected:
friend class AudioEngine;
AudioBuffer _buffer;
- jack_nframes_t _overlen;
+ nframes_t _overlen;
jack_default_audio_sample_t _peak;
float _peak_db;
uint32_t _short_overs;
uint32_t _long_overs;
- static jack_nframes_t _long_over_length;
- static jack_nframes_t _short_over_length;
+ static nframes_t _long_over_length;
+ static nframes_t _short_over_length;
};
} // namespace ARDOUR
int start ();
bool running() const { return _running; }
- int run_process_cycle (ARDOUR::Session*, jack_nframes_t nframes);
-
Glib::Mutex& process_lock() { return _process_lock; }
nframes_t frame_rate();
protected:
int set_live_state (const XMLNode&, Change&, bool send);
- virtual bool verify_start (jack_nframes_t);
- virtual bool verify_start_and_length (jack_nframes_t, jack_nframes_t);
- virtual bool verify_start_mutable (jack_nframes_t&_start);
- virtual bool verify_length (jack_nframes_t);
+ virtual bool verify_start (nframes_t);
+ virtual bool verify_start_and_length (nframes_t, nframes_t);
+ virtual bool verify_start_mutable (nframes_t&_start);
+ virtual bool verify_length (nframes_t);
/*virtual void recompute_at_start () = 0;
virtual void recompute_at_end () = 0;*/
};
bool silent() const { return _silent; }
/** Clear (eg zero, or empty) buffer starting at TIME @a offset */
- virtual void silence(jack_nframes_t len, jack_nframes_t offset=0) = 0;
+ virtual void silence(nframes_t len, nframes_t offset=0) = 0;
/** Clear the entire buffer */
virtual void clear() { silence(_capacity, 0); }
- virtual void read_from(const Buffer& src, jack_nframes_t offset, jack_nframes_t len) = 0;
+ virtual void read_from(const Buffer& src, nframes_t offset, nframes_t len) = 0;
protected:
Buffer(DataType type, size_t capacity)
~AudioBuffer();
- void silence(jack_nframes_t len, jack_nframes_t offset=0)
+ void silence(nframes_t len, nframes_t offset=0)
{
if (!_silent) {
assert(_capacity > 0);
}
/** Read @a len frames FROM THE START OF @a src into self at @a offset */
- void read_from(const Buffer& src, jack_nframes_t len, jack_nframes_t offset)
+ void read_from(const Buffer& src, nframes_t len, nframes_t offset)
{
assert(_capacity > 0);
assert(src.type() == _type == DataType::AUDIO);
assert(offset + len <= _capacity);
- memcpy(_data + offset, ((AudioBuffer&)src).data(len), sizeof(Sample) * len);
+ memcpy(_data + offset, ((AudioBuffer&)src).data(), sizeof(Sample) * len);
_silent = src.silent();
}
/** Accumulate (add)@a len frames FROM THE START OF @a src into self at @a offset */
- void accumulate_from(const AudioBuffer& src, jack_nframes_t len, jack_nframes_t offset)
+ void accumulate_from(const AudioBuffer& src, nframes_t len, nframes_t offset)
{
assert(_capacity > 0);
assert(offset + len <= _capacity);
Sample* const dst_raw = _data + offset;
- const Sample* const src_raw = src.data(len);
+ const Sample* const src_raw = src.data();
- for (jack_nframes_t n = 0; n < len; ++n) {
+ for (nframes_t n = 0; n < len; ++n) {
dst_raw[n] += src_raw[n];
}
/** Accumulate (add) @a len frames FROM THE START OF @a src into self at @a offset
* scaling by @a gain_coeff */
- void accumulate_with_gain_from(const AudioBuffer& src, jack_nframes_t len, jack_nframes_t offset, gain_t gain_coeff)
+ void accumulate_with_gain_from(const AudioBuffer& src, nframes_t len, nframes_t offset, gain_t gain_coeff)
{
assert(_capacity > 0);
assert(offset + len <= _capacity);
Sample* const dst_raw = _data + offset;
- const Sample* const src_raw = src.data(len);
+ const Sample* const src_raw = src.data();
mix_buffers_with_gain (dst_raw, src_raw, len, gain_coeff);
_silent = ( (src.silent() && _silent) || (_silent && gain_coeff == 0) );
}
- void apply_gain(gain_t gain, jack_nframes_t len, jack_nframes_t offset=0) {
+ void apply_gain(gain_t gain, nframes_t len, nframes_t offset=0) {
apply_gain_to_buffer (_data + offset, len, gain);
}
_silent = false;
}
- const Sample* data(jack_nframes_t nframes, jack_nframes_t offset=0) const
+ const Sample* data () const { return _data; }
+ Sample* data () { return _data; }
+
+ const Sample* data(nframes_t nframes, nframes_t offset) const
{ assert(offset + nframes <= _capacity); return _data + offset; }
- Sample* data(jack_nframes_t nframes, jack_nframes_t offset=0)
+ Sample* data (nframes_t nframes, nframes_t offset)
{ assert(offset + nframes <= _capacity); return _data + offset; }
private:
~MidiBuffer();
- void silence(jack_nframes_t dur, jack_nframes_t offset=0);
+ void silence(nframes_t dur, nframes_t offset=0);
- void read_from(const Buffer& src, jack_nframes_t nframes, jack_nframes_t offset);
+ void read_from(const Buffer& src, nframes_t nframes, nframes_t offset);
bool push_back(const MidiEvent& event);
#ifndef __ardour_data_type_h__
#define __ardour_data_type_h__
-#include <cassert>
#include <string>
#include <ardour/data_type.h>
#include <jack/jack.h>
virtual void silence (nframes_t, nframes_t offset);
- void collect_input (BufferSet& bufs, jack_nframes_t nframes, jack_nframes_t offset);
- void deliver_output (BufferSet& bufs, jack_nframes_t start_frame, jack_nframes_t end_frame,
- jack_nframes_t nframes, jack_nframes_t offset);
- void just_meter_input (jack_nframes_t start_frame, jack_nframes_t end_frame,
- jack_nframes_t nframes, jack_nframes_t offset);
+ void collect_input (BufferSet& bufs, nframes_t nframes, nframes_t offset);
+ void deliver_output (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame,
+ nframes_t nframes, nframes_t offset);
+ void just_meter_input (nframes_t start_frame, nframes_t end_frame,
+ nframes_t nframes, nframes_t offset);
virtual void set_gain (gain_t g, void *src);
void inc_gain (gain_t delta, void *src);
/* automation */
- static void set_automation_interval (jack_nframes_t frames) {
+ static void set_automation_interval (nframes_t frames) {
_automation_interval = frames;
}
- static jack_nframes_t automation_interval() {
+ static nframes_t automation_interval() {
return _automation_interval;
}
void reset_max ();
/** Compute peaks */
- void run (BufferSet& bufs, jack_nframes_t nframes, jack_nframes_t offset=0);
+ void run (BufferSet& bufs, nframes_t nframes, nframes_t offset=0);
float peak_power (uint32_t n) {
if (n < _visible_peak_power.size()) {
float playback_buffer_load() const;
float capture_buffer_load() const;
- void get_playback(MidiBuffer& dst, jack_nframes_t start, jack_nframes_t end);
+ void get_playback(MidiBuffer& dst, nframes_t start, nframes_t end);
void set_record_enabled (bool yn);
void set_pending_overwrite(bool);
int overwrite_existing_buffers ();
- void set_block_size (jack_nframes_t);
- int internal_playback_seek (jack_nframes_t distance);
- int can_internal_playback_seek (jack_nframes_t distance);
+ void set_block_size (nframes_t);
+ int internal_playback_seek (nframes_t distance);
+ int can_internal_playback_seek (nframes_t distance);
int rename_write_sources ();
void reset_write_sources (bool, bool force = false);
void non_realtime_input_change ();
protected:
- int seek (jack_nframes_t which_sample, bool complete_refill = false);
+ int seek (nframes_t which_sample, bool complete_refill = false);
protected:
friend class MidiTrack;
- int process (jack_nframes_t transport_frame, jack_nframes_t nframes, jack_nframes_t offset, bool can_record, bool rec_monitors_input);
- bool commit (jack_nframes_t nframes);
+ int process (nframes_t transport_frame, nframes_t nframes, nframes_t offset, bool can_record, bool rec_monitors_input);
+ bool commit (nframes_t nframes);
private:
int do_refill_with_alloc();
- int read (jack_nframes_t& start, jack_nframes_t cnt, bool reversed);
+ int read (nframes_t& start, nframes_t cnt, bool reversed);
void finish_capture (bool rec_monitors_input);
void transport_stopped (struct tm&, time_t, bool abort);
int use_pending_capture_data (XMLNode& node);
void get_input_sources ();
- void check_record_status (jack_nframes_t transport_frame, jack_nframes_t nframes, bool can_record);
+ void check_record_status (nframes_t transport_frame, nframes_t nframes, bool can_record);
void set_align_style_from_io();
void engage_record_enable ();
RingBufferNPT<CaptureTransition>* _capture_transition_buf;
//RingBufferNPT<RawMidi>::rw_vector _playback_vector;
//RingBufferNPT<RawMidi>::rw_vector _capture_vector;
- jack_nframes_t _last_flush_frame;
+ nframes_t _last_flush_frame;
};
}; /* namespace ARDOUR */
MidiPlaylist (Session&, const XMLNode&, bool hidden = false);
MidiPlaylist (Session&, string name, bool hidden = false);
MidiPlaylist (boost::shared_ptr<const MidiPlaylist> other, string name, bool hidden = false);
- MidiPlaylist (boost::shared_ptr<const MidiPlaylist> other, jack_nframes_t start, jack_nframes_t cnt,
+ MidiPlaylist (boost::shared_ptr<const MidiPlaylist> other, nframes_t start, nframes_t cnt,
string name, bool hidden = false);
~MidiPlaylist ();
nframes_t read (MidiRingBuffer& buf,
- jack_nframes_t start, jack_nframes_t cnt, uint32_t chan_n=0);
+ nframes_t start, nframes_t cnt, uint32_t chan_n=0);
int set_state (const XMLNode&);
UndoAction get_memento() const;
return _buffer;
}
- void cycle_start(jack_nframes_t nframes);
+ void cycle_start(nframes_t nframes);
void cycle_end();
size_t capacity() { return _buffer.capacity(); }
/* engine isn't supposed to access below here */
MidiBuffer _buffer;
- jack_nframes_t _nframes_this_cycle;
+ nframes_t _nframes_this_cycle;
};
} // namespace ARDOUR
boost::shared_ptr<MidiSource> midi_source (uint32_t n=0) const;
- jack_nframes_t read_at (MidiRingBuffer& dst,
- jack_nframes_t position,
- jack_nframes_t dur,
+ nframes_t read_at (MidiRingBuffer& dst,
+ nframes_t position,
+ nframes_t dur,
uint32_t chan_n = 0,
- jack_nframes_t read_frames = 0,
- jack_nframes_t skip_frames = 0) const;
+ nframes_t read_frames = 0,
+ nframes_t skip_frames = 0) const;
- jack_nframes_t master_read_at (MidiRingBuffer& dst,
- jack_nframes_t position,
- jack_nframes_t dur,
+ nframes_t master_read_at (MidiRingBuffer& dst,
+ nframes_t position,
+ nframes_t dur,
uint32_t chan_n=0) const;
XMLNode& state (bool);
private:
friend class RegionFactory;
- MidiRegion (boost::shared_ptr<MidiSource>, jack_nframes_t start, jack_nframes_t length);
- MidiRegion (boost::shared_ptr<MidiSource>, jack_nframes_t start, jack_nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags);
- MidiRegion (SourceList &, jack_nframes_t start, jack_nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags);
- MidiRegion (boost::shared_ptr<const MidiRegion>, jack_nframes_t start, jack_nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags);
+ MidiRegion (boost::shared_ptr<MidiSource>, nframes_t start, nframes_t length);
+ MidiRegion (boost::shared_ptr<MidiSource>, nframes_t start, nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags);
+ MidiRegion (SourceList &, nframes_t start, nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags);
+ MidiRegion (boost::shared_ptr<const MidiRegion>, nframes_t start, nframes_t length, const string& name, layer_t = 0, Region::Flag flags = Region::DefaultFlags);
MidiRegion (boost::shared_ptr<const MidiRegion>);
MidiRegion (boost::shared_ptr<MidiSource>, const XMLNode&);
MidiRegion (SourceList &, const XMLNode&);
friend class Playlist;
private:
- jack_nframes_t _read_at (const SourceList&, MidiRingBuffer& dst,
- jack_nframes_t position,
- jack_nframes_t dur,
+ nframes_t _read_at (const SourceList&, MidiRingBuffer& dst,
+ nframes_t position,
+ nframes_t dur,
uint32_t chan_n = 0,
- jack_nframes_t read_frames = 0,
- jack_nframes_t skip_frames = 0) const;
+ nframes_t read_frames = 0,
+ nframes_t skip_frames = 0) const;
void recompute_at_start ();
void recompute_at_end ();
/** Read events all events up to time @a end into @a out, leaving stamps intact.
* Any events before @a start will be dropped. */
- size_t read(MidiBuffer& out, jack_nframes_t start, jack_nframes_t end);
+ size_t read(MidiBuffer& out, nframes_t start, nframes_t end);
/** Write all events from @a in, applying @a offset to all time stamps */
- size_t write(const MidiBuffer& in, jack_nframes_t offset = 0);
+ size_t write(const MidiBuffer& in, nframes_t offset = 0);
inline void clear_event(size_t index);
inline size_t
MidiRingBuffer::write (const MidiEvent& ev)
{
- //static jack_nframes_t last_write_time = 0;
+ //static nframes_t last_write_time = 0;
assert(ev.size > 0);
}
inline size_t
-MidiRingBuffer::read(MidiBuffer& dst, jack_nframes_t start, jack_nframes_t end)
+MidiRingBuffer::read(MidiBuffer& dst, nframes_t start, nframes_t end)
{
if (read_space() == 0)
return 0;
size_t priv_read_ptr = g_atomic_int_get(&_read_ptr);
- jack_nframes_t time = _ev_buf[priv_read_ptr].time;
+ nframes_t time = _ev_buf[priv_read_ptr].time;
size_t count = 0;
size_t limit = read_space();
}
inline size_t
-MidiRingBuffer::write(const MidiBuffer& in, jack_nframes_t offset)
+MidiRingBuffer::write(const MidiBuffer& in, nframes_t offset)
{
size_t num_events = in.size();
size_t to_write = std::min(write_space(), num_events);
MidiSource (Session& session, const XMLNode&);
virtual ~MidiSource ();
- virtual jack_nframes_t read (MidiRingBuffer& dst, jack_nframes_t start, jack_nframes_t cnt, jack_nframes_t stamp_offset) const;
- virtual jack_nframes_t write (MidiRingBuffer& src, jack_nframes_t cnt);
+ virtual nframes_t read (MidiRingBuffer& dst, nframes_t start, nframes_t cnt, nframes_t stamp_offset) const;
+ virtual nframes_t write (MidiRingBuffer& src, nframes_t cnt);
virtual void mark_for_remove() = 0;
virtual void mark_streaming_write_completed () {}
// The MIDI equivalent to "peaks"
static int start_view_data_thread ();
static void stop_view_data_thread ();
- mutable sigc::signal<void,jack_nframes_t,jack_nframes_t> ViewDataRangeReady;
+ mutable sigc::signal<void,nframes_t,nframes_t> ViewDataRangeReady;
XMLNode& get_state ();
int set_state (const XMLNode&);
protected:
- virtual jack_nframes_t read_unlocked (MidiRingBuffer& dst, jack_nframes_t start, jack_nframes_t cnt, jack_nframes_t stamp_offset) const = 0;
- virtual jack_nframes_t write_unlocked (MidiRingBuffer& dst, jack_nframes_t cnt) = 0;
+ virtual nframes_t read_unlocked (MidiRingBuffer& dst, nframes_t start, nframes_t cnt, nframes_t stamp_offset) const = 0;
+ virtual nframes_t write_unlocked (MidiRingBuffer& dst, nframes_t cnt) = 0;
mutable Glib::Mutex _lock;
string _captured_for;
int set_name (string str, void *src);
- int roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame,
- jack_nframes_t offset, int declick, bool can_record, bool rec_monitors_input);
+ int roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
+ nframes_t offset, int declick, bool can_record, bool rec_monitors_input);
- int no_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame,
- jack_nframes_t offset, bool state_changing, bool can_record, bool rec_monitors_input);
+ int no_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
+ nframes_t offset, bool state_changing, bool can_record, bool rec_monitors_input);
- int silent_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame,
- jack_nframes_t offset, bool can_record, bool rec_monitors_input);
+ int silent_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
+ nframes_t offset, bool can_record, bool rec_monitors_input);
void process_output_buffers (BufferSet& bufs,
- jack_nframes_t start_frame, jack_nframes_t end_frame,
- jack_nframes_t nframes, jack_nframes_t offset, bool with_redirects, int declick,
+ nframes_t start_frame, nframes_t end_frame,
+ nframes_t nframes, nframes_t offset, bool with_redirects, int declick,
bool meter);
boost::shared_ptr<MidiDiskstream> midi_diskstream() const;
int set_mode (TrackMode m);
- void set_latency_delay (jack_nframes_t);
+ void set_latency_delay (nframes_t);
int export_stuff (BufferSet& bufs,
- jack_nframes_t nframes, jack_nframes_t end_frame);
+ nframes_t nframes, nframes_t end_frame);
void freeze (InterThreadInfo&);
void unfreeze ();
void bounce (InterThreadInfo&);
- void bounce_range (jack_nframes_t start, jack_nframes_t end, InterThreadInfo&);
+ void bounce_range (nframes_t start, nframes_t end, InterThreadInfo&);
int set_state(const XMLNode& node);
virtual DataType type() const = 0;
- virtual void cycle_start(jack_nframes_t nframes) {}
+ virtual void cycle_start(nframes_t nframes) {}
virtual void cycle_end() {}
virtual Buffer& get_buffer() = 0;
void maybe_uncopy ();
void first_edit ();
- virtual bool verify_start (jack_nframes_t);
- virtual bool verify_start_and_length (jack_nframes_t, jack_nframes_t);
- virtual bool verify_start_mutable (jack_nframes_t&_start);
- virtual bool verify_length (jack_nframes_t);
+ virtual bool verify_start (nframes_t);
+ virtual bool verify_start_and_length (nframes_t, nframes_t);
+ virtual bool verify_start_mutable (nframes_t&_start);
+ virtual bool verify_length (nframes_t);
virtual void recompute_at_start () = 0;
virtual void recompute_at_end () = 0;
/* cache the most-recently requested time conversions. This helps when we
* have multiple clocks showing the same time (e.g. the transport frame) */
bool last_smpte_valid;
- jack_nframes_t last_smpte_when;
+ nframes_t last_smpte_when;
SMPTE::Time last_smpte;
bool _send_smpte_update; ///< Flag to send a full frame (SMPTE) MTC message this cycle
- int send_full_time_code(jack_nframes_t nframes);
- int send_midi_time_code_for_cycle(jack_nframes_t nframes);
+ int send_full_time_code(nframes_t nframes);
+ int send_midi_time_code_for_cycle(nframes_t nframes);
nframes_t adjust_apparent_position (nframes_t frames);
*/
// FIXME and thus are useless for MIDI.. but make MidiDiskstream compile easier! :)
- virtual jack_nframes_t last_capture_start_frame() const { return 0; }
- virtual void mark_capture_start (jack_nframes_t) {}
+ virtual nframes_t last_capture_start_frame() const { return 0; }
+ virtual void mark_capture_start (nframes_t) {}
virtual void mark_capture_end () {}
virtual void clear_capture_marks() {}
void set_allow_remove_if_empty (bool yn);
void mark_for_remove();
- int update_header (jack_nframes_t when, struct tm&, time_t);
+ int update_header (nframes_t when, struct tm&, time_t);
int flush_header ();
int flush_footer ();
string take_id() const { return _take_id; }
static void set_search_path (string);
- static void set_header_position_offset (jack_nframes_t offset, bool negative);
+ static void set_header_position_offset (nframes_t offset, bool negative);
XMLNode& get_state ();
int set_state (const XMLNode&);
int init (string idstr, bool must_exist);
- jack_nframes_t read_unlocked (MidiRingBuffer& dst, jack_nframes_t start, jack_nframes_t cn, jack_nframes_t stamp_offset) const;
- jack_nframes_t write_unlocked (MidiRingBuffer& dst, jack_nframes_t cnt);
+ nframes_t read_unlocked (MidiRingBuffer& dst, nframes_t start, nframes_t cn, nframes_t stamp_offset) const;
+ nframes_t write_unlocked (MidiRingBuffer& dst, nframes_t cnt);
bool find (std::string path, bool must_exist, bool& is_new);
bool removable() const;
bool _allow_remove_if_empty;
uint64_t _timeline_position;
FILE* _fd;
- jack_nframes_t _last_ev_time; // last frame time written, relative to source start
+ nframes_t _last_ev_time; // last frame time written, relative to source start
uint32_t _track_size;
uint32_t _header_size; // size of SMF header, including MTrk chunk header
void stamp (time_t when) { _timestamp = when; }
/** @return the number of items in this source */
- jack_nframes_t length() const { return _length; }
+ nframes_t length() const { return _length; }
- virtual jack_nframes_t natural_position() const { return 0; }
+ virtual nframes_t natural_position() const { return 0; }
virtual void mark_for_remove() = 0;
virtual void mark_streaming_write_completed () = 0;
static sigc::signal<void,Source*> SourceCreated;
protected:
- void update_length (jack_nframes_t pos, jack_nframes_t cnt);
+ void update_length (nframes_t pos, nframes_t cnt);
Session& _session;
string _name;
DataType _type;
time_t _timestamp;
- jack_nframes_t _length;
+ nframes_t _length;
Glib::Mutex playlist_lock;
typedef std::map<boost::shared_ptr<ARDOUR::Playlist>, uint32_t > PlaylistMap;
using namespace ARDOUR;
using namespace std;
-jack_nframes_t AudioPort::_short_over_length = 2;
-jack_nframes_t AudioPort::_long_over_length = 10;
+nframes_t AudioPort::_short_over_length = 2;
+nframes_t AudioPort::_long_over_length = 10;
AudioPort::AudioPort(jack_port_t* p)
: Port(p)
reset_meters ();
}
-void
-AudioPort::cycle_start (jack_nframes_t nframes)
-{
- if (_flags & JackPortIsOutput) {
- const bool silent = _buffer.silent();
- // FIXME: do nothing, we can cache the value (but capacity needs to be set for MIDI)
- _buffer.set_data((Sample*)jack_port_get_buffer (_port, nframes), nframes);
- if (silent) {
- _buffer.silence(nframes);
- }
- } else {
- _buffer.set_data((Sample*)jack_port_get_buffer (_port, nframes), nframes);
- }
-}
-void
-AudioPort::cycle_end()
-{
- // whatever...
-}
uint32_t i;
for (i = 0, n = 1; i < limit; ++i, ++n) {
- memcpy (bufs.get_audio(i).data(nframes), b, sizeof (Sample) * nframes);
+ memcpy (bufs.get_audio(i).data(), b, sizeof (Sample) * nframes);
if (n < diskstream->n_channels().get(DataType::AUDIO)) {
tmpb = diskstream->playback_buffer(n);
if (tmpb!=0) {
boost::shared_ptr<AudioPlaylist> apl = boost::dynamic_pointer_cast<AudioPlaylist>(diskstream->playlist());
assert(apl);
- if (apl->read (buffers.get_audio(nframes).data(nframes),
+ if (apl->read (buffers.get_audio(nframes).data(),
mix_buffer, gain_buffer, start, nframes) != nframes) {
return -1;
}
assert(buffers.count().get(DataType::AUDIO) >= 1);
uint32_t n=1;
- Sample* b = buffers.get_audio(0).data(nframes);
+ Sample* b = buffers.get_audio(0).data();
BufferSet::audio_iterator bi = buffers.audio_begin();
++bi;
for ( ; bi != buffers.audio_end(); ++bi, ++n) {
if (n < diskstream->n_channels().get(DataType::AUDIO)) {
- if (apl->read (bi->data(nframes), mix_buffer, gain_buffer, start, nframes, n) != nframes) {
+ if (apl->read (bi->data(), mix_buffer, gain_buffer, start, nframes, n) != nframes) {
return -1;
}
- b = bi->data(nframes);
+ b = bi->data();
}
else {
/* duplicate last across remaining buffers */
- memcpy (bi->data(nframes), b, sizeof (Sample) * nframes);
+ memcpy (bi->data(), b, sizeof (Sample) * nframes);
}
}
_gain_automation_curve.get_vector (start, start + nframes, gain_automation, nframes);
for (BufferSet::audio_iterator bi = buffers.audio_begin(); bi != buffers.audio_end(); ++bi) {
- Sample *b = bi->data(nframes);
+ Sample *b = bi->data();
for (nframes_t n = 0; n < nframes; ++n) {
b[n] *= gain_automation[n];
}
} else {
for (BufferSet::audio_iterator bi = buffers.audio_begin(); bi != buffers.audio_end(); ++bi) {
- Sample *b = bi->data(nframes);
+ Sample *b = bi->data();
for (nframes_t n = 0; n < nframes; ++n) {
b[n] *= this_gain;
}
return 0;
}
- if (run_process_cycle (session, nframes)) {
- /* we were zombified, maybe because a ladspa plugin took
- too long, or jackd exited, or something like that.
- */
+ boost::shared_ptr<Ports> p = ports.reader();
+
+ // Prepare ports (ie read data if necessary)
+ for (Ports::iterator i = p->begin(); i != p->end(); ++i) {
+ (*i)->cycle_start (nframes);
+ }
+
+ if (session) {
+ session->process (nframes);
+ }
+
+ if (!_running) {
_processed_frames = next_processed_frames;
return 0;
}
+
+ // Finalize ports (ie write data if necessary)
+ for (Ports::iterator i = p->begin(); i != p->end(); ++i) {
+ (*i)->cycle_end ();
+ }
if (last_monitor_check + monitor_check_interval < next_processed_frames) {
return 0;
}
-int
-AudioEngine::run_process_cycle (Session* s, jack_nframes_t nframes)
-{
- boost::shared_ptr<Ports> p = ports.reader();
-
- // Prepare ports (ie read data if necessary)
- for (Ports::iterator i = p->begin(); i != p->end(); ++i)
- (*i)->cycle_start (nframes);
-
- s->process (nframes);
-
- if (!_running) {
- return -1;
- }
-
- // Finalize ports (ie write data if necessary)
- for (Ports::iterator i = p->begin(); i != p->end(); ++i)
- (*i)->cycle_end ();
-
- return 0;
-}
-
int
AudioEngine::_sample_rate_callback (nframes_t nframes, void *arg)
{
can before we really start running.
*/
- run_process_cycle (session, blocksize);
- run_process_cycle (session, blocksize);
- run_process_cycle (session, blocksize);
- run_process_cycle (session, blocksize);
- run_process_cycle (session, blocksize);
- run_process_cycle (session, blocksize);
- run_process_cycle (session, blocksize);
- run_process_cycle (session, blocksize);
+ boost::shared_ptr<Ports> p = ports.reader();
+
+ for (Ports::iterator i = p->begin(); i != p->end(); ++i)
+ (*i)->cycle_start (blocksize);
+
+ s->process (blocksize);
+ s->process (blocksize);
+ s->process (blocksize);
+ s->process (blocksize);
+ s->process (blocksize);
+ s->process (blocksize);
+ s->process (blocksize);
+ s->process (blocksize);
+
+ for (Ports::iterator i = p->begin(); i != p->end(); ++i)
+ (*i)->cycle_end ();
+
}
}
const XMLNodeList& elist = node.children();
XMLNodeConstIterator i;
XMLProperty* prop;
- jack_nframes_t x;
+ nframes_t x;
double y;
freeze ();
* Note that offset and nframes refer to sample time, NOT buffer offsets or event counts.
*/
void
-MidiBuffer::read_from(const Buffer& src, jack_nframes_t nframes, jack_nframes_t offset)
+MidiBuffer::read_from(const Buffer& src, nframes_t nframes, nframes_t offset)
{
assert(src.type() == DataType::MIDI);
const MidiBuffer& msrc = (MidiBuffer&)src;
void
-MidiBuffer::silence(jack_nframes_t dur, jack_nframes_t offset)
+MidiBuffer::silence(nframes_t dur, nframes_t offset)
{
// FIXME use parameters
assert(offset == 0);
// FIXME: make 'in' const
void
-BufferSet::read_from(BufferSet& in, jack_nframes_t nframes, jack_nframes_t offset)
+BufferSet::read_from(BufferSet& in, nframes_t nframes, nframes_t offset)
{
assert(available() >= in.count());
for (list<ControlProtocolInfo*>::iterator p = control_protocol_info.begin(); p != control_protocol_info.end(); ++p) {
// otherwise the ControlProtocol instances are not recreated in set_session
- (*p)->requested = true;
- (*p)->protocol = 0;
+ if ((*p)->protocol) {
+ (*p)->requested = true;
+ (*p)->protocol = 0;
+ }
}
}
}
while (in.getline (line, sizeof(line), '\n')) {
char type;
- jack_nframes_t when;
+ nframes_t when;
double value;
if (++linecnt == 1) {
* be set to 0.
*/
void
-PeakMeter::run (BufferSet& bufs, jack_nframes_t nframes, jack_nframes_t offset)
+PeakMeter::run (BufferSet& bufs, nframes_t nframes, nframes_t offset)
{
size_t meterable = std::min(bufs.count().get(DataType::AUDIO), _peak_power.size());
/* now refill channel buffers */
if (speed() != 1.0f || speed() != -1.0f) {
- seek ((jack_nframes_t) (_session.transport_frame() * (double) speed()));
+ seek ((nframes_t) (_session.transport_frame() * (double) speed()));
}
else {
seek (_session.transport_frame());
}
void
-MidiDiskstream::check_record_status (jack_nframes_t transport_frame, jack_nframes_t nframes, bool can_record)
+MidiDiskstream::check_record_status (nframes_t transport_frame, nframes_t nframes, bool can_record)
{
// FIXME: waaay too much code to duplicate (AudioDiskstream)
}
int
-MidiDiskstream::process (jack_nframes_t transport_frame, jack_nframes_t nframes, jack_nframes_t offset, bool can_record, bool rec_monitors_input)
+MidiDiskstream::process (nframes_t transport_frame, nframes_t nframes, nframes_t offset, bool can_record, bool rec_monitors_input)
{
// FIXME: waay too much code to duplicate (AudioDiskstream::process)
int ret = -1;
- jack_nframes_t rec_offset = 0;
- jack_nframes_t rec_nframes = 0;
+ nframes_t rec_offset = 0;
+ nframes_t rec_nframes = 0;
bool nominally_recording;
bool re = record_enabled ();
bool collect_playback = false;
/* we're doing playback */
- jack_nframes_t necessary_samples;
+ nframes_t necessary_samples;
/* no varispeed playback if we're recording, because the output .... TBD */
if (rec_nframes == 0 && _actual_speed != 1.0f) {
- necessary_samples = (jack_nframes_t) floor ((nframes * fabs (_actual_speed))) + 1;
+ necessary_samples = (nframes_t) floor ((nframes * fabs (_actual_speed))) + 1;
} else {
necessary_samples = nframes;
}
}
bool
-MidiDiskstream::commit (jack_nframes_t nframes)
+MidiDiskstream::commit (nframes_t nframes)
{
bool need_butler = false;
}
int
-MidiDiskstream::seek (jack_nframes_t frame, bool complete_refill)
+MidiDiskstream::seek (nframes_t frame, bool complete_refill)
{
Glib::Mutex::Lock lm (state_lock);
int ret = -1;
}
int
-MidiDiskstream::can_internal_playback_seek (jack_nframes_t distance)
+MidiDiskstream::can_internal_playback_seek (nframes_t distance)
{
if (_playback_buf->read_space() < distance) {
return false;
}
int
-MidiDiskstream::internal_playback_seek (jack_nframes_t distance)
+MidiDiskstream::internal_playback_seek (nframes_t distance)
{
first_recordable_frame += distance;
playback_sample += distance;
/** @a start is set to the new frame position (TIME) read up to */
int
-MidiDiskstream::read (jack_nframes_t& start, jack_nframes_t dur, bool reversed)
+MidiDiskstream::read (nframes_t& start, nframes_t dur, bool reversed)
{
- jack_nframes_t this_read = 0;
+ nframes_t this_read = 0;
bool reloop = false;
- jack_nframes_t loop_end = 0;
- jack_nframes_t loop_start = 0;
- jack_nframes_t loop_length = 0;
+ nframes_t loop_end = 0;
+ nframes_t loop_start = 0;
+ nframes_t loop_length = 0;
Location *loc = 0;
if (!reversed) {
// So (read it, then) write it:
- jack_nframes_t file_frame_tmp = file_frame;
- jack_nframes_t to_read = min(disk_io_chunk_frames, (max_frames - file_frame));
+ nframes_t file_frame_tmp = file_frame;
+ nframes_t to_read = min(disk_io_chunk_frames, (max_frames - file_frame));
// FIXME: read count?
if (read (file_frame_tmp, to_read, reversed)) {
int32_t ret = 0;
// FIXME: I'd be lying if I said I knew what this thing was
//RingBufferNPT<CaptureTransition>::rw_vector transvec;
- jack_nframes_t total;
+ nframes_t total;
_write_data_count = 0;
ret = 1;
}
- //to_write = min (disk_io_chunk_frames, (jack_nframes_t) vector.len[0]);
+ //to_write = min (disk_io_chunk_frames, (nframes_t) vector.len[0]);
to_write = disk_io_chunk_frames;
assert(!destructive());
bool more_work = true;
int err = 0;
boost::shared_ptr<MidiRegion> region;
- jack_nframes_t total_capture;
+ nframes_t total_capture;
MidiRegion::SourceList srcs;
MidiRegion::SourceList::iterator src;
vector<CaptureInfo*>::iterator ci;
}
void
-MidiDiskstream::set_block_size (jack_nframes_t nframes)
+MidiDiskstream::set_block_size (nframes_t nframes)
{
}
* so that an event at start has time = 0
*/
void
-MidiDiskstream::get_playback(MidiBuffer& dst, jack_nframes_t start, jack_nframes_t end)
+MidiDiskstream::get_playback(MidiBuffer& dst, nframes_t start, nframes_t end)
{
dst.clear();
assert(dst.size() == 0);
*/
}
-MidiPlaylist::MidiPlaylist (boost::shared_ptr<const MidiPlaylist> other, jack_nframes_t start, jack_nframes_t dur, string name, bool hidden)
+MidiPlaylist::MidiPlaylist (boost::shared_ptr<const MidiPlaylist> other, nframes_t start, nframes_t dur, string name, bool hidden)
: Playlist (other, start, dur, name, hidden)
{
/* this constructor does NOT notify others (session) */
};
/** Returns the number of frames in time duration read (eg could be large when 0 events are read) */
-jack_nframes_t
-MidiPlaylist::read (MidiRingBuffer& dst, jack_nframes_t start,
- jack_nframes_t dur, unsigned chan_n)
+nframes_t
+MidiPlaylist::read (MidiRingBuffer& dst, nframes_t start,
+ nframes_t dur, unsigned chan_n)
{
/* this function is never called from a realtime thread, so
its OK to block (for short intervals).
Glib::Mutex::Lock rm (region_lock);
- jack_nframes_t ret = 0;
- jack_nframes_t end = start + dur - 1;
- //jack_nframes_t read_frames = 0;
- //jack_nframes_t skip_frames = 0;
+ nframes_t ret = 0;
+ nframes_t end = start + dur - 1;
+ //nframes_t read_frames = 0;
+ //nframes_t skip_frames = 0;
//_read_data_count = 0;
}
void
-MidiPort::cycle_start (jack_nframes_t nframes)
+MidiPort::cycle_start (nframes_t nframes)
{
_buffer.clear();
assert(_buffer.size() == 0);
void* jack_buffer = jack_port_get_buffer(_port, nframes);
- const jack_nframes_t event_count
+ const nframes_t event_count
= jack_midi_get_event_count(jack_buffer);
assert(event_count < _buffer.capacity());
MidiEvent ev;
// FIXME: too slow, event struct is copied twice (here and MidiBuffer::push_back)
- for (jack_nframes_t i=0; i < event_count; ++i) {
+ for (nframes_t i=0; i < event_count; ++i) {
// This will fail to compile if we change MidiEvent to our own class
jack_midi_event_get(static_cast<jack_midi_event_t*>(&ev), jack_buffer, i);
void* jack_buffer = jack_port_get_buffer(_port, _nframes_this_cycle);
- const jack_nframes_t event_count = _buffer.size();
+ const nframes_t event_count = _buffer.size();
//if (event_count > 0)
// cerr << "MIDIPort writing " << event_count << " events." << endl;
jack_midi_clear_buffer(jack_buffer);
- for (jack_nframes_t i=0; i < event_count; ++i) {
+ for (nframes_t i=0; i < event_count; ++i) {
const jack_midi_event_t& ev = _buffer[i];
assert(ev.time < _nframes_this_cycle);
jack_midi_event_write(jack_buffer, ev.time, ev.buffer, ev.size);
using namespace ARDOUR;
/** Basic MidiRegion constructor (one channel) */
-MidiRegion::MidiRegion (boost::shared_ptr<MidiSource> src, jack_nframes_t start, jack_nframes_t length)
+MidiRegion::MidiRegion (boost::shared_ptr<MidiSource> src, nframes_t start, nframes_t length)
: Region (src, start, length, PBD::basename_nosuffix(src->name()), DataType::MIDI, 0, Region::Flag(Region::DefaultFlags|Region::External))
{
assert(_name.find("/") == string::npos);
}
/* Basic MidiRegion constructor (one channel) */
-MidiRegion::MidiRegion (boost::shared_ptr<MidiSource> src, jack_nframes_t start, jack_nframes_t length, const string& name, layer_t layer, Flag flags)
+MidiRegion::MidiRegion (boost::shared_ptr<MidiSource> src, nframes_t start, nframes_t length, const string& name, layer_t layer, Flag flags)
: Region (src, start, length, name, DataType::MIDI, layer, flags)
{
assert(_name.find("/") == string::npos);
}
/* Basic MidiRegion constructor (many channels) */
-MidiRegion::MidiRegion (SourceList& srcs, jack_nframes_t start, jack_nframes_t length, const string& name, layer_t layer, Flag flags)
+MidiRegion::MidiRegion (SourceList& srcs, nframes_t start, nframes_t length, const string& name, layer_t layer, Flag flags)
: Region (srcs, start, length, name, DataType::MIDI, layer, flags)
{
assert(_name.find("/") == string::npos);
/** Create a new MidiRegion, that is part of an existing one */
-MidiRegion::MidiRegion (boost::shared_ptr<const MidiRegion> other, jack_nframes_t offset, jack_nframes_t length, const string& name, layer_t layer, Flag flags)
+MidiRegion::MidiRegion (boost::shared_ptr<const MidiRegion> other, nframes_t offset, nframes_t length, const string& name, layer_t layer, Flag flags)
: Region (other, offset, length, name, layer, flags)
{
assert(_name.find("/") == string::npos);
{
}
-jack_nframes_t
-MidiRegion::read_at (MidiRingBuffer& out, jack_nframes_t position,
- jack_nframes_t dur,
- uint32_t chan_n, jack_nframes_t read_frames, jack_nframes_t skip_frames) const
+nframes_t
+MidiRegion::read_at (MidiRingBuffer& out, nframes_t position,
+ nframes_t dur,
+ uint32_t chan_n, nframes_t read_frames, nframes_t skip_frames) const
{
return _read_at (_sources, out, position, dur, chan_n, read_frames, skip_frames);
}
-jack_nframes_t
-MidiRegion::master_read_at (MidiRingBuffer& out, jack_nframes_t position,
- jack_nframes_t dur, uint32_t chan_n) const
+nframes_t
+MidiRegion::master_read_at (MidiRingBuffer& out, nframes_t position,
+ nframes_t dur, uint32_t chan_n) const
{
return _read_at (_master_sources, out, position, dur, chan_n, 0, 0);
}
-jack_nframes_t
+nframes_t
MidiRegion::_read_at (const SourceList& srcs, MidiRingBuffer& dst,
- jack_nframes_t position, jack_nframes_t dur,
- uint32_t chan_n, jack_nframes_t read_frames, jack_nframes_t skip_frames) const
+ nframes_t position, nframes_t dur,
+ uint32_t chan_n, nframes_t read_frames, nframes_t skip_frames) const
{
// cerr << _name << "._read_at(" << position << ") - " << _position << endl;
- jack_nframes_t internal_offset = 0;
- jack_nframes_t src_offset = 0;
- jack_nframes_t to_read = 0;
+ nframes_t internal_offset = 0;
+ nframes_t src_offset = 0;
+ nframes_t to_read = 0;
/* precondition: caller has verified that we cover the desired section */
return 0;
}
-jack_nframes_t
-MidiSource::read (MidiRingBuffer& dst, jack_nframes_t start, jack_nframes_t cnt, jack_nframes_t stamp_offset) const
+nframes_t
+MidiSource::read (MidiRingBuffer& dst, nframes_t start, nframes_t cnt, nframes_t stamp_offset) const
{
Glib::Mutex::Lock lm (_lock);
return read_unlocked (dst, start, cnt, stamp_offset);
}
-jack_nframes_t
-MidiSource::write (MidiRingBuffer& dst, jack_nframes_t cnt)
+nframes_t
+MidiSource::write (MidiRingBuffer& dst, nframes_t cnt)
{
Glib::Mutex::Lock lm (_lock);
return write_unlocked (dst, cnt);
}
int
-MidiTrack::no_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, jack_nframes_t offset,
+MidiTrack::no_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nframes_t offset,
bool session_state_changing, bool can_record, bool rec_monitors_input)
{
if (n_outputs().get(DataType::MIDI) == 0) {
}
int
-MidiTrack::roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, jack_nframes_t offset, int declick,
+MidiTrack::roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nframes_t offset, int declick,
bool can_record, bool rec_monitors_input)
{
int dret;
return 0;
}
- jack_nframes_t transport_frame = _session.transport_frame();
+ nframes_t transport_frame = _session.transport_frame();
if ((nframes = check_initial_delay (nframes, offset, transport_frame)) == 0) {
/* need to do this so that the diskstream sets its
}
int
-MidiTrack::silent_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame, jack_nframes_t offset,
+MidiTrack::silent_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame, nframes_t offset,
bool can_record, bool rec_monitors_input)
{
if (n_outputs().get(DataType::MIDI) == 0 && _redirects.empty()) {
void
MidiTrack::process_output_buffers (BufferSet& bufs,
- jack_nframes_t start_frame, jack_nframes_t end_frame,
- jack_nframes_t nframes, jack_nframes_t offset, bool with_redirects, int declick,
+ nframes_t start_frame, nframes_t end_frame,
+ nframes_t nframes, nframes_t offset, bool with_redirects, int declick,
bool meter)
{
/* There's no such thing as a MIDI bus for the time being, to avoid diverging from trunk
}
int
-MidiTrack::export_stuff (BufferSet& bufs, jack_nframes_t nframes, jack_nframes_t end_frame)
+MidiTrack::export_stuff (BufferSet& bufs, nframes_t nframes, nframes_t end_frame)
{
return -1;
}
void
-MidiTrack::set_latency_delay (jack_nframes_t longest_session_latency)
+MidiTrack::set_latency_delay (nframes_t longest_session_latency)
{
Route::set_latency_delay (longest_session_latency);
_diskstream->set_roll_delay (_roll_delay);
void
-MidiTrack::bounce_range (jack_nframes_t start, jack_nframes_t end, InterThreadInfo& itt)
+MidiTrack::bounce_range (nframes_t start, nframes_t end, InterThreadInfo& itt)
{
throw;
//vector<MidiSource*> srcs;
_automation.clear ();
while (in.getline (line, sizeof (line), '\n')) {
- jack_nframes_t when;
+ nframes_t when;
double value;
++linecnt;
return;
}
- Sample* const src = srcbuf.data(nframes);
+ Sample* const src = srcbuf.data();
/* LEFT */
- dst = obufs.get_audio(0).data(nframes);
+ dst = obufs.get_audio(0).data();
if (fabsf ((delta = (left - desired_left))) > 0.002) { // about 1 degree of arc
/* RIGHT */
- dst = obufs.get_audio(1).data(nframes);
+ dst = obufs.get_audio(1).data();
if (fabsf ((delta = (right - desired_right))) > 0.002) { // about 1 degree of arc
Sample* dst;
pan_t* pbuf;
- Sample* const src = srcbuf.data(nframes);
+ Sample* const src = srcbuf.data();
/* fetch positional data */
/* LEFT */
- dst = obufs.get_audio(0).data(nframes);
+ dst = obufs.get_audio(0).data();
pbuf = buffers[0];
for (nframes_t n = 0; n < nframes; ++n) {
/* RIGHT */
- dst = obufs.get_audio(1).data(nframes);
+ dst = obufs.get_audio(1).data();
pbuf = buffers[1];
for (nframes_t n = 0; n < nframes; ++n) {
return;
}
- Sample* const src = srcbuf.data(nframes);
+ Sample* const src = srcbuf.data();
for (n = 0, o = parent.outputs.begin(); o != parent.outputs.end(); ++o, ++n) {
- dst = obufs.get_audio(n).data(nframes);
+ dst = obufs.get_audio(n).data();
#ifdef CAN_INTERP
if (fabsf ((delta = (left_interp - desired_left))) > 0.002) { // about 1 degree of arc
Change Region::HiddenChanged = ARDOUR::new_change ();
/** Basic Region constructor (single source) */
-Region::Region (boost::shared_ptr<Source> src, jack_nframes_t start, jack_nframes_t length, const string& name, DataType type, layer_t layer, Region::Flag flags)
+Region::Region (boost::shared_ptr<Source> src, nframes_t start, nframes_t length, const string& name, DataType type, layer_t layer, Region::Flag flags)
: _name(name)
, _type(type)
, _flags(flags)
}
/** Basic Region constructor (many sources) */
-Region::Region (SourceList& srcs, jack_nframes_t start, jack_nframes_t length, const string& name, DataType type, layer_t layer, Region::Flag flags)
+Region::Region (SourceList& srcs, nframes_t start, nframes_t length, const string& name, DataType type, layer_t layer, Region::Flag flags)
: _name(name)
, _type(type)
, _flags(flags)
}
bool
-Region::verify_length (jack_nframes_t len)
+Region::verify_length (nframes_t len)
{
for (uint32_t n=0; n < _sources.size(); ++n) {
if (_start > _sources[n]->length() - len) {
}
bool
-Region::verify_start_and_length (jack_nframes_t new_start, jack_nframes_t new_length)
+Region::verify_start_and_length (nframes_t new_start, nframes_t new_length)
{
for (uint32_t n=0; n < _sources.size(); ++n) {
if (new_length > _sources[n]->length() - new_start) {
return true;
}
bool
-Region::verify_start (jack_nframes_t pos)
+Region::verify_start (nframes_t pos)
{
for (uint32_t n=0; n < _sources.size(); ++n) {
if (pos > _sources[n]->length() - _length) {
}
bool
-Region::verify_start_mutable (jack_nframes_t& new_start)
+Region::verify_start_mutable (nframes_t& new_start)
{
for (uint32_t n=0; n < _sources.size(); ++n) {
if (new_start > _sources[n]->length() - _length) {
if (_phase_invert) {
for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i) {
- Sample* const sp = i->data(nframes);
+ Sample* const sp = i->data();
for (nframes_t nx = 0; nx < nframes; ++nx) {
sp[nx] *= -gab[nx];
}
} else {
for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i) {
- Sample* const sp = i->data(nframes);
+ Sample* const sp = i->data();
for (nframes_t nx = 0; nx < nframes; ++nx) {
sp[nx] *= gab[nx];
}
for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i) {
- Sample* const sp = i->data(nframes);
+ Sample* const sp = i->data();
apply_gain_to_buffer(sp,nframes,this_gain);
}
}
void
-Route::passthru_silence (jack_nframes_t start_frame, jack_nframes_t end_frame, jack_nframes_t nframes, jack_nframes_t offset, int declick, bool meter)
+Route::passthru_silence (nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset, int declick, bool meter)
{
process_output_buffers (_session.get_silent_buffers (n_process_buffers()), start_frame, end_frame, nframes, offset, true, declick, meter);
}
sync_time_vars();
- Route::set_automation_interval ((jack_nframes_t) ceil ((double) frames_per_second * 0.25));
+ Route::set_automation_interval ((nframes_t) ceil ((double) frames_per_second * 0.25));
// XXX we need some equivalent to this, somehow
// SndFileSource::setup_standard_crossfades (frames_per_second);
boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource>(*src);
if (afs) {
- if (afs->write (buffers.get_audio(n).data(this_chunk), this_chunk) != this_chunk) {
+ if (afs->write (buffers.get_audio(n).data(), this_chunk) != this_chunk) {
goto out;
}
}
return;
}
- const jack_nframes_t end = start + (jack_nframes_t)floor(nframes * _transport_speed);
+ const nframes_t end = start + (nframes_t)floor(nframes * _transport_speed);
BufferSet& bufs = get_scratch_buffers(ChanCount(DataType::AUDIO, 1));
- buf = bufs.get_audio(0).data(nframes);
+ buf = bufs.get_audio(0).data();
points = _tempo_map->get_points (start, end);
if (points == 0) {
cerr << "FIXME: Non-audio export" << endl;
continue;
}
- Sample* port_buffer = port->get_audio_buffer().data(nframes);
+ Sample* port_buffer = port->get_audio_buffer().data();
/* now interleave the data from the channel into the float buffer */
* have been called with the appropriate nframes parameter this cycle.
*/
int
-Session::send_full_time_code(jack_nframes_t nframes)
+Session::send_full_time_code(nframes_t nframes)
{
/* This function could easily send at a given frame offset, but would
* that be useful? Does ardour do sub-block accurate locating? [DR] */
if (((mtc_smpte_bits >> 5) != MIDI::MTC_25_FPS) && (transmitting_smpte_time.frames % 2)) {
// start MTC quarter frame transmission on an even frame
SMPTE::increment( transmitting_smpte_time );
- outbound_mtc_smpte_frame += (jack_nframes_t) _frames_per_smpte_frame;
+ outbound_mtc_smpte_frame += (nframes_t) _frames_per_smpte_frame;
}
// Compensate for audio latency
* earlier already this cycle by send_full_time_code)
*/
int
-Session::send_midi_time_code_for_cycle(jack_nframes_t nframes)
+Session::send_midi_time_code_for_cycle(nframes_t nframes)
{
assert (next_quarter_frame_to_send >= 0);
assert (next_quarter_frame_to_send <= 7);
}
/* Duration of one quarter frame */
- jack_nframes_t quarter_frame_duration = ((long) _frames_per_smpte_frame) >> 2;
+ nframes_t quarter_frame_duration = ((long) _frames_per_smpte_frame) >> 2;
//cerr << "(MTC) TR: " << _transport_frame << " - SF: " << outbound_mtc_smpte_frame
//<< " - NQ: " << next_quarter_frame_to_send << " - FD" << quarter_frame_duration << endl;
break;
}
- const jack_nframes_t msg_time = (outbound_mtc_smpte_frame
+ const nframes_t msg_time = (outbound_mtc_smpte_frame
+ (quarter_frame_duration * next_quarter_frame_to_send));
// This message must fall within this block or something is broken
assert(msg_time >= _transport_frame);
assert(msg_time < _transport_frame + nframes);
- jack_nframes_t out_stamp = msg_time - _transport_frame;
+ nframes_t out_stamp = msg_time - _transport_frame;
assert(out_stamp < nframes);
if (!_mtc_port->midimsg (mtc_msg, 2, out_stamp)) {
record_active = actively_recording(); // || (get_record_enabled() && get_punch_in());
- const jack_nframes_t start_frame = _transport_frame;
- const jack_nframes_t end_frame = _transport_frame + (jack_nframes_t)floor(nframes * _transport_speed);
+ const nframes_t start_frame = _transport_frame;
+ const nframes_t end_frame = _transport_frame + (nframes_t)floor(nframes * _transport_speed);
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
declick = -1;
}
- const jack_nframes_t start_frame = _transport_frame;
- const jack_nframes_t end_frame = _transport_frame + lrintf(nframes * _transport_speed);
+ const nframes_t start_frame = _transport_frame;
+ const nframes_t end_frame = _transport_frame + lrintf(nframes * _transport_speed);
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
}
int
-SMFSource::update_header (jack_nframes_t when, struct tm&, time_t)
+SMFSource::update_header (nframes_t when, struct tm&, time_t)
{
_timeline_position = when;
return flush_header();
*/
/*
long
-SMFSource::find_first_event_after(jack_nframes_t start)
+SMFSource::find_first_event_after(nframes_t start)
{
// FIXME: obviously this is slooow
return ev.size;
}
-jack_nframes_t
-SMFSource::read_unlocked (MidiRingBuffer& dst, jack_nframes_t start, jack_nframes_t cnt, jack_nframes_t stamp_offset) const
+nframes_t
+SMFSource::read_unlocked (MidiRingBuffer& dst, nframes_t start, nframes_t cnt, nframes_t stamp_offset) const
{
//cerr << "SMF - read " << start << ", count=" << cnt << ", offset=" << stamp_offset << endl;
- jack_nframes_t time = 0;
+ nframes_t time = 0;
// FIXME: ugh
unsigned char ev_buf[MidiBuffer::max_event_size()];
return cnt;
}
-jack_nframes_t
-SMFSource::write_unlocked (MidiRingBuffer& src, jack_nframes_t cnt)
+nframes_t
+SMFSource::write_unlocked (MidiRingBuffer& src, nframes_t cnt)
{
//cerr << "SMF WRITE -- " << _length << "--" << cnt << endl;
}
void
-Source::update_length (jack_nframes_t pos, jack_nframes_t cnt)
+Source::update_length (nframes_t pos, nframes_t cnt)
{
if (pos + cnt > _length) {
_length = pos+cnt;