summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuo Jinghua <sunmoon1997@gmail.com>2012-06-26 18:15:20 +0800
committerLuo Jinghua <sunmoon1997@gmail.com>2012-06-26 18:15:20 +0800
commit3f52d14271f8a650a1f63512e6f2114ce26d8d25 (patch)
tree751c8ace445554559038ea26574d8f8d5f9b6523
parent1c505614aafbd7a635ed19176aaa0a3eb5235b07 (diff)
Added tempo getter/setter
-rw-r--r--src/audiere.h13
-rw-r--r--src/input_mod.cpp28
-rw-r--r--src/input_mod.h2
3 files changed, 42 insertions, 1 deletions
diff --git a/src/audiere.h b/src/audiere.h
index f53c122..4403637 100644
--- a/src/audiere.h
+++ b/src/audiere.h
@@ -393,6 +393,19 @@ namespace audiere {
* formats supported by dumb.
*/
ADR_METHOD(bool) setChannelVolume(int channel, float volume) { return false; }
+
+
+ /**
+ * Returns the tempo of the source. This is only for formats
+ * supported by dumb.
+ */
+ ADR_METHOD(int) getTempo() { return 0; }
+
+ /**
+ * Sets the tempo of the source. This is only for formats
+ * supported by dumb.
+ */
+ ADR_METHOD(bool) setTempo(int tempo) { return false; }
};
typedef RefPtr<SampleSource> SampleSourcePtr;
diff --git a/src/input_mod.cpp b/src/input_mod.cpp
index 4af33de..6347535 100644
--- a/src/input_mod.cpp
+++ b/src/input_mod.cpp
@@ -170,7 +170,33 @@ namespace audiere {
return true;
}
-
+
+ int
+ MODInputStream::getTempo()
+ {
+ ADR_GUARD("MOD_getTempo");
+ if (m_renderer) {
+ DUMB_IT_SIGRENDERER* itrenderer = duh_get_it_sigrenderer(m_renderer);
+ return dumb_it_sr_get_tempo(itrenderer);
+ }
+ return 0;
+ }
+
+
+ bool
+ MODInputStream::setTempo(int tempo)
+ {
+ ADR_GUARD("MOD_setTempo");
+ if (m_renderer) {
+ DUMB_IT_SIGRENDERER* itrenderer = duh_get_it_sigrenderer(m_renderer);
+ dumb_it_sr_set_tempo(itrenderer, tempo);
+ return true;
+ }
+
+ return false;
+ }
+
+
int
MODInputStream::doRead(int frame_count, void* buffer) {
ADR_GUARD("MOD_doRead");
diff --git a/src/input_mod.h b/src/input_mod.h
index 183a5e5..0a58e43 100644
--- a/src/input_mod.h
+++ b/src/input_mod.h
@@ -28,6 +28,8 @@ namespace audiere {
int ADR_CALL getRow();
float ADR_CALL getChannelVolume(int channel = 0);
bool ADR_CALL setChannelVolume(int channel, float volume);
+ int ADR_CALL getTempo();
+ bool ADR_CALL setTempo(int tempo);
int doRead(int frame_count, void* buffer);