summaryrefslogtreecommitdiff
path: root/libs/ardour/latent.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2019-02-16 00:13:30 +0100
committerRobin Gareus <robin@gareus.org>2019-02-16 01:10:50 +0100
commit3cffaeac74163535295513488756c55ba5e2dffa (patch)
tree3cf90ea9932a8f707f5dc8b04bf0113f2c743e79 /libs/ardour/latent.cc
parent26f37a47530bac5f1c21d660dcea0b794cc22f09 (diff)
Prepare to allow to disable latency-compensation
Previously "zero custom/user latency" meant "default plugin latency". This is now saved in a separate boolean allowing a user to reduce a processor's latency to zero. This also prepares for a global switch to use zero latency throughout the whole session.
Diffstat (limited to 'libs/ardour/latent.cc')
-rw-r--r--libs/ardour/latent.cc42
1 files changed, 42 insertions, 0 deletions
diff --git a/libs/ardour/latent.cc b/libs/ardour/latent.cc
new file mode 100644
index 0000000000..44ec0e7d30
--- /dev/null
+++ b/libs/ardour/latent.cc
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2018 Robin Gareus <robin@gareus.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "pbd/xml++.h"
+
+#include "ardour/latent.h"
+
+using namespace ARDOUR;
+
+bool ARDOUR::Latent::_zero_latency = false;
+
+int
+Latent::set_state (const XMLNode& node, int version)
+{
+ node.get_property ("user-latency", _user_latency);
+ if (!node.get_property ("use-user-latency", _use_user_latency)) {
+ _use_user_latency = _user_latency > 0;
+ }
+ return 0;
+}
+
+void
+Latent::add_state (XMLNode* node) const
+{
+ node->set_property ("user-latency", _user_latency);
+ node->set_property ("use-user-latency", _use_user_latency);
+}