summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-11-22 15:26:41 -0500
committerDavid Robillard <d@drobilla.net>2014-11-22 15:26:41 -0500
commit42b5ed3904f15df77c3a3c18e334fa422911387d (patch)
tree52c57f726950dc8dde0db9578d14b80dedc41919 /libs
parent73ad9935978e152e95b94b15aeb62b9ada4fe9e6 (diff)
Fix clang and MSVC build.
Diffstat (limited to 'libs')
-rw-r--r--libs/evoral/evoral/Control.hpp1
-rw-r--r--libs/evoral/evoral/TypeMap.hpp5
-rw-r--r--libs/evoral/evoral/types.hpp26
-rw-r--r--libs/evoral/src/ControlList.cpp1
-rw-r--r--libs/evoral/src/types.cpp29
-rw-r--r--libs/evoral/wscript1
6 files changed, 48 insertions, 15 deletions
diff --git a/libs/evoral/evoral/Control.hpp b/libs/evoral/evoral/Control.hpp
index 2b7fd0aa65..ea1e9b89e5 100644
--- a/libs/evoral/evoral/Control.hpp
+++ b/libs/evoral/evoral/Control.hpp
@@ -25,7 +25,6 @@
#include "pbd/signals.h"
#include "evoral/visibility.h"
-#include "evoral/types.hpp"
#include "evoral/Parameter.hpp"
namespace Evoral {
diff --git a/libs/evoral/evoral/TypeMap.hpp b/libs/evoral/evoral/TypeMap.hpp
index d751c22a42..987706e541 100644
--- a/libs/evoral/evoral/TypeMap.hpp
+++ b/libs/evoral/evoral/TypeMap.hpp
@@ -19,8 +19,11 @@
#ifndef EVORAL_TYPE_MAP_HPP
#define EVORAL_TYPE_MAP_HPP
+#include <stdint.h>
+
+#include <string>
+
#include "evoral/visibility.h"
-#include "evoral/types.hpp"
namespace Evoral {
diff --git a/libs/evoral/evoral/types.hpp b/libs/evoral/evoral/types.hpp
index d3913f0979..ee93bc3998 100644
--- a/libs/evoral/evoral/types.hpp
+++ b/libs/evoral/evoral/types.hpp
@@ -41,6 +41,8 @@ typedef int32_t event_id_t;
/** Musical time: beats relative to some defined origin */
class LIBEVORAL_API MusicalTime {
public:
+ static const double PPQN;
+
MusicalTime() : _time(0.0) {}
/** Create from a real number of beats. */
@@ -53,7 +55,7 @@ public:
/** Create from ticks at the standard PPQN. */
static MusicalTime ticks(uint32_t ticks) {
- return MusicalTime(ticks / _ppqn);
+ return MusicalTime(ticks / PPQN);
}
/** Create from ticks at a given rate.
@@ -84,17 +86,17 @@ public:
inline bool operator==(const MusicalTime& b) const {
/* Acceptable tolerance is 1 tick. */
- return fabs(_time - b._time) <= (1.0/_ppqn);
+ return fabs(_time - b._time) <= (1.0 / PPQN);
}
inline bool operator==(double t) const {
/* Acceptable tolerance is 1 tick. */
- return fabs(_time - t) <= (1.0/_ppqn);
+ return fabs(_time - t) <= (1.0 / PPQN);
}
inline bool operator==(int beats) const {
/* Acceptable tolerance is 1 tick. */
- return fabs(_time - beats) <= (1.0/_ppqn);
+ return fabs(_time - beats) <= (1.0 / PPQN);
}
inline bool operator!=(const MusicalTime& b) const {
@@ -103,7 +105,7 @@ public:
inline bool operator<(const MusicalTime& b) const {
/* Acceptable tolerance is 1 tick. */
- if (fabs(_time - b._time) <= (1.0/_ppqn)) {
+ if (fabs(_time - b._time) <= (1.0 / PPQN)) {
return false; /* Effectively identical. */
} else {
return _time < b._time;
@@ -116,7 +118,7 @@ public:
inline bool operator>(const MusicalTime& b) const {
/* Acceptable tolerance is 1 tick. */
- if (fabs(_time - b._time) <= (1.0/_ppqn)) {
+ if (fabs(_time - b._time) <= (1.0 / PPQN)) {
return false; /* Effectively identical. */
} else {
return _time > b._time;
@@ -125,7 +127,7 @@ public:
inline bool operator>=(const MusicalTime& b) const {
/* Acceptable tolerance is 1 tick. */
- if (fabs(_time - b._time) <= (1.0/_ppqn)) {
+ if (fabs(_time - b._time) <= (1.0 / PPQN)) {
return true; /* Effectively identical. */
} else {
return _time >= b._time;
@@ -160,23 +162,21 @@ public:
}
double to_double() const { return _time; }
- uint64_t to_ticks() const { return lrint(_time * _ppqn); }
+ uint64_t to_ticks() const { return lrint(_time * PPQN); }
uint64_t to_ticks(uint32_t ppqn) const { return lrint(_time * ppqn); }
operator bool() const { return _time != 0; }
static MusicalTime min() { return MusicalTime(DBL_MIN); }
static MusicalTime max() { return MusicalTime(DBL_MAX); }
- static MusicalTime tick() { return MusicalTime(1.0 / _ppqn); }
+ static MusicalTime tick() { return MusicalTime(1.0 / PPQN); }
private:
- static const double _ppqn = 1920.0; /* TODO: Make configurable. */
-
double _time;
};
-const MusicalTime MaxMusicalTime = Evoral::MusicalTime::max();
-const MusicalTime MinMusicalTime = Evoral::MusicalTime::min();
+extern const MusicalTime MaxMusicalTime;
+extern const MusicalTime MinMusicalTime;
/** Type of an event (opaque, mapped by application) */
typedef uint32_t EventType;
diff --git a/libs/evoral/src/ControlList.cpp b/libs/evoral/src/ControlList.cpp
index 2591cec58c..37e79d70d3 100644
--- a/libs/evoral/src/ControlList.cpp
+++ b/libs/evoral/src/ControlList.cpp
@@ -24,6 +24,7 @@
#include "evoral/Curve.hpp"
#include "pbd/compose.h"
+#include "pbd/debug.h"
using namespace std;
using namespace PBD;
diff --git a/libs/evoral/src/types.cpp b/libs/evoral/src/types.cpp
new file mode 100644
index 0000000000..62614f9113
--- /dev/null
+++ b/libs/evoral/src/types.cpp
@@ -0,0 +1,29 @@
+/* This file is part of Evoral.
+ * Copyright (C) 2008 David Robillard <http://drobilla.net>
+ * Copyright (C) 2000-2008 Paul Davis
+ *
+ * Evoral 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.
+ *
+ * Evoral 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 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 St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <limits.h>
+
+#include "evoral/types.hpp"
+
+namespace Evoral {
+
+const double MusicalTime::PPQN = 1920.0;
+const MusicalTime MaxMusicalTime = Evoral::MusicalTime(DBL_MIN);
+const MusicalTime MinMusicalTime = Evoral::MusicalTime(DBL_MAX);
+
+}
diff --git a/libs/evoral/wscript b/libs/evoral/wscript
index a4aea3a3a2..1eed40474a 100644
--- a/libs/evoral/wscript
+++ b/libs/evoral/wscript
@@ -88,6 +88,7 @@ def build(bld):
src/SMF.cpp
src/Sequence.cpp
src/debug.cpp
+ src/types.cpp
'''
# Library