diff options
| author | Chris Kiefer <chrisk13fer@gmail.com> | 2011-11-03 18:05:24 +0000 |
|---|---|---|
| committer | Chris Kiefer <chrisk13fer@gmail.com> | 2011-11-03 18:05:24 +0000 |
| commit | d09cc45d859aabbf76306fee49c1cec202c4f808 (patch) | |
| tree | 3ddbfeaae1eb3372cb4e9169e724a304cffdbe01 /ofxMaxim/ofxMaximExamples007OSX/maxiAtomSynthesis/src/mp.cpp | |
| parent | 1d99419e6b50b4cacb776fb711874de03dbadc2f (diff) | |
maxiAtoms
Diffstat (limited to 'ofxMaxim/ofxMaximExamples007OSX/maxiAtomSynthesis/src/mp.cpp')
| -rw-r--r-- | ofxMaxim/ofxMaximExamples007OSX/maxiAtomSynthesis/src/mp.cpp | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/ofxMaxim/ofxMaximExamples007OSX/maxiAtomSynthesis/src/mp.cpp b/ofxMaxim/ofxMaximExamples007OSX/maxiAtomSynthesis/src/mp.cpp new file mode 100644 index 0000000..b8e5ffd --- /dev/null +++ b/ofxMaxim/ofxMaximExamples007OSX/maxiAtomSynthesis/src/mp.cpp @@ -0,0 +1,90 @@ +#include "mp.h" + +//-------------------------------------------------------------- +void mp::setup(){ + ofEnableAlphaBlending(); + ofSetupScreen(); + ofBackground(0, 0, 0); + ofSetVerticalSync(true); +// pyd.setup("localhost", 23612); +// pyd.clear(); + + + atomBuffer.resize(512); + + + ofxMaxiSettings::setup(44100, 2, 512); + ofSoundStreamSetup(maxiSettings::channels,0,this, maxiSettings::sampleRate, maxiSettings::bufferSize, 4);/* Call this last ! */ + +} + +//-------------------------------------------------------------- +void mp::update(){ + flArr test; + maxiAtoms::createGabor(test, maxiMap::linexp((float)mouseX/ofGetWidth(), 0, 1, 100, 10000) * (1.0 + (ofRandomuf() * 0.2)), + maxiSettings::sampleRate, + maxiMap::linlin((float)mouseY / ofGetHeight(), 0, 1, 2000, 40000) * (1.0 + (ofRandomuf() * 0.3)), + ofRandomf() * PI, 0.3, 0.05); + atStream.addAtom(test); + +} + +//-------------------------------------------------------------- +void mp::draw(){ + +} + +void mp::audioRequested (float * output, int bufferSize, int nChannels){ + memset(&atomBuffer[0], 0, sizeof(float) * bufferSize); + atStream.fillNextBuffer(&(atomBuffer[0]), bufferSize); + for (int i = 0; i < bufferSize; i++){ + output[i*nChannels ] = output[i*nChannels + 1] = atomBuffer[i]; + } + +} + + +//-------------------------------------------------------------- +void mp::keyPressed(int key){ + +} + +//-------------------------------------------------------------- +void mp::keyReleased(int key){ + +} + +//-------------------------------------------------------------- +void mp::mouseMoved(int x, int y ){ + +} + +//-------------------------------------------------------------- +void mp::mouseDragged(int x, int y, int button){ + +} + +//-------------------------------------------------------------- +void mp::mousePressed(int x, int y, int button){ + +} + +//-------------------------------------------------------------- +void mp::mouseReleased(int x, int y, int button){ + +} + +//-------------------------------------------------------------- +void mp::windowResized(int w, int h){ + +} + +//-------------------------------------------------------------- +void mp::gotMessage(ofMessage msg){ + +} + +//-------------------------------------------------------------- +void mp::dragEvent(ofDragInfo dragInfo){ + +}
\ No newline at end of file |
