#include "ofApp.h" void ofApp::setup(){ int frameRate=60; ofSetFrameRate(frameRate); ofBackground(0); ofEnableSmoothing(); ofEnableAlphaBlending(); ofSetVerticalSync(true); blockSize = SAMPLERATE / (frameRate*10); //80 ofSoundStreamListDevices(); soundStream.setup(this,0, 1, SAMPLERATE, blockSize, 1); buffer=Buffer(SAMPLERATE); vScale=3.0f; hScale=8.0f; lineWidth=2.0f; laser.set_pts(45000); } void ofApp::update(){ } int sampleNum=0; int frameNum=0; void ofApp::draw(){ ofBackground(0); ofSetLineWidth(lineWidth); ofPushMatrix(); ofTranslate(0,ofGetHeight()/2); ofScale(1.0f,ofGetHeight()*vScale); colourPolyline line; line.addVertex(0,buffer[0]); float i=0.0f; while (i<(ofGetWidth()+hScale)){ i+=max(1.0f,hScale); line.curveTo(i,buffer[(int)i]); } line.draw(); int numpts=laser.draw(line); ofPopMatrix(); frameNum++; ofSetWindowTitle(ofToString(ofGetFrameRate())+" fps, pts:"+(numpts?ofToString(numpts):"ERR")); } void ofApp::audioIn(float * input, int blockSize, int nChannels){ //ofLog()<< "frame "<