From 4f8bce944e273e317cb84c7046ea514b9d958b4b Mon Sep 17 00:00:00 2001
From: zhuzizyf <42790740+zhuzizyf@users.noreply.github.com>
Date: 星期六, 22 四月 2023 14:54:49 +0800
Subject: [PATCH] Update FsmnVad.cc

---
 funasr/runtime/onnxruntime/include/Audio.h |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/funasr/runtime/onnxruntime/include/Audio.h b/funasr/runtime/onnxruntime/include/Audio.h
index af8d2a9..2667c31 100644
--- a/funasr/runtime/onnxruntime/include/Audio.h
+++ b/funasr/runtime/onnxruntime/include/Audio.h
@@ -2,9 +2,13 @@
 #ifndef AUDIO_H
 #define AUDIO_H
 
-#include <ComDefine.h>
 #include <queue>
 #include <stdint.h>
+#include "Model.h"
+
+#ifndef WAV_HEADER_SIZE
+#define WAV_HEADER_SIZE 44
+#endif
 
 using namespace std;
 
@@ -20,7 +24,7 @@
 
     ~AudioFrame();
     int set_start(int val);
-    int set_end(int val, int max_len);
+    int set_end(int val);
     int get_start();
     int get_len();
     int disp();
@@ -32,7 +36,6 @@
     int16_t *speech_buff;
     int speech_len;
     int speech_align_len;
-    int16_t sample_rate;
     int offset;
     float align_size;
     int data_type;
@@ -43,11 +46,18 @@
     Audio(int data_type, int size);
     ~Audio();
     void disp();
-    bool loadwav(const char *filename);
+    bool loadwav(const char* filename, int32_t* sampling_rate);
+    void wavResample(int32_t sampling_rate, const float *waveform, int32_t n);
+    bool loadwav(const char* buf, int nLen, int32_t* sampling_rate);
+    bool loadpcmwav(const char* buf, int nFileLen, int32_t* sampling_rate);
+    bool loadpcmwav(const char* filename, int32_t* sampling_rate);
     int fetch_chunck(float *&dout, int len);
     int fetch(float *&dout, int &len, int &flag);
     void padding();
-    void split();
+    void split(Model* pRecogObj);
+    float get_time_len();
+
+    int get_queue_size() { return (int)frame_queue.size(); }
 };
 
 #endif

--
Gitblit v1.9.1