summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drumgizmo/output/outputdummy.cc5
-rw-r--r--drumgizmo/output/outputdummy.h1
-rw-r--r--plugin/drumgizmo_plugin.cc5
-rw-r--r--plugin/drumgizmo_plugin.h3
-rw-r--r--src/audiooutputengine.h2
-rw-r--r--test/dgreftest/midiinputengine.cc5
-rw-r--r--test/dgreftest/midiinputengine.h1
-rw-r--r--test/enginetest.cc34
8 files changed, 38 insertions, 18 deletions
diff --git a/drumgizmo/output/outputdummy.cc b/drumgizmo/output/outputdummy.cc
index eef61b8..1b98896 100644
--- a/drumgizmo/output/outputdummy.cc
+++ b/drumgizmo/output/outputdummy.cc
@@ -64,6 +64,11 @@ void DummyOutputEngine::post(size_t nsamples)
{
}
+std::size_t DummyOutputEngine::getSamplerate() const
+{
+ return 44100;
+}
+
bool DummyOutputEngine::isFreewheeling() const
{
return true;
diff --git a/drumgizmo/output/outputdummy.h b/drumgizmo/output/outputdummy.h
index 3e24495..b21961b 100644
--- a/drumgizmo/output/outputdummy.h
+++ b/drumgizmo/output/outputdummy.h
@@ -42,5 +42,6 @@ public:
void pre(size_t nsamples) override;
void run(int ch, sample_t* samples, size_t nsamples) override;
void post(size_t nsamples) override;
+ std::size_t getSamplerate() const override;
bool isFreewheeling() const override;
};
diff --git a/plugin/drumgizmo_plugin.cc b/plugin/drumgizmo_plugin.cc
index 847d8d2..a5dd7be 100644
--- a/plugin/drumgizmo_plugin.cc
+++ b/plugin/drumgizmo_plugin.cc
@@ -479,6 +479,11 @@ size_t DrumGizmoPlugin::Output::getBufferSize() const
return plugin.getFramesize();
}
+std::size_t DrumGizmoPlugin::Output::getSamplerate() const
+{
+ return plugin.drumgizmo->samplerate();
+}
+
bool DrumGizmoPlugin::Output::isFreewheeling() const
{
return plugin.getFreeWheel();
diff --git a/plugin/drumgizmo_plugin.h b/plugin/drumgizmo_plugin.h
index 6c8eda2..d864def 100644
--- a/plugin/drumgizmo_plugin.h
+++ b/plugin/drumgizmo_plugin.h
@@ -151,7 +151,8 @@ private:
void post(size_t nsamples) override;
sample_t *getBuffer(int ch) const override;
- size_t getBufferSize() const override;
+ std::size_t getBufferSize() const override;
+ std::size_t getSamplerate() const override;
bool isFreewheeling() const override;
protected:
diff --git a/src/audiooutputengine.h b/src/audiooutputengine.h
index 19f9f44..f69fd75 100644
--- a/src/audiooutputengine.h
+++ b/src/audiooutputengine.h
@@ -54,7 +54,7 @@ public:
//! Overload this method to force engine to use different buffer size.
virtual std::size_t getBufferSize() const { return 1024; }
- virtual std::size_t getSamplerate() const { return 44100; }
+ virtual std::size_t getSamplerate() const = 0;
virtual bool isFreewheeling() const = 0;
//! Overload this method to get notification of latency changes.
diff --git a/test/dgreftest/midiinputengine.cc b/test/dgreftest/midiinputengine.cc
index 84f4cc6..e984d58 100644
--- a/test/dgreftest/midiinputengine.cc
+++ b/test/dgreftest/midiinputengine.cc
@@ -192,6 +192,11 @@ void MidifileInputEngine::post()
{
}
+void MidifileInputEngine::setSampleRate(double sample_rate)
+{
+ this->samplerate = sample_rate;
+}
+
bool MidifileInputEngine::isFreewheeling() const
{
return true;
diff --git a/test/dgreftest/midiinputengine.h b/test/dgreftest/midiinputengine.h
index a752ff5..ffd22f8 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;
+ void setSampleRate(double sample_rate) override;
bool isFreewheeling() const override;
private:
diff --git a/test/enginetest.cc b/test/enginetest.cc
index cb21609..585b0d1 100644
--- a/test/enginetest.cc
+++ b/test/enginetest.cc
@@ -37,34 +37,36 @@ class AudioOutputEngineDummy
: public AudioOutputEngine
{
public:
- bool init(const Channels& channels) { return true; }
+ bool init(const Channels& channels) override { return true; }
- void setParm(const std::string& parm, const std::string& value) {}
+ void setParm(const std::string& parm, const std::string& value) override {}
- bool start() { return true; }
- void stop() {}
+ bool start() override { return true; }
+ void stop() override {}
- void pre(size_t nsamples) {}
- void run(int ch, sample_t *samples, size_t nsamples) {}
- void post(size_t nsamples) {}
- bool isFreewheeling() const { return true; }
+ void pre(size_t nsamples) override {}
+ void run(int ch, sample_t *samples, size_t nsamples) override {}
+ void post(size_t nsamples) override {}
+ std::size_t getSamplerate() const override { return 44100; }
+ bool isFreewheeling() const override { return true; }
};
class AudioInputEngineDummy
: public AudioInputEngine
{
public:
- bool init(const Instruments& instruments) { return true; }
+ bool init(const Instruments& instruments) override { return true; }
- void setParm(const std::string& parm, const std::string& value) {}
+ void setParm(const std::string& parm, const std::string& value) override {}
- bool start() { return true; }
- void stop() {}
+ bool start() override { return true; }
+ void stop() override {}
- void pre() {}
- void run(size_t pos, size_t len, std::vector<event_t>& events) {}
- void post() {}
- bool isFreewheeling() const { return true; }
+ void pre() override {}
+ 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 { return true; }
};
class test_engine : public DGUnit