annotate AppCore.h @ 0:a223551fdc1f

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