#include <ardour/ardour.h>
#include <ardour/audioengine.h>
+#include <ardour/analyser.h>
#include <ardour/audio_diskstream.h>
#include <ardour/utils.h>
#include <ardour/configuration.h>
{
string newname;
boost::shared_ptr<AudioPlaylist> playlist;
-
+
if (!in_set_state && destructive()) {
return 0;
}
/* if per-track or global rec-enable turned on while the other was already on, we've started recording */
- if ((change & track_rec_enabled) && record_enabled() && (!(change & global_rec_enabled) && can_record) ||
+ if (((change & track_rec_enabled) && record_enabled() && (!(change & global_rec_enabled) && can_record)) ||
((change & global_rec_enabled) && can_record && (!(change & track_rec_enabled) && record_enabled()))) {
/* starting to record: compute first+last frames */
first_recordable_frame = transport_frame + _capture_offset;
+ // cerr << "set FRF = " << transport_frame << " + " << _capture_offset << " = " << first_recordable_frame << endl;
last_recordable_frame = max_frames;
capture_start_frame = transport_frame;
/* was stopped, now rolling (and recording) */
if (_alignment_style == ExistingMaterial) {
- first_recordable_frame += _session.worst_output_latency();
+ //cerr << "A FRF += " << _session.worst_output_latency () << endl;
+ // first_recordable_frame += _session.worst_output_latency();
} else {
- first_recordable_frame += _roll_delay;
+ // cerr << "B FRF += " << _roll_delay<< endl;
+ // first_recordable_frame += _roll_delay;
}
} else {
this is needed.
*/
+ // cerr << "1 FRF += " << _capture_offset << endl;
first_recordable_frame += _capture_offset;
} else {
on the output latency.
*/
+ // cerr << "2 FRF += " << _session.worst_output_latency() << endl;
first_recordable_frame += _session.worst_output_latency();
}
} else {
if (Config->get_punch_in()) {
+ // cerr << "3 FRF += " << _roll_delay << endl;
first_recordable_frame += _roll_delay;
} else {
capture_start_frame -= _roll_delay;
}
+ // cerr << _name << " FRF = " << first_recordable_frame << " CSF = " << capture_start_frame << endl;
+
if (recordable() && destructive()) {
boost::shared_ptr<ChannelList> c = channels.reader();
for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan) {
}
int
-AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, nframes_t offset, bool can_record, bool rec_monitors_input)
+AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can_record, bool rec_monitors_input)
{
uint32_t n;
boost::shared_ptr<ChannelList> c = channels.reader();
commit_should_unlock = false;
+ if (!_io || !_io->active()) {
+ _processed = true;
+ return 0;
+ }
+
check_record_status (transport_frame, nframes, can_record);
nominally_recording = (can_record && re);
rec_offset
*/
- memcpy (chaninfo->current_capture_buffer, _io->input(n)->get_buffer (rec_nframes) + offset + rec_offset, sizeof (Sample) * rec_nframes);
+ memcpy (chaninfo->current_capture_buffer, _io->get_input_buffer (n, rec_nframes) + rec_offset, sizeof (Sample) * rec_nframes);
} else {
goto out;
}
- Sample* buf = _io->input (n)->get_buffer (nframes) + offset;
+ Sample* buf = _io->get_input_buffer (n, nframes);
nframes_t first = chaninfo->capture_vector.len[0];
memcpy (chaninfo->capture_wrap_buffer, buf, sizeof (Sample) * first);
nframes_t total = chaninfo->playback_vector.len[0] + chaninfo->playback_vector.len[1];
if (necessary_samples > total) {
+ cerr << "underrun for " << _name << endl;
DiskUnderrun ();
goto out;
{
bool need_butler = false;
+ if (!_io || !_io->active()) {
+ return false;
+ }
+
if (_actual_speed < 0.0) {
playback_sample -= playback_distance;
} else {
}
if (_slaved) {
- need_butler = c->front()->playback_buf->write_space() >= c->front()->playback_buf->bufsize() / 2;
+ if (_io && _io->active()) {
+ need_butler = c->front()->playback_buf->write_space() >= c->front()->playback_buf->bufsize() / 2;
+ } else {
+ need_butler = false;
+ }
} else {
- need_butler = c->front()->playback_buf->write_space() >= disk_io_chunk_frames
- || c->front()->capture_buf->read_space() >= disk_io_chunk_frames;
+ if (_io && _io->active()) {
+ need_butler = c->front()->playback_buf->write_space() >= disk_io_chunk_frames
+ || c->front()->capture_buf->read_space() >= disk_io_chunk_frames;
+ } else {
+ need_butler = c->front()->capture_buf->read_space() >= disk_io_chunk_frames;
+ }
}
if (commit_should_unlock) {
vector.buf[1] = 0;
boost::shared_ptr<ChannelList> c = channels.reader();
- for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan) {
+ int nn = 0;
+ for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan, ++nn) {
(*chan)->capture_buf->get_read_vector (&vector);
s->update_header (capture_info.front()->start, when, twhen);
s->set_captured_for (_name);
s->mark_immutable ();
+ if (Config->get_auto_analyse_audio()) {
+ Analyser::queue_source_for_analysis (s, true);
+ }
}
}
{
g_atomic_int_set (&_record_enabled, 0);
boost::shared_ptr<ChannelList> c = channels.reader();
- for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan) {
- if (Config->get_monitoring_model() == HardwareMonitoring) {
+ if (Config->get_monitoring_model() == HardwareMonitoring) {
+ for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan) {
if ((*chan)->source) {
(*chan)->source->ensure_monitor_input (false);
}
if (nchans > _n_channels) {
add_channel (nchans - _n_channels);
+ IO::MoreOutputs(_n_channels);
} else if (nchans < _n_channels) {
up of the IO that owns this DS (::non_realtime_input_change())
*/
- in_set_state = false;
-
return 0;
}
boost::shared_ptr<ChannelList> c = channels.reader();
uint32_t n;
- if (!recordable()) {
+ if (!_session.writable() || !recordable()) {
return;
}
int
AudioDiskstream::remove_channel_from (boost::shared_ptr<ChannelList> c, uint32_t how_many)
{
- while (--how_many && !c->empty()) {
+ while (how_many-- && !c->empty()) {
delete c->back();
c->pop_back();
}