summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Nusser <andre.nusser@googlemail.com>2016-07-13 18:32:52 +0200
committerAndré Nusser <andre.nusser@googlemail.com>2016-07-13 18:32:52 +0200
commiteb3a5e8834c1af80fc5196e5c8f5788e8a2b2167 (patch)
tree51b315faab10b1fdbb6508d6f89d818024a6cefb
parent32606894c67e6be27ba853a8bc3e97c808c14987 (diff)
Introduce input engine isFreewheeling method.
-rw-r--r--drumgizmo/input/inputdummy.cc5
-rw-r--r--drumgizmo/input/inputdummy.h1
-rw-r--r--drumgizmo/input/jackmidi.cc5
-rw-r--r--drumgizmo/input/jackmidi.h1
-rw-r--r--drumgizmo/input/midifile.cc5
-rw-r--r--drumgizmo/input/midifile.h1
-rw-r--r--drumgizmo/input/test.cc5
-rw-r--r--drumgizmo/input/test.h1
-rw-r--r--plugin/drumgizmo_plugin.cc5
-rw-r--r--plugin/drumgizmo_plugin.h2
-rw-r--r--src/audioinputengine.h1
-rw-r--r--test/dgreftest/midiinputengine.cc5
-rw-r--r--test/dgreftest/midiinputengine.h1
-rw-r--r--test/engine.cc1
14 files changed, 39 insertions, 0 deletions
diff --git a/drumgizmo/input/inputdummy.cc b/drumgizmo/input/inputdummy.cc
index 971ef29..54643ae 100644
--- a/drumgizmo/input/inputdummy.cc
+++ b/drumgizmo/input/inputdummy.cc
@@ -63,3 +63,8 @@ void DummyInputEngine::run(size_t pos, size_t len, std::vector<event_t>& events)
void DummyInputEngine::post()
{
}
+
+bool DummyInputEngine::isFreewheeling() const
+{
+ return false;
+}
diff --git a/drumgizmo/input/inputdummy.h b/drumgizmo/input/inputdummy.h
index 7888f33..9420319 100644
--- a/drumgizmo/input/inputdummy.h
+++ b/drumgizmo/input/inputdummy.h
@@ -42,4 +42,5 @@ public:
void pre() override;
void run(size_t pos, size_t len, std::vector<event_t>& events) override;
void post() override;
+ bool isFreewheeling() const override;
};
diff --git a/drumgizmo/input/jackmidi.cc b/drumgizmo/input/jackmidi.cc
index 7eeae7d..7c5cf1c 100644
--- a/drumgizmo/input/jackmidi.cc
+++ b/drumgizmo/input/jackmidi.cc
@@ -101,6 +101,11 @@ void JackMidiInputEngine::post()
{
}
+bool JackMidiInputEngine::isFreewheeling() const
+{
+ return client.isFreewheeling();
+}
+
void JackMidiInputEngine::process(jack_nframes_t num_frames)
{
assert(port != nullptr);
diff --git a/drumgizmo/input/jackmidi.h b/drumgizmo/input/jackmidi.h
index 1532b18..96e2d03 100644
--- a/drumgizmo/input/jackmidi.h
+++ b/drumgizmo/input/jackmidi.h
@@ -50,6 +50,7 @@ public:
void pre() override;
void run(size_t pos, size_t len, std::vector<event_t>& events) override;
void post() override;
+ bool isFreewheeling() const override;
// based on JackProcess
void process(jack_nframes_t num_frames) override;
diff --git a/drumgizmo/input/midifile.cc b/drumgizmo/input/midifile.cc
index 6a24a00..89ffa6b 100644
--- a/drumgizmo/input/midifile.cc
+++ b/drumgizmo/input/midifile.cc
@@ -195,3 +195,8 @@ void MidifileInputEngine::setSampleRate(double sample_rate)
{
this->samplerate = sample_rate;
}
+
+bool MidifileInputEngine::isFreewheeling() const
+{
+ return true;
+}
diff --git a/drumgizmo/input/midifile.h b/drumgizmo/input/midifile.h
index 518d8d2..5756718 100644
--- a/drumgizmo/input/midifile.h
+++ b/drumgizmo/input/midifile.h
@@ -50,6 +50,7 @@ public:
void run(size_t pos, size_t len, std::vector<event_t>& events) override;
void post() override;
void setSampleRate(double sample_rate) override;
+ bool isFreewheeling() const override;
private:
smf_t* smf;
diff --git a/drumgizmo/input/test.cc b/drumgizmo/input/test.cc
index 5025d2c..75b6774 100644
--- a/drumgizmo/input/test.cc
+++ b/drumgizmo/input/test.cc
@@ -118,3 +118,8 @@ void TestInputEngine::setSampleRate(double sample_rate)
{
this->sample_rate = sample_rate;
}
+
+bool TestInputEngine::isFreewheeling() const
+{
+ return false;
+}
diff --git a/drumgizmo/input/test.h b/drumgizmo/input/test.h
index 70936ea..baf7c95 100644
--- a/drumgizmo/input/test.h
+++ b/drumgizmo/input/test.h
@@ -46,6 +46,7 @@ public:
void run(size_t pos, size_t len, std::vector<event_t>& events) override;
void post() override;
void setSampleRate(double sample_rate) override;
+ bool isFreewheeling() const override;
private:
float probability;
diff --git a/plugin/drumgizmo_plugin.cc b/plugin/drumgizmo_plugin.cc
index 4f3edf2..2b0d2a8 100644
--- a/plugin/drumgizmo_plugin.cc
+++ b/plugin/drumgizmo_plugin.cc
@@ -233,6 +233,11 @@ void DrumGizmoPlugin::Input::post()
{
}
+bool DrumGizmoPlugin::Input::isFreewheeling() const
+{
+ return plugin.getFreeWheel();
+}
+
//
// Output Engine
diff --git a/plugin/drumgizmo_plugin.h b/plugin/drumgizmo_plugin.h
index 0adc240..14189c9 100644
--- a/plugin/drumgizmo_plugin.h
+++ b/plugin/drumgizmo_plugin.h
@@ -119,6 +119,8 @@ private:
void run(size_t pos, size_t len, std::vector<event_t>& events) override;
void post() override;
+ bool isFreewheeling() const override;
+
protected:
DrumGizmoPlugin& plugin;
const Instruments* instruments{nullptr};
diff --git a/src/audioinputengine.h b/src/audioinputengine.h
index 72fa57d..71a86c2 100644
--- a/src/audioinputengine.h
+++ b/src/audioinputengine.h
@@ -51,4 +51,5 @@ public:
//! Reimplement to receive sample rate changes.
virtual void setSampleRate(double sample_rate) {}
+ virtual bool isFreewheeling() const = 0;
};
diff --git a/test/dgreftest/midiinputengine.cc b/test/dgreftest/midiinputengine.cc
index bc0fa87..aba726f 100644
--- a/test/dgreftest/midiinputengine.cc
+++ b/test/dgreftest/midiinputengine.cc
@@ -190,3 +190,8 @@ void MidifileInputEngine::run(size_t pos, size_t len, std::vector<event_t>& even
void MidifileInputEngine::post()
{
}
+
+bool MidifileInputEngine::isFreewheeling() const
+{
+ return true;
+}
diff --git a/test/dgreftest/midiinputengine.h b/test/dgreftest/midiinputengine.h
index 3740d44..a752ff5 100644
--- a/test/dgreftest/midiinputengine.h
+++ b/test/dgreftest/midiinputengine.h
@@ -50,6 +50,7 @@ public:
void pre() override;
void run(size_t pos, size_t len, std::vector<event_t>& events) override;
void post() override;
+ bool isFreewheeling() const override;
private:
smf_t* smf;
diff --git a/test/engine.cc b/test/engine.cc
index 11fa720..96d513f 100644
--- a/test/engine.cc
+++ b/test/engine.cc
@@ -60,6 +60,7 @@ public:
void pre() {}
void run(size_t pos, size_t len, std::vector<event_t>& events) {}
void post() {}
+ bool isFreewheeling() const { return true; }
};
class test_engine : public CppUnit::TestFixture