From 981cd50a83e67f5471ee1e1ad0c0575506f14da0 Mon Sep 17 00:00:00 2001 From: deva Date: Mon, 21 Jul 2008 12:11:02 +0000 Subject: Wee multivoices and multiple wavs... all triggered by the midi test framework. --- src/drumgizmo.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/drumgizmo.cc') 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; -- cgit v1.2.3