rt300@9
|
1 /*
|
rt300@9
|
2 * Copyright (c) 2011 Dan Wilcox <danomatika@gmail.com>
|
rt300@9
|
3 *
|
rt300@9
|
4 * BSD Simplified License.
|
rt300@9
|
5 * For information on usage and redistribution, and for a DISCLAIMER OF ALL
|
rt300@9
|
6 * WARRANTIES, see the file, "LICENSE.txt," in this distribution.
|
rt300@9
|
7 *
|
rt300@9
|
8 * See https://github.com/danomatika/ofxPd for documentation
|
rt300@9
|
9 *
|
rt300@9
|
10 */
|
rt300@9
|
11 #pragma once
|
rt300@9
|
12
|
rt300@9
|
13 #include "ofMain.h"
|
rt300@9
|
14
|
rt300@9
|
15 #include "ofxPd.h"
|
rt300@9
|
16
|
rt300@9
|
17 // a namespace for the Pd types
|
rt300@9
|
18 using namespace pd;
|
rt300@9
|
19
|
rt300@9
|
20 class AppCore : public PdReceiver, public PdMidiReceiver {
|
rt300@9
|
21
|
rt300@9
|
22 public:
|
rt300@45
|
23 string patchName;
|
rt300@9
|
24 // main
|
rt300@9
|
25 void setup(const int numOutChannels, const int numInChannels,
|
rt300@9
|
26 const int sampleRate, const int ticksPerBuffer);
|
rt300@9
|
27 void update();
|
rt300@9
|
28 void draw();
|
rt300@9
|
29 void exit();
|
rt300@9
|
30
|
rt300@9
|
31 // do something
|
rt300@9
|
32 void playTone(int pitch);
|
rt300@9
|
33
|
rt300@9
|
34 // input callbacks
|
rt300@9
|
35 void keyPressed(int key);
|
rt300@9
|
36
|
rt300@9
|
37 // audio callbacks
|
rt300@9
|
38 void audioReceived(float * input, int bufferSize, int nChannels);
|
rt300@9
|
39 void audioRequested(float * output, int bufferSize, int nChannels);
|
rt300@9
|
40
|
rt300@9
|
41 // pd message receiver callbacks
|
rt300@9
|
42 void print(const std::string& message);
|
rt300@9
|
43
|
rt300@9
|
44 void receiveBang(const std::string& dest);
|
rt300@9
|
45 void receiveFloat(const std::string& dest, float value);
|
rt300@9
|
46 void receiveSymbol(const std::string& dest, const std::string& symbol);
|
rt300@9
|
47 void receiveList(const std::string& dest, const List& list);
|
rt300@9
|
48 void receiveMessage(const std::string& dest, const std::string& msg, const List& list);
|
rt300@9
|
49
|
rt300@9
|
50 // pd midi receiver callbacks
|
rt300@9
|
51 void receiveNoteOn(const int channel, const int pitch, const int velocity);
|
rt300@9
|
52 void receiveControlChange(const int channel, const int controller, const int value);
|
rt300@9
|
53 void receiveProgramChange(const int channel, const int value);
|
rt300@9
|
54 void receivePitchBend(const int channel, const int value);
|
rt300@9
|
55 void receiveAftertouch(const int channel, const int value);
|
rt300@9
|
56 void receivePolyAftertouch(const int channel, const int pitch, const int value);
|
rt300@9
|
57
|
rt300@9
|
58 void receiveMidiByte(const int port, const int byte);
|
rt300@9
|
59
|
rt300@9
|
60 // demonstrates how to manually poll for messages
|
rt300@9
|
61 void processEvents();
|
rt300@9
|
62
|
rt300@9
|
63 ofxPd pd;
|
rt300@9
|
64 vector<float> scopeArray;
|
rt300@9
|
65
|
rt300@9
|
66 int midiChan;
|
rt300@9
|
67 };
|