#include <ardour/track.h>
#include <ardour/diskstream.h>
#include <ardour/session.h>
-#include <ardour/redirect.h>
+#include <ardour/io_processor.h>
#include <ardour/audioregion.h>
#include <ardour/audiosource.h>
#include <ardour/route_group_specialized.h>
-#include <ardour/insert.h>
+#include <ardour/processor.h>
#include <ardour/audioplaylist.h>
#include <ardour/panner.h>
#include <ardour/utils.h>
Track::Track (Session& sess, string name, Route::Flag flag, TrackMode mode, DataType default_type)
: Route (sess, name, 1, -1, -1, -1, flag, default_type)
- , _diskstream (0)
- , _rec_enable_control (*this)
+ , _rec_enable_control (new RecEnableControllable(*this))
{
_declickable = true;
_freeze_record.state = NoFreeze;
}
Track::Track (Session& sess, const XMLNode& node, DataType default_type)
- : Route (sess, "to be renamed", 0, 0, -1, -1, Route::Flag(0), default_type)
- , _diskstream (0)
- , _rec_enable_control (*this)
+ : Route (sess, node)
+ , _rec_enable_control (new RecEnableControllable(*this))
{
_freeze_record.state = NoFreeze;
_declickable = true;
Track::~Track ()
{
- if (_diskstream) {
- _diskstream->unref();
- }
}
void
void
Track::toggle_monitor_input ()
{
- for (vector<Port*>::iterator i = _inputs.begin(); i != _inputs.end(); ++i) {
- (*i)->request_monitor_input(!(*i)->monitoring_input());
+ for (PortSet::iterator i = _inputs.begin(); i != _inputs.end(); ++i) {
+ i->ensure_monitor_input(!i->monitoring_input());
}
}
-jack_nframes_t
+ARDOUR::nframes_t
Track::update_total_latency ()
{
- _own_latency = 0;
+ nframes_t old = _own_latency;
+
+ if (_user_latency) {
+ _own_latency = _user_latency;
+ } else {
+ _own_latency = 0;
- for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) {
- if ((*i)->active ()) {
- _own_latency += (*i)->latency ();
+ for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ++i) {
+ if ((*i)->active ()) {
+ _own_latency += (*i)->signal_latency ();
+ }
}
}
set_port_latency (_own_latency);
+ if (old != _own_latency) {
+ signal_latency_changed (); /* EMIT SIGNAL */
+ }
+
return _own_latency;
}
-
Track::FreezeRecord::~FreezeRecord ()
{
- for (vector<FreezeRecordInsertInfo*>::iterator i = insert_info.begin(); i != insert_info.end(); ++i) {
+ for (vector<FreezeRecordProcessorInfo*>::iterator i = processor_info.begin(); i != processor_info.end(); ++i) {
delete *i;
}
}
}
Track::RecEnableControllable::RecEnableControllable (Track& s)
- : track (s)
+ : Controllable (X_("recenable")), track (s)
{
}
{
return _diskstream->record_enabled ();
}
+
+bool
+Track::can_record()
+{
+ bool will_record = true;
+ for (PortSet::iterator i = _inputs.begin(); i != _inputs.end() && will_record; ++i) {
+ if (!i->connected())
+ will_record = false;
+ }
+
+ return will_record;
+}
void
Track::set_record_enable (bool yn, void *src)
}
/* keep track of the meter point as it was before we rec-enabled */
-
if (!_diskstream->record_enabled()) {
_saved_meter_point = _meter_point;
}
set_meter_point (_saved_meter_point, this);
}
- _rec_enable_control.Changed ();
+ _rec_enable_control->Changed ();
}
-void
-Track::set_mode (TrackMode m)
-{
- if (_diskstream) {
- if (_mode != m) {
- _mode = m;
- _diskstream->set_destructive (m == Destructive);
- ModeChanged();
- }
- }
-}
-int
-Track::set_name (string str, void *src)
+bool
+Track::set_name (const string& str)
{
- int ret;
+ bool ret;
if (record_enabled() && _session.actively_recording()) {
/* this messes things up if done while recording */
- return -1;
+ return false;
}
if (_diskstream->set_name (str)) {
- return -1;
+ return false;
}
/* save state so that the statefile fully reflects any filename changes */
- if ((ret = IO::set_name (str, src)) == 0) {
+ if ((ret = IO::set_name (str)) == 0) {
_session.save_state ("");
}
+
return ret;
}
void
-Track::set_latency_delay (jack_nframes_t longest_session_latency)
+Track::set_latency_delay (nframes_t longest_session_latency)
{
Route::set_latency_delay (longest_session_latency);
_diskstream->set_roll_delay (_roll_delay);