From 6f96e034906f06439b6e3e00517f03927264a8f4 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 28 Jan 2016 19:04:43 +0100 Subject: Don't remove the old run() method just yet. --- src/drumgizmo.cc | 24 ++++++++++++++++++++++++ src/drumgizmo.h | 1 + 2 files changed, 25 insertions(+) (limited to 'src') diff --git a/src/drumgizmo.cc b/src/drumgizmo.cc index 26b8e65..0edc599 100644 --- a/src/drumgizmo.cc +++ b/src/drumgizmo.cc @@ -217,6 +217,30 @@ void DrumGizmo::setFreeWheel(bool freewheel) } } +void DrumGizmo::run(int endpos) +{ + size_t pos = 0; + size_t nsamples = 1024;//oe->getBufferSize(); + sample_t *samples = (sample_t *)malloc(nsamples * sizeof(sample_t)); + + ie->start(); + oe->start(); + + while(run(pos, samples, nsamples) == true) + { + pos += nsamples; + if((endpos != -1) && (pos >= (size_t)endpos)) + { + break; + } + } + + ie->stop(); + oe->stop(); + + free(samples); +} + bool DrumGizmo::run(size_t pos, sample_t *samples, size_t nsamples) { setFrameSize(nsamples); diff --git a/src/drumgizmo.h b/src/drumgizmo.h index 98cd287..2778092 100644 --- a/src/drumgizmo.h +++ b/src/drumgizmo.h @@ -64,6 +64,7 @@ public: bool init(); + void run(int endpos); bool run(size_t pos, sample_t *samples, size_t nsamples); void stop(); -- cgit v1.2.3