#include "pbd/enumwriter.h"
#include "pbd/stacktrace.h"
-#include "ardour/ardour.h"
-#include "ardour/audioengine.h"
#include "ardour/analyser.h"
+#include "ardour/ardour.h"
+#include "ardour/audio_buffer.h"
#include "ardour/audio_diskstream.h"
-#include "ardour/utils.h"
-#include "ardour/configuration.h"
+#include "ardour/audio_port.h"
+#include "ardour/audioengine.h"
#include "ardour/audiofilesource.h"
-#include "ardour/send.h"
-#include "ardour/region_factory.h"
+
#include "ardour/audioplaylist.h"
-#include "ardour/playlist_factory.h"
-#include "ardour/cycle_timer.h"
#include "ardour/audioregion.h"
-#include "ardour/audio_port.h"
-#include "ardour/source_factory.h"
-#include "ardour/audio_buffer.h"
-#include "ardour/session.h"
+#include "ardour/butler.h"
+#include "ardour/configuration.h"
+#include "ardour/cycle_timer.h"
+#include "ardour/debug.h"
#include "ardour/io.h"
+#include "ardour/playlist_factory.h"
+#include "ardour/region_factory.h"
+#include "ardour/send.h"
+#include "ardour/session.h"
+#include "ardour/source_factory.h"
+#include "ardour/utils.h"
+#include "ardour/session_playlists.h"
#include "i18n.h"
#include <locale.h>
AudioDiskstream::~AudioDiskstream ()
{
- notify_callbacks ();
+ DEBUG_TRACE (DEBUG::Destruction, string_compose ("Audio Diskstream %1 destructor\n", _name));
{
RCUWriter<ChannelList> writer (channels);
{
boost::shared_ptr<AudioPlaylist> playlist;
- if ((playlist = boost::dynamic_pointer_cast<AudioPlaylist> (_session.playlist_by_name (name))) == 0) {
+ if ((playlist = boost::dynamic_pointer_cast<AudioPlaylist> (_session.playlists->by_name (name))) == 0) {
playlist = boost::dynamic_pointer_cast<AudioPlaylist> (PlaylistFactory::create (DataType::AUDIO, _session, name));
}
nframes_t total = chaninfo->playback_vector.len[0] + chaninfo->playback_vector.len[1];
if (necessary_samples > total) {
+ cerr << _name << " Need " << necessary_samples << " total = " << total << endl;
cerr << "underrun for " << _name << endl;
DiskUnderrun ();
goto out;
void
AudioDiskstream::process_varispeed_playback(nframes_t nframes, boost::shared_ptr<ChannelList> c)
{
- ChannelList::iterator chan;
+ ChannelList::iterator chan;
- interpolation.set_speed (_target_speed);
+ interpolation.set_speed (_target_speed);
- int channel = 0;
- for (chan = c->begin(); chan != c->end(); ++chan, ++channel) {
- ChannelInfo* chaninfo (*chan);
+ int channel = 0;
+ for (chan = c->begin(); chan != c->end(); ++chan, ++channel) {
+ ChannelInfo* chaninfo (*chan);
- playback_distance = interpolation.interpolate (
- channel, nframes, chaninfo->current_playback_buffer, chaninfo->speed_buffer);
+ playback_distance = interpolation.interpolate (
+ channel, nframes, chaninfo->current_playback_buffer, chaninfo->speed_buffer);
- chaninfo->current_playback_buffer = chaninfo->speed_buffer;
- }
+ chaninfo->current_playback_buffer = chaninfo->speed_buffer;
+ }
}
bool
continue; /* XXX is this OK? */
}
- region->GoingAway.connect (bind (mem_fun (*this, &Diskstream::remove_region_from_last_capture), boost::weak_ptr<Region>(region)));
+ region->DropReferences.connect_same_thread (*this, boost::bind (&Diskstream::remove_region_from_last_capture, this, boost::weak_ptr<Region>(region)));
_last_capture_regions.push_back (region);
return;
}
- if (yn && channels.reader()->front()->source == 0) {
-
- /* pick up connections not initiated *from* the IO object
- we're associated with.
- */
-
- get_input_sources ();
- }
-
/* yes, i know that this not proof against race conditions, but its
good enough. i think.
*/
if (_session.config.get_punch_in() && ((pi = _session.locations()->auto_punch_location()) != 0)) {
snprintf (buf, sizeof (buf), "%" PRId64, pi->start());
} else {
- snprintf (buf, sizeof (buf), "%" PRIu32, _session.transport_frame());
+ snprintf (buf, sizeof (buf), "%" PRId64, _session.transport_frame());
}
cs_child->add_property (X_("at"), buf);
}
int
-AudioDiskstream::set_state (const XMLNode& node, int version)
+AudioDiskstream::set_state (const XMLNode& node, int /*version*/)
{
const XMLProperty* prop;
XMLNodeList nlist = node.children();
/* do not remove destructive files even if they are empty */
chan->write_source->set_allow_remove_if_empty (!destructive());
+
+ /* until we write, this file is considered removable */
+
+ chan->write_source->mark_for_remove ();
return 0;
}
{
/* make sure the wrap buffer is at least large enough to deal
with the speeds up to 1.2, to allow for micro-variation
- when slaving to MTC, SMPTE etc.
+ when slaving to MTC, Timecode etc.
*/
double sp = max (fabsf (_actual_speed), 1.2f);
int
AudioDiskstream::add_channel_to (boost::shared_ptr<ChannelList> c, uint32_t how_many)
{
-
while (how_many--) {
- c->push_back (new ChannelInfo(_session.audio_diskstream_buffer_size(), speed_buffer_size, wrap_buffer_size));
- interpolation.add_channel_to (_session.audio_diskstream_buffer_size(), speed_buffer_size);
+ c->push_back (new ChannelInfo(_session.butler()->audio_diskstream_buffer_size(), speed_buffer_size, wrap_buffer_size));
+ interpolation.add_channel_to (_session.butler()->audio_diskstream_buffer_size(), speed_buffer_size);
}
_n_channels.set(DataType::AUDIO, c->size());
try {
fs = boost::dynamic_pointer_cast<AudioFileSource> (
SourceFactory::createWritable (DataType::AUDIO, _session,
- prop->value(), true,
- false, _session.frame_rate()));
+ prop->value(), false, _session.frame_rate()));
}
catch (failed_constructor& err) {
assert (afirst);
- if (afirst->source()->used() > 1) {
+ if (_session.playlists->source_use_count (afirst->source()) > 1) {
requires_bounce = true;
return false;
}