3
3
4
4
#include <fftw3.h>
5
5
6
+ // cava_plan, parameters used internally by cavacore, do not modify these directly
7
+ // only the cut off frequencies is of any potential interest to read out,
8
+ // the rest should most likley be hidden somehow
6
9
struct cava_plan {
7
10
int FFTbassbufferSize ;
8
11
int FFTmidbufferSize ;
@@ -53,48 +56,52 @@ struct cava_plan {
53
56
int * cava_fall ;
54
57
};
55
58
56
- // cava_init initialize cava , takes the following parameters:
59
+ // cava_init, initialize visualization , takes the following parameters:
57
60
58
- // number_of_bars is number of wanted bars per channel
61
+ // number_of_bars, number of wanted bars per channel
59
62
60
- // rate is sample rate of input signal
63
+ // rate, sample rate of input signal
61
64
62
- // channels is number of interleaved channels in input
65
+ // channels, number of interleaved channels in input
63
66
64
- // autosens toggle automatic sensitivity adjustment 1 = on, 2 = off
65
- // on gives a dynamically adjusted output signal from 0 to 1
67
+ // autosens, toggle automatic sensitivity adjustment 1 = on, 0 = off
68
+ // on, gives a dynamically adjusted output signal from 0 to 1
66
69
// the output is continously adjusted to use the entire range
67
- // off will pass the raw values from cava directly to the output
68
- // the max values will depend on the input
70
+ // off, will pass the raw values from cava directly to the output
71
+ // the max values will then be dependent on the input
69
72
70
- // noise_reduction 0 - 1, recomended 0.77
73
+ // noise_reduction, adjust noise reduciton filters. 0 - 1, recomended 0.77
71
74
// the raw visualization is very noisy, this factor adjusts the integral
72
75
// and gravity filters inside cavacore to keep the signal smooth
73
76
// 1 will be very slow and smooth, 0 will be fast but noisy.
74
77
75
78
// low_cut_off, high_cut_off cut off frequencies for visualization in Hz
79
+ // recomended: 50, 10000
76
80
77
81
// returns a cava_plan to be used by cava_execute
78
82
extern struct cava_plan * cava_init (int number_of_bars , unsigned int rate , int channels ,
79
83
int autosens , double noise_reduction , int low_cut_off ,
80
84
int high_cut_off );
81
85
82
- // cava_execute executes cava
86
+ // cava_execute, executes visualization
83
87
84
- // cava_in size can be up to 4096 * number of channels, but it is recomended to only fill up some
88
+ // cava_in, input buffer can be any size. internal buffers in cavacore is
89
+ // 4096 * number of channels at 44100 samples rate, but it is recomended to use less
85
90
// new samples per execution as this determines your framerate.
86
91
// 512 samples at 44100 sample rate mono, gives about 86 frames per second.
87
92
88
- // new_samples is the number of samples in cava_in
93
+ // new_samples, the number of samples in cava_in to be processed
89
94
// if you have async reading of data this number can vary from execution to execution
90
95
91
- // cava_out size must be number of bars * number of channels, left + right
96
+ // cava_out, output buffer. Size must be number of bars * number of channels. Bars will
97
+ // be sorted from lowest to highest frequency. Feft channel first then right channel.
92
98
93
- // plan is the struct returned from cava_init
99
+ // plan, the cava_plan struct returned from cava_init
94
100
95
101
// cava_execute assumes cava_in samples to be interleaved if more than one channel
102
+ // only up to two channels are supported.
96
103
extern void cava_execute (double * cava_in , int new_samples , double * cava_out ,
97
104
struct cava_plan * plan );
98
105
99
- // destroys the plan, frees up memory
106
+ // cava_destroy, destroys the plan, frees up memory
100
107
extern void cava_destroy (struct cava_plan * plan );
0 commit comments