diff options
-rw-r--r-- | drumgizmo/drumgizmoc.cc | 25 | ||||
-rw-r--r-- | src/drumgizmo.cc | 26 | ||||
-rw-r--r-- | src/drumgizmo.h | 1 | ||||
-rw-r--r-- | test/dgreftest/dgreftest.cc | 21 |
4 files changed, 44 insertions, 29 deletions
diff --git a/drumgizmo/drumgizmoc.cc b/drumgizmo/drumgizmoc.cc index 4f3123b..1ba9516 100644 --- a/drumgizmo/drumgizmoc.cc +++ b/drumgizmo/drumgizmoc.cc @@ -391,7 +391,30 @@ int main(int argc, char* argv[]) return 1; } - gizmo.run(endpos); + // former drumgizmo run call + size_t pos = 0; + size_t nsamples = oe->getBufferSize(); + sample_t *samples = (sample_t *)malloc(nsamples * sizeof(sample_t)); + + gizmo.setFrameSize(oe->getBufferSize()); + + ie->start(); + oe->start(); + + while(gizmo.run(pos, samples, nsamples) == true) + { + pos += nsamples; + if((endpos != -1) && (pos >= (size_t)endpos)) + { + break; + } + } + + ie->stop(); + oe->stop(); + + free(samples); + // end former drumgizmo run call printf("Quit.\n"); fflush(stdout); diff --git a/src/drumgizmo.cc b/src/drumgizmo.cc index d6dc028..14d47a1 100644 --- a/src/drumgizmo.cc +++ b/src/drumgizmo.cc @@ -122,32 +122,6 @@ void DrumGizmo::setRandomSeed(unsigned int seed) rand.setSeed(seed); } -void DrumGizmo::run(int endpos) -{ - size_t pos = 0; - size_t nsamples = oe.getBufferSize(); - sample_t *samples = (sample_t *)malloc(nsamples * sizeof(sample_t)); - - setFrameSize(oe.getBufferSize()); - - 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 63c0fb6..8ad77d3 100644 --- a/src/drumgizmo.h +++ b/src/drumgizmo.h @@ -55,7 +55,6 @@ public: bool init(); - void run(int endpos); bool run(size_t pos, sample_t *samples, size_t nsamples); void stop(); diff --git a/test/dgreftest/dgreftest.cc b/test/dgreftest/dgreftest.cc index 7d9d00c..0147244 100644 --- a/test/dgreftest/dgreftest.cc +++ b/test/dgreftest/dgreftest.cc @@ -130,7 +130,26 @@ int main(int argc, char* argv[]) return 1; } - drumgizmo.run(-1); + // former drumgizmo run call + size_t pos = 0; + size_t nsamples = oe->getBufferSize(); + sample_t *samples = (sample_t *)malloc(nsamples * sizeof(sample_t)); + + drumgizmo.setFrameSize(oe->getBufferSize()); + + ie.start(); + oe->start(); + + while(drumgizmo.run(pos, samples, nsamples) == true) + { + pos += nsamples; + } + + ie.stop(); + oe->stop(); + + free(samples); + // end former drumgizmo run call return 0; } |