Mercurial > hg > beaglert
comparison examples/basic_midi/render.cpp @ 301:e4392164b458 prerelease
RENAMED BeagleRT to Bela AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, scripts probably not working
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Fri, 27 May 2016 14:34:41 +0100 |
parents | dbeed520b014 |
children | 1feb9c23ac57 |
comparison
equal
deleted
inserted
replaced
300:dbeed520b014 | 301:e4392164b458 |
---|---|
3 * | 3 * |
4 * Created on: Oct 24, 2014 | 4 * Created on: Oct 24, 2014 |
5 * Author: parallels | 5 * Author: parallels |
6 */ | 6 */ |
7 | 7 |
8 #include <BeagleRT.h> | 8 #include <Bela.h> |
9 #include <Midi.h> | 9 #include <Midi.h> |
10 #include <Utilities.h> | 10 #include <Utilities.h> |
11 #include <stdlib.h> | 11 #include <stdlib.h> |
12 #include <rtdk.h> | 12 #include <rtdk.h> |
13 #include <cmath> | 13 #include <cmath> |
39 // in from the call to initAudio(). | 39 // in from the call to initAudio(). |
40 // | 40 // |
41 // Return true on success; returning false halts the program. | 41 // Return true on success; returning false halts the program. |
42 Midi midi; | 42 Midi midi; |
43 int gMidiPort0 = 0; | 43 int gMidiPort0 = 0; |
44 bool setup(BeagleRTContext *context, void *userData) | 44 bool setup(BelaContext *context, void *userData) |
45 { | 45 { |
46 midi.readFrom(gMidiPort0); | 46 midi.readFrom(gMidiPort0); |
47 midi.writeTo(gMidiPort0); | 47 midi.writeTo(gMidiPort0); |
48 midi.enableParser(true); | 48 midi.enableParser(true); |
49 midi.setParserCallback(midiMessageCallback, &gMidiPort0); | 49 midi.setParserCallback(midiMessageCallback, &gMidiPort0); |
60 // ADCs and DACs (if available). If only audio is available, numMatrixFrames | 60 // ADCs and DACs (if available). If only audio is available, numMatrixFrames |
61 // will be 0. | 61 // will be 0. |
62 | 62 |
63 | 63 |
64 enum {kVelocity, kNoteOn, kNoteNumber}; | 64 enum {kVelocity, kNoteOn, kNoteNumber}; |
65 void render(BeagleRTContext *context, void *userData) | 65 void render(BelaContext *context, void *userData) |
66 { | 66 { |
67 // one way of getting the midi data is to parse them yourself | 67 // one way of getting the midi data is to parse them yourself |
68 // (you should set midi.enableParser(false) above): | 68 // (you should set midi.enableParser(false) above): |
69 /* | 69 /* |
70 static midi_byte_t noteOnStatus = 0x90; //on channel 1 | 70 static midi_byte_t noteOnStatus = 0x90; //on channel 1 |
158 } | 158 } |
159 | 159 |
160 // cleanup() is called once at the end, after the audio has stopped. | 160 // cleanup() is called once at the end, after the audio has stopped. |
161 // Release any resources that were allocated in setup(). | 161 // Release any resources that were allocated in setup(). |
162 | 162 |
163 void cleanup(BeagleRTContext *context, void *userData) | 163 void cleanup(BelaContext *context, void *userData) |
164 { | 164 { |
165 | 165 |
166 } | 166 } |