summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drumgizmo/drumgizmoc.cc2
-rw-r--r--plugin/drumgizmo_plugin.cc2
-rw-r--r--src/drumgizmo.cc40
-rw-r--r--src/drumgizmo.h7
-rw-r--r--test/dgreftest/dgreftest.cc2
-rw-r--r--test/engine.cc2
6 files changed, 28 insertions, 27 deletions
diff --git a/drumgizmo/drumgizmoc.cc b/drumgizmo/drumgizmoc.cc
index a774705..6433d9d 100644
--- a/drumgizmo/drumgizmoc.cc
+++ b/drumgizmo/drumgizmoc.cc
@@ -344,7 +344,7 @@ int main(int argc, char* argv[])
printf("Using kitfile: %s\n", kitfile.c_str());
Settings settings;
- DrumGizmo gizmo(settings, oe.get(), ie.get());
+ DrumGizmo gizmo(settings, *oe.get(), *ie.get());
gizmo.setFrameSize(oe->getBufferSize());
diff --git a/plugin/drumgizmo_plugin.cc b/plugin/drumgizmo_plugin.cc
index 06c2799..5c94db4 100644
--- a/plugin/drumgizmo_plugin.cc
+++ b/plugin/drumgizmo_plugin.cc
@@ -59,7 +59,7 @@ DrumGizmoPlugin::DrumGizmoPlugin()
{
init();
- drumgizmo = std::make_shared<DrumGizmo>(settings, &output, &input);
+ drumgizmo = std::make_shared<DrumGizmo>(settings, output, input);
resizeWindow(370, 330);
drumgizmo->setFreeWheel(true);
drumgizmo->setSamplerate(44100);
diff --git a/src/drumgizmo.cc b/src/drumgizmo.cc
index 6c639b8..ef4d3b6 100644
--- a/src/drumgizmo.cc
+++ b/src/drumgizmo.cc
@@ -49,8 +49,8 @@
#include "nolocale.h"
DrumGizmo::DrumGizmo(Settings& settings,
- AudioOutputEngine *o, AudioInputEngine *i)
- : loader(settings, kit, *i, resamplers, rand)
+ AudioOutputEngine& o, AudioInputEngine& i)
+ : loader(settings, kit, i, resamplers, rand)
, oe(o)
, ie(i)
, kit()
@@ -73,12 +73,12 @@ DrumGizmo::~DrumGizmo()
bool DrumGizmo::init()
{
- if(!ie->init(kit.instruments))
+ if(!ie.init(kit.instruments))
{
return false;
}
- if(!oe->init(kit.channels))
+ if(!oe.init(kit.channels))
{
return false;
}
@@ -125,13 +125,13 @@ void DrumGizmo::setRandomSeed(unsigned int seed)
void DrumGizmo::run(int endpos)
{
size_t pos = 0;
- size_t nsamples = oe->getBufferSize();
+ size_t nsamples = oe.getBufferSize();
sample_t *samples = (sample_t *)malloc(nsamples * sizeof(sample_t));
- setFrameSize(oe->getBufferSize());
+ setFrameSize(oe.getBufferSize());
- ie->start();
- oe->start();
+ ie.start();
+ oe.start();
while(run(pos, samples, nsamples) == true)
{
@@ -142,8 +142,8 @@ void DrumGizmo::run(int endpos)
}
}
- ie->stop();
- oe->stop();
+ ie.stop();
+ oe.stop();
free(samples);
}
@@ -152,14 +152,14 @@ bool DrumGizmo::run(size_t pos, sample_t *samples, size_t nsamples)
{
setFrameSize(nsamples);
- ie->pre();
- oe->pre(nsamples);
+ ie.pre();
+ oe.pre(nsamples);
//
// Read new events
//
- ie->run(pos, nsamples, events);
+ ie.run(pos, nsamples, events);
double resample_ratio = resamplers.getRatio();
bool active_events_left = input_processor.process(events, pos, resample_ratio);
@@ -182,9 +182,9 @@ bool DrumGizmo::run(size_t pos, sample_t *samples, size_t nsamples)
{
sample_t *buf = samples;
bool internal = false;
- if(oe->getBuffer(c))
+ if(oe.getBuffer(c))
{
- buf = oe->getBuffer(c);
+ buf = oe.getBuffer(c);
internal = true;
}
@@ -196,7 +196,7 @@ bool DrumGizmo::run(size_t pos, sample_t *samples, size_t nsamples)
if(!internal)
{
- oe->run(c, samples, nsamples);
+ oe.run(c, samples, nsamples);
}
}
}
@@ -244,14 +244,14 @@ bool DrumGizmo::run(size_t pos, sample_t *samples, size_t nsamples)
// Write output data to output engine.
for(size_t c = 0; c < kit.channels.size(); ++c)
{
- oe->run(c, resampler_output_buffer[c], nsamples);
+ oe.run(c, resampler_output_buffer[c], nsamples);
}
}
#endif/*WITH_RESAMPLER*/
- ie->post();
- oe->post(nsamples);
+ ie.post();
+ oe.post(nsamples);
pos += nsamples;
@@ -454,7 +454,7 @@ float str2float(std::string a)
std::string DrumGizmo::configString()
{
std::string mmapfile;
- auto midiEngine = dynamic_cast<AudioInputEngineMidi*>(ie);
+ auto midiEngine = dynamic_cast<AudioInputEngineMidi*>(&ie);
if(midiEngine)
{
mmapfile = midiEngine->getMidimapFile();
diff --git a/src/drumgizmo.h b/src/drumgizmo.h
index ea04603..3f2d17c 100644
--- a/src/drumgizmo.h
+++ b/src/drumgizmo.h
@@ -49,7 +49,8 @@ class DrumGizmo
{
public:
DrumGizmo(Settings& settings,
- AudioOutputEngine *outputengine, AudioInputEngine *inputengine);
+ AudioOutputEngine& outputengine,
+ AudioInputEngine& inputengine);
virtual ~DrumGizmo();
bool init();
@@ -82,8 +83,8 @@ protected:
Mutex mutex;
- AudioOutputEngine *oe;
- AudioInputEngine *ie;
+ AudioOutputEngine& oe;
+ AudioInputEngine& ie;
std::list< Event* > activeevents[MAX_NUM_CHANNELS];
diff --git a/test/dgreftest/dgreftest.cc b/test/dgreftest/dgreftest.cc
index 072dcdc..7d9d00c 100644
--- a/test/dgreftest/dgreftest.cc
+++ b/test/dgreftest/dgreftest.cc
@@ -86,7 +86,7 @@ int main(int argc, char* argv[])
oe->setParm("file", reffile.c_str());
oe->setParm("srate", "44100");
- DrumGizmo drumgizmo(settings, oe.get(), &ie);
+ DrumGizmo drumgizmo(settings, *oe.get(), ie);
drumgizmo.setRandomSeed(seed);
drumgizmo.setFreeWheel(true); // Run in-sync with disk-cache
drumgizmo.setFrameSize(oe->getBufferSize());
diff --git a/test/engine.cc b/test/engine.cc
index 8f417e0..c607ded 100644
--- a/test/engine.cc
+++ b/test/engine.cc
@@ -76,7 +76,7 @@ public:
Settings settings;
AudioOutputEngineDummy oe;
AudioInputEngineDummy ie;
- DrumGizmo dg(settings, &oe, &ie);
+ DrumGizmo dg(settings, oe, ie);
dg.setFrameSize(100);
// Switch kits emmidiately without giving the loader time to work: