Преглед изворни кода

添加腾讯SmartOral语音评测

hwh97 пре 6 година
родитељ
комит
7e4a619c8a

+ 16 - 45
.idea/workspace.xml

@@ -6,41 +6,12 @@
   </component>
   <component name="ChangeListManager">
     <list default="true" id="91fb8cbe-3946-4eca-a4cf-05dab52b73c6" name="Default Changelist" comment="">
-      <change afterPath="$PROJECT_DIR$/android/src/main/assets/aiengine.provision" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/android/src/main/jniLibs/arm64-v8a/libaiengine.so" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/android/src/main/jniLibs/armeabi-v5te/libaiengine.so" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/android/src/main/jniLibs/armeabi-v7a-neon/libaiengine.so" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/android/src/main/jniLibs/armeabi-v7a/libaiengine.so" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/android/src/main/jniLibs/armeabi/libaiengine.so" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/android/src/main/jniLibs/mips/libaiengine.so" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/android/src/main/jniLibs/mips64/libaiengine.so" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/android/src/main/jniLibs/x86/libaiengine.so" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/android/src/main/jniLibs/x86_64/libaiengine.so" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/android/src/main/kotlin/cn/i2edu/speech_plugin/model/chivox/App.kt" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/android/src/main/kotlin/cn/i2edu/speech_plugin/model/chivox/Audio.kt" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/android/src/main/kotlin/cn/i2edu/speech_plugin/model/chivox/ChivoxResult.kt" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/android/src/main/kotlin/cn/i2edu/speech_plugin/model/chivox/Detail.kt" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/android/src/main/kotlin/cn/i2edu/speech_plugin/model/chivox/Fluency.kt" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/android/src/main/kotlin/cn/i2edu/speech_plugin/model/chivox/Info.kt" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/android/src/main/kotlin/cn/i2edu/speech_plugin/model/chivox/Params.kt" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/android/src/main/kotlin/cn/i2edu/speech_plugin/model/chivox/Request.kt" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/android/src/main/kotlin/cn/i2edu/speech_plugin/model/chivox/Result.kt" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/android/src/main/kotlin/cn/i2edu/speech_plugin/model/chivox/Rhythm.kt" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/android/src/main/kotlin/cn/i2edu/speech_plugin/model/chivox/Sdk.kt" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/android/src/main/kotlin/cn/i2edu/speech_plugin/model/chivox/Time.kt" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/android/src/main/kotlin/cn/i2edu/speech_plugin/util/AIEngineHelper.java" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/android/src/main/kotlin/cn/i2edu/speech_plugin/util/IFlyAudioEvaluatorUtil.kt" afterDir="false" />
+      <change afterPath="$PROJECT_DIR$/android/src/main/kotlin/cn/i2edu/speech_plugin/util/SmartOralAudioEvaluatorUtil.kt" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/android/.idea/caches/build_file_checksums.ser" beforeDir="false" afterPath="$PROJECT_DIR$/android/.idea/caches/build_file_checksums.ser" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/android/build.gradle" beforeDir="false" afterPath="$PROJECT_DIR$/android/build.gradle" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/android/libs/Msc.jar" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/jniLibs/Msc.jar" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/android/libs/arm64-v8a/libmsc.so" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/jniLibs/arm64-v8a/libmsc.so" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/android/libs/armeabi-v7a/libmsc.so" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/jniLibs/armeabi-v7a/libmsc.so" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/android/libs/flutter.jar" beforeDir="false" />
       <change beforePath="$PROJECT_DIR$/android/src/main/kotlin/cn/i2edu/speech_plugin/SpeechPlugin.kt" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/kotlin/cn/i2edu/speech_plugin/SpeechPlugin.kt" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/android/src/main/kotlin/cn/i2edu/speech_plugin/util/AudioEvaluatorUtil.kt" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/kotlin/cn/i2edu/speech_plugin/util/ChivoxAudioEvaluatorUtil.kt" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/example/android/gradle.properties" beforeDir="false" afterPath="$PROJECT_DIR$/example/android/gradle.properties" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/example/pubspec.lock" beforeDir="false" afterPath="$PROJECT_DIR$/example/pubspec.lock" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/android/src/main/kotlin/cn/i2edu/speech_plugin/util/ChivoxAudioEvaluatorUtil.kt" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/kotlin/cn/i2edu/speech_plugin/util/ChivoxAudioEvaluatorUtil.kt" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/lib/speech_plugin.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/speech_plugin.dart" afterDir="false" />
     </list>
     <ignored path="$PROJECT_DIR$/.dart_tool/" />
@@ -62,16 +33,16 @@
   <component name="ExecutionTargetManager" SELECTED_TARGET="792QAESFTC6MD" />
   <component name="FileEditorManager">
     <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
-      <file pinned="false" current-in-tab="false">
+      <file pinned="false" current-in-tab="true">
         <entry file="file://$PROJECT_DIR$/lib/speech_plugin.dart">
           <provider selected="true" editor-type-id="text-editor">
-            <state relative-caret-position="302">
-              <caret line="20" column="3" lean-forward="true" selection-start-line="20" selection-start-column="3" selection-end-line="20" selection-end-column="3" />
+            <state relative-caret-position="308">
+              <caret line="16" lean-forward="true" selection-start-line="16" selection-end-line="16" />
             </state>
           </provider>
         </entry>
       </file>
-      <file pinned="false" current-in-tab="true">
+      <file pinned="false" current-in-tab="false">
         <entry file="file://$PROJECT_DIR$/.gitignore">
           <provider selected="true" editor-type-id="text-editor">
             <state relative-caret-position="154">
@@ -109,6 +80,9 @@
       <foldersAlwaysOnTop value="true" />
     </navigator>
     <panes>
+      <pane id="Scope" />
+      <pane id="PackagesPane" />
+      <pane id="AndroidView" />
       <pane id="ProjectPane">
         <subPane>
           <expand>
@@ -129,9 +103,6 @@
           <select />
         </subPane>
       </pane>
-      <pane id="Scope" />
-      <pane id="AndroidView" />
-      <pane id="PackagesPane" />
     </panes>
   </component>
   <component name="PropertiesComponent">
@@ -220,13 +191,6 @@
         </state>
       </provider>
     </entry>
-    <entry file="file://$PROJECT_DIR$/lib/speech_plugin.dart">
-      <provider selected="true" editor-type-id="text-editor">
-        <state relative-caret-position="302">
-          <caret line="20" column="3" lean-forward="true" selection-start-line="20" selection-start-column="3" selection-end-line="20" selection-end-column="3" />
-        </state>
-      </provider>
-    </entry>
     <entry file="file://$PROJECT_DIR$/android/src/main/kotlin/cn/i2edu/speech_plugin/SpeechPlugin.kt">
       <provider selected="true" editor-type-id="text-editor">
         <state relative-caret-position="154">
@@ -241,5 +205,12 @@
         </state>
       </provider>
     </entry>
+    <entry file="file://$PROJECT_DIR$/lib/speech_plugin.dart">
+      <provider selected="true" editor-type-id="text-editor">
+        <state relative-caret-position="308">
+          <caret line="16" lean-forward="true" selection-start-line="16" selection-end-line="16" />
+        </state>
+      </provider>
+    </entry>
   </component>
 </project>

BIN
android/.idea/caches/build_file_checksums.ser


+ 1 - 0
android/build.gradle

@@ -46,5 +46,6 @@ dependencies {
     implementation 'com.googlecode.mp4parser:isoparser:1.0-RC-37'
     api "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
     implementation 'com.alibaba:fastjson:1.1.71.android'
+    implementation 'com.tencent.taisdk:taisdk:1.2.0.61'
     implementation fileTree(dir: 'src\\main\\jniLibs', include: ['*.aar', '*.jar'], exclude: [])
 }

+ 73 - 51
android/src/main/kotlin/cn/i2edu/speech_plugin/SpeechPlugin.kt

@@ -4,13 +4,10 @@ import android.app.Activity
 import android.content.Context
 import android.text.TextUtils
 import cn.i2edu.dubbing_lib.bean.SimpleWord
-import cn.i2edu.dubbing_lib.util.ChivoxAudioEvaluatorUtil
-import cn.i2edu.dubbing_lib.util.ChivoxEvaluatorCallBack
 import cn.i2edu.speech_plugin.audioUtils.audioEvaluator.resultParse.ReadSentenceResult
 import cn.i2edu.speech_plugin.audioUtils.audioEvaluator.resultParse.XmlResultParser
 import cn.i2edu.speech_plugin.model.chivox.ChivoxResult
-import cn.i2edu.speech_plugin.util.IFlyAudioEvaluatorUtil
-import cn.i2edu.speech_plugin.util.IFlyEvaluatorCallBack
+import cn.i2edu.speech_plugin.util.*
 import com.alibaba.fastjson.JSON
 import com.googlecode.mp4parser.authoring.Movie
 import com.googlecode.mp4parser.authoring.Track
@@ -21,16 +18,15 @@ import com.iflytek.cloud.EvaluatorResult
 import com.iflytek.cloud.SpeechConstant
 import com.iflytek.cloud.SpeechError
 import com.iflytek.cloud.SpeechUtility
+import com.tencent.taisdk.TAIOralEvaluationRet
 import io.flutter.plugin.common.MethodCall
 import io.flutter.plugin.common.MethodChannel
 import io.flutter.plugin.common.MethodChannel.MethodCallHandler
 import io.flutter.plugin.common.MethodChannel.Result
 import io.flutter.plugin.common.PluginRegistry.Registrar
 import java.io.File
-import java.io.FileInputStream
 import java.io.RandomAccessFile
 import java.util.*
-import com.chivox.AIEngine.*
 
 class SpeechPlugin : MethodCallHandler {
 
@@ -115,28 +111,49 @@ class SpeechPlugin : MethodCallHandler {
     private fun evaluatorRecord(pathEvaluatorDecode: String, index: Int, recordPath: String, en: String, isVideo: Boolean, sdk: SpeechSdk) {
         val dir = File(pathEvaluatorDecode)
         if (!dir.exists()) dir.mkdirs()
-        val decodePath = pathEvaluatorDecode + UUID.randomUUID().toString() + ".pcm"
+        var decodePath = pathEvaluatorDecode + UUID.randomUUID().toString() + ".pcm"
 
         if (sdk == SpeechSdk.Chivox) {
+            // 驰声评测
             ChivoxAudioEvaluatorUtil.getInstance(context)
-                    .setEvaluatorCallBack(object: ChivoxEvaluatorCallBack {
+                    .setEvaluatorCallBack(object : ChivoxEvaluatorCallBack {
                         override fun onResult(result: ChivoxResult) {
-                            (context as Activity).runOnUiThread {
-                                val formatWords = arrayListOf<SimpleWord>()
-                                for (detail in result.result.details) {
-                                    formatWords.add(SimpleWord(detail.char, detail.score / 20.0f))
-                                }
-                                channel.invokeMethod("evaluatorResult",
-                                        mapOf("index" to index, "score" to result.result.overall / 20.0f, "integrity_score" to result.result.integrity / 20.0f,
-                                                "accuracy_score" to result.result.accuracy / 20.0f, "fluency_score" to result.result.fluency.overall / 20.0f,
-                                                "words" to JSON.toJSONString(formatWords)))
+                            val formatWords = arrayListOf<SimpleWord>()
+                            for (detail in result.result.details) {
+                                formatWords.add(SimpleWord(detail.char, detail.score / 20.0f))
                             }
+                            invokeEvaluatorResult(index, score = result.result.overall / 20.0f, integrityScore = result.result.integrity / 20.0f,
+                                    accuracyScore = result.result.accuracy / 20.0f, fluencyScore = result.result.fluency.overall / 20.0f,
+                                    words = JSON.toJSONString(formatWords))
                         }
 
                         override fun onError(message: String) {
-                            (context as Activity).runOnUiThread {
-                                channel.invokeMethod("evaluatorResult", mapOf("index" to index, "score" to null, "integrity_score" to null, "accuracy_score" to null, "fluency_score" to null))
+                            invokeEvaluatorResult(index)
+                        }
+                    })
+                    ?.startEvaluator(en, recordPath, decodePath)
+        } else if (sdk == SpeechSdk.SmartOral) {
+            // 腾讯智聆
+            decodePath = pathEvaluatorDecode + UUID.randomUUID().toString() + ".mp3"
+            SmartOralAudioEvaluatorUtil.getInstance(context)
+                    .setEvaluatorCallBack(object : SmartOralEvaluatorCallBack {
+                        override fun onResult(result: TAIOralEvaluationRet?) {
+                            val formatWords = arrayListOf<SimpleWord>()
+                            for (detail in result!!.words) {
+                                formatWords.add(SimpleWord(detail.word, if (detail.pronAccuracy == -1.0 ) 0f else (detail.pronAccuracy * 5).toFloat()))
                             }
+                            val pronAccuracy = if (result.pronAccuracy == -1.0 ) 0f else (result.pronAccuracy * 5).toFloat()
+                            val pronFluency = result.pronFluency
+                            val pronCompletion = result.pronCompletion
+
+                            val totalScore = (pronAccuracy + pronFluency + pronCompletion) / 3
+                            invokeEvaluatorResult(index, score = totalScore.toFloat(), integrityScore = pronCompletion.toFloat(),
+                                    accuracyScore = pronAccuracy.toFloat(), fluencyScore = pronFluency.toFloat(),
+                                    words = JSON.toJSONString(formatWords))
+                        }
+
+                        override fun onError(message: String) {
+                            invokeEvaluatorResult(index)
                         }
                     })
                     ?.startEvaluator(en, recordPath, decodePath)
@@ -144,51 +161,56 @@ class SpeechPlugin : MethodCallHandler {
             IFlyAudioEvaluatorUtil.getInstance(context = context)
                     .setEvaluatorCallBack(object : IFlyEvaluatorCallBack {
                         override fun onResult(result: EvaluatorResult) {
-                            (context as Activity).runOnUiThread {
-                                if (isVideo) {
-                                    try {
-                                        File(recordPath).delete()
-                                    } catch (e: java.lang.Exception) {
-                                        e.printStackTrace()
-                                    }
+                            if (isVideo) {
+                                try {
+                                    File(recordPath).delete()
+                                } catch (e: java.lang.Exception) {
+                                    e.printStackTrace()
                                 }
-                                val builder = StringBuilder()
-                                builder.append(result.resultString)
-                                if (!TextUtils.isEmpty(builder)) {
-                                    val resultParser = XmlResultParser()
-                                    val parseResult = resultParser.parse(builder.toString()) as ReadSentenceResult
-                                    val formatWords = arrayListOf<SimpleWord>()
-                                    for (sentence in parseResult.sentences) {
-                                        val words = sentence.words
-                                        for (word in words) {
-                                            // 过滤掉sil、 silv 表示静音, fil 表示噪音
-                                            if (word.content == "sil" || word.content == "silv" || word.content == "fil")
-                                                continue
-                                            formatWords.add(SimpleWord(word.content, word.total_score))
-                                        }
+                            }
+                            val builder = StringBuilder()
+                            builder.append(result.resultString)
+                            if (!TextUtils.isEmpty(builder)) {
+                                val resultParser = XmlResultParser()
+                                val parseResult = resultParser.parse(builder.toString()) as ReadSentenceResult
+                                val formatWords = arrayListOf<SimpleWord>()
+                                for (sentence in parseResult.sentences) {
+                                    val words = sentence.words
+                                    for (word in words) {
+                                        // 过滤掉sil、 silv 表示静音, fil 表示噪音
+                                        if (word.content == "sil" || word.content == "silv" || word.content == "fil")
+                                            continue
+                                        formatWords.add(SimpleWord(word.content, word.total_score))
                                     }
-
-                                    channel.invokeMethod("evaluatorResult",
-                                            mapOf("index" to index, "score" to (if (parseResult.is_rejected) null else parseResult.total_score), "integrity_score" to (if (parseResult.is_rejected) null else parseResult.integrity_score),
-                                                    "accuracy_score" to (if (parseResult.is_rejected) null else parseResult.accuracy_score), "fluency_score" to (if (parseResult.is_rejected) null else parseResult.fluency_score),
-                                                    "words" to JSON.toJSONString(formatWords)))
-                                } else {
-                                    channel.invokeMethod("evaluatorResult", mapOf("index" to index, "score" to null, "integrity_score" to null, "accuracy_score" to null, "fluency_score" to null))
                                 }
+
+                                invokeEvaluatorResult(index, score = (if (parseResult.is_rejected) null else parseResult.total_score), integrityScore = if (parseResult.is_rejected) null else parseResult.integrity_score,
+                                        accuracyScore = if (parseResult.is_rejected) null else parseResult.accuracy_score, fluencyScore = if (parseResult.is_rejected) null else parseResult.fluency_score,
+                                        words = JSON.toJSONString(formatWords))
+                            } else {
+                                invokeEvaluatorResult(index)
                             }
                         }
 
                         override fun onError(error: SpeechError) {
-                            (context as Activity).runOnUiThread {
-                                channel.invokeMethod("evaluatorResult", mapOf("index" to index, "score" to null))
-                            }
+                            invokeEvaluatorResult(index)
                         }
                     })
                     ?.startEvaluator(en, recordPath, decodePath, evaluatorType)
         }
     }
+
+    fun invokeEvaluatorResult(index: Int, score: Float? = null, integrityScore: Float? = null, accuracyScore: Float? = null, fluencyScore: Float? = null,
+                    words: String? = null) {
+        (context as Activity).runOnUiThread {
+            channel.invokeMethod("evaluatorResult",
+                    mapOf("index" to index, "score" to score, "integrity_score" to integrityScore,
+                            "accuracy_score" to accuracyScore, "fluency_score" to fluencyScore,
+                            "words" to words))
+        }
+    }
 }
 
 enum class SpeechSdk {
-    IFly, Chivox,
+    IFly, Chivox, SmartOral
 }

+ 1 - 3
android/src/main/kotlin/cn/i2edu/speech_plugin/util/ChivoxAudioEvaluatorUtil.kt

@@ -1,13 +1,11 @@
-package cn.i2edu.dubbing_lib.util
+package cn.i2edu.speech_plugin.util
 
 import android.content.Context
 import android.util.Log
 import cn.i2edu.speech_plugin.audioUtils.audiotransfer.DecodeEngine
 import cn.i2edu.speech_plugin.audioUtils.audiotransfer.DecodeOperateInterface
 import cn.i2edu.speech_plugin.model.chivox.ChivoxResult
-import cn.i2edu.speech_plugin.util.AIEngineHelper
 import com.alibaba.fastjson.JSON
-import com.chivox.AIEngine
 import com.chivox.AIEngine.*
 import java.io.File
 import java.io.FileInputStream

+ 107 - 0
android/src/main/kotlin/cn/i2edu/speech_plugin/util/SmartOralAudioEvaluatorUtil.kt

@@ -0,0 +1,107 @@
+package cn.i2edu.speech_plugin.util
+
+import android.content.Context
+import android.util.Log
+import cn.i2edu.speech_plugin.audioUtils.audiotransfer.DecodeEngine
+import cn.i2edu.speech_plugin.audioUtils.audiotransfer.DecodeOperateInterface
+import com.tencent.taisdk.*
+import java.io.File
+import java.io.FileInputStream
+import com.tencent.taisdk.TAIOralEvaluationFileType
+import com.tencent.taisdk.TAIOralEvaluationServerType
+import com.tencent.taisdk.TAIOralEvaluationStorageMode
+import com.tencent.taisdk.TAIOralEvaluationEvalMode
+import com.tencent.taisdk.TAIOralEvaluationWorkMode
+import java.util.UUID
+import com.tencent.taisdk.TAIOralEvaluationParam
+
+
+
+interface SmartOralEvaluatorCallBack {
+    fun onResult(result: TAIOralEvaluationRet?)
+    fun onError(message: String)
+}
+
+class SmartOralAudioEvaluatorUtil private constructor(val context: Context) {
+    private var smartOralEvaluatorCallBack: SmartOralEvaluatorCallBack? = null
+    private var oral: TAIOralEvaluation? = null
+    private val TAG: String = "SmartOralAudioEvaluator"
+
+    companion object {
+        @Volatile
+        private var instance: SmartOralAudioEvaluatorUtil? = null
+
+        fun getInstance(context: Context) = instance
+                ?: synchronized(this) {
+                    instance
+                            ?: SmartOralAudioEvaluatorUtil(context)
+                                    .also {
+                                    }
+                                    .also { instance = it }
+                }
+    }
+
+    fun startEvaluator(en: String, filePath: String, decodedFilePath: String) {
+        oral = TAIOralEvaluation()
+        oral?.setListener(object : TAIOralEvaluationListener {
+            override fun onEvaluationData(data: TAIOralEvaluationData?, result: TAIOralEvaluationRet?, error: TAIError?) {
+                if (data?.bEnd == true) {
+                    smartOralEvaluatorCallBack?.onResult(result)
+                } else {
+                    Log.e(TAG, "error code: ${error?.code} message: ${error?.desc}")
+                    smartOralEvaluatorCallBack?.onError(error?.desc ?: "")
+                }
+            }
+        })
+        val param = TAIOralEvaluationParam()
+        param.context = context
+        param.appId = ""
+        param.secretId = ""
+        param.secretKey = ""
+        param.sessionId = UUID.randomUUID().toString()
+        param.workMode = TAIOralEvaluationWorkMode.ONCE
+        param.evalMode = TAIOralEvaluationEvalMode.SENTENCE
+        param.storageMode = TAIOralEvaluationStorageMode.DISABLE
+        param.serverType = TAIOralEvaluationServerType.ENGLISH
+        param.fileType = TAIOralEvaluationFileType.MP3//只支持mp3
+        param.scoreCoeff = 1.0
+        param.refText = en
+        Thread {
+            DecodeEngine.getInstance(context).beginDecodeMusicFile(filePath, decodedFilePath, 0, 16000, 1, 2, object : DecodeOperateInterface {
+                override fun updateDecodeProgress(decodeProgress: Int) {
+                }
+
+                override fun decodeSuccess() {
+                    try {
+                        val file = File(decodedFilePath)
+                        val fileInputStream = FileInputStream(file)
+                        val buffer = ByteArray(fileInputStream.available())
+
+                        val data = TAIOralEvaluationData()
+                        data.seqId = 1
+                        data.bEnd = true
+                        data.audio = buffer
+                        oral?.oralEvaluation(param, data, TAIOralEvaluationCallback {
+                            //接口调用结果返回
+                            Log.d(TAG, "oralEvaluation call result: ${it?.code ?: "error null"}")
+                        })
+                        file.delete()
+                        fileInputStream.close()
+                    } catch (e: Exception) {
+                        e.printStackTrace()
+                        smartOralEvaluatorCallBack?.onError("failed ${e.message}")
+                    }
+                }
+
+                override fun decodeFail() {
+                    smartOralEvaluatorCallBack?.onError("decode fail")
+                }
+            })
+        }.start()
+    }
+
+    fun setEvaluatorCallBack(callback: SmartOralEvaluatorCallBack): SmartOralAudioEvaluatorUtil? {
+        this.smartOralEvaluatorCallBack = callback
+        return instance
+    }
+}

+ 1 - 1
lib/speech_plugin.dart

@@ -82,5 +82,5 @@ class SpeechPlugin {
 }
 
 enum SpeechSdk {
-  IFly, Chivox,
+  IFly, Chivox, SmartOral
 }