summaryrefslogtreecommitdiffstats
path: root/ingen
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2017-02-18 19:29:15 +0100
committerDavid Robillard <d@drobilla.net>2017-02-18 19:38:14 +0100
commit667e633e829760b5a1e9591227ec5437cac1995d (patch)
treeffbcdcdacb1187912027e0365c8b0e571b43e5bf /ingen
parent24b575cf28f9b007939b9fa14c991c51326c8348 (diff)
downloadingen-667e633e829760b5a1e9591227ec5437cac1995d.tar.gz
ingen-667e633e829760b5a1e9591227ec5437cac1995d.tar.bz2
ingen-667e633e829760b5a1e9591227ec5437cac1995d.zip
Improve parallel analysis and execution algorithms
Diffstat (limited to 'ingen')
-rw-r--r--ingen/Clock.hpp58
-rw-r--r--ingen/EngineBase.hpp7
-rw-r--r--ingen/World.hpp14
3 files changed, 71 insertions, 8 deletions
diff --git a/ingen/Clock.hpp b/ingen/Clock.hpp
new file mode 100644
index 00000000..8071ee1f
--- /dev/null
+++ b/ingen/Clock.hpp
@@ -0,0 +1,58 @@
+/*
+ This file is part of Ingen.
+ Copyright 2016-2017 David Robillard <http://drobilla.net/>
+
+ Ingen is free software: you can redistribute it and/or modify it under the
+ terms of the GNU Affero General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or any later version.
+
+ Ingen 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 Affero General Public License for details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with Ingen. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef INGEN_ENGINE_CLOCK_HPP
+#define INGEN_ENGINE_CLOCK_HPP
+
+#ifdef __MACH__
+# include <mach/mach.h>
+# include <mach/mach_time.h>
+#endif
+
+namespace Ingen {
+
+class Clock {
+public:
+#ifdef __MACH__
+
+ Clock() { mach_timebase_info(&_timebase); }
+
+ inline uint64_t now_microseconds() const {
+ const uint64_t now = mach_absolute_time();
+ return now * _timebase.numer / _timebase.denom / 1e3;
+ }
+
+private:
+ mach_timebase_info_data_t _timebase;
+
+#else
+
+ inline uint64_t now_microseconds() const {
+ struct timespec time;
+# if defined(CLOCK_MONOTONIC_RAW)
+ clock_gettime(CLOCK_MONOTONIC_RAW, &time);
+# else
+ clock_gettime(CLOCK_MONOTONIC, &time);
+# endif
+ return (uint64_t)time.tv_sec * 1e6 + (uint64_t)time.tv_nsec / 1e3;
+ }
+
+#endif
+};
+
+} // namespace Ingen
+
+#endif // INGEN_ENGINE_CLOCK_HPP
diff --git a/ingen/EngineBase.hpp b/ingen/EngineBase.hpp
index a0a20cd9..a57743fe 100644
--- a/ingen/EngineBase.hpp
+++ b/ingen/EngineBase.hpp
@@ -79,7 +79,12 @@ public:
virtual void flush_events(const std::chrono::milliseconds& sleep_ms) = 0;
/**
- Locate to a given cycle.
+ Advance audio time by the given number of frames.
+ */
+ virtual void advance(uint32_t nframes) = 0;
+
+ /**
+ Locate to a given audio position.
*/
virtual void locate(uint32_t start, uint32_t sample_count) = 0;
diff --git a/ingen/World.hpp b/ingen/World.hpp
index fc77593a..b0e09b34 100644
--- a/ingen/World.hpp
+++ b/ingen/World.hpp
@@ -64,20 +64,20 @@ class URIs;
class INGEN_API World : public Raul::Noncopyable {
public:
/** Construct a new Ingen world.
- * @param argc Argument count (as in C main())
- * @param argv Argument vector (as in C main())
* @param map LV2 URID map implementation, or NULL to use internal.
* @param unmap LV2 URID unmap implementation, or NULL to use internal.
* @param log LV2 log implementation, or NULL to use internal.
*/
- World(int& argc,
- char**& argv,
- LV2_URID_Map* map,
- LV2_URID_Unmap* unmap,
- LV2_Log_Log* log);
+ World(LV2_URID_Map* map, LV2_URID_Unmap* unmap, LV2_Log_Log* log);
virtual ~World();
+ /** Load configuration from files and command line.
+ * @param argc Argument count (as in C main())
+ * @param argv Argument vector (as in C main())
+ */
+ virtual void load_configuration(int& argc, char**& argv);
+
/** Load an Ingen module by name (e.g. "server", "gui", etc.)
* @return True on success.
*/