summaryrefslogtreecommitdiff
path: root/drumgizmo/drumgizmoc.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2015-05-22 10:34:21 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2016-01-20 13:28:48 +0100
commit60cd3f9dc45b194198198591a7bf48e2d8afb16c (patch)
tree1f32bc03dbd42da23f5c4707f8aa9d51f1193eb3 /drumgizmo/drumgizmoc.cc
parentfd501c7dc4042ce993b16a2d079d5b05af2ecb07 (diff)
Added framesize control mechanism to the engine, and made us of it in the cachemanager and drumkitloader.
Diffstat (limited to 'drumgizmo/drumgizmoc.cc')
-rw-r--r--drumgizmo/drumgizmoc.cc19
1 files changed, 18 insertions, 1 deletions
diff --git a/drumgizmo/drumgizmoc.cc b/drumgizmo/drumgizmoc.cc
index 1ccc151..ab91423 100644
--- a/drumgizmo/drumgizmoc.cc
+++ b/drumgizmo/drumgizmoc.cc
@@ -328,6 +328,8 @@ int CliMain::run(int argc, char *argv[])
DrumGizmo gizmo(oe, ie);
+ gizmo.setFrameSize(oe->getBufferSize());
+
if(kitfile == "" || !gizmo.loadkit(kitfile)) {
printf("Failed to load \"%s\".\n", kitfile.c_str());
return 1;
@@ -357,7 +359,22 @@ int CliMain::run(int argc, char *argv[])
return 1;
}
- gizmo.run(endpos);
+ size_t pos = 0;
+ size_t nsamples = oe->getBufferSize();
+ sample_t *samples = (sample_t *)malloc(nsamples * sizeof(sample_t));
+
+ 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);
printf("Quit.\n"); fflush(stdout);