Skip to content
Snippets Groups Projects
Commit 28d9cd34 authored by James Carty's avatar James Carty
Browse files

electro template

parents 3898cedc d724c8dc
Branches
No related merge requests found
......@@ -41,6 +41,7 @@ void ofApp::draw() {
//technoVisual.update(newBeat.returnBeat(),newBeat.returnHiHat()); //returned values from functions in beatDetection
<<<<<<< HEAD
//technoVisual.update(x, y); //DEBBUG MODE
......@@ -56,6 +57,10 @@ void ofApp::draw() {
//ledControl();
=======
technoVisual.update(x, y); //DEBBUG MODE
ledControl();
>>>>>>> d724c8dc7788e408ff479859f16b367d77b31742
}
......
......@@ -3,7 +3,10 @@
#include "ofxBeat.h"
#include "beatDetection.h"
#include "techno.h"
<<<<<<< HEAD
#include "electro.h"
=======
>>>>>>> d724c8dc7788e408ff479859f16b367d77b31742
class ofApp : public ofBaseApp {
......
#include "techno.h"
techno::techno() {
barWidth = ofGetScreenWidth();
barHeight = ofGetScreenHeight()/128;
}
//--------------------------------------------------------------
void techno::setup() {
}
//--------------------------------------------------------------
void techno::update(float value, float hihat_value) {
ofBackgroundGradient(0, 15, OF_GRADIENT_CIRCULAR);
float hiHatValue = hihat_value;
float beatValue = value;
if (beatValue > 16&&prevBeat<15.8) {
counter += g;
}
//following code creates loops with a counter and loop variable, adjust the value to increase time for each visual
if (counter > 32) {
counter = 32;
g = g*-1;
loops++;
}
if (counter < 0) { //sometimes goes beneath 0, not sure why
counter = 0;
g = g*-1;
loops++;
}
if (loops == 3) { //increase this to add new animation
loops = 0; //resets loop animation so it runs over everything again
}
//LINE VISUAL
if (loops == 0) { //decide the order of animations with this
for (int i = 0; i<counter&&i < 32; i++) {
ofSetColor(200);
ofDrawRectangle(barWidth / 5, 50 + (i * 32), barWidth / 1.6, barHeight);
}
}
else if (loops == 1) {
for (int i = 0; i < 32; i++) {
ofSetColor(200);
ofDrawRectangle(barWidth / 5, 50 + (i * 32), barWidth / 1.6, barHeight);
}
for (int i = 32; i > 0 && i > counter; i--) {
cam.begin();
glLineWidth(7.);
glRotatef(sin(ofGetElapsedTimeMillis() / 10) * 20, 1.0, 0, 0);
//glRotatef(sin(ofGetElapsedTimeMillis() / 4) * 20, 0, 1.0, 0);
//glRotatef(sin(ofGetElapsedTimeMillis() / 7) * 20, 0, 0, 1.0);
if (beatValue > 16) {
glScalef(1.2, 1.3, 1.4);
}
if (i == 31) {
glLineWidth(7.);
glScalef(0.74, 0.74, 0.74);
glBegin(GL_LINE_LOOP);
glColor3f(.8, .8, .8);
glVertex3f(-250.0f, 250.0f, -250.0f);
glVertex3f(-250.0f, -250.0f, -250.0f);
glVertex3f(-250.0f, -250.0f, 250.0f);
glVertex3f(-250.0f, 250.0f, 250.0f);
glEnd();
}
if (i == 30) {
glLineWidth(7.);
glScalef(0.74, 0.74, 0.74);
glBegin(GL_LINE_LOOP);
glColor3f(.8, .8, .8);
glVertex3f(250.0f, 250.0f, -250.0f);
glVertex3f(250.0f, -250.0f, -250.0f);
glVertex3f(250.0f, -250.0f, 250.0f);
glVertex3f(250.0f, 250.0f, 250.0f);
glEnd();
}
if (i == 29) {
glLineWidth(7.);
glScalef(0.74, 0.74, 0.74);
glBegin(GL_LINES);
glColor3f(.8, .8, .8);
glVertex3f(-250.0f, -250.0f, -250.0f);
glVertex3f(250.0f, -250.0f, -250.0f);
glVertex3f(-250.0f, 250.0f, -250.0f);
glVertex3f(250.0f, 250.0f, -250.0f);
glEnd();
}
if (i == 28) {
glLineWidth(7.);
glScalef(0.74, 0.74, 0.74);
glBegin(GL_LINES);
glVertex3f(-250.0f, 250.0f, 250.0f);
glVertex3f(250.0f, 250.0f, 250.0f);
glEnd();
}
if (i == 27) {
glLineWidth(7.);
glScalef(0.74, 0.74, 0.74);
glBegin(GL_LINES);
glVertex3f(-250.0f, -250.0f, 250.0f);
glVertex3f(250.0f, -250.0f, 250.0f);
glEnd();
}
cam.end();
}
}
//OFFSET TRIANGLE VISUAL
//uses simple opengl geometry to create two triangles, the smaller triangle reacts to hihats, the larger to low end frequencies
else if (loops == 2) {
glLineWidth(3.);
if (hiHatValue >4 ) { //when using beat.getBand(100);
//if (hiHatValue >= 1) { //when using beat.snare();
cam.begin();
glBegin(GL_LINE_LOOP);
glColor3f(0.8f, 0.8f, 0.8f);
glVertex3f(0, 150, 0);
glVertex3f(-100, -50, 0);
glVertex3f(100, -50, 0);
glEnd();
cam.end();
}
if (beatValue > 16) {
cam.begin();
glBegin(GL_LINE_LOOP);
glColor3f(0.8f, 0.8f, 0.8f);
glVertex3f(300, -100, 50);
glVertex3f(100, 300, 50);
glVertex3f(-100, -100, 50);
glEnd();
cam.end();
}
}
//DEFORMED PLANE VISUAL
//creates two square geometries, and moves them on a hihate
else if (loops == 3) {
glLineWidth(3.);
cam.begin();
if (hiHatValue > 4) { //when using beat.getBand(100);
//if (hiHatValue >= 1) { //when using beat.snare();
//if (beatValue > 2.5) { //on lows/kick instead of hihate
glBegin(GL_LINE_LOOP);
scale = 50;
}
else {
glBegin(GL_QUADS);
scale = 0;
}
glColor3f(0.6f, 0.6f, 0.6f);
glVertex3f(0 + scale, 0 + scale, 100 + scale);
glVertex3f(0 + scale, -150 + scale, 0 + scale);
glVertex3f(-150 + scale, -150 + scale, 0 + scale);
glVertex3f(-150 + scale, 0 + scale, 0 + scale);
glVertex3f(0 + scale, 0 + scale, 100 + scale);
glVertex3f(-150 + scale, 0 + scale, 0 + scale);
glVertex3f(-150 + scale, 150 + scale, 0 + scale);
glVertex3f(0 + scale, 150 + scale, 0 + scale);
glVertex3f(0 + scale, 0 + scale, 100 + scale);
glVertex3f(0 + scale, 150 + scale, 0 + scale);
glVertex3f(150 + scale, 150 + scale, 0 + scale);
glVertex3f(150 + scale, 0 + scale, 0 + scale);
glVertex3f(0 + scale, 0 + scale, 100 + scale);
glVertex3f(150 + scale, 0 + scale, 0 + scale);
glVertex3f(150 + scale, -150 + scale, 0 + scale);
glVertex3f(0 + scale, -150 + scale, 0 + scale);
glEnd();
cam.end();
}
prevBeat = value;
}
//--------------------------------------------------------------
void techno::draw() {
}
......@@ -32,7 +32,10 @@ private:
ofEasyCam cam;
int i =0;
int scale = 0;
<<<<<<< HEAD
int counter = 0;
=======
>>>>>>> d724c8dc7788e408ff479859f16b367d77b31742
int loops = 32;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment