*/
#include "pbd/enumwriter.h"
-#include "pbd/i18n.h"
#include "pbd/memento_command.h"
#include "ardour/audioengine.h"
#include "ardour/session.h"
#include "ardour/session_playlists.h"
+#include "pbd/i18n.h"
+
using namespace ARDOUR;
using namespace PBD;
using namespace std;
DiskReader::DiskReader (Session& s, string const & str, DiskIOProcessor::Flag f)
: DiskIOProcessor (s, str, f)
- , _roll_delay (0)
, overwrite_sample (0)
- , overwrite_offset (0)
- , _pending_overwrite (false)
- , overwrite_queued (false)
+ , overwrite_offset (0)
+ , _pending_overwrite (false)
+ , overwrite_queued (false)
, _gui_feed_buffer (AudioEngine::instance()->raw_buffer_size (DataType::MIDI))
{
file_sample[DataType::AUDIO] = 0;
return true;
}
-void
-DiskReader::set_roll_delay (ARDOUR::samplecnt_t nframes)
-{
- _roll_delay = nframes;
-}
-
XMLNode&
DiskReader::state (bool full)
{
}
}
- if (speed == 0.0 && (ms == MonitoringDisk)) {
- /* stopped. Don't accidentally pass any data from disk
- * into our outputs (e.g. via interpolation)
- */
- bufs.silence (nframes, 0);
+ if (speed == 0.0) {
+ /* stopped. Don't accidentally pass any data from disk
+ * into our outputs (e.g. via interpolation)
+ * nor jump ahead playback_sample when not rolling
+ */
+ if (ms == MonitoringDisk) {
+ /* when monitoring disk, clear input data so far,
+ * everything before the disk processor is not relevant.
+ */
+ bufs.silence (nframes, 0);
+ }
return;
}
disk_signal = output.data ();
}
+ if (start_sample < playback_sample) {
+ cerr << owner()->name() << " SS = " << start_sample << " PS = " << playback_sample << endl;
+ abort ();
+ }
+
+ if (start_sample != playback_sample) {
+ cerr << owner()->name() << " playback not aligned, jump ahead " << (start_sample - playback_sample) << endl;
+
+ if (can_internal_playback_seek (start_sample - playback_sample)) {
+ internal_playback_seek (start_sample - playback_sample);
+ } else {
+ cerr << owner()->name() << " playback not possible: ss = " << start_sample << " ps = " << playback_sample << endl;
+ goto midi;
+ }
+ }
+
chaninfo->buf->get_read_vector (&(*chan)->rw_vector);
if (disk_samples_to_consume <= (samplecnt_t) chaninfo->rw_vector.len[0]) {
if (fabsf (speed) != 1.0f) {
(void) interpolation.interpolate (
- n, nframes,
+ n, disk_samples_to_consume,
chaninfo->rw_vector.buf[0],
disk_signal);
} else if (speed != 0.0) {
}
if (scaling != 1.0f && speed != 0.0) {
- apply_gain_to_buffer (disk_signal, nframes, scaling);
+ apply_gain_to_buffer (disk_signal, disk_samples_to_consume, scaling);
}
chaninfo->buf->increment_read_ptr (disk_samples_to_consume);
- if ((speed != 0.0) && (ms & MonitoringInput)) {
+ monitor_mix:
+
+ if (ms & MonitoringInput) {
/* mix the disk signal into the input signal (already in bufs) */
- mix_buffers_no_gain (output.data(), disk_signal, speed == 0.0 ? nframes : disk_samples_to_consume);
+ mix_buffers_no_gain (output.data(), disk_signal, disk_samples_to_consume);
}
}
}
/* MIDI data handling */
+ midi:
if (!_session.declick_out_pending() && bufs.count().n_midi()) {
MidiBuffer* dst;
ChannelList::iterator chan;
boost::shared_ptr<ChannelList> c = channels.reader();
+ //sample = std::max ((samplecnt_t)0, sample -_session.worst_output_latency ());
+
for (n = 0, chan = c->begin(); chan != c->end(); ++chan, ++n) {
(*chan)->buf->reset ();
}