1 /*
2  * Copyright (C) 2015-2020 Alibaba Group Holding Limited
3  */
4 #ifndef SPECTRUM_FIX_H
5 #define SPECTRUM_FIX_H
6 
7 #include <stdint.h>
8 
9 #define MAX_FREQ_NUM (10)
10 
11 typedef struct
12 {
13     int freq_num;
14     int freq_list[MAX_FREQ_NUM];
15 } SpectrumFixConfig;
16 
17 struct SpectrumFixState_;
18 
19 typedef struct SpectrumFixState_ SpectrumFixState;
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 SpectrumFixState *spectrum_fix_init(int sample_rate, int frame_size, const SpectrumFixConfig *config);
26 
27 void spectrum_fix_destroy(SpectrumFixState *st);
28 
29 /* Update input buffer, must be called every block */
30 void spectrum_fix_analysis(SpectrumFixState *st, const int16_t *x);
31 
32 /* Calculate spectrum, should be called when needed */
33 void spectrum_fix_process(SpectrumFixState *st, int16_t *spectrum, int spectrum_num);
34 
35 #ifdef __cplusplus
36 }
37 #endif
38 
39 #endif