void set_record_enabled (bool yn);
void set_record_safe (bool yn);
-#ifdef XXX_OLD_DESTRUCTIVE_API_XXX
- int set_destructive (bool yn);
- int set_non_layered (bool yn);
- bool can_become_destructive (bool& requires_bounce) const;
-#endif
boost::shared_ptr<AudioPlaylist> audio_playlist () { return boost::dynamic_pointer_cast<AudioPlaylist>(_playlist); }
AudioTrack (Session&, std::string name, TrackMode m = Normal);
~AudioTrack ();
-#ifdef XXX_OLD_DESTRUCTIVE_API_XXX
- int set_mode (TrackMode m);
- bool can_use_mode (TrackMode m, bool& bounce_required);
-#endif
-
int roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
int declick, bool& need_butler);
virtual void set_record_safe (bool yn) = 0;
bool destructive() const { return _flags & Destructive; }
-#ifdef XXX_OLD_DESTRUCTIVE_API_XXX
- virtual int set_destructive (bool /*yn*/) { return -1; }
- virtual int set_non_layered (bool /*yn*/) { return -1; }
- virtual bool can_become_destructive (bool& /*requires_bounce*/) const { return false; }
-#endif
bool hidden() const { return _flags & Hidden; }
bool recordable() const { return _flags & Recordable; }
boost::shared_ptr<SMFSource> write_source () { return _write_source; }
-#ifdef XXX_OLD_DESTRUCTIVE_API_XXX
- int set_destructive (bool yn); // doom!
-#endif
-
void set_note_mode (NoteMode m);
/** Emitted when some MIDI data has been received for recording.
void mark_capture_end ();
void clear_capture_marks();
-#ifdef XXX_OLD_DESTRUCTIVE_API_XXX
- bool set_destructive (bool yn);
-#endif
-
bool one_of_several_channels () const;
uint32_t channel_count () const { return _info.channels; }
bool destructive() const { return (_flags & Destructive); }
bool writable () const;
-#ifdef XXX_OLD_DESTRUCTIVE_API_XXX
- virtual bool set_destructive (bool /*yn*/) { return false; }
-#endif
+
virtual bool length_mutable() const { return false; }
static PBD::Signal1<void,Source*> SourceCreated;
void resync_track_name ();
TrackMode mode () const { return _mode; }
-#ifdef XXX_OLD_DESTRUCTIVE_API_XXX
- virtual int set_mode (TrackMode /*m*/) { return false; }
- virtual bool can_use_mode (TrackMode /*m*/, bool& /*bounce_required*/) { return false; }
- PBD::Signal0<void> TrackModeChanged;
-#endif
boost::shared_ptr<MonitorControl> monitoring_control() const { return _monitoring_control; }
/* this might be false if we switched modes, so force it */
-#ifdef XXX_OLD_DESTRUCTIVE_API_XXX
- (*chan)->write_source->set_destructive (true);
-#else
// should be set when creating the source or loading the state
assert ((*chan)->write_source->destructive());
-#endif
}
/* the source list will never be reset for a destructive track */
return 0;
}
-#ifdef XXX_OLD_DESTRUCTIVE_API_XXX
-int
-AudioDiskstream::set_non_layered (bool yn)
-{
- if (yn != non_layered()) {
-
- if (yn) {
- _flags = Flag (_flags | NonLayered);
- } else {
- _flags = Flag (_flags & ~NonLayered);
- }
- }
-
- return 0;
-}
-
-int
-AudioDiskstream::set_destructive (bool yn)
-{
- if (yn != destructive()) {
-
- if (yn) {
- bool bounce_ignored;
- /* requestor should already have checked this and
- bounced if necessary and desired
- */
- if (!can_become_destructive (bounce_ignored)) {
- return -1;
- }
- _flags = Flag (_flags | Destructive);
- use_destructive_playlist ();
- } else {
- _flags = Flag (_flags & ~Destructive);
- reset_write_sources (true, true);
- }
- }
-
- return 0;
-}
-
-bool
-AudioDiskstream::can_become_destructive (bool& requires_bounce) const
-{
- if (Profile->get_trx()) {
- return false;
- }
-
- if (!_playlist) {
- requires_bounce = false;
- return false;
- }
-
- /* if no regions are present: easy */
-
- if (_playlist->n_regions() == 0) {
- requires_bounce = false;
- return true;
- }
-
- /* is there only one region ? */
-
- if (_playlist->n_regions() != 1) {
- requires_bounce = true;
- return false;
- }
-
- boost::shared_ptr<Region> first;
- {
- const RegionList& rl (_playlist->region_list_property().rlist());
- assert((rl.size() == 1));
- first = rl.front();
-
- }
-
- if (!first) {
- requires_bounce = false;
- return true;
- }
-
- /* do the source(s) for the region cover the session start position ? */
-
- if (first->position() != _session.current_start_frame()) {
- // what is the idea here? why start() ??
- if (first->start() > _session.current_start_frame()) {
- requires_bounce = true;
- return false;
- }
- }
-
- /* currently RouteTimeAxisView::set_track_mode does not
- * implement bounce. Existing regions cannot be converted.
- *
- * so let's make sure this region is already set up
- * as tape-track (spanning the complete range)
- */
- if (first->length() != max_framepos - first->position()) {
- requires_bounce = true;
- return false;
- }
-
- /* is the source used by only 1 playlist ? */
-
- boost::shared_ptr<AudioRegion> afirst = boost::dynamic_pointer_cast<AudioRegion> (first);
-
- assert (afirst);
-
- if (_session.playlists->source_use_count (afirst->source()) > 1) {
- requires_bounce = true;
- return false;
- }
-
- requires_bounce = false;
- return true;
-}
-#endif
-
void
AudioDiskstream::adjust_playback_buffering ()
{
Track::set_diskstream (ds);
_diskstream->set_track (this);
-#ifdef XXX_OLD_DESTRUCTIVE_API_XXX
- if (Profile->get_trx()) {
- _diskstream->set_destructive (false);
- } else {
- _diskstream->set_destructive (_mode == Destructive);
- }
- _diskstream->set_non_layered (_mode == NonLayered);
-#endif
if (audio_diskstream()->deprecated_io_node) {
return boost::dynamic_pointer_cast<AudioDiskstream>(_diskstream);
}
-#ifdef XXX_OLD_DESTRUCTIVE_API_XXX
-int
-AudioTrack::set_mode (TrackMode m)
-{
- if (m != _mode) {
-
- if (!Profile->get_trx() && _diskstream->set_destructive (m == Destructive)) {
- return -1;
- }
-
- _diskstream->set_non_layered (m == NonLayered);
- _mode = m;
-
- TrackModeChanged (); /* EMIT SIGNAL */
- }
-
- return 0;
-}
-
-bool
-AudioTrack::can_use_mode (TrackMode m, bool& bounce_required)
-{
- switch (m) {
- case NonLayered:
- case Normal:
- bounce_required = false;
- return true;
-
- case Destructive:
- if (Profile->get_trx()) {
- return false;
- } else {
- return _diskstream->can_become_destructive (bounce_required);
- }
- break;
-
- default:
- return false;
- }
-}
-#endif
-
int
AudioTrack::deprecated_use_diskstream_connections ()
{
Track::set_diskstream (ds);
_diskstream->set_track (this);
-#ifdef XXX_OLD_DESTRUCTIVE_API_XXX
- if (Profile->get_trx()) {
- _diskstream->set_destructive (false);
- } else {
- _diskstream->set_destructive (_mode == Destructive);
- }
- _diskstream->set_non_layered (_mode == NonLayered);
-#endif
_diskstream->set_record_enabled (false);
_diskstream->request_input_monitoring (false);
}
}
-#ifdef XXX_OLD_DESTRUCTIVE_API_XXX
-/** Overloaded from parent to die horribly
- */
-int
-MidiDiskstream::set_destructive (bool yn)
-{
- return yn ? -1 : 0;
-}
-#endif
-
void
MidiDiskstream::set_note_mode (NoteMode m)
{
mds->reset_tracker ();
_diskstream->set_track (this);
-#ifdef XXX_OLD_DESTRUCTIVE_API_XXX
- if (Profile->get_trx()) {
- _diskstream->set_destructive (false);
- } else {
- _diskstream->set_destructive (_mode == Destructive);
- }
-#endif
_diskstream->set_record_enabled (false);
_diskstream_data_recorded_connection.disconnect ();
return _timeline_position;
}
-#ifdef XXX_OLD_DESTRUCTIVE_API_XXX
-bool
-SndFileSource::set_destructive (bool yn)
-{
- if (yn) {
- _flags = Flag (_flags | Writable | Destructive);
- if (!xfade_buf) {
- xfade_buf = new Sample[xfade_frames];
- }
- clear_capture_marks ();
- _timeline_position = header_position_offset;
- } else {
- _flags = Flag (_flags & ~Destructive);
- _timeline_position = 0;
- /* leave xfade buf alone in case we need it again later */
- }
-
- return true;
-}
-#endif
-
void
SndFileSource::clear_capture_marks ()
{