Mercurial > hg > tweakathon2ios
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AppCore.h Fri Oct 10 11:46:42 2014 +0100 @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2011 Dan Wilcox <danomatika@gmail.com> + * + * BSD Simplified License. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. + * + * See https://github.com/danomatika/ofxPd for documentation + * + */ +#pragma once + +#include "ofMain.h" + +#include "ofxPd.h" + +// a namespace for the Pd types +using namespace pd; + +class AppCore : public PdReceiver, public PdMidiReceiver { + + public: + string patchName; + // main + void setup(const int numOutChannels, const int numInChannels, + const int sampleRate, const int ticksPerBuffer); + void update(); + void draw(); + void exit(); + + // do something + void playTone(int pitch); + + // input callbacks + void keyPressed(int key); + + // audio callbacks + void audioReceived(float * input, int bufferSize, int nChannels); + void audioRequested(float * output, int bufferSize, int nChannels); + + // pd message receiver callbacks + void print(const std::string& message); + + void receiveBang(const std::string& dest); + void receiveFloat(const std::string& dest, float value); + void receiveSymbol(const std::string& dest, const std::string& symbol); + void receiveList(const std::string& dest, const List& list); + void receiveMessage(const std::string& dest, const std::string& msg, const List& list); + + // pd midi receiver callbacks + void receiveNoteOn(const int channel, const int pitch, const int velocity); + void receiveControlChange(const int channel, const int controller, const int value); + void receiveProgramChange(const int channel, const int value); + void receivePitchBend(const int channel, const int value); + void receiveAftertouch(const int channel, const int value); + void receivePolyAftertouch(const int channel, const int pitch, const int value); + + void receiveMidiByte(const int port, const int byte); + + // demonstrates how to manually poll for messages + void processEvents(); + + ofxPd pd; + vector<float> scopeArray; + + int midiChan; +};