-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPATgui.h
93 lines (71 loc) · 2.54 KB
/
PATgui.h
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
//
// PATgui.h
// PowerAmplifierTuner
//
// Created by Patrick Dallat
// 17/08/2017
//-----------------------------------------------------------------------
#ifndef _PATgui_h_
#define _PATgui_h_
#include "ofMain.h"
#include "PATfft.h"
#include "PATfile.h"
#include "PATeq.h"
#include "ofxDatGui.h"
#include <vector>
#include <math.h>
#define NUMBER_OF_WINDOWS (80)
#define NUMBER_OF_OUTPUTS (2)
#define NUMBER_OF_INPUTS (2)
#define SAMPLE_RATE (44100)
#define FRAMES_PER_BUFFER (2048)
#define NUMBER_OF_BUFFERS (4)
//-----------------------------------------------------------------------
class PATgui : public ofSimpleApp{
string errorString;
public:
int inputDeviceIndex;
int outputDeviceIndex;
void setup();
void update();
void draw();
void audioIn( float* inputBuffer, int bufferSize, int nChannels);
void audioOut(float* outputBuffer, int bufferSize, int nChannels);
void onInputDeviceDropdownEvent( ofxDatGuiDropdownEvent e);
void onOutputDeviceDropdownEvent(ofxDatGuiDropdownEvent e);
void onAudioAnalyserToggleEvent( ofxDatGuiToggleEvent e);
void onPinkNoiseToggleEvent( ofxDatGuiToggleEvent e);
void onEQToggleEvent( ofxDatGuiToggleEvent e);
void onCreatePresetButtonEvent( ofxDatGuiButtonEvent e);
void onErrorButtonEvent( ofxDatGuiButtonEvent e);
void setErrorMessage(string error);
private:
float* leftInput;
float* rightInput;
float scaledX;
float scaledY;
float magnitude[FRAMES_PER_BUFFER];
float phase[FRAMES_PER_BUFFER];
float power[FRAMES_PER_BUFFER];
float frequency[NUMBER_OF_WINDOWS][FRAMES_PER_BUFFER/2];
float freq_phas[NUMBER_OF_WINDOWS][FRAMES_PER_BUFFER/2];
vector<int> audioInputDeviceIndex;
vector<int> audioOutputDeviceIndex;
vector<string> audioInputDeviceList;
vector<string> audioOutputDeviceList;
vector<ofSoundDevice> devicesList;
ofxDatGuiDropdown* imenu;
ofxDatGuiDropdown* omenu;
ofxDatGuiToggle* pinkToggle;
ofxDatGuiToggle* analyserToggle;
ofxDatGuiToggle* EQToggle;
ofxDatGuiButton* createPresetButton;
ofxDatGuiButton* errorButton;
ofxDatGuiTextInput* presetText;
ofSoundStream soundInputStream;
ofSoundStream soundOutputStream;
ofSoundDevice soundDevice;
ofColor colorTheme;
ofColor colorText;
};
#endif