Newer
Older
#include "ofApp.h"
//REQUIRES OFXBEATMASTER ADDON FOR OPENFRAMEWORKS
//Reacts to sound from either mic or line in, we use line in for demonstrating the program
//may have bad results on mic in
//--------------------------------------------------------------
void ofApp::setup() {
ofEnableDepthTest();
newBeat.setup(); //initialise FFT / Beat detection
technoVisual.setup();
ofEnableSmoothing();
ofSetFrameRate(60); //speed up frame rate
serial.setup("COM6", 57600);
}
//--------------------------------------------------------------
void ofApp::update() {
}
//--------------------------------------------------------------
void ofApp::draw() {
//technoVisual.update(newBeat.returnBeat(),newBeat.returnHiHat()); //returned values from functions in beatDetection
//electroVisual.update(newBeat.returnBeat(), newBeat.returnHiHat());
electroVisual.update(x, y);
//discoVisual.update(newBeat.returnBeat(), newBeat.returnHiHat());
//discoVisual.update(x,y);
//ledControl();
William Fish
committed
technoVisual.update(x, y); //DEBBUG MODE
void ofApp::ledControl() //pointless making another class as most of the calculation is in the
{
//send a byte over a volume threshold to create a 'pulse' in the LEDS, second byte turns them back off
if (newBeat.returnBeat()>16) {
serial.writeByte(1);
}
//if (newBeat.returnHiHat()>5) {
// serial.writeByte(1);
//}
}
//--------------------------------------------------------------
void ofApp::keyPressed(int key) {
if (key == 'a'){
x = 20;
}
else if (key == 's') {
x = 0;
}
else if (key == 'z') {
y = 20;
}
else if (key == 'x') {
y = 0;
}
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
}
//--------------------------------------------------------------
void ofApp::keyReleased(int key) {
}
//--------------------------------------------------------------
void ofApp::mouseMoved(int x, int y) {
}
//--------------------------------------------------------------
void ofApp::mouseDragged(int x, int y, int button) {
}
//--------------------------------------------------------------
void ofApp::mousePressed(int x, int y, int button) {
}
//--------------------------------------------------------------
void ofApp::mouseReleased(int x, int y, int button) {
}
//--------------------------------------------------------------
void ofApp::windowResized(int w, int h) {
}
//--------------------------------------------------------------
void ofApp::gotMessage(ofMessage msg) {
}
//--------------------------------------------------------------
void ofApp::dragEvent(ofDragInfo dragInfo) {
}