1 #ifndef CALF_MODULES_PITCH_H
2 #define CALF_MODULES_PITCH_H
16 #if ENABLE_EXPERIMENTAL
18 namespace calf_plugins
{
20 class pitch_audio_module
: public audio_module
<pitch_metadata
>, public line_graph_iface
23 typedef dsp::fft
<float, 12> pfft
;
24 enum { BufferSize
= 4096 };
27 float inputbuf
[BufferSize
];
28 pfft::complex waveform
[2 * BufferSize
], spectrum
[2 * BufferSize
], autocorr
[2 * BufferSize
];
29 float magarr
[BufferSize
/ 2];
30 float sumsquares
[BufferSize
+ 1], sumsquares_last
;
35 typedef pitch_audio_module AM
;
38 ~pitch_audio_module();
39 void params_changed();
41 void set_sample_rate(uint32_t sr
);
43 uint32_t process(uint32_t offset
, uint32_t numsamples
, uint32_t inputs_mask
, uint32_t outputs_mask
);
45 bool get_graph(int index
, int subindex
, int phase
, float *data
, int points
, cairo_iface
*context
, int *mode
) const;
46 bool get_layers(int index
, int generation
, unsigned int &layers
) const { layers
= LG_REALTIME_GRAPH
; return true; }