blob: 02ab1ecb8816ea40c4bd77bd65835f65e7fdb788 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
#ifndef _TEST_APP
#define _TEST_APP
#include "ofMain.h"
#include "fft.h"
#include "FFTOctaveAnalyzer.h"
#include "ofxOsc.h"
#define OSCPORT 12345
#include "oni.h"
#define BUFFER_SIZE 1024
#define BUFFER_FRAMES 512
/*
ok seriously lets make this good
recording - storage for a bunch of fft
average them on the fly? seems likely
*/
#define OF_ADDON_USING_OFXMIDIIN
#include "ofxMidi.h"
#define FFT_AVG 1
#define FFT_RAW 2
#define WAVEFORM 3
#define PICTURE 1
#define GRABBER 2
class testApp : public ofBaseApp, public ofxMidiListener{
public:
void setup();
void update();
void draw();
void keyPressed (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();
void audioIn(float * input, int bufferSize, int nChannels);
FFTOctaveAnalyzer lFFTanalyzer;
FFTOctaveAnalyzer rFFTanalyzer;
ofxMidiIn midiIn;
ofxMidiOut midiOut;
void newMidiMessage(ofxMidiEventArgs& eventArgs);
void setMidiState();
private:
float * left;
float * right;
int bufferCounter;
fft myfft;
float FFTbuffer[2][BUFFER_SIZE][BUFFER_FRAMES];
int thisFFTbuffer;
float lmagnitude[BUFFER_SIZE];
float lphase[BUFFER_SIZE];
float lpower[BUFFER_SIZE];
float lfreq[BUFFER_SIZE/2];
float rmagnitude[BUFFER_SIZE];
float rphase[BUFFER_SIZE];
float rpower[BUFFER_SIZE];
float rfreq[BUFFER_SIZE/2];
ofSoundStream soundStream;
ofImage fbImage;
//ofImage blendImage;
ofVideoPlayer blendImage;
ofFbo renderImage;
ofShader maskShader;
bool showFPS;
bool fullScreen;
ofImage testImage;
//controllable variables
float F_scale;
float F_drawFrames;
float F_drawStep;
float F_drawDecay;
float F_lineWidth;
float F_drawAxis;
float F_xRotation;
float F_yRotation;
float F_zRotation;
float F_xRotate;
float F_yRotate;
float F_zRotate;
float lastFrameTime;
bool draworder;
bool B_vSync;
bool B_fill;
int visMode;
int inputMode;
int I_fade1;
int I_fade2;
int I_movieSource;
int I_moviePlaying;
bool B_glitch;
unsigned char *gammamap;
unsigned char *line1;
unsigned char *line2;
unsigned char *outBuffer;
float F_particleAmount;
float F_particleLife;
float F_particleX;
float F_particleY;
float F_particleZ;
float whitePt;
float blackPt;
float gamma;
bool field2; //flag that there is a 2nd field waiting to be processed
bool use2fields;
int frameTime,grabTime; //keep track of field timing
bool deInterlace;
ofTexture outTexture;
float F_movieSpeed;
ofImage blanker;
ofCamera camera;
ofNode target;
oniManager narrator;
ofxXmlSettings XML;
vector<ofVideoPlayer> videoclips;
ofxOscReceiver receiver;
};
#endif
|