summaryrefslogtreecommitdiff
path: root/libs/evoral
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2016-12-16 10:43:52 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2016-12-16 10:43:52 +0000
commitc0aa738395f500923e67696deb46a71395a7cc07 (patch)
tree6c1131d0e3724b67139527585f6ea1484c3a408d /libs/evoral
parent2378e7b60ce9d2923e9c631299732cb5ef3a6b3c (diff)
expose SMF tempo information in Evoral::SMF
Diffstat (limited to 'libs/evoral')
-rw-r--r--libs/evoral/evoral/SMF.hpp13
-rw-r--r--libs/evoral/src/SMF.cpp26
2 files changed, 37 insertions, 2 deletions
diff --git a/libs/evoral/evoral/SMF.hpp b/libs/evoral/evoral/SMF.hpp
index 5747e87e3e..0c312890b2 100644
--- a/libs/evoral/evoral/SMF.hpp
+++ b/libs/evoral/evoral/SMF.hpp
@@ -28,8 +28,10 @@
struct smf_struct;
struct smf_track_struct;
+struct smf_tempo_struct;
typedef smf_struct smf_t;
typedef smf_track_struct smf_track_t;
+typedef smf_tempo_struct smf_tempo_t;
namespace Evoral {
@@ -40,7 +42,7 @@ namespace Evoral {
*
* For WRITING: this object specifically wraps a type0 file or a type1 file with only a
* single track. It has no support at this time for a type1 file with multiple
- * tracks.
+ * tracks.
*
* For READING: this object can read a single arbitrary track from a type1
* file, or the single track of a type0 file. It has no support at this time
@@ -89,6 +91,14 @@ public:
void track_names (std::vector<std::string>&) const;
void instrument_names (std::vector<std::string>&) const;
+ int num_tempos () const;
+
+ typedef smf_tempo_t Tempo;
+
+ Tempo* tempo_at_smf_pulse (size_t smf_pulse) const;
+ Tempo* tempo_at_seconds (double seconds) const;
+ Tempo* nth_tempo (size_t n) const;
+
private:
smf_t* _smf;
smf_track_t* _smf_track;
@@ -102,4 +112,3 @@ public:
}; /* namespace Evoral */
#endif /* EVORAL_SMF_HPP */
-
diff --git a/libs/evoral/src/SMF.cpp b/libs/evoral/src/SMF.cpp
index 4abd69796c..63050b63be 100644
--- a/libs/evoral/src/SMF.cpp
+++ b/libs/evoral/src/SMF.cpp
@@ -522,5 +522,31 @@ SMF::instrument_names(vector<string>& names) const
}
}
+int
+SMF::num_tempos () const
+{
+ assert (_smf);
+ return smf_get_tempo_count (_smf);
+}
+
+SMF::Tempo*
+SMF::tempo_at_smf_pulse (size_t smf_pulse) const
+{
+ return smf_get_tempo_by_seconds (_smf, smf_pulse);
+}
+
+SMF::Tempo*
+SMF::tempo_at_seconds (double seconds) const
+{
+ return smf_get_tempo_by_seconds (_smf, seconds);
+}
+
+SMF::Tempo*
+SMF::nth_tempo (size_t n) const
+{
+ assert (_smf);
+
+ return smf_get_tempo_by_number (_smf, n);
+}
} // namespace Evoral