Fix broken indentation.

git-svn-id: svn://localhost/ardour2/branches/3.0@9151 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
David Robillard 2011-03-14 21:53:10 +00:00
parent b1697a75ac
commit 148c1f805b
6 changed files with 912 additions and 878 deletions

View File

@ -312,8 +312,8 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[])
keyboard->set_state (*node, Stateful::loading_state_version);
}
/* we don't like certain modifiers */
Bindings::set_ignored_state (GDK_LOCK_MASK|GDK_MOD2_MASK|GDK_MOD3_MASK);
/* we don't like certain modifiers */
Bindings::set_ignored_state (GDK_LOCK_MASK|GDK_MOD2_MASK|GDK_MOD3_MASK);
reset_dpi();
@ -334,7 +334,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[])
}
setup_clock ();
speaker_config_window->set (new SpeakerDialog);
speaker_config_window->set (new SpeakerDialog);
starting.connect (sigc::mem_fun(*this, &ARDOUR_UI::startup));
stopping.connect (sigc::mem_fun(*this, &ARDOUR_UI::shutdown));
@ -762,15 +762,15 @@ ARDOUR_UI::check_memory_locking ()
if (ram == 0 || ((double) limits.rlim_cur / ram) < 0.75) {
MessageDialog msg (
string_compose (_("WARNING: Your system has a limit for maximum amount of locked memory. "
"This might cause %1 to run out of memory before your system "
"runs out of memory. \n\n"
"You can view the memory limit with 'ulimit -l', "
"and it is normally controlled by /etc/security/limits.conf"),
PROGRAM_NAME).c_str());
string_compose (
_("WARNING: Your system has a limit for maximum amount of locked memory. "
"This might cause %1 to run out of memory before your system "
"runs out of memory. \n\n"
"You can view the memory limit with 'ulimit -l', "
"and it is normally controlled by /etc/security/limits.conf"),
PROGRAM_NAME).c_str());
VBox* vbox = msg.get_vbox();
HBox hbox;
CheckButton cb (_("Do not show this window again"));
@ -1274,9 +1274,10 @@ ARDOUR_UI::check_audioengine ()
{
if (engine) {
if (!engine->connected()) {
MessageDialog msg (string_compose (_("%1 is not connected to JACK\n"
"You cannot open or close sessions in this condition"),
PROGRAM_NAME));
MessageDialog msg (string_compose (
_("%1 is not connected to JACK\n"
"You cannot open or close sessions in this condition"),
PROGRAM_NAME));
pop_back_splash ();
msg.run ();
return false;
@ -2095,7 +2096,7 @@ ARDOUR_UI::snapshot_session (bool switch_to_it)
char timebuf[128];
time_t n;
struct tm local_time;
time (&n);
localtime_r (&n, &local_time);
strftime (timebuf, sizeof(timebuf), "%FT%T", &local_time);
@ -2439,7 +2440,7 @@ ARDOUR_UI::build_session_from_nsd (const std::string& session_path, const std::s
}
/// @todo some minor tweaks.
bus_profile.output_ac = AutoConnectOption (0);
if (_startup->connect_outputs ()) {
@ -2578,7 +2579,7 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri
/* absolute path or cwd-relative path specified for session name: infer session folder
from what was given.
*/
session_path = Glib::path_get_dirname (session_name);
session_name = Glib::path_get_basename (session_name);
@ -2587,16 +2588,18 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri
session_path = _startup->session_folder();
if (session_name.find ('/') != string::npos) {
MessageDialog msg (*_startup, _("To ensure compatibility with various systems\n"
"session names may not contain a '/' character"));
MessageDialog msg (*_startup,
_("To ensure compatibility with various systems\n"
"session names may not contain a '/' character"));
msg.run ();
ARDOUR_COMMAND_LINE::session_name = ""; // cancel that
continue;
}
if (session_name.find ('\\') != string::npos) {
MessageDialog msg (*_startup, _("To ensure compatibility with various systems\n"
"session names may not contain a '\\' character"));
MessageDialog msg (*_startup,
_("To ensure compatibility with various systems\n"
"session names may not contain a '\\' character"));
msg.run ();
ARDOUR_COMMAND_LINE::session_name = ""; // cancel that
continue;
@ -2632,16 +2635,18 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri
}
if (session_name.find ('/') != std::string::npos) {
MessageDialog msg (*_startup, _("To ensure compatibility with various systems\n"
"session names may not contain a '/' character"));
MessageDialog msg (*_startup,
_("To ensure compatibility with various systems\n"
"session names may not contain a '/' character"));
msg.run ();
ARDOUR_COMMAND_LINE::session_name = ""; // cancel that
continue;
}
if (session_name.find ('\\') != std::string::npos) {
MessageDialog msg (*_startup, _("To ensure compatibility with various systems\n"
"session names may not contain a '\\' character"));
MessageDialog msg (*_startup,
_("To ensure compatibility with various systems\n"
"session names may not contain a '\\' character"));
msg.run ();
ARDOUR_COMMAND_LINE::session_name = ""; // cancel that
continue;
@ -2752,7 +2757,9 @@ ARDOUR_UI::load_session (const std::string& path, const std::string& snap_name,
catch (...) {
MessageDialog msg (string_compose(_("Session \"%1 (snapshot %2)\" did not load successfully"),path, snap_name),
MessageDialog msg (string_compose(
_("Session \"%1 (snapshot %2)\" did not load successfully"),
path, snap_name),
true,
Gtk::MESSAGE_INFO,
BUTTONS_OK);
@ -3021,8 +3028,8 @@ require some unused files to continue to exist."));
if (rep.space < 1000) {
bprefix = X_("");
space_adjusted = rep.space;
} else if (rep.space < 1000000) {
bprefix = X_("kilo");
} else if (rep.space < 1000000) {
bprefix = X_("kilo");
space_adjusted = truncf((float)rep.space / 1000.0);
} else if (rep.space < 1000000 * 1000) {
bprefix = X_("mega");
@ -3073,7 +3080,7 @@ require some unused files to continue to exist."));
results.run ();
}
}
void
ARDOUR_UI::cleanup ()
@ -3364,8 +3371,8 @@ ARDOUR_UI::disk_underrun_handler ()
if (!have_disk_speed_dialog_displayed) {
have_disk_speed_dialog_displayed = true;
MessageDialog* msg = new MessageDialog (*editor,
string_compose (_("The disk system on your computer\n\
MessageDialog* msg = new MessageDialog (
*editor, string_compose (_("The disk system on your computer\n\
was not able to keep up with %1.\n\
\n\
Specifically, it failed to read data from disk\n\
@ -3710,16 +3717,16 @@ void
ARDOUR_UI::toggle_translations ()
{
using namespace Glib;
RefPtr<Action> act = ActionManager::get_action (X_("Main"), X_("EnableTranslation"));
if (act) {
RefPtr<ToggleAction> ract = RefPtr<ToggleAction>::cast_dynamic (act);
if (ract) {
string i18n_killer = ARDOUR::translation_kill_path();
bool already_enabled = !ARDOUR::translations_are_disabled ();
if (ract->get_active ()) {
/* we don't care about errors */
int fd = ::open (i18n_killer.c_str(), O_RDONLY|O_CREAT, 0644);
@ -3728,7 +3735,7 @@ ARDOUR_UI::toggle_translations ()
/* we don't care about errors */
unlink (i18n_killer.c_str());
}
if (already_enabled != ract->get_active()) {
MessageDialog win (already_enabled ? _("Translations disabled") : _("Translations enabled"),
false,
@ -3741,7 +3748,7 @@ ARDOUR_UI::toggle_translations ()
}
}
}
}
}
/** Add a window proxy to our list, so that its state will be saved.
* This call also causes the window to be created and opened if its

View File

@ -174,11 +174,11 @@ AudioDiskstream::non_realtime_input_change ()
remove_channel_from (c, _n_channels.n_audio() - _io->n_ports().n_audio());
}
}
get_input_sources ();
set_capture_offset ();
set_align_style_from_io ();
set_align_style_from_io ();
input_change_pending = IOChange::NoChange;
/* implicit unlock */
@ -223,11 +223,11 @@ AudioDiskstream::get_input_sources ()
connections.clear ();
cerr << "Getting Nth connection from io " << n << " = " << _io->nth(n) << endl;
cerr << "Getting Nth connection from io " << n << " = " << _io->nth(n) << endl;
if (_io->nth (n)->get_connections (connections) == 0) {
cerr << "\tThere were NO connections, apparently ...\n";
cerr << "\tThere were NO connections, apparently ...\n";
if ((*chan)->source) {
// _source->disable_metering ();
}
@ -235,7 +235,7 @@ AudioDiskstream::get_input_sources ()
(*chan)->source = 0;
} else {
cerr << "\tThere were some connections, apparently ... to " << connections[0] << endl;
cerr << "\tThere were some connections, apparently ... to " << connections[0] << endl;
(*chan)->source = dynamic_cast<AudioPort*>(_session.engine().get_port_by_name (connections[0]) );
}
}
@ -421,7 +421,7 @@ AudioDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool ca
framecnt_t rec_nframes = 0;
bool collect_playback = false;
playback_distance = 0;
playback_distance = 0;
if (!_io || !_io->active()) {
return 0;
@ -433,9 +433,9 @@ AudioDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool ca
return 0;
}
Glib::Mutex::Lock sm (state_lock, Glib::TRY_LOCK);
Glib::Mutex::Lock sm (state_lock, Glib::TRY_LOCK);
if (!sm.locked()) {
if (!sm.locked()) {
return 1;
}
@ -446,31 +446,31 @@ AudioDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool ca
(*chan)->current_playback_buffer = 0;
}
/* two conditions to test for here:
A: this track is rec-enabled, and the session has confirmed that we can record
B: this track is rec-enabled, has been recording, and we are set up for auto-punch-in
/* two conditions to test for here:
The second test is necessary to capture the extra material that arrives AFTER the transport
frame has left the punch range (which will cause the "can_record" argument to be false).
*/
A: this track is rec-enabled, and the session has confirmed that we can record
B: this track is rec-enabled, has been recording, and we are set up for auto-punch-in
The second test is necessary to capture the extra material that arrives AFTER the transport
frame has left the punch range (which will cause the "can_record" argument to be false).
*/
// Safeguard against situations where process() goes haywire when autopunching
// and last_recordable_frame < first_recordable_frame
// Safeguard against situations where process() goes haywire when autopunching
// and last_recordable_frame < first_recordable_frame
if (last_recordable_frame < first_recordable_frame) {
last_recordable_frame = max_framepos;
}
OverlapType ot = coverage (first_recordable_frame, last_recordable_frame, transport_frame, transport_frame + nframes);
if (last_recordable_frame < first_recordable_frame) {
last_recordable_frame = max_framepos;
}
calculate_record_range (ot, transport_frame, nframes, rec_nframes, rec_offset);
if (rec_nframes && !was_recording) {
capture_captured = 0;
was_recording = true;
}
OverlapType ot = coverage (first_recordable_frame, last_recordable_frame, transport_frame, transport_frame + nframes);
calculate_record_range (ot, transport_frame, nframes, rec_nframes, rec_offset);
if (rec_nframes && !was_recording) {
capture_captured = 0;
was_recording = true;
}
if (can_record && !_last_capture_sources.empty()) {
_last_capture_sources.clear ();
@ -643,9 +643,9 @@ AudioDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool ca
ret = 0;
if (commit (nframes)) {
need_butler = true;
}
if (commit (nframes)) {
need_butler = true;
}
out:
return ret;
@ -1476,7 +1476,7 @@ AudioDiskstream::transport_stopped_wallclock (struct tm& when, time_t twhen, boo
// cerr << _name << ": there are " << capture_info.size() << " capture_info records\n";
_playlist->clear_changes ();
_playlist->clear_changes ();
_playlist->freeze ();
for (buffer_position = c->front()->write_source->last_capture_start_frame(), ci = capture_info.begin(); ci != capture_info.end(); ++ci) {
@ -1594,8 +1594,8 @@ void
AudioDiskstream::finish_capture (bool /*rec_monitors_input*/, boost::shared_ptr<ChannelList> c)
{
was_recording = false;
first_recordable_frame = max_framepos;
last_recordable_frame = max_framepos;
first_recordable_frame = max_framepos;
last_recordable_frame = max_framepos;
if (capture_captured == 0) {
return;
@ -1724,7 +1724,7 @@ AudioDiskstream::get_state ()
boost::shared_ptr<ChannelList> c = channels.reader();
snprintf (buf, sizeof(buf), "%zd", c->size());
node.add_property ("channels", buf);
if (!capturing_sources.empty() && _session.get_record_enabled()) {
XMLNode* cs_child = new XMLNode (X_("CapturingSources"));
@ -1777,9 +1777,9 @@ AudioDiskstream::set_state (const XMLNode& node, int version)
}
}
if (Diskstream::set_state (node, version)) {
return -1;
}
if (Diskstream::set_state (node, version)) {
return -1;
}
if ((prop = node.property ("channels")) != 0) {
nchans = atoi (prop->value().c_str());
@ -1801,14 +1801,14 @@ AudioDiskstream::set_state (const XMLNode& node, int version)
}
if (!destructive() && capture_pending_node) {
/* destructive streams have one and only one source per channel,
and so they never end up in pending capture in any useful
sense.
*/
use_pending_capture_data (*capture_pending_node);
}
if (!destructive() && capture_pending_node) {
/* destructive streams have one and only one source per channel,
and so they never end up in pending capture in any useful
sense.
*/
use_pending_capture_data (*capture_pending_node);
}
in_set_state = false;
@ -1840,8 +1840,8 @@ AudioDiskstream::use_new_write_source (uint32_t n)
ChannelInfo* chan = (*c)[n];
try {
if ((chan->write_source = _session.create_audio_source_for_session (n_channels().n_audio(),
name(), n, destructive())) == 0) {
if ((chan->write_source = _session.create_audio_source_for_session (
n_channels().n_audio(), name(), n, destructive())) == 0) {
throw failed_constructor();
}
}
@ -1862,9 +1862,9 @@ AudioDiskstream::use_new_write_source (uint32_t n)
list<boost::shared_ptr<Source> >
AudioDiskstream::steal_write_sources()
{
/* not possible to steal audio write sources */
list<boost::shared_ptr<Source> > ret;
return ret;
/* not possible to steal audio write sources */
list<boost::shared_ptr<Source> > ret;
return ret;
}
void
@ -1891,13 +1891,13 @@ AudioDiskstream::reset_write_sources (bool mark_write_complete, bool /*force*/)
(*chan)->write_source->done_with_peakfile_writes ();
}
if ((*chan)->write_source->removable()) {
(*chan)->write_source->mark_for_remove ();
(*chan)->write_source->drop_references ();
}
if ((*chan)->write_source->removable()) {
(*chan)->write_source->mark_for_remove ();
(*chan)->write_source->drop_references ();
}
(*chan)->write_source.reset ();
}
(*chan)->write_source.reset ();
}
use_new_write_source (n);
@ -2004,9 +2004,9 @@ AudioDiskstream::set_align_style_from_io ()
{
bool have_physical = false;
if (_alignment_choice != Automatic) {
return;
}
if (_alignment_choice != Automatic) {
return;
}
if (_io == 0) {
return;
@ -2016,17 +2016,17 @@ AudioDiskstream::set_align_style_from_io ()
boost::shared_ptr<ChannelList> c = channels.reader();
cerr << "Checking " << c->size() << " for physical connections\n";
cerr << "Checking " << c->size() << " for physical connections\n";
for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan) {
cerr << "Channel connected via " << (*chan)->source << endl;
cerr << "Channel connected via " << (*chan)->source << endl;
if ((*chan)->source && (*chan)->source->flags() & JackPortIsPhysical) {
cerr << "\tchannel has physical connection to " << (*chan)->source->name() << endl;
cerr << "\tchannel has physical connection to " << (*chan)->source->name() << endl;
have_physical = true;
break;
}
}
cerr << "\tphysical? " << have_physical << endl;
cerr << "\tphysical? " << have_physical << endl;
if (have_physical) {
set_align_style (ExistingMaterial);
@ -2039,10 +2039,13 @@ int
AudioDiskstream::add_channel_to (boost::shared_ptr<ChannelList> c, uint32_t how_many)
{
while (how_many--) {
c->push_back (new ChannelInfo(_session.butler()->audio_diskstream_playback_buffer_size(),
_session.butler()->audio_diskstream_capture_buffer_size(),
speed_buffer_size, wrap_buffer_size));
interpolation.add_channel_to (_session.butler()->audio_diskstream_playback_buffer_size(), speed_buffer_size);
c->push_back (new ChannelInfo(
_session.butler()->audio_diskstream_playback_buffer_size(),
_session.butler()->audio_diskstream_capture_buffer_size(),
speed_buffer_size, wrap_buffer_size));
interpolation.add_channel_to (
_session.butler()->audio_diskstream_playback_buffer_size(),
speed_buffer_size);
}
_n_channels.set(DataType::AUDIO, c->size());
@ -2142,8 +2145,9 @@ AudioDiskstream::use_pending_capture_data (XMLNode& node)
try {
fs = boost::dynamic_pointer_cast<AudioFileSource> (
SourceFactory::createWritable (DataType::AUDIO, _session,
prop->value(), string(), false, _session.frame_rate()));
SourceFactory::createWritable (
DataType::AUDIO, _session,
prop->value(), string(), false, _session.frame_rate()));
}
catch (failed_constructor& err) {
@ -2294,8 +2298,8 @@ AudioDiskstream::adjust_playback_buffering ()
boost::shared_ptr<ChannelList> c = channels.reader();
for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan) {
(*chan)->resize_playback (_session.butler()->audio_diskstream_playback_buffer_size());
}
(*chan)->resize_playback (_session.butler()->audio_diskstream_playback_buffer_size());
}
}
void
@ -2304,8 +2308,8 @@ AudioDiskstream::adjust_capture_buffering ()
boost::shared_ptr<ChannelList> c = channels.reader();
for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan) {
(*chan)->resize_capture (_session.butler()->audio_diskstream_capture_buffer_size());
}
(*chan)->resize_capture (_session.butler()->audio_diskstream_capture_buffer_size());
}
}
AudioDiskstream::ChannelInfo::ChannelInfo (framecnt_t playback_bufsize, framecnt_t capture_bufsize, framecnt_t speed_size, framecnt_t wrap_size)
@ -2338,7 +2342,7 @@ AudioDiskstream::ChannelInfo::ChannelInfo (framecnt_t playback_bufsize, framecnt
void
AudioDiskstream::ChannelInfo::resize_playback (framecnt_t playback_bufsize)
{
delete playback_buf;
delete playback_buf;
playback_buf = new RingBufferNPT<Sample> (playback_bufsize);
memset (playback_buf->buffer(), 0, sizeof (Sample) * playback_buf->bufsize());
}
@ -2346,7 +2350,7 @@ AudioDiskstream::ChannelInfo::resize_playback (framecnt_t playback_bufsize)
void
AudioDiskstream::ChannelInfo::resize_capture (framecnt_t capture_bufsize)
{
delete capture_buf;
delete capture_buf;
capture_buf = new RingBufferNPT<Sample> (capture_bufsize);
memset (capture_buf->buffer(), 0, sizeof (Sample) * capture_buf->bufsize());
@ -2354,7 +2358,7 @@ AudioDiskstream::ChannelInfo::resize_capture (framecnt_t capture_bufsize)
AudioDiskstream::ChannelInfo::~ChannelInfo ()
{
write_source.reset ();
write_source.reset ();
delete [] speed_buffer;
speed_buffer = 0;

View File

@ -40,9 +40,9 @@ using namespace ARDOUR;
using namespace PBD;
AudioEngine* Port::_engine = 0;
bool Port::_connecting_blocked = false;
pframes_t Port::_global_port_buffer_offset = 0;
pframes_t Port::_cycle_nframes = 0;
bool Port::_connecting_blocked = false;
pframes_t Port::_global_port_buffer_offset = 0;
pframes_t Port::_cycle_nframes = 0;
/** @param n Port short name */
Port::Port (std::string const & n, DataType t, Flags f)
@ -51,14 +51,14 @@ Port::Port (std::string const & n, DataType t, Flags f)
, _flags (f)
, _last_monitor (false)
{
_private_playback_latency.min = 0;
_private_playback_latency.max = 0;
_private_capture_latency.min = 0;
_private_capture_latency.max = 0;
_private_playback_latency.min = 0;
_private_playback_latency.max = 0;
_private_capture_latency.min = 0;
_private_capture_latency.max = 0;
/* Unfortunately we have to pass the DataType into this constructor so that we can
create the right kind of JACK port; aside from this we'll use the virtual function type ()
to establish type.
/* Unfortunately we have to pass the DataType into this constructor so that
we can create the right kind of JACK port; aside from this we'll use the
virtual function type () to establish type.
*/
assert (_name.find_first_of (':') == std::string::npos);
@ -68,7 +68,7 @@ Port::Port (std::string const & n, DataType t, Flags f)
}
if ((_jack_port = jack_port_register (_engine->jack (), _name.c_str (), t.to_jack_type (), _flags, 0)) == 0) {
cerr << "Failed to register JACK port, reason is unknown from here\n";
cerr << "Failed to register JACK port, reason is unknown from here\n";
throw failed_constructor ();
}
}
@ -103,15 +103,16 @@ Port::disconnect_all ()
bool
Port::connected_to (std::string const & o) const
{
if (!_engine->connected()) {
/* in some senses, this answer isn't the right one all the time,
because we know about our connections and will re-establish
them when we reconnect to JACK.
*/
return false;
}
if (!_engine->connected()) {
/* in some senses, this answer isn't the right one all the time,
because we know about our connections and will re-establish
them when we reconnect to JACK.
*/
return false;
}
return jack_port_connected_to (_jack_port, _engine->make_port_name_non_relative(o).c_str ());
return jack_port_connected_to (_jack_port,
_engine->make_port_name_non_relative(o).c_str ());
}
/** @param o Filled in with port full names of ports that we are connected to */
@ -120,17 +121,17 @@ Port::get_connections (std::vector<std::string> & c) const
{
int n = 0;
if (_engine->connected()) {
const char** jc = jack_port_get_connections (_jack_port);
if (jc) {
for (int i = 0; jc[i]; ++i) {
c.push_back (jc[i]);
++n;
}
if (_engine->connected()) {
const char** jc = jack_port_get_connections (_jack_port);
if (jc) {
for (int i = 0; jc[i]; ++i) {
c.push_back (jc[i]);
++n;
}
jack_free (jc);
}
}
jack_free (jc);
}
}
return n;
}
@ -178,7 +179,7 @@ Port::disconnect (std::string const & other)
_connections.erase (other);
}
return r;
return r;
}
@ -239,118 +240,134 @@ Port::increment_port_buffer_offset (pframes_t nframes)
void
Port::set_public_latency_range (jack_latency_range_t& range, bool playback) const
{
/* this sets the visible latency that the rest of JACK sees. because we do latency
compensation, all (most) of our visible port latency values are identical.
*/
/* this sets the visible latency that the rest of JACK sees. because we do latency
compensation, all (most) of our visible port latency values are identical.
*/
if (!jack_port_set_latency_range) {
return;
}
if (!jack_port_set_latency_range) {
return;
}
DEBUG_TRACE (DEBUG::Latency, string_compose ("SET PORT %1 %4 PUBLIC latency now [%2 - %3]\n", name(),
range.min,
range.max,
(playback ? "PLAYBACK" : "CAPTURE")));;
DEBUG_TRACE (DEBUG::Latency,
string_compose ("SET PORT %1 %4 PUBLIC latency now [%2 - %3]\n",
name(), range.min, range.max,
(playback ? "PLAYBACK" : "CAPTURE")));;
jack_port_set_latency_range (_jack_port, (playback ? JackPlaybackLatency : JackCaptureLatency), &range);
jack_port_set_latency_range (_jack_port,
(playback ? JackPlaybackLatency : JackCaptureLatency),
&range);
}
void
Port::set_private_latency_range (jack_latency_range_t& range, bool playback)
{
if (playback) {
_private_playback_latency = range;
DEBUG_TRACE (DEBUG::Latency, string_compose ("SET PORT %1 playback PRIVATE latency now [%2 - %3]\n", name(),
_private_playback_latency.min,
_private_playback_latency.max));
} else {
_private_capture_latency = range;
DEBUG_TRACE (DEBUG::Latency, string_compose ("SET PORT %1 capture PRIVATE latency now [%2 - %3]\n", name(),
_private_capture_latency.min,
_private_capture_latency.max));
}
if (playback) {
_private_playback_latency = range;
DEBUG_TRACE (DEBUG::Latency, string_compose (
"SET PORT %1 playback PRIVATE latency now [%2 - %3]\n",
name(),
_private_playback_latency.min,
_private_playback_latency.max));
} else {
_private_capture_latency = range;
DEBUG_TRACE (DEBUG::Latency, string_compose (
"SET PORT %1 capture PRIVATE latency now [%2 - %3]\n",
name(),
_private_capture_latency.min,
_private_capture_latency.max));
}
/* push to public (JACK) location so that everyone else can see it */
/* push to public (JACK) location so that everyone else can see it */
set_public_latency_range (range, playback);
set_public_latency_range (range, playback);
}
const jack_latency_range_t&
Port::private_latency_range (bool playback) const
{
if (playback) {
DEBUG_TRACE (DEBUG::Latency, string_compose ("GET PORT %1 playback PRIVATE latency now [%2 - %3]\n", name(),
_private_playback_latency.min,
_private_playback_latency.max));
return _private_playback_latency;
} else {
DEBUG_TRACE (DEBUG::Latency, string_compose ("GET PORT %1 capture PRIVATE latency now [%2 - %3]\n", name(),
_private_playback_latency.min,
_private_playback_latency.max));
return _private_capture_latency;
}
if (playback) {
DEBUG_TRACE (DEBUG::Latency, string_compose (
"GET PORT %1 playback PRIVATE latency now [%2 - %3]\n",
name(),
_private_playback_latency.min,
_private_playback_latency.max));
return _private_playback_latency;
} else {
DEBUG_TRACE (DEBUG::Latency, string_compose (
"GET PORT %1 capture PRIVATE latency now [%2 - %3]\n",
name(),
_private_playback_latency.min,
_private_playback_latency.max));
return _private_capture_latency;
}
}
jack_latency_range_t
Port::public_latency_range (bool playback) const
{
jack_latency_range_t r;
jack_latency_range_t r;
jack_port_get_latency_range (_jack_port,
sends_output() ? JackPlaybackLatency : JackCaptureLatency,
&r);
DEBUG_TRACE (DEBUG::Latency, string_compose ("GET PORT %1: %4 PUBLIC latency range %2 .. %3\n",
name(), r.min, r.max,
sends_output() ? "PLAYBACK" : "CAPTURE"));
return r;
jack_port_get_latency_range (_jack_port,
sends_output() ? JackPlaybackLatency : JackCaptureLatency,
&r);
DEBUG_TRACE (DEBUG::Latency, string_compose (
"GET PORT %1: %4 PUBLIC latency range %2 .. %3\n",
name(), r.min, r.max,
sends_output() ? "PLAYBACK" : "CAPTURE"));
return r;
}
void
Port::get_connected_latency_range (jack_latency_range_t& range, bool playback) const
{
if (!jack_port_get_latency_range) {
return;
}
if (!jack_port_get_latency_range) {
return;
}
vector<string> connections;
jack_client_t* jack = _engine->jack();
vector<string> connections;
jack_client_t* jack = _engine->jack();
if (!jack) {
range.min = 0;
range.max = 0;
PBD::warning << _("get_connected_latency_range() called while disconnected from JACK") << endmsg;
return;
}
if (!jack) {
range.min = 0;
range.max = 0;
PBD::warning << _("get_connected_latency_range() called while disconnected from JACK") << endmsg;
return;
}
get_connections (connections);
get_connections (connections);
if (!connections.empty()) {
if (!connections.empty()) {
range.min = ~((jack_nframes_t) 0);
range.max = 0;
range.min = ~((jack_nframes_t) 0);
range.max = 0;
for (vector<string>::iterator c = connections.begin(); c != connections.end(); ++c) {
for (vector<string>::const_iterator c = connections.begin();
c != connections.end(); ++c) {
cerr << "Connection between " << name() << " and " << *c << endl;
cerr << "Connection between " << name() << " and " << *c << endl;
jack_port_t* remote_port = jack_port_by_name (_engine->jack(), (*c).c_str());
jack_latency_range_t lr;
jack_port_t* remote_port = jack_port_by_name (_engine->jack(), (*c).c_str());
jack_latency_range_t lr;
if (remote_port) {
jack_port_get_latency_range (remote_port, (playback ? JackPlaybackLatency : JackCaptureLatency), &lr);
DEBUG_TRACE (DEBUG::Latency, string_compose ("\t%1 <-> %2 : latter has latency range %3 .. %4\n", name(), *c, lr.min, lr.max));
range.min = min (range.min, lr.min);
range.max = max (range.max, lr.max);
} else {
cerr << "\t NO PORT BY NAME!\n";
}
}
if (remote_port) {
jack_port_get_latency_range (
remote_port,
(playback ? JackPlaybackLatency : JackCaptureLatency),
&lr);
DEBUG_TRACE (DEBUG::Latency, string_compose (
"\t%1 <-> %2 : latter has latency range %3 .. %4\n",
name(), *c, lr.min, lr.max));
range.min = min (range.min, lr.min);
range.max = max (range.max, lr.max);
} else {
cerr << "\t NO PORT BY NAME!\n";
}
}
} else {
range.min = 0;
range.max = 0;
}
} else {
range.min = 0;
range.max = 0;
}
}
int
@ -420,17 +437,17 @@ Port::physically_connected () const
if (jc) {
for (int i = 0; jc[i]; ++i) {
jack_port_t* port = jack_port_by_name (_engine->jack(), jc[i]);
jack_port_t* port = jack_port_by_name (_engine->jack(), jc[i]);
if (port && (jack_port_flags (port) & JackPortIsPhysical)) {
jack_free (jc);
return true;
}
if (port && (jack_port_flags (port) & JackPortIsPhysical)) {
jack_free (jc);
return true;
}
}
jack_free (jc);
}
return false;
return false;
}

File diff suppressed because it is too large Load Diff

View File

@ -132,11 +132,11 @@ static void clean_up_session_event (SessionEvent* ev) { delete ev; }
const SessionEvent::RTeventCallback Session::rt_cleanup (clean_up_session_event);
Session::Session (AudioEngine &eng,
const string& fullpath,
const string& snapshot_name,
const string& fullpath,
const string& snapshot_name,
BusProfile* bus_profile,
string mix_template)
: _engine (eng)
string mix_template)
: _engine (eng)
, _target_transport_speed (0.0)
, _requested_return_frame (-1)
, _session_dir (new SessionDirectory(fullpath))
@ -207,7 +207,7 @@ Session::Session (AudioEngine &eng,
StartTimeChanged.connect_same_thread (*this, boost::bind (&Session::start_time_changed, this, _1));
EndTimeChanged.connect_same_thread (*this, boost::bind (&Session::end_time_changed, this, _1));
_is_new = false;
_is_new = false;
}
Session::~Session ()
@ -245,7 +245,7 @@ Session::destroy ()
_butler->drop_references ();
delete _butler;
delete midi_control_ui;
delete _all_route_group;
delete _all_route_group;
if (click_data != default_click) {
delete [] click_data;
@ -438,7 +438,7 @@ Session::when_engine_running ()
char buf[32];
snprintf (buf, sizeof (buf), _("out %" PRIu32), np+1);
boost::shared_ptr<Bundle> c (new Bundle (buf, true));
boost::shared_ptr<Bundle> c (new Bundle (buf, true));
c->add_channel (_("mono"), DataType::AUDIO);
c->set_port (0, outputs[DataType::AUDIO][np]);
@ -467,7 +467,7 @@ Session::when_engine_running ()
char buf[32];
snprintf (buf, sizeof (buf), _("in %" PRIu32), np+1);
boost::shared_ptr<Bundle> c (new Bundle (buf, false));
boost::shared_ptr<Bundle> c (new Bundle (buf, false));
c->add_channel (_("mono"), DataType::AUDIO);
c->set_port (0, inputs[DataType::AUDIO][np]);
@ -481,7 +481,7 @@ Session::when_engine_running ()
char buf[32];
snprintf (buf, sizeof(buf), _("in %" PRIu32 "+%" PRIu32), np + 1, np + 2);
boost::shared_ptr<Bundle> c (new Bundle (buf, false));
boost::shared_ptr<Bundle> c (new Bundle (buf, false));
c->add_channel (_("L"), DataType::AUDIO);
c->set_port (0, inputs[DataType::AUDIO][np]);
c->add_channel (_("R"), DataType::AUDIO);
@ -497,7 +497,7 @@ Session::when_engine_running ()
string n = inputs[DataType::MIDI][np];
boost::erase_first (n, X_("alsa_pcm:"));
boost::shared_ptr<Bundle> c (new Bundle (n, false));
boost::shared_ptr<Bundle> c (new Bundle (n, false));
c->add_channel ("", DataType::MIDI);
c->set_port (0, inputs[DataType::MIDI][np]);
add_bundle (c);
@ -509,7 +509,7 @@ Session::when_engine_running ()
string n = outputs[DataType::MIDI][np];
boost::erase_first (n, X_("alsa_pcm:"));
boost::shared_ptr<Bundle> c (new Bundle (n, true));
boost::shared_ptr<Bundle> c (new Bundle (n, true));
c->add_channel ("", DataType::MIDI);
c->set_port (0, outputs[DataType::MIDI][np]);
add_bundle (c);
@ -521,9 +521,9 @@ Session::when_engine_running ()
if (_is_new && !no_auto_connect()) {
Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock());
Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock());
/* don't connect the master bus outputs if there is a monitor bus */
/* don't connect the master bus outputs if there is a monitor bus */
if (_master_out && Config->get_auto_connect_standard_busses() && !_monitor_out) {
@ -595,7 +595,7 @@ Session::when_engine_running ()
}
} else {
for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
uint32_t mod = n_physical_outputs.get (*t);
uint32_t limit = _monitor_out->n_outputs().get(*t);
@ -631,7 +631,7 @@ Session::when_engine_running ()
BootMessage (_("Connect to engine"));
_engine.set_session (this);
update_latency_compensation (true);
update_latency_compensation (true);
}
void
@ -678,11 +678,10 @@ Session::hookup_io ()
Delivery::reset_panners ();
/* Connect tracks to monitor/listen bus if there is one.
Note that in an existing session, the internal sends will
already exist, but we want the routes to notice that
they connect to the control out specifically.
*/
/* Connect tracks to monitor/listen bus if there is one. Note that in an
existing session, the internal sends will already exist, but we want the
routes to notice that they connect to the control out specifically.
*/
if (_monitor_out) {
boost::shared_ptr<RouteList> r = routes.reader ();
@ -758,23 +757,23 @@ Session::record_enabling_legal () const
void
Session::set_track_monitor_input_status (bool yn)
{
boost::shared_ptr<RouteList> rl = routes.reader ();
for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
boost::shared_ptr<AudioTrack> tr = boost::dynamic_pointer_cast<AudioTrack> (*i);
if (tr && tr->record_enabled ()) {
//cerr << "switching to input = " << !auto_input << __FILE__ << __LINE__ << endl << endl;
tr->monitor_input (yn);
}
}
boost::shared_ptr<RouteList> rl = routes.reader ();
for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
boost::shared_ptr<AudioTrack> tr = boost::dynamic_pointer_cast<AudioTrack> (*i);
if (tr && tr->record_enabled ()) {
//cerr << "switching to input = " << !auto_input << __FILE__ << __LINE__ << endl << endl;
tr->monitor_input (yn);
}
}
}
void
Session::reset_input_monitor_state ()
{
if (transport_rolling()) {
set_track_monitor_input_status (Config->get_monitoring_model() == HardwareMonitoring && !config.get_auto_input());
set_track_monitor_input_status (Config->get_monitoring_model() == HardwareMonitoring && !config.get_auto_input());
} else {
set_track_monitor_input_status (Config->get_monitoring_model() == HardwareMonitoring);
set_track_monitor_input_status (Config->get_monitoring_model() == HardwareMonitoring);
}
}
@ -985,7 +984,7 @@ Session::enable_record ()
MIDI::Manager::instance()->mmc()->send (MIDI::MachineControlCommand (MIDI::MachineControl::cmdRecordStrobe));
if (Config->get_monitoring_model() == HardwareMonitoring && config.get_auto_input()) {
set_track_monitor_input_status (true);
set_track_monitor_input_status (true);
}
RecordStateChanged ();
@ -1011,7 +1010,7 @@ Session::disable_record (bool rt_context, bool force)
}
if (Config->get_monitoring_model() == HardwareMonitoring && config.get_auto_input()) {
set_track_monitor_input_status (false);
set_track_monitor_input_status (false);
}
RecordStateChanged (); /* emit signal */
@ -1028,7 +1027,7 @@ Session::step_back_from_record ()
if (g_atomic_int_compare_and_exchange (&_record_status, Recording, Enabled)) {
if (Config->get_monitoring_model() == HardwareMonitoring && config.get_auto_input()) {
set_track_monitor_input_status (false);
set_track_monitor_input_status (false);
}
}
}
@ -1233,7 +1232,7 @@ struct RouteSorter {
static void
trace_terminal (boost::shared_ptr<Route> r1, boost::shared_ptr<Route> rbase)
{
boost::shared_ptr<Route> r2;
boost::shared_ptr<Route> r2;
if (r1->feeds (rbase) && rbase->feeds (r1)) {
info << string_compose(_("feedback loop setup between %1 and %2"), r1->name(), rbase->name()) << endmsg;
@ -1293,7 +1292,7 @@ Session::resort_routes ()
{
RCUWriter<RouteList> writer (routes);
boost::shared_ptr<RouteList> r = writer.get_copy ();
boost::shared_ptr<RouteList> r = writer.get_copy ();
resort_routes_using (r);
/* writer goes out of scope and forces update */
}
@ -1407,7 +1406,7 @@ Session::count_existing_route_channels (ChanCount& in, ChanCount& out)
in = ChanCount::ZERO;
out = ChanCount::ZERO;
boost::shared_ptr<RouteList> r = routes.reader ();
boost::shared_ptr<RouteList> r = routes.reader ();
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
if (!(*i)->is_hidden()) {
@ -1440,7 +1439,7 @@ Session::new_midi_track (TrackMode mode, RouteGroup* route_group, uint32_t how_m
goto failed;
}
boost::shared_ptr<MidiTrack> track;
boost::shared_ptr<MidiTrack> track;
try {
track.reset (new MidiTrack (*this, track_name, Route::Flag (0), mode));
@ -1511,15 +1510,15 @@ void
Session::auto_connect_route (Route* route, ChanCount& existing_inputs, ChanCount& existing_outputs,
bool with_lock, bool connect_inputs, ChanCount input_start, ChanCount output_start)
{
if (!IO::connecting_legal) {
return;
}
if (!IO::connecting_legal) {
return;
}
Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock (), Glib::NOT_LOCK);
Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock (), Glib::NOT_LOCK);
if (with_lock) {
lm.acquire ();
}
if (with_lock) {
lm.acquire ();
}
/* If both inputs and outputs are auto-connected to physical ports,
use the max of input and output offsets to ensure auto-connected
@ -1529,10 +1528,10 @@ Session::auto_connect_route (Route* route, ChanCount& existing_inputs, ChanCount
offset possible.
*/
cerr << "ACR: existing in = " << existing_inputs << " out = " << existing_outputs << endl;
cerr << "ACR: existing in = " << existing_inputs << " out = " << existing_outputs << endl;
const bool in_out_physical =
(Config->get_input_auto_connect() & AutoConnectPhysical)
(Config->get_input_auto_connect() & AutoConnectPhysical)
&& (Config->get_output_auto_connect() & AutoConnectPhysical)
&& connect_inputs;
@ -1552,22 +1551,22 @@ Session::auto_connect_route (Route* route, ChanCount& existing_inputs, ChanCount
if (!physinputs.empty() && connect_inputs) {
uint32_t nphysical_in = physinputs.size();
cerr << "There are " << nphysical_in << " physical inputs of type " << *t << endl;
cerr << "There are " << nphysical_in << " physical inputs of type " << *t << endl;
for (uint32_t i = input_start.get(*t); i < route->n_inputs().get(*t) && i < nphysical_in; ++i) {
string port;
if (Config->get_input_auto_connect() & AutoConnectPhysical) {
cerr << "Get index " << in_offset.get(*t) << " + " << i << " % " << nphysical_in << " = "
<< (in_offset.get(*t) + i) % nphysical_in
<< endl;
cerr << "Get index " << in_offset.get(*t) << " + " << i << " % " << nphysical_in << " = "
<< (in_offset.get(*t) + i) % nphysical_in
<< endl;
port = physinputs[(in_offset.get(*t) + i) % nphysical_in];
}
cerr << "Connect route " << route->name() << " IN to " << port << endl;
cerr << "Connect route " << route->name() << " IN to " << port << endl;
if (!port.empty() && route->input()->connect (
route->input()->ports().port(*t, i), port, this)) {
route->input()->ports().port(*t, i), port, this)) {
break;
}
}
@ -1587,7 +1586,7 @@ Session::auto_connect_route (Route* route, ChanCount& existing_inputs, ChanCount
}
}
cerr << "Connect route " << route->name() << " OUT to " << port << endl;
cerr << "Connect route " << route->name() << " OUT to " << port << endl;
if (!port.empty() && route->output()->connect (
route->output()->ports().port(*t, i), port, this)) {
@ -1623,7 +1622,7 @@ Session::new_audio_track (
goto failed;
}
boost::shared_ptr<AudioTrack> track;
boost::shared_ptr<AudioTrack> track;
try {
track.reset (new AudioTrack (*this, track_name, Route::Flag (0), mode));
@ -1699,7 +1698,7 @@ Session::set_remote_control_ids ()
RemoteModel m = Config->get_remote_model();
bool emit_signal = false;
boost::shared_ptr<RouteList> r = routes.reader ();
boost::shared_ptr<RouteList> r = routes.reader ();
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
if (MixerOrdered == m) {
@ -1845,7 +1844,7 @@ Session::new_route_from_template (uint32_t how_many, const std::string& template
Track::zero_diskstream_id_in_xml (node_copy);
try {
boost::shared_ptr<Route> route (XMLRouteFactory (node_copy, 3000));
boost::shared_ptr<Route> route (XMLRouteFactory (node_copy, 3000));
if (route == 0) {
error << _("Session: cannot create track/bus from template description") << endmsg;
@ -1899,7 +1898,7 @@ Session::add_routes (RouteList& new_routes, bool auto_connect, bool save)
{
{
RCUWriter<RouteList> writer (routes);
boost::shared_ptr<RouteList> r = writer.get_copy ();
boost::shared_ptr<RouteList> r = writer.get_copy ();
r->insert (r->end(), new_routes.begin(), new_routes.end());
@ -1947,16 +1946,16 @@ Session::add_routes (RouteList& new_routes, bool auto_connect, bool save)
}
}
if (auto_connect) {
if (auto_connect) {
ChanCount existing_inputs;
ChanCount existing_outputs;
ChanCount existing_inputs;
ChanCount existing_outputs;
count_existing_route_channels (existing_inputs, existing_outputs);
count_existing_route_channels (existing_inputs, existing_outputs);
auto_connect_route (r, existing_inputs, existing_outputs, true);
}
}
auto_connect_route (r, existing_inputs, existing_outputs, true);
}
}
if (_monitor_out && IO::connecting_legal) {
@ -2072,7 +2071,7 @@ Session::remove_route (boost::shared_ptr<Route> route)
{
RCUWriter<RouteList> writer (routes);
boost::shared_ptr<RouteList> rs = writer.get_copy ();
boost::shared_ptr<RouteList> rs = writer.get_copy ();
rs->remove (route);
@ -2204,23 +2203,23 @@ Session::route_solo_isolated_changed (void* /*src*/, boost::weak_ptr<Route> wpr)
return;
}
bool send_changed = false;
bool send_changed = false;
if (route->solo_isolated()) {
if (_solo_isolated_cnt == 0) {
send_changed = true;
}
_solo_isolated_cnt++;
} else if (_solo_isolated_cnt > 0) {
_solo_isolated_cnt--;
if (_solo_isolated_cnt == 0) {
send_changed = true;
}
}
if (route->solo_isolated()) {
if (_solo_isolated_cnt == 0) {
send_changed = true;
}
_solo_isolated_cnt++;
} else if (_solo_isolated_cnt > 0) {
_solo_isolated_cnt--;
if (_solo_isolated_cnt == 0) {
send_changed = true;
}
}
if (send_changed) {
IsolatedChanged (); /* EMIT SIGNAL */
}
if (send_changed) {
IsolatedChanged (); /* EMIT SIGNAL */
}
}
void
@ -2643,7 +2642,7 @@ Session::add_source (boost::shared_ptr<Source> source)
}
source->DropReferences.connect_same_thread (*this, boost::bind (&Session::remove_source, this, boost::weak_ptr<Source> (source)));
}
}
}
void
@ -4115,7 +4114,7 @@ Session::ensure_search_path_includes (const string& path, DataType type)
boost::shared_ptr<Speakers>
Session::get_speakers()
{
return _speakers;
return _speakers;
}
list<string>
@ -4138,105 +4137,105 @@ Session::unknown_processors () const
void
Session::update_latency (bool playback)
{
DEBUG_TRACE (DEBUG::Latency, string_compose ("JACK latency callback: %1\n", (playback ? "PLAYBACK" : "CAPTURE")));
DEBUG_TRACE (DEBUG::Latency, string_compose ("JACK latency callback: %1\n", (playback ? "PLAYBACK" : "CAPTURE")));
if (_state_of_the_state & (InitialConnecting|Deletion)) {
return;
}
if (_state_of_the_state & (InitialConnecting|Deletion)) {
return;
}
boost::shared_ptr<RouteList> r = routes.reader ();
framecnt_t max_latency = 0;
framecnt_t max_latency = 0;
if (playback) {
/* reverse the list so that we work backwards from the last route to run to the first */
reverse (r->begin(), r->end());
}
if (playback) {
/* reverse the list so that we work backwards from the last route to run to the first */
reverse (r->begin(), r->end());
}
/* compute actual latency values for the given direction and store them all in per-port
structures. this will also publish the same values (to JACK) so that computation of latency
for routes can consistently use public latency values.
*/
/* compute actual latency values for the given direction and store them all in per-port
structures. this will also publish the same values (to JACK) so that computation of latency
for routes can consistently use public latency values.
*/
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
max_latency = max (max_latency, (*i)->set_private_port_latencies (playback));
}
max_latency = max (max_latency, (*i)->set_private_port_latencies (playback));
}
if (playback) {
if (playback) {
post_playback_latency ();
post_playback_latency ();
/* because we latency compensate playback, our published playback latencies should
be the same for all output ports - all material played back by ardour has
the same latency, whether its caused by plugins or by latency compensation. since
these may differ from the values computed above, reset all playback port latencies
to the same value.
*/
/* because we latency compensate playback, our published playback latencies should
be the same for all output ports - all material played back by ardour has
the same latency, whether its caused by plugins or by latency compensation. since
these may differ from the values computed above, reset all playback port latencies
to the same value.
*/
DEBUG_TRACE (DEBUG::Latency, string_compose ("Set public port latencies to %1\n", max_latency));
DEBUG_TRACE (DEBUG::Latency, string_compose ("Set public port latencies to %1\n", max_latency));
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
(*i)->set_public_port_latencies (max_latency, playback);
}
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
(*i)->set_public_port_latencies (max_latency, playback);
}
} else {
} else {
post_capture_latency ();
}
post_capture_latency ();
}
DEBUG_TRACE (DEBUG::Latency, "JACK latency callback: DONE\n");
DEBUG_TRACE (DEBUG::Latency, "JACK latency callback: DONE\n");
}
void
Session::post_playback_latency ()
{
set_worst_playback_latency ();
set_worst_playback_latency ();
boost::shared_ptr<RouteList> r = routes.reader ();
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
if (!(*i)->is_hidden() && ((*i)->active())) {
_worst_track_latency = max (_worst_track_latency, (*i)->update_signal_latency ());
}
boost::shared_ptr<RouteList> r = routes.reader ();
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
if (!(*i)->is_hidden() && ((*i)->active())) {
_worst_track_latency = max (_worst_track_latency, (*i)->update_signal_latency ());
}
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
(*i)->set_latency_compensation (_worst_track_latency);
}
}
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
(*i)->set_latency_compensation (_worst_track_latency);
}
}
}
void
Session::post_capture_latency ()
{
set_worst_capture_latency ();
set_worst_capture_latency ();
/* reflect any changes in capture latencies into capture offsets
*/
/* reflect any changes in capture latencies into capture offsets
*/
boost::shared_ptr<RouteList> rl = routes.reader();
for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
if (tr) {
tr->set_capture_offset ();
}
}
boost::shared_ptr<RouteList> rl = routes.reader();
for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
if (tr) {
tr->set_capture_offset ();
}
}
}
void
Session::set_worst_io_latencies ()
{
set_worst_playback_latency ();
set_worst_capture_latency ();
set_worst_playback_latency ();
set_worst_capture_latency ();
}
void
Session::set_worst_playback_latency ()
{
if (_state_of_the_state & (InitialConnecting|Deletion)) {
return;
}
if (_state_of_the_state & (InitialConnecting|Deletion)) {
return;
}
_worst_output_latency = 0;
_worst_output_latency = 0;
if (!_engine.connected()) {
return;
@ -4245,20 +4244,20 @@ Session::set_worst_playback_latency ()
boost::shared_ptr<RouteList> r = routes.reader ();
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
_worst_output_latency = max (_worst_output_latency, (*i)->output()->latency());
_worst_output_latency = max (_worst_output_latency, (*i)->output()->latency());
}
DEBUG_TRACE (DEBUG::Latency, string_compose ("Worst output latency: %1\n", _worst_output_latency));
DEBUG_TRACE (DEBUG::Latency, string_compose ("Worst output latency: %1\n", _worst_output_latency));
}
void
Session::set_worst_capture_latency ()
{
if (_state_of_the_state & (InitialConnecting|Deletion)) {
return;
}
if (_state_of_the_state & (InitialConnecting|Deletion)) {
return;
}
_worst_input_latency = 0;
_worst_input_latency = 0;
if (!_engine.connected()) {
return;
@ -4267,7 +4266,7 @@ Session::set_worst_capture_latency ()
boost::shared_ptr<RouteList> r = routes.reader ();
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
_worst_input_latency = max (_worst_input_latency, (*i)->input()->latency());
_worst_input_latency = max (_worst_input_latency, (*i)->input()->latency());
}
DEBUG_TRACE (DEBUG::Latency, string_compose ("Worst input latency: %1\n", _worst_input_latency));
@ -4284,30 +4283,30 @@ Session::update_latency_compensation (bool force_whole_graph)
DEBUG_TRACE(DEBUG::Latency, "---------------------------- update latency compensation\n\n");
_worst_track_latency = 0;
_worst_track_latency = 0;
boost::shared_ptr<RouteList> r = routes.reader ();
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
if (!(*i)->is_hidden() && ((*i)->active())) {
framecnt_t tl;
if ((*i)->signal_latency () != (tl = (*i)->update_signal_latency ())) {
update_jack = true;
}
_worst_track_latency = max (tl, _worst_track_latency);
}
}
framecnt_t tl;
if ((*i)->signal_latency () != (tl = (*i)->update_signal_latency ())) {
update_jack = true;
}
_worst_track_latency = max (tl, _worst_track_latency);
}
}
DEBUG_TRACE (DEBUG::Latency, string_compose ("worst signal processing latency: %1 (changed ? %2)\n", _worst_track_latency,
(update_jack ? "yes" : "no")));
DEBUG_TRACE (DEBUG::Latency, string_compose ("worst signal processing latency: %1 (changed ? %2)\n", _worst_track_latency,
(update_jack ? "yes" : "no")));
if (force_whole_graph || update_jack) {
/* trigger a full recompute of latency numbers for the graph.
everything else that we need to do will be done in the latency
callback.
*/
/* trigger a full recompute of latency numbers for the graph.
everything else that we need to do will be done in the latency
callback.
*/
_engine.update_total_latencies ();
return; // everything else will be done in the latency callback
return; // everything else will be done in the latency callback
}

View File

@ -222,14 +222,14 @@ Session::realtime_stop (bool abort, bool clear_state)
past that point to pick up delayed input (and/or to delick)
*/
if (worst_playback_latency() > current_block_size) {
/* we rolled past the stop point to pick up data that had
not yet arrived. move back to where the stop occured.
*/
decrement_transport_position (current_block_size + (worst_playback_latency() - current_block_size));
} else {
decrement_transport_position (current_block_size);
}
if (worst_playback_latency() > current_block_size) {
/* we rolled past the stop point to pick up data that had
not yet arrived. move back to where the stop occured.
*/
decrement_transport_position (current_block_size + (worst_playback_latency() - current_block_size));
} else {
decrement_transport_position (current_block_size);
}
/* the duration change is not guaranteed to have happened, but is likely */
@ -252,9 +252,9 @@ Session::realtime_stop (bool abort, bool clear_state)
_clear_event_type (SessionEvent::RangeStop);
_clear_event_type (SessionEvent::RangeLocate);
/* if we're going to clear loop state, then force disabling record BUT only if we're not doing latched rec-enable */
/* if we're going to clear loop state, then force disabling record BUT only if we're not doing latched rec-enable */
disable_record (true, (!Config->get_latched_record_enable() && clear_state));
reset_slave_state ();
_transport_speed = 0;
@ -284,26 +284,26 @@ Session::butler_transport_work ()
DEBUG_TRACE (DEBUG::Transport, string_compose ("Butler transport work, todo = %1\n", enum_2_string (ptw)));
if (ptw & PostTransportAdjustPlaybackBuffering) {
if (ptw & PostTransportAdjustPlaybackBuffering) {
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
if (tr) {
tr->adjust_playback_buffering ();
/* and refill those buffers ... */
tr->non_realtime_locate (_transport_frame);
/* and refill those buffers ... */
tr->non_realtime_locate (_transport_frame);
}
}
}
if (ptw & PostTransportAdjustCaptureBuffering) {
}
if (ptw & PostTransportAdjustCaptureBuffering) {
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
if (tr) {
tr->adjust_capture_buffering ();
}
}
}
}
if (ptw & PostTransportCurveRealloc) {
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
@ -460,11 +460,11 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
DEBUG_TRACE (DEBUG::Transport, X_("Butler PTW: DS stop\n"));
if (abort && did_record) {
/* no reason to save the session file when we remove sources
*/
_state_of_the_state = StateOfTheState (_state_of_the_state|InCleanup);
}
if (abort && did_record) {
/* no reason to save the session file when we remove sources
*/
_state_of_the_state = StateOfTheState (_state_of_the_state|InCleanup);
}
for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
@ -473,9 +473,9 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
}
}
if (abort && did_record) {
_state_of_the_state = StateOfTheState (_state_of_the_state & ~InCleanup);
}
if (abort && did_record) {
_state_of_the_state = StateOfTheState (_state_of_the_state & ~InCleanup);
}
boost::shared_ptr<RouteList> r = routes.reader ();
@ -490,8 +490,8 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
}
if (_engine.running()) {
PostTransportWork ptw = post_transport_work ();
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
PostTransportWork ptw = post_transport_work ();
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
(*i)->nonrealtime_handle_transport_stopped (abort, (ptw & PostTransportLocate), (!(ptw & PostTransportLocate) || pending_locate_flush));
}
update_latency_compensation ();
@ -512,7 +512,7 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
if ((auto_return_enabled || synced_to_jack() || _requested_return_frame >= 0) &&
!(ptw & PostTransportLocate)) {
/* no explicit locate queued */
/* no explicit locate queued */
bool do_locate = false;
@ -601,10 +601,10 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
send_full_time_code (_transport_frame);
if (!dynamic_cast<MTC_Slave*>(_slave)) {
MIDI::Manager::instance()->mmc()->send (MIDI::MachineControlCommand (MIDI::MachineControl::cmdStop));
send_mmc_locate (_transport_frame);
}
if (!dynamic_cast<MTC_Slave*>(_slave)) {
MIDI::Manager::instance()->mmc()->send (MIDI::MachineControlCommand (MIDI::MachineControl::cmdStop));
send_mmc_locate (_transport_frame);
}
if ((ptw & PostTransportLocate) && get_record_enabled()) {
/* capture start has been changed, so save pending state */
@ -612,9 +612,9 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
saved = true;
}
/* always try to get rid of this */
/* always try to get rid of this */
remove_pending_capture_state ();
remove_pending_capture_state ();
/* save the current state of things if appropriate */
@ -691,8 +691,9 @@ Session::set_play_loop (bool yn)
}
if (yn && Config->get_seamless_loop() && synced_to_jack()) {
warning << string_compose (_("Seamless looping cannot be supported while %1 is using JACK transport.\n"
"Recommend changing the configured options"), PROGRAM_NAME)
warning << string_compose (
_("Seamless looping cannot be supported while %1 is using JACK transport.\n"
"Recommend changing the configured options"), PROGRAM_NAME)
<< endmsg;
return;
}
@ -876,12 +877,12 @@ Session::locate (framepos_t target_frame, bool with_roll, bool with_flush, bool
if (with_roll) {
/* switch from input if we're going to roll */
if (Config->get_monitoring_model() == HardwareMonitoring) {
set_track_monitor_input_status (!config.get_auto_input());
set_track_monitor_input_status (!config.get_auto_input());
}
} else {
/* otherwise we're going to stop, so do the opposite */
if (Config->get_monitoring_model() == HardwareMonitoring) {
set_track_monitor_input_status (true);
set_track_monitor_input_status (true);
}
}
@ -952,7 +953,7 @@ Session::set_transport_speed (double speed, bool abort, bool clear_state)
/* we are rolling and we want to stop */
if (Config->get_monitoring_model() == HardwareMonitoring) {
set_track_monitor_input_status (true);
set_track_monitor_input_status (true);
}
if (synced_to_jack ()) {
@ -975,7 +976,7 @@ Session::set_transport_speed (double speed, bool abort, bool clear_state)
/* we are stopped and we want to start rolling at speed 1 */
if (Config->get_monitoring_model() == HardwareMonitoring && config.get_auto_input()) {
set_track_monitor_input_status (false);
set_track_monitor_input_status (false);
}
if (synced_to_jack()) {
@ -987,8 +988,9 @@ Session::set_transport_speed (double speed, bool abort, bool clear_state)
} else {
if ((synced_to_jack()) && speed != 0.0 && speed != 1.0) {
warning << string_compose (_("Global varispeed cannot be supported while %1 is connected to JACK transport control"),
PROGRAM_NAME)
warning << string_compose (
_("Global varispeed cannot be supported while %1 is connected to JACK transport control"),
PROGRAM_NAME)
<< endmsg;
return;
}
@ -1053,7 +1055,7 @@ Session::stop_transport (bool abort, bool clear_state)
if (tr) {
tr->prepare_to_stop (_transport_frame);
}
}
}
/* we need to capture the audio that has still not yet been received by the system
at the time the stop is requested, so we have to roll past that time.
@ -1064,8 +1066,8 @@ Session::stop_transport (bool abort, bool clear_state)
*/
SessionEvent *ev = new SessionEvent (SessionEvent::StopOnce, SessionEvent::Replace,
_transport_frame + _worst_input_latency - current_block_size,
0, 0, abort);
_transport_frame + _worst_input_latency - current_block_size,
0, 0, abort);
merge_event (ev);
transport_sub_state |= StopPendingCapture;
@ -1076,16 +1078,16 @@ Session::stop_transport (bool abort, bool clear_state)
if ((transport_sub_state & PendingDeclickOut) == 0) {
if (!(transport_sub_state & StopPendingCapture)) {
if (!(transport_sub_state & StopPendingCapture)) {
boost::shared_ptr<RouteList> rl = routes.reader();
for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
if (tr) {
tr->prepare_to_stop (_transport_frame);
}
}
}
}
}
transport_sub_state |= PendingDeclickOut;
/* we'll be called again after the declick */
pending_abort = abort;
@ -1136,14 +1138,14 @@ Session::start_transport ()
if (tr) {
tr->realtime_set_speed (tr->speed(), true);
}
(*i)->automation_snapshot (_transport_frame, true);
(*i)->automation_snapshot (_transport_frame, true);
}
Timecode::Time time;
timecode_time_subframes (_transport_frame, time);
if (!dynamic_cast<MTC_Slave*>(_slave)) {
MIDI::Manager::instance()->mmc()->send (MIDI::MachineControlCommand (MIDI::MachineControl::cmdDeferredPlay));
}
Timecode::Time time;
timecode_time_subframes (_transport_frame, time);
if (!dynamic_cast<MTC_Slave*>(_slave)) {
MIDI::Manager::instance()->mmc()->send (MIDI::MachineControlCommand (MIDI::MachineControl::cmdDeferredPlay));
}
TransportStateChange (); /* EMIT SIGNAL */
}
@ -1284,9 +1286,9 @@ Session::switch_to_sync_source (SyncSource src)
return;
}
if (config.get_video_pullup() != 0.0f) {
return;
}
if (config.get_video_pullup() != 0.0f) {
return;
}
new_slave = new JACK_Slave (_engine.jack());
break;
@ -1488,15 +1490,15 @@ Session::reset_jack_connection (jack_client_t* jack)
bool
Session::maybe_stop (framepos_t limit)
{
if ((_transport_speed > 0.0f && _transport_frame >= limit) || (_transport_speed < 0.0f && _transport_frame == 0)) {
if (synced_to_jack () && config.get_jack_time_master ()) {
_engine.transport_stop ();
} else if (!synced_to_jack ()) {
stop_transport ();
}
return true;
}
return false;
if ((_transport_speed > 0.0f && _transport_frame >= limit) || (_transport_speed < 0.0f && _transport_frame == 0)) {
if (synced_to_jack () && config.get_jack_time_master ()) {
_engine.transport_stop ();
} else if (!synced_to_jack ()) {
stop_transport ();
}
return true;
}
return false;
}
void