Mercurial > hg > tweakathon2ios
view AppCore.h @ 44:d810aa9ca03a
times. cosmetic stuff
author | Robert Tubb <rt300@eecs.qmul.ac.uk> |
---|---|
date | Mon, 15 Dec 2014 17:33:41 +0000 |
parents | 91c3fba6e5b9 |
children |
line wrap: on
line source
/* * 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 "boost/bind.hpp" #include "boost/function.hpp" #include "ofxPd.h" #include "globalVariables.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; vector<TickListenerFunction> tickListeners; // register for a clock tick void clockTickSender(int stepNo){ for(auto tli = tickListeners.begin(); tli < tickListeners.end(); tli++){ (*tli)(stepNo); } }; void addTickListener(TickListenerFunction listenerFunction) // virtual? { cout << "added tick listener" << endl; tickListeners.push_back(listenerFunction); }; };