2021-07-19 11:58:48 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ofMain.h"
|
|
|
|
#include "ofxFft.h"
|
2021-07-23 12:31:58 +02:00
|
|
|
#include "mnglitches/glitch.h"
|
|
|
|
#include "mnglitches/line.h"
|
2021-07-19 11:58:48 +02:00
|
|
|
//#include "ofxVoronoi2D.h"
|
|
|
|
//#include "ofxAudioAnalyzer.h"
|
|
|
|
|
|
|
|
class ofApp : public ofBaseApp{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
void setup();
|
|
|
|
void update();
|
|
|
|
void draw();
|
|
|
|
|
|
|
|
void keyPressed(int key);
|
|
|
|
void keyReleased(int key);
|
|
|
|
void mouseMoved(int x, int y );
|
|
|
|
void mouseDragged(int x, int y, int button);
|
|
|
|
void mousePressed(int x, int y, int button);
|
|
|
|
void mouseReleased(int x, int y, int button);
|
|
|
|
void mouseEntered(int x, int y);
|
|
|
|
void mouseExited(int x, int y);
|
|
|
|
void windowResized(int w, int h);
|
|
|
|
void dragEvent(ofDragInfo dragInfo);
|
|
|
|
void gotMessage(ofMessage msg);
|
|
|
|
void plot(vector<float>& buffer, float scale, float offset);
|
|
|
|
void audioReceived(float* input, int bufferSize, int nChannels);
|
|
|
|
void audioIn(ofSoundBuffer & input);
|
|
|
|
protected:
|
|
|
|
float map(float value, float min1, float max1, float min2, float max2);
|
|
|
|
private:
|
|
|
|
vector <float> left;
|
|
|
|
vector <float> right;
|
|
|
|
vector <float> volHistory;
|
|
|
|
|
|
|
|
int bufferCounter;
|
|
|
|
int drawCounter;
|
|
|
|
|
|
|
|
float smoothedVol;
|
|
|
|
float scaledVol;
|
|
|
|
|
|
|
|
ofSoundStream soundStream;
|
|
|
|
|
|
|
|
//FFT
|
|
|
|
ofxFft* fft;
|
|
|
|
|
|
|
|
int plotHeight, bufferSize;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ofMutex soundMutex;
|
|
|
|
vector<float> drawBins, middleBins, audioBins;
|
|
|
|
// ofxAudioAnalyzer audioAnalyzer;
|
|
|
|
//glitch
|
|
|
|
float coinToss;
|
2021-07-23 12:31:58 +02:00
|
|
|
vector <Glitch*> glitches;
|
2021-07-19 11:58:48 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|