annotate AppCore.h @ 52:89944ab3e129 tip

fix oF linker errors ios8
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Tue, 03 Feb 2015 13:18:23 +0000
parents 91c3fba6e5b9
children
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@11 14 #include "boost/bind.hpp"
rt300@11 15 #include "boost/function.hpp"
rt300@11 16 #include "ofxPd.h"
rt300@11 17 #include "globalVariables.h"
rt300@0 18
rt300@0 19
rt300@0 20 // a namespace for the Pd types
rt300@0 21 using namespace pd;
rt300@0 22
rt300@0 23 class AppCore : public PdReceiver, public PdMidiReceiver {
rt300@0 24
rt300@0 25 public:
rt300@0 26 string patchName;
rt300@0 27 // main
rt300@0 28 void setup(const int numOutChannels, const int numInChannels,
rt300@0 29 const int sampleRate, const int ticksPerBuffer);
rt300@0 30 void update();
rt300@0 31 void draw();
rt300@0 32 void exit();
rt300@0 33
rt300@0 34 // do something
rt300@0 35 void playTone(int pitch);
rt300@0 36
rt300@0 37 // input callbacks
rt300@0 38 void keyPressed(int key);
rt300@0 39
rt300@0 40 // audio callbacks
rt300@0 41 void audioReceived(float * input, int bufferSize, int nChannels);
rt300@0 42 void audioRequested(float * output, int bufferSize, int nChannels);
rt300@0 43
rt300@0 44 // pd message receiver callbacks
rt300@0 45 void print(const std::string& message);
rt300@0 46
rt300@0 47 void receiveBang(const std::string& dest);
rt300@0 48 void receiveFloat(const std::string& dest, float value);
rt300@0 49 void receiveSymbol(const std::string& dest, const std::string& symbol);
rt300@0 50 void receiveList(const std::string& dest, const List& list);
rt300@0 51 void receiveMessage(const std::string& dest, const std::string& msg, const List& list);
rt300@0 52
rt300@0 53 // pd midi receiver callbacks
rt300@0 54 void receiveNoteOn(const int channel, const int pitch, const int velocity);
rt300@0 55 void receiveControlChange(const int channel, const int controller, const int value);
rt300@0 56 void receiveProgramChange(const int channel, const int value);
rt300@0 57 void receivePitchBend(const int channel, const int value);
rt300@0 58 void receiveAftertouch(const int channel, const int value);
rt300@0 59 void receivePolyAftertouch(const int channel, const int pitch, const int value);
rt300@0 60
rt300@0 61 void receiveMidiByte(const int port, const int byte);
rt300@0 62
rt300@0 63 // demonstrates how to manually poll for messages
rt300@0 64 void processEvents();
rt300@0 65
rt300@0 66 ofxPd pd;
rt300@0 67 vector<float> scopeArray;
rt300@0 68
rt300@0 69 int midiChan;
rt300@11 70 vector<TickListenerFunction> tickListeners;
rt300@11 71
rt300@11 72 // register for a clock tick
rt300@11 73 void clockTickSender(int stepNo){
rt300@11 74 for(auto tli = tickListeners.begin(); tli < tickListeners.end(); tli++){
rt300@11 75 (*tli)(stepNo);
rt300@11 76 }
rt300@11 77 };
rt300@11 78
rt300@11 79 void addTickListener(TickListenerFunction listenerFunction) // virtual?
rt300@11 80 {
rt300@11 81 cout << "added tick listener" << endl;
rt300@11 82 tickListeners.push_back(listenerFunction);
rt300@11 83 };
rt300@0 84 };