aboutsummaryrefslogtreecommitdiffstats
path: root/ofxMaxim/ofxMaximiPhone0062Example/src
diff options
context:
space:
mode:
authorMick Grierson <mickgrierson@gmail.com>2011-10-31 17:10:28 +0000
committerMick Grierson <mickgrierson@gmail.com>2011-10-31 17:10:28 +0000
commit086644237c0ed96383be68d4772623332d860473 (patch)
tree96a279125a6b11a4a43761669a5e48c33ca6e574 /ofxMaxim/ofxMaximiPhone0062Example/src
parent09eb47749f4d866228c884c9cb0462b883901953 (diff)
ofxMaxim Examples updated. Tested on XCode 4 with ofxiPhone 007 and iOS 5 - everything works.
Diffstat (limited to 'ofxMaxim/ofxMaximiPhone0062Example/src')
-rw-r--r--ofxMaxim/ofxMaximiPhone0062Example/src/main.mm8
-rwxr-xr-xofxMaxim/ofxMaximiPhone0062Example/src/testApp.h42
-rwxr-xr-xofxMaxim/ofxMaximiPhone0062Example/src/testApp.mm116
3 files changed, 166 insertions, 0 deletions
diff --git a/ofxMaxim/ofxMaximiPhone0062Example/src/main.mm b/ofxMaxim/ofxMaximiPhone0062Example/src/main.mm
new file mode 100644
index 0000000..a0b6b4c
--- /dev/null
+++ b/ofxMaxim/ofxMaximiPhone0062Example/src/main.mm
@@ -0,0 +1,8 @@
+#include "ofMain.h"
+#include "testApp.h"
+
+int main(){
+ ofSetupOpenGL(1024,768, OF_FULLSCREEN); // <-------- setup the GL context
+
+ ofRunApp(new testApp);
+}
diff --git a/ofxMaxim/ofxMaximiPhone0062Example/src/testApp.h b/ofxMaxim/ofxMaximiPhone0062Example/src/testApp.h
new file mode 100755
index 0000000..ac944e5
--- /dev/null
+++ b/ofxMaxim/ofxMaximiPhone0062Example/src/testApp.h
@@ -0,0 +1,42 @@
+#pragma once
+
+#include "ofMain.h"
+#include "ofxiPhone.h"
+#include "ofxiPhoneExtras.h"
+#include "ofxMaxim.h"
+
+
+class testApp : public ofxiPhoneApp {
+
+public:
+ ~testApp();
+ void setup();
+ void update();
+ void draw();
+ void exit();
+
+ void touchDown(ofTouchEventArgs &touch);
+ void touchMoved(ofTouchEventArgs &touch);
+ void touchUp(ofTouchEventArgs &touch);
+ void touchDoubleTap(ofTouchEventArgs &touch);
+
+ void lostFocus();
+ void gotFocus();
+ void gotMemoryWarning();
+ void deviceOrientationChanged(int newOrientation);
+
+ void audioReceived( float * input, int bufferSize, int nChannels );
+ void audioRequested( float * output, int bufferSize, int nChannels );
+
+ int initialBufferSize;
+ int sampleRate;
+
+
+ ofxMaxiOsc myOsc1;
+ ofxMaxiSample sample1;
+ double patch1,sample,outputs1[2];
+ ofxMaxiMix channel1;
+
+};
+
+
diff --git a/ofxMaxim/ofxMaximiPhone0062Example/src/testApp.mm b/ofxMaxim/ofxMaximiPhone0062Example/src/testApp.mm
new file mode 100755
index 0000000..8dc9e95
--- /dev/null
+++ b/ofxMaxim/ofxMaximiPhone0062Example/src/testApp.mm
@@ -0,0 +1,116 @@
+#include "testApp.h"
+#include "ofxMaxim.h"
+
+testApp::~testApp() {
+
+ delete sample1.myData;
+
+}
+
+
+//--------------------------------------------------------------
+void testApp::setup(){
+ ofEnableAlphaBlending();
+ // register touch events
+ ofRegisterTouchEvents(this);
+
+ // initialize the accelerometer
+ ofxAccelerometer.setup();
+
+ //iPhoneAlerts will be sent to this.
+ ofxiPhoneAlerts.addListener(this);
+
+ sampleRate = 44100;
+ initialBufferSize = 512;
+
+ sample1.load(ofToDataPath("beat2.wav"));
+
+ ofSoundStreamSetup(2,0,this, sampleRate, initialBufferSize, 4);
+
+ //If you want a landscape oreintation
+ //iPhoneSetOrientation(OFXIPHONE_ORIENTATION_LANDSCAPE_RIGHT);
+
+ ofBackground(255,255,255);
+}
+
+//--------------------------------------------------------------
+void testApp::update(){
+
+}
+
+//--------------------------------------------------------------
+void testApp::draw(){
+
+}
+
+//--------------------------------------------------------------
+void testApp::exit(){
+
+}
+
+
+//--------------------------------------------------------------
+void testApp::audioRequested(float * output, int bufferSize, int nChannels){
+
+ if( initialBufferSize != bufferSize ){
+ ofLog(OF_LOG_ERROR, "your buffer size was set to %i - but the stream needs a buffer size of %i", initialBufferSize, bufferSize);
+ return;
+ }
+
+ for (int i = 0; i < bufferSize; i++){
+
+ sample=sample1.play(1.);
+ channel1.stereo(sample,outputs1,0.5);
+
+ output[i*nChannels ] = outputs1[0];
+ output[i*nChannels + 1] = outputs1[1];
+
+ }
+
+}
+
+//--------------------------------------------------------------
+void testApp::audioReceived(float * input, int bufferSize, int nChannels){
+
+}
+
+//--------------------------------------------------------------
+void testApp::touchDown(ofTouchEventArgs &touch){
+
+}
+
+//--------------------------------------------------------------
+void testApp::touchMoved(ofTouchEventArgs &touch){
+
+}
+
+//--------------------------------------------------------------
+void testApp::touchUp(ofTouchEventArgs &touch){
+
+}
+
+//--------------------------------------------------------------
+void testApp::touchDoubleTap(ofTouchEventArgs &touch){
+
+}
+
+//--------------------------------------------------------------
+void testApp::lostFocus(){
+
+}
+
+//--------------------------------------------------------------
+void testApp::gotFocus(){
+
+}
+
+//--------------------------------------------------------------
+void testApp::gotMemoryWarning(){
+
+}
+
+//--------------------------------------------------------------
+void testApp::deviceOrientationChanged(int newOrientation){
+
+}
+