summaryrefslogtreecommitdiff
path: root/src/drumgizmo.cc
diff options
context:
space:
mode:
authordeva <deva>2008-07-21 12:11:02 +0000
committerdeva <deva>2008-07-21 12:11:02 +0000
commit981cd50a83e67f5471ee1e1ad0c0575506f14da0 (patch)
treec206e93a6def02fec109190cc1c0b15c26f639c8 /src/drumgizmo.cc
parent9f07c02a19ee79906ad3f3ab8c9eed725def8b96 (diff)
Wee multivoices and multiple wavs... all triggered by the midi test framework.
Diffstat (limited to 'src/drumgizmo.cc')
-rw-r--r--src/drumgizmo.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/drumgizmo.cc b/src/drumgizmo.cc
index 737a197..f423bb0 100644
--- a/src/drumgizmo.cc
+++ b/src/drumgizmo.cc
@@ -31,20 +31,23 @@
static jack_port_t *test_midi_port = NULL;
static size_t timer = 0;
+static size_t next = 44100;
int process(jack_nframes_t nframes, void *arg)
{
// if(jack_port_connected_to(test_midi_port, "DrumGizmo:midi_in")) {
void* port_buf = jack_port_get_buffer(test_midi_port, nframes);
- if(timer > 44100) { // activate every second (44100 samples)
- printf("ding\n");
+ if(timer > next) { // activate every second (44100 samples)
+ // printf("ding\n");
- jack_nframes_t time = 1;
- size_t size = 3;
- jack_midi_data_t all_notes_off[] = { 0xB0, 123, 0 };
+ jack_nframes_t time = (jack_nframes_t)(((float)rand() / (float)RAND_MAX) * nframes);
+ size_t size = 1;
+ jack_midi_data_t all_notes_off[] = { rand() % 2 };
jack_midi_event_write(port_buf, time, all_notes_off, size);
+
timer = 0;
+ next = (size_t)(((float)rand() / (float)RAND_MAX) * 0.3 * 44100);
}
timer += nframes;