From dc26c53fc4d1b92cc6fdda5e73825c6e093c73a9 Mon Sep 17 00:00:00 2001 From: deva Date: Sun, 17 Jul 2011 12:27:10 +0000 Subject: Fix bug, where pos was not increased as it should on each run. --- src/drumgizmo.cc | 11 ++++++----- src/drumgizmo.h | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/drumgizmo.cc b/src/drumgizmo.cc index de8e610..b0d59ef 100644 --- a/src/drumgizmo.cc +++ b/src/drumgizmo.cc @@ -88,7 +88,7 @@ bool DrumGizmo::init(bool preload) return true; } -void DrumGizmo::run(size_t pos, sample_t *samples, size_t nsamples) +bool DrumGizmo::run(size_t pos, sample_t *samples, size_t nsamples) { ie->pre(); oe->pre(nsamples); @@ -153,8 +153,7 @@ void DrumGizmo::run(size_t pos, sample_t *samples, size_t nsamples) } if(evs[e].type == TYPE_STOP) { - printf("Stoooooop!\n"); - // running = false; + return false; } } @@ -176,6 +175,8 @@ void DrumGizmo::run(size_t pos, sample_t *samples, size_t nsamples) oe->post(nsamples); pos += nsamples; + + return true; } void DrumGizmo::run() @@ -189,8 +190,8 @@ void DrumGizmo::run() bool running = true; - while(running) { - run(pos, samples, nsamples); + while(run(pos, samples, nsamples) == true) { + pos += nsamples; } ie->stop(); diff --git a/src/drumgizmo.h b/src/drumgizmo.h index 1bdb5b5..2f85d51 100644 --- a/src/drumgizmo.h +++ b/src/drumgizmo.h @@ -50,7 +50,7 @@ public: bool init(bool preload = true); void run(); - void run(size_t pos, sample_t *samples, size_t nsamples); + bool run(size_t pos, sample_t *samples, size_t nsamples); void stop(); void getSamples(int ch, int pos, sample_t *s, size_t sz); -- cgit v1.2.3