summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordeva <deva>2011-07-17 12:27:10 +0000
committerdeva <deva>2011-07-17 12:27:10 +0000
commitdc26c53fc4d1b92cc6fdda5e73825c6e093c73a9 (patch)
tree32436d0a721b66482b29bb9fec0b0bb857ebcc42
parent7d35e31ea61cb7fa088aa33a90f3207919fcd0b1 (diff)
Fix bug, where pos was not increased as it should on each run.
-rw-r--r--src/drumgizmo.cc11
-rw-r--r--src/drumgizmo.h2
2 files changed, 7 insertions, 6 deletions
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);