This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "LiveAudio.h" | |
| #include <math.h> | |
| #include <stdlib.h> | |
| class MyLiveAudio : public LiveAudio { | |
| public: | |
| float random() { | |
| return (rand() %10000) / 5000.f - 1.f; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| float midiNoteToSpeed(int midiNote, int originalNote) { | |
| return pow(2, (midiNote-originalNote)/12.f); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #define PENTATONIC 2 | |
| #define CHROMATIC 1 | |
| #define WHOLE 3 | |
| #define MAJOR 4 | |
| #define MINOR 0 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ofVec2f rowCols[5][5]; | |
| ofVec2f texz[5][5]; | |
| int i = 0; | |
| int j = 0; | |
| for(float xx = 0; xx <= 1; xx += 0.25) { | |
| // here's the meat | |
| ofVec2f p0_p1 = quad[0]*xx + quad[1]*(1.f-xx); | |
| ofVec2f p4_p3 = quad[2]*xx + quad[3]*(1.f-xx); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| float mtof(float f) | |
| { | |
| return (8.17579891564 * exp(.0577622650 * f)); | |
| } | |
| float ftom(float f) | |
| { | |
| return (17.3123405046 * log(.12231220585 * f)); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #ifndef PI | |
| # define PI 3.14159265358979 | |
| #endif | |
| inline float easeInBack(float t) { | |
| float s = 1.70158f; | |
| return t*t*((s+1)*t - s); | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Bloom.cpp | |
| * | |
| * Created by Marek Bereza on 05/10/2011. | |
| */ | |
| #include "Bloom.h" | |
| void tricks::gl::effects::Bloom::setup(bool drawToFbo) { | |
| this->drawToFbo = drawToFbo; | |
| blurX = ofVec2f( 0.001953125, 0.0 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void tricks::gl::effects::Bloom::end() { | |
| output.end(); | |
| out1.begin(); | |
| ofClear(0, 0, 0, 255); | |
| // convolution 1 | |
| shader.begin(); | |
| shader.setUniformTexture("tDiffuse", output.getTextureReference(0), 0); | |
| shader.setUniform2f("uImageIncrement", blurX.x*ofGetWidth(), blurX.y*ofGetHeight()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class LineEquation { | |
| public: | |
| float m; | |
| float c; | |
| void setFrom2Points(ofVec2f a, ofVec2f b) { | |
| ofVec2f g = b - a; | |
| float m = g.y / g.x; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ofVec3f utils::lineLineIntersection(ofVec3f p1, ofVec3f p2, ofVec3f p3, ofVec3f p4) { | |
| ofVec3f pa, pb; | |
| utils::lineLineIntersectSegment(p1,p2,p3,p4,pa,pb); | |
| return (pa+pb)/2.f; | |
| } | |
| // from the bourkster. | |
| bool utils::lineLineIntersectSegment(ofVec3f p1, ofVec3f p2, ofVec3f p3, ofVec3f p4, ofVec3f &pa, ofVec3f &pb) { |
NewerOlder