// 秒寻科技
// 文件读写
// 周涛
// 2023-03-15

#ifndef __UTILS_FILE_H
#define __UTILS_FILE_H

#include "../sysdefine/sysdef.h"

// #define UTIL_OUTPUT_DATA_TO_FILE

uint8 util_read_data_from_wav_file(char *file_name, int offset, int data_length, int16 *pwOutData);            // 从wav文件读取实数数据并放入指定内存地址
int util_read_real_number_from_audio_file(char *file_name, int offset, int data_length, float *data_real_ptr); // 从录音文件读取实数数据并放入指定内存地址

int util_read_int_number_from_txt_file(char *file_name, int offset, int data_length, int *data_int_ptr);
int util_read_real_number_from_txt_file(char *file_name, int offset, int data_length, float *data_real_ptr);                          // 从文件读取实数数据并放入指定内存地址
int util_read_complex_number_from_txt_file(char *file_name, int offset, int data_length, float *data_real_ptr, float *data_imag_ptr); // 从文件读取复数数据并放入指定内存地址
int util_write_real_number_to_txt_file(char *file_name, int data_length, uint32 *data_real_ptr);                                      // 将指定内存地址的实数数据写入文件
int util_write_complex_number_to_txt_file(char *file_name, int data_length, float *data_real_ptr, float *data_imag_ptr);              // 将指定内存地址的复数数据写入文件

int util_write_int16_to_bin_file(char *file_name, int data_length, int16 *data_ptr);
int util_write_double_to_txt_file(char *file_name, int data_length, double *data_double_ptr); // 将指定内存地址的double数据写入文件
int util_write_flt32_to_bin_file(char *file_name, int data_length, flt32 *data_ptr, uint8 byOpenFlag);
int util_write_coord_to_bin_file(char *file_name, int data_length, uint32 *data_ptr);
uint8 util_file_read_int16_from_bin_file(char *filePath, uint16 wReadTimes, int16 wReadDataLen, int16 *pwOutData);
#endif