mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-17 12:16:30 +01:00
optimize some performance bottlenecks; remove jack_nframes_t that crept back into the code
git-svn-id: svn://localhost/ardour2/branches/midi@1779 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
5a1ca70f07
commit
a8da89d745
46 changed files with 291 additions and 306 deletions
|
|
@ -28,27 +28,31 @@ namespace ARDOUR {
|
||||||
|
|
||||||
/** Apply a declicked gain to the audio buffers of @a bufs */
|
/** Apply a declicked gain to the audio buffers of @a bufs */
|
||||||
void
|
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)
|
if (bufs.count().get(DataType::AUDIO) == 0)
|
||||||
return;
|
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 we don't need to declick, defer to apply_simple_gain
|
||||||
|
|
||||||
if (initial == target) {
|
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;
|
gain_t delta;
|
||||||
double fractional_shift = -1.0/declick;
|
double fractional_shift = -1.0/declick;
|
||||||
double fractional_pos;
|
double fractional_pos;
|
||||||
gain_t polscale = invert_polarity ? -1.0f : 1.0f;
|
gain_t polscale = invert_polarity ? -1.0f : 1.0f;
|
||||||
|
|
||||||
if (nframes == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (target < initial) {
|
if (target < initial) {
|
||||||
/* fade out: remove more and more of delta from initial */
|
/* fade out: remove more and more of delta from initial */
|
||||||
delta = -(initial - target);
|
delta = -(initial - target);
|
||||||
|
|
@ -58,11 +62,11 @@ Amp::run (BufferSet& bufs, jack_nframes_t nframes, gain_t initial, gain_t target
|
||||||
}
|
}
|
||||||
|
|
||||||
for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i) {
|
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;
|
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))));
|
buffer[nx] *= polscale * (initial + (delta * (0.5 + 0.5 * cos (M_PI * fractional_pos))));
|
||||||
fractional_pos += fractional_shift;
|
fractional_pos += fractional_shift;
|
||||||
}
|
}
|
||||||
|
|
@ -78,20 +82,15 @@ Amp::run (BufferSet& bufs, jack_nframes_t nframes, gain_t initial, gain_t target
|
||||||
if (target == 0.0) {
|
if (target == 0.0) {
|
||||||
memset (&buffer[declick], 0, sizeof (Sample) * (nframes - declick));
|
memset (&buffer[declick], 0, sizeof (Sample) * (nframes - declick));
|
||||||
} else if (target != 1.0) {
|
} else if (target != 1.0) {
|
||||||
for (jack_nframes_t nx = declick; nx < nframes; ++nx) {
|
apply_gain_to_buffer (&buffer[declick], nframes - declick, target);
|
||||||
buffer[nx] *= target;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,9 @@ class BufferSet;
|
||||||
*/
|
*/
|
||||||
class Amp {
|
class Amp {
|
||||||
public:
|
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);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,11 @@ class AudioPort : public Port {
|
||||||
free (_port);
|
free (_port);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cycle_start(jack_nframes_t nframes);
|
void cycle_start(nframes_t nframes) {
|
||||||
void cycle_end();
|
_buffer.set_data ((Sample*) jack_port_get_buffer (_port, nframes), nframes);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cycle_end() {}
|
||||||
|
|
||||||
DataType type() const { return DataType(DataType::AUDIO); }
|
DataType type() const { return DataType(DataType::AUDIO); }
|
||||||
|
|
||||||
|
|
@ -72,8 +75,8 @@ class AudioPort : public Port {
|
||||||
uint32_t short_overs () const { return _short_overs; }
|
uint32_t short_overs () const { return _short_overs; }
|
||||||
uint32_t long_overs () const { return _long_overs; }
|
uint32_t long_overs () const { return _long_overs; }
|
||||||
|
|
||||||
static void set_short_over_length (jack_nframes_t);
|
static void set_short_over_length (nframes_t);
|
||||||
static void set_long_over_length (jack_nframes_t);
|
static void set_long_over_length (nframes_t);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class AudioEngine;
|
friend class AudioEngine;
|
||||||
|
|
@ -85,14 +88,14 @@ class AudioPort : public Port {
|
||||||
|
|
||||||
AudioBuffer _buffer;
|
AudioBuffer _buffer;
|
||||||
|
|
||||||
jack_nframes_t _overlen;
|
nframes_t _overlen;
|
||||||
jack_default_audio_sample_t _peak;
|
jack_default_audio_sample_t _peak;
|
||||||
float _peak_db;
|
float _peak_db;
|
||||||
uint32_t _short_overs;
|
uint32_t _short_overs;
|
||||||
uint32_t _long_overs;
|
uint32_t _long_overs;
|
||||||
|
|
||||||
static jack_nframes_t _long_over_length;
|
static nframes_t _long_over_length;
|
||||||
static jack_nframes_t _short_over_length;
|
static nframes_t _short_over_length;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ARDOUR
|
} // namespace ARDOUR
|
||||||
|
|
|
||||||
|
|
@ -68,8 +68,6 @@ class AudioEngine : public sigc::trackable
|
||||||
int start ();
|
int start ();
|
||||||
bool running() const { return _running; }
|
bool running() const { return _running; }
|
||||||
|
|
||||||
int run_process_cycle (ARDOUR::Session*, jack_nframes_t nframes);
|
|
||||||
|
|
||||||
Glib::Mutex& process_lock() { return _process_lock; }
|
Glib::Mutex& process_lock() { return _process_lock; }
|
||||||
|
|
||||||
nframes_t frame_rate();
|
nframes_t frame_rate();
|
||||||
|
|
|
||||||
|
|
@ -176,10 +176,10 @@ class AudioRegion : public Region
|
||||||
protected:
|
protected:
|
||||||
int set_live_state (const XMLNode&, Change&, bool send);
|
int set_live_state (const XMLNode&, Change&, bool send);
|
||||||
|
|
||||||
virtual bool verify_start (jack_nframes_t);
|
virtual bool verify_start (nframes_t);
|
||||||
virtual bool verify_start_and_length (jack_nframes_t, jack_nframes_t);
|
virtual bool verify_start_and_length (nframes_t, nframes_t);
|
||||||
virtual bool verify_start_mutable (jack_nframes_t&_start);
|
virtual bool verify_start_mutable (nframes_t&_start);
|
||||||
virtual bool verify_length (jack_nframes_t);
|
virtual bool verify_length (nframes_t);
|
||||||
/*virtual void recompute_at_start () = 0;
|
/*virtual void recompute_at_start () = 0;
|
||||||
virtual void recompute_at_end () = 0;*/
|
virtual void recompute_at_end () = 0;*/
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -60,12 +60,12 @@ public:
|
||||||
bool silent() const { return _silent; }
|
bool silent() const { return _silent; }
|
||||||
|
|
||||||
/** Clear (eg zero, or empty) buffer starting at TIME @a offset */
|
/** 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 */
|
/** Clear the entire buffer */
|
||||||
virtual void clear() { silence(_capacity, 0); }
|
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:
|
protected:
|
||||||
Buffer(DataType type, size_t capacity)
|
Buffer(DataType type, size_t capacity)
|
||||||
|
|
@ -95,7 +95,7 @@ public:
|
||||||
|
|
||||||
~AudioBuffer();
|
~AudioBuffer();
|
||||||
|
|
||||||
void silence(jack_nframes_t len, jack_nframes_t offset=0)
|
void silence(nframes_t len, nframes_t offset=0)
|
||||||
{
|
{
|
||||||
if (!_silent) {
|
if (!_silent) {
|
||||||
assert(_capacity > 0);
|
assert(_capacity > 0);
|
||||||
|
|
@ -108,25 +108,25 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Read @a len frames FROM THE START OF @a src into self at @a offset */
|
/** 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(_capacity > 0);
|
||||||
assert(src.type() == _type == DataType::AUDIO);
|
assert(src.type() == _type == DataType::AUDIO);
|
||||||
assert(offset + len <= _capacity);
|
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();
|
_silent = src.silent();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 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 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(_capacity > 0);
|
||||||
assert(offset + len <= _capacity);
|
assert(offset + len <= _capacity);
|
||||||
|
|
||||||
Sample* const dst_raw = _data + offset;
|
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];
|
dst_raw[n] += src_raw[n];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -135,20 +135,20 @@ public:
|
||||||
|
|
||||||
/** Accumulate (add) @a len frames FROM THE START OF @a src into self at @a offset
|
/** Accumulate (add) @a len frames FROM THE START OF @a src into self at @a offset
|
||||||
* scaling by @a gain_coeff */
|
* 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(_capacity > 0);
|
||||||
assert(offset + len <= _capacity);
|
assert(offset + len <= _capacity);
|
||||||
|
|
||||||
Sample* const dst_raw = _data + offset;
|
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);
|
mix_buffers_with_gain (dst_raw, src_raw, len, gain_coeff);
|
||||||
|
|
||||||
_silent = ( (src.silent() && _silent) || (_silent && gain_coeff == 0) );
|
_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);
|
apply_gain_to_buffer (_data + offset, len, gain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -165,10 +165,13 @@ public:
|
||||||
_silent = false;
|
_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; }
|
{ 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; }
|
{ assert(offset + nframes <= _capacity); return _data + offset; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -190,9 +193,9 @@ public:
|
||||||
|
|
||||||
~MidiBuffer();
|
~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);
|
bool push_back(const MidiEvent& event);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@
|
||||||
#ifndef __ardour_data_type_h__
|
#ifndef __ardour_data_type_h__
|
||||||
#define __ardour_data_type_h__
|
#define __ardour_data_type_h__
|
||||||
|
|
||||||
#include <cassert>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <ardour/data_type.h>
|
#include <ardour/data_type.h>
|
||||||
#include <jack/jack.h>
|
#include <jack/jack.h>
|
||||||
|
|
|
||||||
|
|
@ -96,11 +96,11 @@ class IO : public PBD::StatefulDestructible
|
||||||
|
|
||||||
virtual void silence (nframes_t, nframes_t offset);
|
virtual void silence (nframes_t, nframes_t offset);
|
||||||
|
|
||||||
void collect_input (BufferSet& bufs, jack_nframes_t nframes, jack_nframes_t offset);
|
void collect_input (BufferSet& bufs, nframes_t nframes, nframes_t offset);
|
||||||
void deliver_output (BufferSet& bufs, jack_nframes_t start_frame, jack_nframes_t end_frame,
|
void deliver_output (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame,
|
||||||
jack_nframes_t nframes, jack_nframes_t offset);
|
nframes_t nframes, nframes_t offset);
|
||||||
void just_meter_input (jack_nframes_t start_frame, jack_nframes_t end_frame,
|
void just_meter_input (nframes_t start_frame, nframes_t end_frame,
|
||||||
jack_nframes_t nframes, jack_nframes_t offset);
|
nframes_t nframes, nframes_t offset);
|
||||||
|
|
||||||
virtual void set_gain (gain_t g, void *src);
|
virtual void set_gain (gain_t g, void *src);
|
||||||
void inc_gain (gain_t delta, void *src);
|
void inc_gain (gain_t delta, void *src);
|
||||||
|
|
@ -216,11 +216,11 @@ class IO : public PBD::StatefulDestructible
|
||||||
|
|
||||||
/* automation */
|
/* automation */
|
||||||
|
|
||||||
static void set_automation_interval (jack_nframes_t frames) {
|
static void set_automation_interval (nframes_t frames) {
|
||||||
_automation_interval = frames;
|
_automation_interval = frames;
|
||||||
}
|
}
|
||||||
|
|
||||||
static jack_nframes_t automation_interval() {
|
static nframes_t automation_interval() {
|
||||||
return _automation_interval;
|
return _automation_interval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ public:
|
||||||
void reset_max ();
|
void reset_max ();
|
||||||
|
|
||||||
/** Compute peaks */
|
/** 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) {
|
float peak_power (uint32_t n) {
|
||||||
if (n < _visible_peak_power.size()) {
|
if (n < _visible_peak_power.size()) {
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ class MidiDiskstream : public Diskstream
|
||||||
float playback_buffer_load() const;
|
float playback_buffer_load() const;
|
||||||
float capture_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_record_enabled (bool yn);
|
||||||
|
|
||||||
|
|
@ -99,21 +99,21 @@ class MidiDiskstream : public Diskstream
|
||||||
|
|
||||||
void set_pending_overwrite(bool);
|
void set_pending_overwrite(bool);
|
||||||
int overwrite_existing_buffers ();
|
int overwrite_existing_buffers ();
|
||||||
void set_block_size (jack_nframes_t);
|
void set_block_size (nframes_t);
|
||||||
int internal_playback_seek (jack_nframes_t distance);
|
int internal_playback_seek (nframes_t distance);
|
||||||
int can_internal_playback_seek (jack_nframes_t distance);
|
int can_internal_playback_seek (nframes_t distance);
|
||||||
int rename_write_sources ();
|
int rename_write_sources ();
|
||||||
void reset_write_sources (bool, bool force = false);
|
void reset_write_sources (bool, bool force = false);
|
||||||
void non_realtime_input_change ();
|
void non_realtime_input_change ();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int seek (jack_nframes_t which_sample, bool complete_refill = false);
|
int seek (nframes_t which_sample, bool complete_refill = false);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class MidiTrack;
|
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);
|
int process (nframes_t transport_frame, nframes_t nframes, nframes_t offset, bool can_record, bool rec_monitors_input);
|
||||||
bool commit (jack_nframes_t nframes);
|
bool commit (nframes_t nframes);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
@ -123,7 +123,7 @@ class MidiDiskstream : public Diskstream
|
||||||
|
|
||||||
int do_refill_with_alloc();
|
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 finish_capture (bool rec_monitors_input);
|
||||||
void transport_stopped (struct tm&, time_t, bool abort);
|
void transport_stopped (struct tm&, time_t, bool abort);
|
||||||
|
|
@ -139,7 +139,7 @@ class MidiDiskstream : public Diskstream
|
||||||
int use_pending_capture_data (XMLNode& node);
|
int use_pending_capture_data (XMLNode& node);
|
||||||
|
|
||||||
void get_input_sources ();
|
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 set_align_style_from_io();
|
||||||
|
|
||||||
void engage_record_enable ();
|
void engage_record_enable ();
|
||||||
|
|
@ -157,7 +157,7 @@ class MidiDiskstream : public Diskstream
|
||||||
RingBufferNPT<CaptureTransition>* _capture_transition_buf;
|
RingBufferNPT<CaptureTransition>* _capture_transition_buf;
|
||||||
//RingBufferNPT<RawMidi>::rw_vector _playback_vector;
|
//RingBufferNPT<RawMidi>::rw_vector _playback_vector;
|
||||||
//RingBufferNPT<RawMidi>::rw_vector _capture_vector;
|
//RingBufferNPT<RawMidi>::rw_vector _capture_vector;
|
||||||
jack_nframes_t _last_flush_frame;
|
nframes_t _last_flush_frame;
|
||||||
};
|
};
|
||||||
|
|
||||||
}; /* namespace ARDOUR */
|
}; /* namespace ARDOUR */
|
||||||
|
|
|
||||||
|
|
@ -41,13 +41,13 @@ public:
|
||||||
MidiPlaylist (Session&, const XMLNode&, bool hidden = false);
|
MidiPlaylist (Session&, const XMLNode&, bool hidden = false);
|
||||||
MidiPlaylist (Session&, string name, 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, 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);
|
string name, bool hidden = false);
|
||||||
|
|
||||||
~MidiPlaylist ();
|
~MidiPlaylist ();
|
||||||
|
|
||||||
nframes_t read (MidiRingBuffer& buf,
|
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&);
|
int set_state (const XMLNode&);
|
||||||
UndoAction get_memento() const;
|
UndoAction get_memento() const;
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ class MidiPort : public Port {
|
||||||
return _buffer;
|
return _buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cycle_start(jack_nframes_t nframes);
|
void cycle_start(nframes_t nframes);
|
||||||
void cycle_end();
|
void cycle_end();
|
||||||
|
|
||||||
size_t capacity() { return _buffer.capacity(); }
|
size_t capacity() { return _buffer.capacity(); }
|
||||||
|
|
@ -61,7 +61,7 @@ class MidiPort : public Port {
|
||||||
/* engine isn't supposed to access below here */
|
/* engine isn't supposed to access below here */
|
||||||
|
|
||||||
MidiBuffer _buffer;
|
MidiBuffer _buffer;
|
||||||
jack_nframes_t _nframes_this_cycle;
|
nframes_t _nframes_this_cycle;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ARDOUR
|
} // namespace ARDOUR
|
||||||
|
|
|
||||||
|
|
@ -50,16 +50,16 @@ class MidiRegion : public Region
|
||||||
|
|
||||||
boost::shared_ptr<MidiSource> midi_source (uint32_t n=0) const;
|
boost::shared_ptr<MidiSource> midi_source (uint32_t n=0) const;
|
||||||
|
|
||||||
jack_nframes_t read_at (MidiRingBuffer& dst,
|
nframes_t read_at (MidiRingBuffer& dst,
|
||||||
jack_nframes_t position,
|
nframes_t position,
|
||||||
jack_nframes_t dur,
|
nframes_t dur,
|
||||||
uint32_t chan_n = 0,
|
uint32_t chan_n = 0,
|
||||||
jack_nframes_t read_frames = 0,
|
nframes_t read_frames = 0,
|
||||||
jack_nframes_t skip_frames = 0) const;
|
nframes_t skip_frames = 0) const;
|
||||||
|
|
||||||
jack_nframes_t master_read_at (MidiRingBuffer& dst,
|
nframes_t master_read_at (MidiRingBuffer& dst,
|
||||||
jack_nframes_t position,
|
nframes_t position,
|
||||||
jack_nframes_t dur,
|
nframes_t dur,
|
||||||
uint32_t chan_n=0) const;
|
uint32_t chan_n=0) const;
|
||||||
|
|
||||||
XMLNode& state (bool);
|
XMLNode& state (bool);
|
||||||
|
|
@ -72,10 +72,10 @@ class MidiRegion : public Region
|
||||||
private:
|
private:
|
||||||
friend class RegionFactory;
|
friend class RegionFactory;
|
||||||
|
|
||||||
MidiRegion (boost::shared_ptr<MidiSource>, jack_nframes_t start, jack_nframes_t length);
|
MidiRegion (boost::shared_ptr<MidiSource>, nframes_t start, 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 (boost::shared_ptr<MidiSource>, nframes_t start, 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 (SourceList &, nframes_t start, 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<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<const MidiRegion>);
|
||||||
MidiRegion (boost::shared_ptr<MidiSource>, const XMLNode&);
|
MidiRegion (boost::shared_ptr<MidiSource>, const XMLNode&);
|
||||||
MidiRegion (SourceList &, const XMLNode&);
|
MidiRegion (SourceList &, const XMLNode&);
|
||||||
|
|
@ -84,12 +84,12 @@ class MidiRegion : public Region
|
||||||
friend class Playlist;
|
friend class Playlist;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
jack_nframes_t _read_at (const SourceList&, MidiRingBuffer& dst,
|
nframes_t _read_at (const SourceList&, MidiRingBuffer& dst,
|
||||||
jack_nframes_t position,
|
nframes_t position,
|
||||||
jack_nframes_t dur,
|
nframes_t dur,
|
||||||
uint32_t chan_n = 0,
|
uint32_t chan_n = 0,
|
||||||
jack_nframes_t read_frames = 0,
|
nframes_t read_frames = 0,
|
||||||
jack_nframes_t skip_frames = 0) const;
|
nframes_t skip_frames = 0) const;
|
||||||
|
|
||||||
void recompute_at_start ();
|
void recompute_at_start ();
|
||||||
void recompute_at_end ();
|
void recompute_at_end ();
|
||||||
|
|
|
||||||
|
|
@ -94,10 +94,10 @@ public:
|
||||||
|
|
||||||
/** Read events all events up to time @a end into @a out, leaving stamps intact.
|
/** Read events all events up to time @a end into @a out, leaving stamps intact.
|
||||||
* Any events before @a start will be dropped. */
|
* 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 */
|
/** 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 void clear_event(size_t index);
|
||||||
|
|
||||||
|
|
@ -128,7 +128,7 @@ MidiRingBuffer::clear_event(size_t index)
|
||||||
inline size_t
|
inline size_t
|
||||||
MidiRingBuffer::write (const MidiEvent& ev)
|
MidiRingBuffer::write (const MidiEvent& ev)
|
||||||
{
|
{
|
||||||
//static jack_nframes_t last_write_time = 0;
|
//static nframes_t last_write_time = 0;
|
||||||
|
|
||||||
assert(ev.size > 0);
|
assert(ev.size > 0);
|
||||||
|
|
||||||
|
|
@ -162,13 +162,13 @@ MidiRingBuffer::write (const MidiEvent& ev)
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t
|
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)
|
if (read_space() == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
size_t priv_read_ptr = g_atomic_int_get(&_read_ptr);
|
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 count = 0;
|
||||||
size_t limit = read_space();
|
size_t limit = read_space();
|
||||||
|
|
||||||
|
|
@ -205,7 +205,7 @@ MidiRingBuffer::read(MidiBuffer& dst, jack_nframes_t start, jack_nframes_t end)
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t
|
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 num_events = in.size();
|
||||||
size_t to_write = std::min(write_space(), num_events);
|
size_t to_write = std::min(write_space(), num_events);
|
||||||
|
|
|
||||||
|
|
@ -47,8 +47,8 @@ class MidiSource : public Source
|
||||||
MidiSource (Session& session, const XMLNode&);
|
MidiSource (Session& session, const XMLNode&);
|
||||||
virtual ~MidiSource ();
|
virtual ~MidiSource ();
|
||||||
|
|
||||||
virtual jack_nframes_t read (MidiRingBuffer& dst, jack_nframes_t start, jack_nframes_t cnt, jack_nframes_t stamp_offset) const;
|
virtual nframes_t read (MidiRingBuffer& dst, nframes_t start, nframes_t cnt, nframes_t stamp_offset) const;
|
||||||
virtual jack_nframes_t write (MidiRingBuffer& src, jack_nframes_t cnt);
|
virtual nframes_t write (MidiRingBuffer& src, nframes_t cnt);
|
||||||
|
|
||||||
virtual void mark_for_remove() = 0;
|
virtual void mark_for_remove() = 0;
|
||||||
virtual void mark_streaming_write_completed () {}
|
virtual void mark_streaming_write_completed () {}
|
||||||
|
|
@ -64,14 +64,14 @@ class MidiSource : public Source
|
||||||
// The MIDI equivalent to "peaks"
|
// The MIDI equivalent to "peaks"
|
||||||
static int start_view_data_thread ();
|
static int start_view_data_thread ();
|
||||||
static void stop_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 ();
|
XMLNode& get_state ();
|
||||||
int set_state (const XMLNode&);
|
int set_state (const XMLNode&);
|
||||||
|
|
||||||
protected:
|
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 nframes_t read_unlocked (MidiRingBuffer& dst, nframes_t start, nframes_t cnt, nframes_t stamp_offset) const = 0;
|
||||||
virtual jack_nframes_t write_unlocked (MidiRingBuffer& dst, jack_nframes_t cnt) = 0;
|
virtual nframes_t write_unlocked (MidiRingBuffer& dst, nframes_t cnt) = 0;
|
||||||
|
|
||||||
mutable Glib::Mutex _lock;
|
mutable Glib::Mutex _lock;
|
||||||
string _captured_for;
|
string _captured_for;
|
||||||
|
|
|
||||||
|
|
@ -39,18 +39,18 @@ public:
|
||||||
|
|
||||||
int set_name (string str, void *src);
|
int set_name (string str, void *src);
|
||||||
|
|
||||||
int roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t end_frame,
|
int roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
|
||||||
jack_nframes_t offset, int declick, bool can_record, bool rec_monitors_input);
|
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,
|
int no_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
|
||||||
jack_nframes_t offset, bool state_changing, bool can_record, bool rec_monitors_input);
|
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,
|
int silent_roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
|
||||||
jack_nframes_t offset, bool can_record, bool rec_monitors_input);
|
nframes_t offset, bool can_record, bool rec_monitors_input);
|
||||||
|
|
||||||
void process_output_buffers (BufferSet& bufs,
|
void process_output_buffers (BufferSet& bufs,
|
||||||
jack_nframes_t start_frame, jack_nframes_t end_frame,
|
nframes_t start_frame, nframes_t end_frame,
|
||||||
jack_nframes_t nframes, jack_nframes_t offset, bool with_redirects, int declick,
|
nframes_t nframes, nframes_t offset, bool with_redirects, int declick,
|
||||||
bool meter);
|
bool meter);
|
||||||
|
|
||||||
boost::shared_ptr<MidiDiskstream> midi_diskstream() const;
|
boost::shared_ptr<MidiDiskstream> midi_diskstream() const;
|
||||||
|
|
@ -60,16 +60,16 @@ public:
|
||||||
|
|
||||||
int set_mode (TrackMode m);
|
int set_mode (TrackMode m);
|
||||||
|
|
||||||
void set_latency_delay (jack_nframes_t);
|
void set_latency_delay (nframes_t);
|
||||||
|
|
||||||
int export_stuff (BufferSet& bufs,
|
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 freeze (InterThreadInfo&);
|
||||||
void unfreeze ();
|
void unfreeze ();
|
||||||
|
|
||||||
void bounce (InterThreadInfo&);
|
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);
|
int set_state(const XMLNode& node);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ class Port : public sigc::trackable {
|
||||||
|
|
||||||
virtual DataType type() const = 0;
|
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 void cycle_end() {}
|
||||||
|
|
||||||
virtual Buffer& get_buffer() = 0;
|
virtual Buffer& get_buffer() = 0;
|
||||||
|
|
|
||||||
|
|
@ -213,10 +213,10 @@ class Region : public PBD::StatefulDestructible, public boost::enable_shared_fro
|
||||||
void maybe_uncopy ();
|
void maybe_uncopy ();
|
||||||
void first_edit ();
|
void first_edit ();
|
||||||
|
|
||||||
virtual bool verify_start (jack_nframes_t);
|
virtual bool verify_start (nframes_t);
|
||||||
virtual bool verify_start_and_length (jack_nframes_t, jack_nframes_t);
|
virtual bool verify_start_and_length (nframes_t, nframes_t);
|
||||||
virtual bool verify_start_mutable (jack_nframes_t&_start);
|
virtual bool verify_start_mutable (nframes_t&_start);
|
||||||
virtual bool verify_length (jack_nframes_t);
|
virtual bool verify_length (nframes_t);
|
||||||
virtual void recompute_at_start () = 0;
|
virtual void recompute_at_start () = 0;
|
||||||
virtual void recompute_at_end () = 0;
|
virtual void recompute_at_end () = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1319,13 +1319,13 @@ class Session : public PBD::StatefulDestructible
|
||||||
/* cache the most-recently requested time conversions. This helps when we
|
/* cache the most-recently requested time conversions. This helps when we
|
||||||
* have multiple clocks showing the same time (e.g. the transport frame) */
|
* have multiple clocks showing the same time (e.g. the transport frame) */
|
||||||
bool last_smpte_valid;
|
bool last_smpte_valid;
|
||||||
jack_nframes_t last_smpte_when;
|
nframes_t last_smpte_when;
|
||||||
SMPTE::Time last_smpte;
|
SMPTE::Time last_smpte;
|
||||||
|
|
||||||
bool _send_smpte_update; ///< Flag to send a full frame (SMPTE) MTC message this cycle
|
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_full_time_code(nframes_t nframes);
|
||||||
int send_midi_time_code_for_cycle(jack_nframes_t nframes);
|
int send_midi_time_code_for_cycle(nframes_t nframes);
|
||||||
|
|
||||||
nframes_t adjust_apparent_position (nframes_t frames);
|
nframes_t adjust_apparent_position (nframes_t frames);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,8 +56,8 @@ class SMFSource : public MidiSource {
|
||||||
*/
|
*/
|
||||||
// FIXME and thus are useless for MIDI.. but make MidiDiskstream compile easier! :)
|
// FIXME and thus are useless for MIDI.. but make MidiDiskstream compile easier! :)
|
||||||
|
|
||||||
virtual jack_nframes_t last_capture_start_frame() const { return 0; }
|
virtual nframes_t last_capture_start_frame() const { return 0; }
|
||||||
virtual void mark_capture_start (jack_nframes_t) {}
|
virtual void mark_capture_start (nframes_t) {}
|
||||||
virtual void mark_capture_end () {}
|
virtual void mark_capture_end () {}
|
||||||
virtual void clear_capture_marks() {}
|
virtual void clear_capture_marks() {}
|
||||||
|
|
||||||
|
|
@ -68,7 +68,7 @@ class SMFSource : public MidiSource {
|
||||||
void set_allow_remove_if_empty (bool yn);
|
void set_allow_remove_if_empty (bool yn);
|
||||||
void mark_for_remove();
|
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_header ();
|
||||||
int flush_footer ();
|
int flush_footer ();
|
||||||
|
|
||||||
|
|
@ -81,7 +81,7 @@ class SMFSource : public MidiSource {
|
||||||
string take_id() const { return _take_id; }
|
string take_id() const { return _take_id; }
|
||||||
|
|
||||||
static void set_search_path (string);
|
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 ();
|
XMLNode& get_state ();
|
||||||
int set_state (const XMLNode&);
|
int set_state (const XMLNode&);
|
||||||
|
|
@ -90,8 +90,8 @@ class SMFSource : public MidiSource {
|
||||||
|
|
||||||
int init (string idstr, bool must_exist);
|
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;
|
nframes_t read_unlocked (MidiRingBuffer& dst, nframes_t start, nframes_t cn, nframes_t stamp_offset) const;
|
||||||
jack_nframes_t write_unlocked (MidiRingBuffer& dst, jack_nframes_t cnt);
|
nframes_t write_unlocked (MidiRingBuffer& dst, nframes_t cnt);
|
||||||
|
|
||||||
bool find (std::string path, bool must_exist, bool& is_new);
|
bool find (std::string path, bool must_exist, bool& is_new);
|
||||||
bool removable() const;
|
bool removable() const;
|
||||||
|
|
@ -112,7 +112,7 @@ class SMFSource : public MidiSource {
|
||||||
bool _allow_remove_if_empty;
|
bool _allow_remove_if_empty;
|
||||||
uint64_t _timeline_position;
|
uint64_t _timeline_position;
|
||||||
FILE* _fd;
|
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 _track_size;
|
||||||
uint32_t _header_size; // size of SMF header, including MTrk chunk header
|
uint32_t _header_size; // size of SMF header, including MTrk chunk header
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,9 +52,9 @@ class Source : public PBD::StatefulDestructible
|
||||||
void stamp (time_t when) { _timestamp = when; }
|
void stamp (time_t when) { _timestamp = when; }
|
||||||
|
|
||||||
/** @return the number of items in this source */
|
/** @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_for_remove() = 0;
|
||||||
virtual void mark_streaming_write_completed () = 0;
|
virtual void mark_streaming_write_completed () = 0;
|
||||||
|
|
@ -74,13 +74,13 @@ class Source : public PBD::StatefulDestructible
|
||||||
static sigc::signal<void,Source*> SourceCreated;
|
static sigc::signal<void,Source*> SourceCreated;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void update_length (jack_nframes_t pos, jack_nframes_t cnt);
|
void update_length (nframes_t pos, nframes_t cnt);
|
||||||
|
|
||||||
Session& _session;
|
Session& _session;
|
||||||
string _name;
|
string _name;
|
||||||
DataType _type;
|
DataType _type;
|
||||||
time_t _timestamp;
|
time_t _timestamp;
|
||||||
jack_nframes_t _length;
|
nframes_t _length;
|
||||||
|
|
||||||
Glib::Mutex playlist_lock;
|
Glib::Mutex playlist_lock;
|
||||||
typedef std::map<boost::shared_ptr<ARDOUR::Playlist>, uint32_t > PlaylistMap;
|
typedef std::map<boost::shared_ptr<ARDOUR::Playlist>, uint32_t > PlaylistMap;
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,8 @@
|
||||||
using namespace ARDOUR;
|
using namespace ARDOUR;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
jack_nframes_t AudioPort::_short_over_length = 2;
|
nframes_t AudioPort::_short_over_length = 2;
|
||||||
jack_nframes_t AudioPort::_long_over_length = 10;
|
nframes_t AudioPort::_long_over_length = 10;
|
||||||
|
|
||||||
AudioPort::AudioPort(jack_port_t* p)
|
AudioPort::AudioPort(jack_port_t* p)
|
||||||
: Port(p)
|
: Port(p)
|
||||||
|
|
@ -51,23 +51,4 @@ AudioPort::reset()
|
||||||
reset_meters ();
|
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...
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -586,7 +586,7 @@ AudioTrack::roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
for (i = 0, n = 1; i < limit; ++i, ++n) {
|
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)) {
|
if (n < diskstream->n_channels().get(DataType::AUDIO)) {
|
||||||
tmpb = diskstream->playback_buffer(n);
|
tmpb = diskstream->playback_buffer(n);
|
||||||
if (tmpb!=0) {
|
if (tmpb!=0) {
|
||||||
|
|
@ -652,26 +652,26 @@ AudioTrack::export_stuff (BufferSet& buffers, nframes_t start, nframes_t nframes
|
||||||
boost::shared_ptr<AudioPlaylist> apl = boost::dynamic_pointer_cast<AudioPlaylist>(diskstream->playlist());
|
boost::shared_ptr<AudioPlaylist> apl = boost::dynamic_pointer_cast<AudioPlaylist>(diskstream->playlist());
|
||||||
assert(apl);
|
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) {
|
mix_buffer, gain_buffer, start, nframes) != nframes) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(buffers.count().get(DataType::AUDIO) >= 1);
|
assert(buffers.count().get(DataType::AUDIO) >= 1);
|
||||||
uint32_t n=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();
|
BufferSet::audio_iterator bi = buffers.audio_begin();
|
||||||
++bi;
|
++bi;
|
||||||
for ( ; bi != buffers.audio_end(); ++bi, ++n) {
|
for ( ; bi != buffers.audio_end(); ++bi, ++n) {
|
||||||
if (n < diskstream->n_channels().get(DataType::AUDIO)) {
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
b = bi->data(nframes);
|
b = bi->data();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* duplicate last across remaining buffers */
|
/* duplicate last across remaining buffers */
|
||||||
memcpy (bi->data(nframes), b, sizeof (Sample) * nframes);
|
memcpy (bi->data(), b, sizeof (Sample) * nframes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -700,7 +700,7 @@ AudioTrack::export_stuff (BufferSet& buffers, nframes_t start, nframes_t nframes
|
||||||
_gain_automation_curve.get_vector (start, start + nframes, gain_automation, nframes);
|
_gain_automation_curve.get_vector (start, start + nframes, gain_automation, nframes);
|
||||||
|
|
||||||
for (BufferSet::audio_iterator bi = buffers.audio_begin(); bi != buffers.audio_end(); ++bi) {
|
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) {
|
for (nframes_t n = 0; n < nframes; ++n) {
|
||||||
b[n] *= gain_automation[n];
|
b[n] *= gain_automation[n];
|
||||||
}
|
}
|
||||||
|
|
@ -709,7 +709,7 @@ AudioTrack::export_stuff (BufferSet& buffers, nframes_t start, nframes_t nframes
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
for (BufferSet::audio_iterator bi = buffers.audio_begin(); bi != buffers.audio_end(); ++bi) {
|
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) {
|
for (nframes_t n = 0; n < nframes; ++n) {
|
||||||
b[n] *= this_gain;
|
b[n] *= this_gain;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -304,14 +304,27 @@ AudioEngine::process_callback (nframes_t nframes)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (run_process_cycle (session, nframes)) {
|
boost::shared_ptr<Ports> p = ports.reader();
|
||||||
/* we were zombified, maybe because a ladspa plugin took
|
|
||||||
too long, or jackd exited, or something like that.
|
// 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;
|
_processed_frames = next_processed_frames;
|
||||||
return 0;
|
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) {
|
if (last_monitor_check + monitor_check_interval < next_processed_frames) {
|
||||||
|
|
||||||
boost::shared_ptr<Ports> p = ports.reader();
|
boost::shared_ptr<Ports> p = ports.reader();
|
||||||
|
|
@ -336,28 +349,6 @@ AudioEngine::process_callback (nframes_t nframes)
|
||||||
return 0;
|
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
|
int
|
||||||
AudioEngine::_sample_rate_callback (nframes_t nframes, void *arg)
|
AudioEngine::_sample_rate_callback (nframes_t nframes, void *arg)
|
||||||
{
|
{
|
||||||
|
|
@ -456,14 +447,23 @@ AudioEngine::set_session (Session *s)
|
||||||
can before we really start running.
|
can before we really start running.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
run_process_cycle (session, blocksize);
|
boost::shared_ptr<Ports> p = ports.reader();
|
||||||
run_process_cycle (session, blocksize);
|
|
||||||
run_process_cycle (session, blocksize);
|
for (Ports::iterator i = p->begin(); i != p->end(); ++i)
|
||||||
run_process_cycle (session, blocksize);
|
(*i)->cycle_start (blocksize);
|
||||||
run_process_cycle (session, blocksize);
|
|
||||||
run_process_cycle (session, blocksize);
|
s->process (blocksize);
|
||||||
run_process_cycle (session, blocksize);
|
s->process (blocksize);
|
||||||
run_process_cycle (session, 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 ();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1335,7 +1335,7 @@ AutomationList::set_state (const XMLNode& node)
|
||||||
const XMLNodeList& elist = node.children();
|
const XMLNodeList& elist = node.children();
|
||||||
XMLNodeConstIterator i;
|
XMLNodeConstIterator i;
|
||||||
XMLProperty* prop;
|
XMLProperty* prop;
|
||||||
jack_nframes_t x;
|
nframes_t x;
|
||||||
double y;
|
double y;
|
||||||
|
|
||||||
freeze ();
|
freeze ();
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ MidiBuffer::~MidiBuffer()
|
||||||
* Note that offset and nframes refer to sample time, NOT buffer offsets or event counts.
|
* Note that offset and nframes refer to sample time, NOT buffer offsets or event counts.
|
||||||
*/
|
*/
|
||||||
void
|
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);
|
assert(src.type() == DataType::MIDI);
|
||||||
const MidiBuffer& msrc = (MidiBuffer&)src;
|
const MidiBuffer& msrc = (MidiBuffer&)src;
|
||||||
|
|
@ -154,7 +154,7 @@ MidiBuffer::push_back(const MidiEvent& ev)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MidiBuffer::silence(jack_nframes_t dur, jack_nframes_t offset)
|
MidiBuffer::silence(nframes_t dur, nframes_t offset)
|
||||||
{
|
{
|
||||||
// FIXME use parameters
|
// FIXME use parameters
|
||||||
assert(offset == 0);
|
assert(offset == 0);
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@ BufferSet::buffer_capacity(DataType type) const
|
||||||
|
|
||||||
// FIXME: make 'in' const
|
// FIXME: make 'in' const
|
||||||
void
|
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());
|
assert(available() >= in.count());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -96,8 +96,10 @@ ControlProtocolManager::drop_session ()
|
||||||
|
|
||||||
for (list<ControlProtocolInfo*>::iterator p = control_protocol_info.begin(); p != control_protocol_info.end(); ++p) {
|
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
|
// otherwise the ControlProtocol instances are not recreated in set_session
|
||||||
(*p)->requested = true;
|
if ((*p)->protocol) {
|
||||||
(*p)->protocol = 0;
|
(*p)->requested = true;
|
||||||
|
(*p)->protocol = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1444,7 +1444,7 @@ IO::load_automation (string path)
|
||||||
|
|
||||||
while (in.getline (line, sizeof(line), '\n')) {
|
while (in.getline (line, sizeof(line), '\n')) {
|
||||||
char type;
|
char type;
|
||||||
jack_nframes_t when;
|
nframes_t when;
|
||||||
double value;
|
double value;
|
||||||
|
|
||||||
if (++linecnt == 1) {
|
if (++linecnt == 1) {
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ namespace ARDOUR {
|
||||||
* be set to 0.
|
* be set to 0.
|
||||||
*/
|
*/
|
||||||
void
|
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());
|
size_t meterable = std::min(bufs.count().get(DataType::AUDIO), _peak_power.size());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,7 @@ MidiDiskstream::non_realtime_input_change ()
|
||||||
/* now refill channel buffers */
|
/* now refill channel buffers */
|
||||||
|
|
||||||
if (speed() != 1.0f || speed() != -1.0f) {
|
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 {
|
else {
|
||||||
seek (_session.transport_frame());
|
seek (_session.transport_frame());
|
||||||
|
|
@ -308,7 +308,7 @@ MidiDiskstream::set_destructive (bool yn)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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)
|
// FIXME: waaay too much code to duplicate (AudioDiskstream)
|
||||||
|
|
||||||
|
|
@ -431,12 +431,12 @@ MidiDiskstream::check_record_status (jack_nframes_t transport_frame, jack_nframe
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
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)
|
// FIXME: waay too much code to duplicate (AudioDiskstream::process)
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
jack_nframes_t rec_offset = 0;
|
nframes_t rec_offset = 0;
|
||||||
jack_nframes_t rec_nframes = 0;
|
nframes_t rec_nframes = 0;
|
||||||
bool nominally_recording;
|
bool nominally_recording;
|
||||||
bool re = record_enabled ();
|
bool re = record_enabled ();
|
||||||
bool collect_playback = false;
|
bool collect_playback = false;
|
||||||
|
|
@ -582,12 +582,12 @@ MidiDiskstream::process (jack_nframes_t transport_frame, jack_nframes_t nframes,
|
||||||
|
|
||||||
/* we're doing playback */
|
/* we're doing playback */
|
||||||
|
|
||||||
jack_nframes_t necessary_samples;
|
nframes_t necessary_samples;
|
||||||
|
|
||||||
/* no varispeed playback if we're recording, because the output .... TBD */
|
/* no varispeed playback if we're recording, because the output .... TBD */
|
||||||
|
|
||||||
if (rec_nframes == 0 && _actual_speed != 1.0f) {
|
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 {
|
} else {
|
||||||
necessary_samples = nframes;
|
necessary_samples = nframes;
|
||||||
}
|
}
|
||||||
|
|
@ -618,7 +618,7 @@ MidiDiskstream::process (jack_nframes_t transport_frame, jack_nframes_t nframes,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
MidiDiskstream::commit (jack_nframes_t nframes)
|
MidiDiskstream::commit (nframes_t nframes)
|
||||||
{
|
{
|
||||||
bool need_butler = false;
|
bool need_butler = false;
|
||||||
|
|
||||||
|
|
@ -674,7 +674,7 @@ MidiDiskstream::overwrite_existing_buffers ()
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
MidiDiskstream::seek (jack_nframes_t frame, bool complete_refill)
|
MidiDiskstream::seek (nframes_t frame, bool complete_refill)
|
||||||
{
|
{
|
||||||
Glib::Mutex::Lock lm (state_lock);
|
Glib::Mutex::Lock lm (state_lock);
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
@ -696,7 +696,7 @@ MidiDiskstream::seek (jack_nframes_t frame, bool complete_refill)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
MidiDiskstream::can_internal_playback_seek (jack_nframes_t distance)
|
MidiDiskstream::can_internal_playback_seek (nframes_t distance)
|
||||||
{
|
{
|
||||||
if (_playback_buf->read_space() < distance) {
|
if (_playback_buf->read_space() < distance) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -706,7 +706,7 @@ MidiDiskstream::can_internal_playback_seek (jack_nframes_t distance)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
MidiDiskstream::internal_playback_seek (jack_nframes_t distance)
|
MidiDiskstream::internal_playback_seek (nframes_t distance)
|
||||||
{
|
{
|
||||||
first_recordable_frame += distance;
|
first_recordable_frame += distance;
|
||||||
playback_sample += distance;
|
playback_sample += distance;
|
||||||
|
|
@ -716,13 +716,13 @@ MidiDiskstream::internal_playback_seek (jack_nframes_t distance)
|
||||||
|
|
||||||
/** @a start is set to the new frame position (TIME) read up to */
|
/** @a start is set to the new frame position (TIME) read up to */
|
||||||
int
|
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;
|
bool reloop = false;
|
||||||
jack_nframes_t loop_end = 0;
|
nframes_t loop_end = 0;
|
||||||
jack_nframes_t loop_start = 0;
|
nframes_t loop_start = 0;
|
||||||
jack_nframes_t loop_length = 0;
|
nframes_t loop_length = 0;
|
||||||
Location *loc = 0;
|
Location *loc = 0;
|
||||||
|
|
||||||
if (!reversed) {
|
if (!reversed) {
|
||||||
|
|
@ -884,8 +884,8 @@ MidiDiskstream::do_refill ()
|
||||||
|
|
||||||
// So (read it, then) write it:
|
// So (read it, then) write it:
|
||||||
|
|
||||||
jack_nframes_t file_frame_tmp = file_frame;
|
nframes_t file_frame_tmp = file_frame;
|
||||||
jack_nframes_t to_read = min(disk_io_chunk_frames, (max_frames - file_frame));
|
nframes_t to_read = min(disk_io_chunk_frames, (max_frames - file_frame));
|
||||||
|
|
||||||
// FIXME: read count?
|
// FIXME: read count?
|
||||||
if (read (file_frame_tmp, to_read, reversed)) {
|
if (read (file_frame_tmp, to_read, reversed)) {
|
||||||
|
|
@ -917,7 +917,7 @@ MidiDiskstream::do_flush (Session::RunContext context, bool force_flush)
|
||||||
int32_t ret = 0;
|
int32_t ret = 0;
|
||||||
// FIXME: I'd be lying if I said I knew what this thing was
|
// FIXME: I'd be lying if I said I knew what this thing was
|
||||||
//RingBufferNPT<CaptureTransition>::rw_vector transvec;
|
//RingBufferNPT<CaptureTransition>::rw_vector transvec;
|
||||||
jack_nframes_t total;
|
nframes_t total;
|
||||||
|
|
||||||
_write_data_count = 0;
|
_write_data_count = 0;
|
||||||
|
|
||||||
|
|
@ -949,7 +949,7 @@ MidiDiskstream::do_flush (Session::RunContext context, bool force_flush)
|
||||||
ret = 1;
|
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;
|
to_write = disk_io_chunk_frames;
|
||||||
|
|
||||||
assert(!destructive());
|
assert(!destructive());
|
||||||
|
|
@ -977,7 +977,7 @@ MidiDiskstream::transport_stopped (struct tm& when, time_t twhen, bool abort_cap
|
||||||
bool more_work = true;
|
bool more_work = true;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
boost::shared_ptr<MidiRegion> region;
|
boost::shared_ptr<MidiRegion> region;
|
||||||
jack_nframes_t total_capture;
|
nframes_t total_capture;
|
||||||
MidiRegion::SourceList srcs;
|
MidiRegion::SourceList srcs;
|
||||||
MidiRegion::SourceList::iterator src;
|
MidiRegion::SourceList::iterator src;
|
||||||
vector<CaptureInfo*>::iterator ci;
|
vector<CaptureInfo*>::iterator ci;
|
||||||
|
|
@ -1411,7 +1411,7 @@ MidiDiskstream::rename_write_sources ()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MidiDiskstream::set_block_size (jack_nframes_t nframes)
|
MidiDiskstream::set_block_size (nframes_t nframes)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1477,7 +1477,7 @@ MidiDiskstream::use_pending_capture_data (XMLNode& node)
|
||||||
* so that an event at start has time = 0
|
* so that an event at start has time = 0
|
||||||
*/
|
*/
|
||||||
void
|
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();
|
dst.clear();
|
||||||
assert(dst.size() == 0);
|
assert(dst.size() == 0);
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ MidiPlaylist::MidiPlaylist (boost::shared_ptr<const MidiPlaylist> other, string
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
: Playlist (other, start, dur, name, hidden)
|
||||||
{
|
{
|
||||||
/* this constructor does NOT notify others (session) */
|
/* this constructor does NOT notify others (session) */
|
||||||
|
|
@ -118,9 +118,9 @@ struct RegionSortByLayer {
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Returns the number of frames in time duration read (eg could be large when 0 events are read) */
|
/** Returns the number of frames in time duration read (eg could be large when 0 events are read) */
|
||||||
jack_nframes_t
|
nframes_t
|
||||||
MidiPlaylist::read (MidiRingBuffer& dst, jack_nframes_t start,
|
MidiPlaylist::read (MidiRingBuffer& dst, nframes_t start,
|
||||||
jack_nframes_t dur, unsigned chan_n)
|
nframes_t dur, unsigned chan_n)
|
||||||
{
|
{
|
||||||
/* this function is never called from a realtime thread, so
|
/* this function is never called from a realtime thread, so
|
||||||
its OK to block (for short intervals).
|
its OK to block (for short intervals).
|
||||||
|
|
@ -128,10 +128,10 @@ MidiPlaylist::read (MidiRingBuffer& dst, jack_nframes_t start,
|
||||||
|
|
||||||
Glib::Mutex::Lock rm (region_lock);
|
Glib::Mutex::Lock rm (region_lock);
|
||||||
|
|
||||||
jack_nframes_t ret = 0;
|
nframes_t ret = 0;
|
||||||
jack_nframes_t end = start + dur - 1;
|
nframes_t end = start + dur - 1;
|
||||||
//jack_nframes_t read_frames = 0;
|
//nframes_t read_frames = 0;
|
||||||
//jack_nframes_t skip_frames = 0;
|
//nframes_t skip_frames = 0;
|
||||||
|
|
||||||
//_read_data_count = 0;
|
//_read_data_count = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ MidiPort::~MidiPort()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MidiPort::cycle_start (jack_nframes_t nframes)
|
MidiPort::cycle_start (nframes_t nframes)
|
||||||
{
|
{
|
||||||
_buffer.clear();
|
_buffer.clear();
|
||||||
assert(_buffer.size() == 0);
|
assert(_buffer.size() == 0);
|
||||||
|
|
@ -62,7 +62,7 @@ MidiPort::cycle_start (jack_nframes_t nframes)
|
||||||
|
|
||||||
void* jack_buffer = jack_port_get_buffer(_port, nframes);
|
void* jack_buffer = jack_port_get_buffer(_port, nframes);
|
||||||
|
|
||||||
const jack_nframes_t event_count
|
const nframes_t event_count
|
||||||
= jack_midi_get_event_count(jack_buffer);
|
= jack_midi_get_event_count(jack_buffer);
|
||||||
|
|
||||||
assert(event_count < _buffer.capacity());
|
assert(event_count < _buffer.capacity());
|
||||||
|
|
@ -70,7 +70,7 @@ MidiPort::cycle_start (jack_nframes_t nframes)
|
||||||
MidiEvent ev;
|
MidiEvent ev;
|
||||||
|
|
||||||
// FIXME: too slow, event struct is copied twice (here and MidiBuffer::push_back)
|
// 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
|
// 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);
|
jack_midi_event_get(static_cast<jack_midi_event_t*>(&ev), jack_buffer, i);
|
||||||
|
|
@ -100,13 +100,13 @@ MidiPort::cycle_end()
|
||||||
|
|
||||||
void* jack_buffer = jack_port_get_buffer(_port, _nframes_this_cycle);
|
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)
|
//if (event_count > 0)
|
||||||
// cerr << "MIDIPort writing " << event_count << " events." << endl;
|
// cerr << "MIDIPort writing " << event_count << " events." << endl;
|
||||||
|
|
||||||
jack_midi_clear_buffer(jack_buffer);
|
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];
|
const jack_midi_event_t& ev = _buffer[i];
|
||||||
assert(ev.time < _nframes_this_cycle);
|
assert(ev.time < _nframes_this_cycle);
|
||||||
jack_midi_event_write(jack_buffer, ev.time, ev.buffer, ev.size);
|
jack_midi_event_write(jack_buffer, ev.time, ev.buffer, ev.size);
|
||||||
|
|
|
||||||
|
|
@ -48,21 +48,21 @@ using namespace std;
|
||||||
using namespace ARDOUR;
|
using namespace ARDOUR;
|
||||||
|
|
||||||
/** Basic MidiRegion constructor (one channel) */
|
/** 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))
|
: Region (src, start, length, PBD::basename_nosuffix(src->name()), DataType::MIDI, 0, Region::Flag(Region::DefaultFlags|Region::External))
|
||||||
{
|
{
|
||||||
assert(_name.find("/") == string::npos);
|
assert(_name.find("/") == string::npos);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Basic MidiRegion constructor (one channel) */
|
/* 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)
|
: Region (src, start, length, name, DataType::MIDI, layer, flags)
|
||||||
{
|
{
|
||||||
assert(_name.find("/") == string::npos);
|
assert(_name.find("/") == string::npos);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Basic MidiRegion constructor (many channels) */
|
/* 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)
|
: Region (srcs, start, length, name, DataType::MIDI, layer, flags)
|
||||||
{
|
{
|
||||||
assert(_name.find("/") == string::npos);
|
assert(_name.find("/") == string::npos);
|
||||||
|
|
@ -70,7 +70,7 @@ MidiRegion::MidiRegion (SourceList& srcs, jack_nframes_t start, jack_nframes_t l
|
||||||
|
|
||||||
|
|
||||||
/** Create a new MidiRegion, that is part of an existing one */
|
/** 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)
|
: Region (other, offset, length, name, layer, flags)
|
||||||
{
|
{
|
||||||
assert(_name.find("/") == string::npos);
|
assert(_name.find("/") == string::npos);
|
||||||
|
|
@ -108,31 +108,31 @@ MidiRegion::~MidiRegion ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
jack_nframes_t
|
nframes_t
|
||||||
MidiRegion::read_at (MidiRingBuffer& out, jack_nframes_t position,
|
MidiRegion::read_at (MidiRingBuffer& out, nframes_t position,
|
||||||
jack_nframes_t dur,
|
nframes_t dur,
|
||||||
uint32_t chan_n, jack_nframes_t read_frames, jack_nframes_t skip_frames) const
|
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);
|
return _read_at (_sources, out, position, dur, chan_n, read_frames, skip_frames);
|
||||||
}
|
}
|
||||||
|
|
||||||
jack_nframes_t
|
nframes_t
|
||||||
MidiRegion::master_read_at (MidiRingBuffer& out, jack_nframes_t position,
|
MidiRegion::master_read_at (MidiRingBuffer& out, nframes_t position,
|
||||||
jack_nframes_t dur, uint32_t chan_n) const
|
nframes_t dur, uint32_t chan_n) const
|
||||||
{
|
{
|
||||||
return _read_at (_master_sources, out, position, dur, chan_n, 0, 0);
|
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,
|
MidiRegion::_read_at (const SourceList& srcs, MidiRingBuffer& dst,
|
||||||
jack_nframes_t position, jack_nframes_t dur,
|
nframes_t position, nframes_t dur,
|
||||||
uint32_t chan_n, jack_nframes_t read_frames, jack_nframes_t skip_frames) const
|
uint32_t chan_n, nframes_t read_frames, nframes_t skip_frames) const
|
||||||
{
|
{
|
||||||
// cerr << _name << "._read_at(" << position << ") - " << _position << endl;
|
// cerr << _name << "._read_at(" << position << ") - " << _position << endl;
|
||||||
|
|
||||||
jack_nframes_t internal_offset = 0;
|
nframes_t internal_offset = 0;
|
||||||
jack_nframes_t src_offset = 0;
|
nframes_t src_offset = 0;
|
||||||
jack_nframes_t to_read = 0;
|
nframes_t to_read = 0;
|
||||||
|
|
||||||
/* precondition: caller has verified that we cover the desired section */
|
/* precondition: caller has verified that we cover the desired section */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -90,15 +90,15 @@ MidiSource::set_state (const XMLNode& node)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
jack_nframes_t
|
nframes_t
|
||||||
MidiSource::read (MidiRingBuffer& dst, jack_nframes_t start, jack_nframes_t cnt, jack_nframes_t stamp_offset) const
|
MidiSource::read (MidiRingBuffer& dst, nframes_t start, nframes_t cnt, nframes_t stamp_offset) const
|
||||||
{
|
{
|
||||||
Glib::Mutex::Lock lm (_lock);
|
Glib::Mutex::Lock lm (_lock);
|
||||||
return read_unlocked (dst, start, cnt, stamp_offset);
|
return read_unlocked (dst, start, cnt, stamp_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
jack_nframes_t
|
nframes_t
|
||||||
MidiSource::write (MidiRingBuffer& dst, jack_nframes_t cnt)
|
MidiSource::write (MidiRingBuffer& dst, nframes_t cnt)
|
||||||
{
|
{
|
||||||
Glib::Mutex::Lock lm (_lock);
|
Glib::Mutex::Lock lm (_lock);
|
||||||
return write_unlocked (dst, cnt);
|
return write_unlocked (dst, cnt);
|
||||||
|
|
|
||||||
|
|
@ -352,7 +352,7 @@ MidiTrack::set_state_part_two ()
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
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)
|
bool session_state_changing, bool can_record, bool rec_monitors_input)
|
||||||
{
|
{
|
||||||
if (n_outputs().get(DataType::MIDI) == 0) {
|
if (n_outputs().get(DataType::MIDI) == 0) {
|
||||||
|
|
@ -433,7 +433,7 @@ MidiTrack::no_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nfr
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
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)
|
bool can_record, bool rec_monitors_input)
|
||||||
{
|
{
|
||||||
int dret;
|
int dret;
|
||||||
|
|
@ -448,7 +448,7 @@ MidiTrack::roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframe
|
||||||
return 0;
|
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) {
|
if ((nframes = check_initial_delay (nframes, offset, transport_frame)) == 0) {
|
||||||
/* need to do this so that the diskstream sets its
|
/* need to do this so that the diskstream sets its
|
||||||
|
|
@ -507,7 +507,7 @@ MidiTrack::roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframe
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
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)
|
bool can_record, bool rec_monitors_input)
|
||||||
{
|
{
|
||||||
if (n_outputs().get(DataType::MIDI) == 0 && _redirects.empty()) {
|
if (n_outputs().get(DataType::MIDI) == 0 && _redirects.empty()) {
|
||||||
|
|
@ -529,8 +529,8 @@ MidiTrack::silent_roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack
|
||||||
|
|
||||||
void
|
void
|
||||||
MidiTrack::process_output_buffers (BufferSet& bufs,
|
MidiTrack::process_output_buffers (BufferSet& bufs,
|
||||||
jack_nframes_t start_frame, jack_nframes_t end_frame,
|
nframes_t start_frame, nframes_t end_frame,
|
||||||
jack_nframes_t nframes, jack_nframes_t offset, bool with_redirects, int declick,
|
nframes_t nframes, nframes_t offset, bool with_redirects, int declick,
|
||||||
bool meter)
|
bool meter)
|
||||||
{
|
{
|
||||||
/* There's no such thing as a MIDI bus for the time being, to avoid diverging from trunk
|
/* There's no such thing as a MIDI bus for the time being, to avoid diverging from trunk
|
||||||
|
|
@ -578,13 +578,13 @@ MidiTrack::set_name (string str, void *src)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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);
|
Route::set_latency_delay (longest_session_latency);
|
||||||
_diskstream->set_roll_delay (_roll_delay);
|
_diskstream->set_roll_delay (_roll_delay);
|
||||||
|
|
@ -600,7 +600,7 @@ MidiTrack::bounce (InterThreadInfo& itt)
|
||||||
|
|
||||||
|
|
||||||
void
|
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;
|
throw;
|
||||||
//vector<MidiSource*> srcs;
|
//vector<MidiSource*> srcs;
|
||||||
|
|
|
||||||
|
|
@ -244,7 +244,7 @@ BaseStereoPanner::load (istream& in, string path, uint32_t& linecnt)
|
||||||
_automation.clear ();
|
_automation.clear ();
|
||||||
|
|
||||||
while (in.getline (line, sizeof (line), '\n')) {
|
while (in.getline (line, sizeof (line), '\n')) {
|
||||||
jack_nframes_t when;
|
nframes_t when;
|
||||||
double value;
|
double value;
|
||||||
|
|
||||||
++linecnt;
|
++linecnt;
|
||||||
|
|
@ -281,11 +281,11 @@ BaseStereoPanner::distribute (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gain
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Sample* const src = srcbuf.data(nframes);
|
Sample* const src = srcbuf.data();
|
||||||
|
|
||||||
/* LEFT */
|
/* 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
|
if (fabsf ((delta = (left - desired_left))) > 0.002) { // about 1 degree of arc
|
||||||
|
|
||||||
|
|
@ -335,7 +335,7 @@ BaseStereoPanner::distribute (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gain
|
||||||
|
|
||||||
/* RIGHT */
|
/* 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
|
if (fabsf ((delta = (right - desired_right))) > 0.002) { // about 1 degree of arc
|
||||||
|
|
||||||
|
|
@ -434,7 +434,7 @@ EqualPowerStereoPanner::distribute_automated (AudioBuffer& srcbuf, BufferSet& ob
|
||||||
|
|
||||||
Sample* dst;
|
Sample* dst;
|
||||||
pan_t* pbuf;
|
pan_t* pbuf;
|
||||||
Sample* const src = srcbuf.data(nframes);
|
Sample* const src = srcbuf.data();
|
||||||
|
|
||||||
/* fetch positional data */
|
/* fetch positional data */
|
||||||
|
|
||||||
|
|
@ -473,7 +473,7 @@ EqualPowerStereoPanner::distribute_automated (AudioBuffer& srcbuf, BufferSet& ob
|
||||||
|
|
||||||
/* LEFT */
|
/* LEFT */
|
||||||
|
|
||||||
dst = obufs.get_audio(0).data(nframes);
|
dst = obufs.get_audio(0).data();
|
||||||
pbuf = buffers[0];
|
pbuf = buffers[0];
|
||||||
|
|
||||||
for (nframes_t n = 0; n < nframes; ++n) {
|
for (nframes_t n = 0; n < nframes; ++n) {
|
||||||
|
|
@ -484,7 +484,7 @@ EqualPowerStereoPanner::distribute_automated (AudioBuffer& srcbuf, BufferSet& ob
|
||||||
|
|
||||||
/* RIGHT */
|
/* RIGHT */
|
||||||
|
|
||||||
dst = obufs.get_audio(1).data(nframes);
|
dst = obufs.get_audio(1).data();
|
||||||
pbuf = buffers[1];
|
pbuf = buffers[1];
|
||||||
|
|
||||||
for (nframes_t n = 0; n < nframes; ++n) {
|
for (nframes_t n = 0; n < nframes; ++n) {
|
||||||
|
|
@ -642,12 +642,12 @@ Multi2dPanner::distribute (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gain_co
|
||||||
return;
|
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) {
|
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
|
#ifdef CAN_INTERP
|
||||||
if (fabsf ((delta = (left_interp - desired_left))) > 0.002) { // about 1 degree of arc
|
if (fabsf ((delta = (left_interp - desired_left))) > 0.002) { // about 1 degree of arc
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ Change Region::LayerChanged = ARDOUR::new_change ();
|
||||||
Change Region::HiddenChanged = ARDOUR::new_change ();
|
Change Region::HiddenChanged = ARDOUR::new_change ();
|
||||||
|
|
||||||
/** Basic Region constructor (single source) */
|
/** 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)
|
: _name(name)
|
||||||
, _type(type)
|
, _type(type)
|
||||||
, _flags(flags)
|
, _flags(flags)
|
||||||
|
|
@ -73,7 +73,7 @@ Region::Region (boost::shared_ptr<Source> src, jack_nframes_t start, jack_nframe
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Basic Region constructor (many sources) */
|
/** 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)
|
: _name(name)
|
||||||
, _type(type)
|
, _type(type)
|
||||||
, _flags(flags)
|
, _flags(flags)
|
||||||
|
|
@ -1191,7 +1191,7 @@ Region::source_equivalent (boost::shared_ptr<const Region> other) const
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Region::verify_length (jack_nframes_t len)
|
Region::verify_length (nframes_t len)
|
||||||
{
|
{
|
||||||
for (uint32_t n=0; n < _sources.size(); ++n) {
|
for (uint32_t n=0; n < _sources.size(); ++n) {
|
||||||
if (_start > _sources[n]->length() - len) {
|
if (_start > _sources[n]->length() - len) {
|
||||||
|
|
@ -1202,7 +1202,7 @@ Region::verify_length (jack_nframes_t len)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
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) {
|
for (uint32_t n=0; n < _sources.size(); ++n) {
|
||||||
if (new_length > _sources[n]->length() - new_start) {
|
if (new_length > _sources[n]->length() - new_start) {
|
||||||
|
|
@ -1212,7 +1212,7 @@ Region::verify_start_and_length (jack_nframes_t new_start, jack_nframes_t new_le
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool
|
bool
|
||||||
Region::verify_start (jack_nframes_t pos)
|
Region::verify_start (nframes_t pos)
|
||||||
{
|
{
|
||||||
for (uint32_t n=0; n < _sources.size(); ++n) {
|
for (uint32_t n=0; n < _sources.size(); ++n) {
|
||||||
if (pos > _sources[n]->length() - _length) {
|
if (pos > _sources[n]->length() - _length) {
|
||||||
|
|
@ -1223,7 +1223,7 @@ Region::verify_start (jack_nframes_t pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
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) {
|
for (uint32_t n=0; n < _sources.size(); ++n) {
|
||||||
if (new_start > _sources[n]->length() - _length) {
|
if (new_start > _sources[n]->length() - _length) {
|
||||||
|
|
|
||||||
|
|
@ -459,7 +459,7 @@ Route::process_output_buffers (BufferSet& bufs,
|
||||||
|
|
||||||
if (_phase_invert) {
|
if (_phase_invert) {
|
||||||
for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i) {
|
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) {
|
for (nframes_t nx = 0; nx < nframes; ++nx) {
|
||||||
sp[nx] *= -gab[nx];
|
sp[nx] *= -gab[nx];
|
||||||
|
|
@ -467,7 +467,7 @@ Route::process_output_buffers (BufferSet& bufs,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i) {
|
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) {
|
for (nframes_t nx = 0; nx < nframes; ++nx) {
|
||||||
sp[nx] *= gab[nx];
|
sp[nx] *= gab[nx];
|
||||||
|
|
@ -505,7 +505,7 @@ Route::process_output_buffers (BufferSet& bufs,
|
||||||
}
|
}
|
||||||
|
|
||||||
for (BufferSet::audio_iterator i = bufs.audio_begin(); i != bufs.audio_end(); ++i) {
|
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);
|
apply_gain_to_buffer(sp,nframes,this_gain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -699,7 +699,7 @@ Route::passthru (nframes_t start_frame, nframes_t end_frame, nframes_t nframes,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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);
|
process_output_buffers (_session.get_silent_buffers (n_process_buffers()), start_frame, end_frame, nframes, offset, true, declick, meter);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1380,7 +1380,7 @@ Session::set_frame_rate (nframes_t frames_per_second)
|
||||||
|
|
||||||
sync_time_vars();
|
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
|
// XXX we need some equivalent to this, somehow
|
||||||
// SndFileSource::setup_standard_crossfades (frames_per_second);
|
// SndFileSource::setup_standard_crossfades (frames_per_second);
|
||||||
|
|
@ -4097,7 +4097,7 @@ Session::write_one_audio_track (AudioTrack& track, nframes_t start, nframes_t le
|
||||||
boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource>(*src);
|
boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource>(*src);
|
||||||
|
|
||||||
if (afs) {
|
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;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,10 +53,10 @@ Session::click (nframes_t start, nframes_t nframes, nframes_t offset)
|
||||||
return;
|
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));
|
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);
|
points = _tempo_map->get_points (start, end);
|
||||||
|
|
||||||
if (points == 0) {
|
if (points == 0) {
|
||||||
|
|
|
||||||
|
|
@ -589,7 +589,7 @@ Session::process_export (nframes_t nframes, AudioExportSpecification* spec)
|
||||||
cerr << "FIXME: Non-audio export" << endl;
|
cerr << "FIXME: Non-audio export" << endl;
|
||||||
continue;
|
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 */
|
/* now interleave the data from the channel into the float buffer */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -763,7 +763,7 @@ Session::change_midi_ports ()
|
||||||
* have been called with the appropriate nframes parameter this cycle.
|
* have been called with the appropriate nframes parameter this cycle.
|
||||||
*/
|
*/
|
||||||
int
|
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
|
/* This function could easily send at a given frame offset, but would
|
||||||
* that be useful? Does ardour do sub-block accurate locating? [DR] */
|
* that be useful? Does ardour do sub-block accurate locating? [DR] */
|
||||||
|
|
@ -787,7 +787,7 @@ Session::send_full_time_code(jack_nframes_t nframes)
|
||||||
if (((mtc_smpte_bits >> 5) != MIDI::MTC_25_FPS) && (transmitting_smpte_time.frames % 2)) {
|
if (((mtc_smpte_bits >> 5) != MIDI::MTC_25_FPS) && (transmitting_smpte_time.frames % 2)) {
|
||||||
// start MTC quarter frame transmission on an even frame
|
// start MTC quarter frame transmission on an even frame
|
||||||
SMPTE::increment( transmitting_smpte_time );
|
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
|
// Compensate for audio latency
|
||||||
|
|
@ -828,7 +828,7 @@ Session::send_full_time_code(jack_nframes_t nframes)
|
||||||
* earlier already this cycle by send_full_time_code)
|
* earlier already this cycle by send_full_time_code)
|
||||||
*/
|
*/
|
||||||
int
|
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 >= 0);
|
||||||
assert (next_quarter_frame_to_send <= 7);
|
assert (next_quarter_frame_to_send <= 7);
|
||||||
|
|
@ -845,7 +845,7 @@ Session::send_midi_time_code_for_cycle(jack_nframes_t nframes)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Duration of one quarter frame */
|
/* 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
|
//cerr << "(MTC) TR: " << _transport_frame << " - SF: " << outbound_mtc_smpte_frame
|
||||||
//<< " - NQ: " << next_quarter_frame_to_send << " - FD" << quarter_frame_duration << endl;
|
//<< " - NQ: " << next_quarter_frame_to_send << " - FD" << quarter_frame_duration << endl;
|
||||||
|
|
@ -888,14 +888,14 @@ Session::send_midi_time_code_for_cycle(jack_nframes_t nframes)
|
||||||
break;
|
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));
|
+ (quarter_frame_duration * next_quarter_frame_to_send));
|
||||||
|
|
||||||
// This message must fall within this block or something is broken
|
// This message must fall within this block or something is broken
|
||||||
assert(msg_time >= _transport_frame);
|
assert(msg_time >= _transport_frame);
|
||||||
assert(msg_time < _transport_frame + nframes);
|
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);
|
assert(out_stamp < nframes);
|
||||||
|
|
||||||
if (!_mtc_port->midimsg (mtc_msg, 2, out_stamp)) {
|
if (!_mtc_port->midimsg (mtc_msg, 2, out_stamp)) {
|
||||||
|
|
|
||||||
|
|
@ -130,8 +130,8 @@ Session::process_routes (nframes_t nframes, nframes_t offset)
|
||||||
|
|
||||||
record_active = actively_recording(); // || (get_record_enabled() && get_punch_in());
|
record_active = actively_recording(); // || (get_record_enabled() && get_punch_in());
|
||||||
|
|
||||||
const jack_nframes_t start_frame = _transport_frame;
|
const nframes_t start_frame = _transport_frame;
|
||||||
const jack_nframes_t end_frame = _transport_frame + (jack_nframes_t)floor(nframes * _transport_speed);
|
const nframes_t end_frame = _transport_frame + (nframes_t)floor(nframes * _transport_speed);
|
||||||
|
|
||||||
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
|
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
|
||||||
|
|
||||||
|
|
@ -176,8 +176,8 @@ Session::silent_process_routes (nframes_t nframes, nframes_t offset)
|
||||||
declick = -1;
|
declick = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const jack_nframes_t start_frame = _transport_frame;
|
const nframes_t start_frame = _transport_frame;
|
||||||
const jack_nframes_t end_frame = _transport_frame + lrintf(nframes * _transport_speed);
|
const nframes_t end_frame = _transport_frame + lrintf(nframes * _transport_speed);
|
||||||
|
|
||||||
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
|
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@ SMFSource::open()
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
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;
|
_timeline_position = when;
|
||||||
return flush_header();
|
return flush_header();
|
||||||
|
|
@ -220,7 +220,7 @@ SMFSource::flush_footer()
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
long
|
long
|
||||||
SMFSource::find_first_event_after(jack_nframes_t start)
|
SMFSource::find_first_event_after(nframes_t start)
|
||||||
{
|
{
|
||||||
// FIXME: obviously this is slooow
|
// FIXME: obviously this is slooow
|
||||||
|
|
||||||
|
|
@ -287,12 +287,12 @@ SMFSource::read_event(MidiEvent& ev) const
|
||||||
return ev.size;
|
return ev.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
jack_nframes_t
|
nframes_t
|
||||||
SMFSource::read_unlocked (MidiRingBuffer& dst, jack_nframes_t start, jack_nframes_t cnt, jack_nframes_t stamp_offset) const
|
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;
|
//cerr << "SMF - read " << start << ", count=" << cnt << ", offset=" << stamp_offset << endl;
|
||||||
|
|
||||||
jack_nframes_t time = 0;
|
nframes_t time = 0;
|
||||||
|
|
||||||
// FIXME: ugh
|
// FIXME: ugh
|
||||||
unsigned char ev_buf[MidiBuffer::max_event_size()];
|
unsigned char ev_buf[MidiBuffer::max_event_size()];
|
||||||
|
|
@ -334,8 +334,8 @@ SMFSource::read_unlocked (MidiRingBuffer& dst, jack_nframes_t start, jack_nframe
|
||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
jack_nframes_t
|
nframes_t
|
||||||
SMFSource::write_unlocked (MidiRingBuffer& src, jack_nframes_t cnt)
|
SMFSource::write_unlocked (MidiRingBuffer& src, nframes_t cnt)
|
||||||
{
|
{
|
||||||
//cerr << "SMF WRITE -- " << _length << "--" << cnt << endl;
|
//cerr << "SMF WRITE -- " << _length << "--" << cnt << endl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ Source::set_state (const XMLNode& node)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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) {
|
if (pos + cnt > _length) {
|
||||||
_length = pos+cnt;
|
_length = pos+cnt;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue