123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- #ifndef SIGNALSTATS_WRAPPER_H
- #define SIGNALSTATS_WRAPPER_H
- #include <vector>
- #include <string>
- #include <nlohmann/json.hpp>
- // 定义导出宏
- #ifdef _WIN32
- #ifdef BUILDING_DLL
- #define EXPORT_API __declspec(dllexport)
- #else
- #define EXPORT_API __declspec(dllimport)
- #endif
- #else
- #define EXPORT_API __attribute__((visibility("default")))
- #endif
- namespace signalstats_wrapper
- {
- /**
- * @brief 初始化Python解释器
- *
- * 初始化嵌入式Python解释器并设置必要的Python路径。
- * 必须在调用任何Python相关功能前调用此函数。
- */
- EXPORT_API void initialize();
- /**
- * @brief 释放Python解释器
- *
- * 释放嵌入式Python解释器资源。
- * 应在程序结束时调用此函数。
- */
- EXPORT_API void finalize();
- /**
- * @brief C++接口封装函数
- *
- * @param audio_signal 音频信号数据(vector)
- * @param audio_samplerate 采样率(Hz)
- * @param silence_threshold 静音检测阈值
- * @param db_threshold 分贝阈值
- * @param cv_threshold 变异系数阈值
- * @param window_params 窗函数参数
- * @param nperseg 每段样本数
- * @param noverlap 重叠样本数
- * @param nfft FFT点数
- * @param debug 是否输出调试信息
- * @param output 输出结果容器
- */
- EXPORT_API nlohmann::json& detect_signal_wrapper(
- const std::vector<double> &audio_signal,
- double audio_samplerate,
- double silence_threshold,
- double db_threshold,
- double cv_threshold,
- const std::vector<std::string> &window_params,
- int nperseg,
- int noverlap,
- int nfft,
- bool debug,
- nlohmann::json &output);
- }
- #endif // SIGNALSTATS_WRAPPER_H
|