-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathaudioInformation.h
73 lines (57 loc) · 1.49 KB
/
audioInformation.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
#ifndef AUDIOINFORMATION_H
#define AUDIOINFORMATION_H
#include<SDL2/SDL.h>
#include <fftw3.h>
#include <stdlib.h>
struct AudioData;
struct Visualizer_Pkg;
struct FFTWop;
struct FFTW_Results;
typedef struct Visualizer_Pkg* Visualizer_Pkg_ptr;
void outputpowerspectrum(Visualizer_Pkg_ptr package);
void MyAudioCallback(void* userdata, Uint8* stream, int streamLength);
double Get8bitAudioSample(Uint8* bytebuffer, SDL_AudioFormat format);
double Get16bitAudioSample(Uint8* bytebuffer, SDL_AudioFormat format);
double Get32bitAudioSample(Uint8* bytebuffer, SDL_AudioFormat format);
struct AudioData* GetAudioData(Visualizer_Pkg_ptr);
SDL_AudioSpec* GetSDL_AudioSpec(Visualizer_Pkg_ptr);
struct FFTW_Results* GetFFTW_Results(Visualizer_Pkg_ptr);
struct FFTWop* GetFFTWop(Visualizer_Pkg_ptr);
struct AudioData
{
Uint8* currentPos;
Uint32 currentLength;
Uint8* wavStart;
Uint32 wavLength;
};
struct FFTWop
{
fftw_complex *in;
fftw_complex *out;
fftw_plan p;
int index;
};
struct FFTW_Results
{
double* peakfreq;
double* peakpower;
double** peakmagMatrix;
char*** outputMatrix;
double phase;
};
struct Visualizer_Pkg
{
char* filename;
int total_packets;
int total_frames;
int frame_size;
int bitsize;
SDL_AudioDeviceID device;
SDL_AudioSpec* wavSpec_ptr;
struct AudioData* AudioData_ptr;
struct FFTW_Results* FFTW_Results_ptr;
struct FFTWop* fftw_ptr;
double (*GetAudioSample)(Uint8*, SDL_AudioFormat);
void (*setupDFT)(Visualizer_Pkg_ptr, Uint8*, int );
};
#endif //AUDIOINFORMATION_H