#include <sys/mman.h>
#include <pbd/error.h>
-#include <pbd/basename.h>
#include <glibmm/thread.h>
#include <pbd/xml++.h>
#include <pbd/memento_command.h>
uint32_t n;
ChannelList::iterator chan;
uint32_t ni = _io->n_inputs().n_audio();
+ vector<string> connections;
for (n = 0, chan = c->begin(); chan != c->end() && n < ni; ++chan, ++n) {
- const char **connections = _io->input(n)->get_connections ();
+ connections.clear ();
+
+ if (_io->input(n)->get_connections (connections) == 0) {
- if (connections == 0 || connections[0] == 0) {
-
if ((*chan)->source) {
// _source->disable_metering ();
}
(*chan)->source = 0;
} else {
- (*chan)->source = dynamic_cast<AudioPort*>(
- _session.engine().get_port_by_name (connections[0]) );
- }
-
- if (connections) {
- free (connections);
+ (*chan)->source = dynamic_cast<AudioPort*>(_session.engine().get_port_by_name (connections[0]) );
}
}
}
if (rec_nframes == 0 && _actual_speed != 1.0f && _actual_speed != -1.0f) {
uint64_t phase = last_phase;
+ int64_t phi_delta;
nframes_t i = 0;
// Linearly interpolate into the alt buffer
// using 40.24 fixp maths (swh)
+ if (phi != target_phi) {
+ phi_delta = ((int64_t)(target_phi - phi)) / nframes;
+ } else {
+ phi_delta = 0;
+ }
+
for (chan = c->begin(); chan != c->end(); ++chan) {
float fr;
chaninfo->speed_buffer[outsample] =
chaninfo->current_playback_buffer[i] * (1.0f - fr) +
chaninfo->current_playback_buffer[i+1] * fr;
- phase += phi;
+ phase += phi + phi_delta;
}
chaninfo->current_playback_buffer = chaninfo->speed_buffer;
}
- playback_distance = i + 1;
+ playback_distance = i; // + 1;
last_phase = (phase & 0xFFFFFF);
} else {
playback_distance = nframes;
}
+ phi = target_phi;
+
}
ret = 0;
capture_info.push_back (ci);
capture_captured = 0;
+
+ /* now we've finished a capture, reset first_recordable_frame for next time */
+ first_recordable_frame = max_frames;
}
void
(*chan)->source->ensure_monitor_input (!(Config->get_auto_input() && rolling));
}
capturing_sources.push_back ((*chan)->write_source);
+ (*chan)->write_source->mark_streaming_write_started ();
}
} else {
for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan) {
capturing_sources.push_back ((*chan)->write_source);
+ (*chan)->write_source->mark_streaming_write_started ();
}
}
continue;
}
+ // This protects sessions from errant CapturingSources in stored sessions
+ struct stat sbuf;
+ if (stat (prop->value().c_str(), &sbuf)) {
+ continue;
+ }
+
try {
fs = boost::dynamic_pointer_cast<AudioFileSource> (
SourceFactory::createWritable (DataType::AUDIO, _session, prop->value(), false, _session.frame_rate()));