diff AppCore.h @ 9:346807b47860

added extra files: JSON stuff and ofxPD altered example code.
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Wed, 16 Jan 2013 13:44:07 +0000
parents
children c2fffc8ea84d
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/AppCore.h	Wed Jan 16 13:44:07 2013 +0000
@@ -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:
+
+		// 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;
+};