diff options
| author | Chris Kiefer <chrisk13fer@gmail.com> | 2011-08-25 15:53:46 +0100 |
|---|---|---|
| committer | Chris Kiefer <chrisk13fer@gmail.com> | 2011-08-25 15:53:46 +0100 |
| commit | f246be00cfd2ab25cb921552e9dd5a12c0605df7 (patch) | |
| tree | 1591103bb4e73328e5e80cea43dc1ec4bede4336 /ofxMaxim/ofxMaximiPhoneExample/src/testApp.mm | |
| parent | 955744bad39224a5c9d21d73790599b05a74b04b (diff) | |
| parent | ffcfdd709c296f7304869e6a046ee1496f732b5b (diff) | |
Merge branch 'master' of github.com:micknoise/Maximilian
Diffstat (limited to 'ofxMaxim/ofxMaximiPhoneExample/src/testApp.mm')
| -rwxr-xr-x | ofxMaxim/ofxMaximiPhoneExample/src/testApp.mm | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/ofxMaxim/ofxMaximiPhoneExample/src/testApp.mm b/ofxMaxim/ofxMaximiPhoneExample/src/testApp.mm new file mode 100755 index 0000000..8dc9e95 --- /dev/null +++ b/ofxMaxim/ofxMaximiPhoneExample/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){ + +} + |
