ReadOpsNone = 0x0,
ReadOpsOwnAutomation = 0x1,
ReadOpsOwnScaling = 0x2,
- ReadOpsCount = 0x4,
- ReadOpsFades = 0x8
+ ReadOpsFades = 0x4
};
virtual framecnt_t read (Sample*, framepos_t pos, framecnt_t cnt, int channel) const;
void set_captured_for (std::string str) { _captured_for = str; }
std::string captured_for() const { return _captured_for; }
- uint32_t read_data_count() const { return _read_data_count; }
- uint32_t write_data_count() const { return _write_data_count; }
- void dec_read_data_count (framecnt_t);
-
int read_peaks (PeakData *peaks, framecnt_t npeaks,
framepos_t start, framecnt_t cnt, double samples_per_visual_peak) const;
std::string peakpath;
std::string _captured_for;
- mutable uint32_t _read_data_count; // modified in read()
- mutable uint32_t _write_data_count; // modified in write()
-
int initialize_peakfile (bool newfile, std::string path);
int build_peaks_from_scratch ();
int compute_and_write_peaks (Sample* buf, framecnt_t first_frame, framecnt_t cnt,
bool transport_work_requested() const;
void drop_references ();
- float read_data_rate() const; ///< in usec
- float write_data_rate() const;
-
framecnt_t audio_diskstream_capture_buffer_size() const { return audio_dstream_capture_buffer_size; }
framecnt_t audio_diskstream_playback_buffer_size() const { return audio_dstream_playback_buffer_size; }
uint32_t midi_diskstream_buffer_size() const { return midi_dstream_buffer_size; }
virtual void reset_write_sources (bool, bool force = false) = 0;
virtual void non_realtime_input_change () = 0;
- uint32_t read_data_count() const { return _read_data_count; }
- uint32_t write_data_count() const { return _write_data_count; }
-
protected:
friend class Auditioner;
virtual int seek (framepos_t which_sample, bool complete_refill = false) = 0;
framepos_t playback_sample;
framecnt_t playback_distance;
- uint32_t _read_data_count;
- uint32_t _write_data_count;
-
bool in_set_state;
Glib::Mutex state_lock;
std::string captured_for() const { return _captured_for; }
void set_captured_for (std::string str) { _captured_for = str; }
- uint32_t read_data_count() const { return _read_data_count; }
- uint32_t write_data_count() const { return _write_data_count; }
-
framepos_t last_write_end() const { return _last_write_end; }
void set_last_write_end (framepos_t pos) { _last_write_end = pos; }
framecnt_t cnt) = 0;
std::string _captured_for;
- mutable uint32_t _read_data_count; ///< modified in read()
- mutable uint32_t _write_data_count; ///< modified in write()
boost::shared_ptr<MidiModel> _model;
bool _writing;
void raise_region_to_top (boost::shared_ptr<Region>);
void lower_region_to_bottom (boost::shared_ptr<Region>);
- uint32_t read_data_count() const { return _read_data_count; }
-
/* XXX: use of diskstream here is a little unfortunate */
const PBD::ID& get_orig_diskstream_id () const { return _orig_diskstream_id; }
void set_orig_diskstream_id (const PBD::ID& did) { _orig_diskstream_id = did; }
bool in_partition;
bool _frozen;
uint32_t subcnt;
- uint32_t _read_data_count;
PBD::ID _orig_diskstream_id;
uint64_t layer_op_counter;
framecnt_t freeze_length;
virtual float capture_buffer_load () const = 0;
virtual int do_refill () = 0;
virtual int do_flush (RunContext, bool force = false) = 0;
- virtual uint32_t read_data_count() const = 0;
- virtual uint32_t write_data_count() const = 0;
virtual void set_pending_overwrite (bool) = 0;
virtual int seek (framepos_t, bool complete_refill = false) = 0;
virtual bool hidden () const = 0;
int apply (Filter &, Progress* progress = 0);
- virtual uint64_t read_data_count () const { return _read_data_count; }
-
boost::shared_ptr<ARDOUR::Playlist> playlist () const { return _playlist.lock(); }
virtual void set_playlist (boost::weak_ptr<ARDOUR::Playlist>);
Timecode::BBT_Time _bbt_time;
AnalysisFeatureList _transients;
- mutable uint64_t _read_data_count; ///< modified in read()
uint64_t _last_layer_op; ///< timestamp
SourceList _sources;
/** Used when timefx are applied, so we can always use the original source */
float capture_buffer_load () const;
int do_refill ();
int do_flush (RunContext, bool force = false);
- uint32_t read_data_count() const;
- uint32_t write_data_count() const;
void set_pending_overwrite (bool);
int seek (framepos_t, bool complete_refill = false);
bool hidden () const;
return -1;
}
- _read_data_count = _playlist->read_data_count();
-
if (reversed) {
swap_by_ptr (buf, buf + this_read - 1);
RingBufferNPT<CaptureTransition>::rw_vector transvec;
framecnt_t total;
- _write_data_count = 0;
-
transvec.buf[0] = 0;
transvec.buf[1] = 0;
vector.buf[0] = 0;
return -1;
}
- _write_data_count += (*chan)->write_source->write_data_count();
-
(*chan)->capture_buf->increment_read_ptr (to_write);
(*chan)->curr_capture_cnt += to_write;
}
Glib::RecMutex::Lock rm (region_lock);
framepos_t const end = start + cnt - 1;
- _read_data_count = 0;
-
- _read_data_count = 0;
RegionList* rlist = regions_to_read (start, start+cnt);
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("read from region %1\n", ar->name()));
assert(ar);
ar->read_at (buf, mixdown_buffer, gain_buffer, start, cnt, chan_n);
- _read_data_count += ar->read_data_count();
}
for (vector<boost::shared_ptr<Crossfade> >::iterator i = x.begin(); i != x.end(); ++i) {
DEBUG_TRACE (DEBUG::AudioPlayback, string_compose ("read from xfade between %1 & %2\n", (*i)->out()->name(), (*i)->in()->name()));
(*i)->read_at (buf, mixdown_buffer, gain_buffer, start, cnt, chan_n);
-
- /* don't JACK up _read_data_count, since its the same data as we just
- read from the regions, and the OS should handle that for us.
- */
}
}
mixdown_buffer += buf_offset;
}
- if (rops & ReadOpsCount) {
- _read_data_count = 0;
- }
-
if (chan_n < n_channels()) {
boost::shared_ptr<AudioSource> src = boost::dynamic_pointer_cast<AudioSource> (srcs[chan_n]);
return 0; /* "read nothing" */
}
- if (rops & ReadOpsCount) {
- _read_data_count += src->read_data_count();
- }
-
} else {
/* track is N-channel, this region has less channels; silence the ones
return 0; /* "read nothing" */
}
- /* adjust read data count appropriately since this was a duplicate read */
- src->dec_read_data_count (to_read);
} else {
memset (mixdown_buffer, 0, sizeof (Sample) * cnt);
}
_peaks_built = false;
_peak_byte_max = 0;
_peakfile_descriptor = 0;
- _read_data_count = 0;
- _write_data_count = 0;
peak_leftover_cnt = 0;
peak_leftover_size = 0;
peak_leftovers = 0;
_peaks_built = false;
_peak_byte_max = 0;
_peakfile_descriptor = 0;
- _read_data_count = 0;
- _write_data_count = 0;
peak_leftover_cnt = 0;
peak_leftover_size = 0;
peak_leftovers = 0;
return (end/sizeof(PeakData)) * _FPP;
}
-void
-AudioSource::dec_read_data_count (framecnt_t cnt)
-{
- uint32_t val = cnt * sizeof (Sample);
-
- if (val < _read_data_count) {
- _read_data_count -= val;
- } else {
- _read_data_count = 0;
- }
-}
-
void
AudioSource::mark_streaming_write_completed ()
{
using namespace PBD;
-static float _read_data_rate;
-static float _write_data_rate;
-
namespace ARDOUR {
Butler::Butler(Session& s)
Butler::thread_work ()
{
uint32_t err = 0;
- int32_t bytes;
- bool compute_io;
- microseconds_t begin, end;
struct pollfd pfd[1];
bool disk_work_outstanding = false;
}
- bytes = 0;
- compute_io = true;
-
restart:
disk_work_outstanding = false;
_session.butler_transport_work ();
}
- begin = get_microseconds();
-
boost::shared_ptr<RouteList> rl = _session.get_routes();
RouteList rl_with_auditioner = *rl;
}
switch (tr->do_refill ()) {
- case 0:
- bytes += tr->read_data_count();
- break;
case 1:
- bytes += tr->read_data_count();
disk_work_outstanding = true;
break;
default:
- compute_io = false;
error << string_compose(_("Butler read ahead failure on dstream %1"), (*i)->name()) << endmsg;
break;
}
goto restart;
}
- if (compute_io) {
- end = get_microseconds();
- if (end - begin > 0) {
- _read_data_rate = (float) bytes / (float) (end - begin);
- } else {
- _read_data_rate = 0; // infinity better
- }
- }
-
- bytes = 0;
- compute_io = true;
- begin = get_microseconds();
-
for (i = rl->begin(); !transport_work_requested() && should_run && i != rl->end(); ++i) {
// cerr << "write behind for " << (*i)->name () << endl;
*/
switch (tr->do_flush (ButlerContext)) {
- case 0:
- bytes += tr->write_data_count();
- break;
case 1:
- bytes += tr->write_data_count();
disk_work_outstanding = true;
break;
default:
err++;
- compute_io = false;
error << string_compose(_("Butler write-behind failure on dstream %1"), (*i)->name()) << endmsg;
/* don't break - try to flush all streams in case they
are split across disks.
goto restart;
}
- if (compute_io) {
- // there are no apparent users for this calculation?
- end = get_microseconds();
- if (end - begin > 0) {
- _write_data_rate = (float) bytes / (float) (end - begin);
- } else {
- _write_data_rate = 0; // Well, infinity would be better
- }
- }
-
if (!disk_work_outstanding) {
_session.refresh_disk_space ();
}
return g_atomic_int_get(&should_do_transport_work);
}
-float
-Butler::read_data_rate () const
-{
- /* disk i/o in excess of 10000MB/sec indicate the buffer cache
- in action. ignore it.
- */
- return _read_data_rate > 10485.7600000f ? 0.0f : _read_data_rate;
-}
-
-float
-Butler::write_data_rate () const
-{
- /* disk i/o in excess of 10000MB/sec indicate the buffer cache
- in action. ignore it.
- */
- return _write_data_rate > 10485.7600000f ? 0.0f : _write_data_rate;
-}
-
void
Butler::empty_pool_trash ()
{
if (n_channels == 1) {
if (safe_read (dst, start, file_cnt, abl) == 0) {
- _read_data_count = cnt * sizeof (Sample);
return cnt;
}
return 0;
return 0;
}
- _read_data_count = cnt * sizeof(float);
-
Sample *ptr = interleave_buf + _channel;
/* stride through the interleaved data */
, file_frame (0)
, playback_sample (0)
, playback_distance (0)
- , _read_data_count (0)
- , _write_data_count (0)
, in_set_state (false)
, _flags (flag)
, deprecated_io_node (0)
, file_frame (0)
, playback_sample (0)
, playback_distance (0)
- , _read_data_count (0)
- , _write_data_count (0)
, in_set_state (false)
, _flags (Recordable)
, deprecated_io_node (0)
g_atomic_int_add(&_frames_written_to_ringbuffer, this_read);
- _read_data_count = _playlist->read_data_count();
-
if (reversed) {
// Swap note ons with note offs here. etc?
assert (!destructive());
- _write_data_count = 0;
-
total = _session.transport_frame() - _write_source->last_write_end();
if (total == 0 ||
framepos_t end = start + dur - 1;
- _read_data_count = 0;
-
// relevent regions overlapping start <--> end
vector< boost::shared_ptr<Region> > regs;
typedef pair<MidiStateTracker*,framepos_t> TrackerInfo;
_note_trackers.insert (newpair);
DEBUG_TRACE (DEBUG::MidiPlaylistIO, "\tadded tracker to trackers\n");
}
-
- _read_data_count += mr->read_data_count();
}
} else {
mr->read_at (evlist, start, dur, chan_n, _note_mode, tracker);
- _read_data_count += mr->read_data_count();
#ifndef NDEBUG
DEBUG_TRACE (DEBUG::MidiPlaylistIO, string_compose ("After %1 (%2 .. %3) we now have %4\n", mr->name(), mr->position(), mr->last_frame(), evlist.size()));
return 0; /* read nothing */
}
- _read_data_count = 0;
-
boost::shared_ptr<MidiSource> src = midi_source(chan_n);
src->set_note_mode(mode);
return 0; /* "read nothing" */
}
- _read_data_count += src->read_data_count();
-
return to_read;
}
MidiSource::MidiSource (Session& s, string name, Source::Flag flags)
: Source(s, DataType::MIDI, name, flags)
- , _read_data_count(0)
- , _write_data_count(0)
, _writing(false)
, _model_iter_valid(false)
, _length_beats(0.0)
MidiSource::MidiSource (Session& s, const XMLNode& node)
: Source(s, node)
- , _read_data_count(0)
- , _write_data_count(0)
, _writing(false)
, _model_iter_valid(false)
, _length_beats(0.0)
, _last_read_end(0)
, _last_write_end(0)
{
- _read_data_count = 0;
- _write_data_count = 0;
-
if (set_state (node, Stateful::loading_state_version)) {
throw failed_constructor();
}
in_flush = false;
in_partition = false;
subcnt = 0;
- _read_data_count = 0;
_frozen = other->_frozen;
layer_op_counter = other->layer_op_counter;
in_flush = false;
in_partition = false;
subcnt = 0;
- _read_data_count = 0;
_frozen = false;
layer_op_counter = 0;
freeze_length = 0;
, _last_length (length)
, _last_position (0)
, _first_edit (EditChangesNothing)
- , _read_data_count(0)
, _last_layer_op(0)
, _pending_explicit_relayer (false)
{
, _last_length (0)
, _last_position (0)
, _first_edit (EditChangesNothing)
- , _read_data_count(0)
, _last_layer_op (0)
, _pending_explicit_relayer (false)
{
, _last_length (other->_last_length)
, _last_position(other->_last_position) \
, _first_edit (EditChangesNothing)
- , _read_data_count(0)
, _last_layer_op (0)
, _pending_explicit_relayer (false)
, _last_length (other->_last_length)
, _last_position(other->_last_position) \
, _first_edit (EditChangesNothing)
- , _read_data_count(0)
, _last_layer_op (0)
, _pending_explicit_relayer (false)
, _last_length (other->_last_length)
, _last_position (other->_last_position)
, _first_edit (EditChangesID)
- , _read_data_count (0)
, _last_layer_op (other->_last_layer_op)
, _pending_explicit_relayer (false)
{
DEBUG_TRACE (DEBUG::MidiSourceIO, string_compose ("SMF read_unlocked: start %1 duration %2\n", start, duration));
- _read_data_count = 0;
-
// Output parameters for read_event (which will allocate scratch in buffer as needed)
uint32_t ev_delta_t = 0;
uint32_t ev_type = 0;
break;
}
- _read_data_count += ev_size;
-
if (ev_size > scratch_size) {
scratch_size = ev_size;
}
mark_streaming_write_started ();
}
- _write_data_count = 0;
-
framepos_t time;
Evoral::EventType type;
uint32_t size;
Evoral::SMF::append_event_delta(delta_time_ticks, ev.size(), ev.buffer(), event_id);
_last_ev_time_beats = ev.time();
-
- _write_data_count += ev.size();
-
}
/** Append an event with a timestamp in frames (framepos_t) */
Evoral::SMF::append_event_delta(delta_time_ticks, ev.size(), ev.buffer(), event_id);
_last_ev_time_frames = ev.time();
-
- _write_data_count += ev.size();
-
}
XMLNode&
if (_info.channels == 1) {
framecnt_t ret = sf_read_float (sf, dst, file_cnt);
- _read_data_count = ret * sizeof(float);
if (ret != file_cnt) {
char errbuf[256];
sf_error_str (0, errbuf, sizeof (errbuf) - 1);
ptr += _info.channels;
}
- _read_data_count = cnt * sizeof(float);
-
_descriptor->release ();
return nread;
}
compute_and_write_peaks (data, frame_pos, cnt, false, true);
}
- _write_data_count = cnt;
-
return cnt;
}
return _diskstream->use_new_playlist ();
}
-uint32_t
-Track::read_data_count () const
-{
- return _diskstream->read_data_count ();
-}
-
void
Track::set_align_style (AlignStyle s, bool force)
{
_diskstream->set_align_choice (s, force);
}
-uint32_t
-Track::write_data_count () const
-{
- return _diskstream->write_data_count ();
-}
-
PBD::ID const &
Track::diskstream_id () const
{