diff --git a/Assets/StreamingAssets/VoiceAssistant/hey care bot.table b/Assets/StreamingAssets/VoiceAssistant/hey care bot.table
new file mode 100644
index 0000000..f313787
Binary files /dev/null and b/Assets/StreamingAssets/VoiceAssistant/hey care bot.table differ
diff --git a/Assets/StreamingAssets/VoiceAssistant/hey care bot.table.meta b/Assets/StreamingAssets/VoiceAssistant/hey care bot.table.meta
new file mode 100644
index 0000000..59985ed
--- /dev/null
+++ b/Assets/StreamingAssets/VoiceAssistant/hey care bot.table.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: f541e80887be9b841a5f1d73f29ec235
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/StreamingAssets/VoiceAssistant/715948c4-7d2a-423c-8f7f-7a82c44ee5de.table b/Assets/StreamingAssets/VoiceAssistant/hey mike.table
similarity index 100%
rename from Assets/StreamingAssets/VoiceAssistant/715948c4-7d2a-423c-8f7f-7a82c44ee5de.table
rename to Assets/StreamingAssets/VoiceAssistant/hey mike.table
diff --git a/Assets/StreamingAssets/VoiceAssistant/715948c4-7d2a-423c-8f7f-7a82c44ee5de.table.meta b/Assets/StreamingAssets/VoiceAssistant/hey mike.table.meta
similarity index 100%
rename from Assets/StreamingAssets/VoiceAssistant/715948c4-7d2a-423c-8f7f-7a82c44ee5de.table.meta
rename to Assets/StreamingAssets/VoiceAssistant/hey mike.table.meta
diff --git a/Assets/UVC4UnityAndroidPlugin/Scripts/UVCManager.cs b/Assets/UVC4UnityAndroidPlugin/Scripts/UVCManager.cs
index ec60401..48e1571 100644
--- a/Assets/UVC4UnityAndroidPlugin/Scripts/UVCManager.cs
+++ b/Assets/UVC4UnityAndroidPlugin/Scripts/UVCManager.cs
@@ -1,4 +1,4 @@
-#define ENABLE_LOG
+#define ENABLE_LOG
/*
* Copyright (c) 2014 - 2022 t_saki@serenegiant.com
*/
@@ -493,6 +493,7 @@ namespace Serenegiant.UVC
*/
private bool HandleOnAttachEvent(UVCDevice device/*NonNull*/)
{
+ return FilterDevice(device.name);
if ((UVCDrawers == null) || (UVCDrawers.Length == 0))
{ // IUVCDrawerが割り当てられていないときはtrue(接続されたUVC機器を使用する)を返す
return true;
@@ -517,6 +518,17 @@ namespace Serenegiant.UVC
}
}
+ ///
+ /// 由于USB相机有两个摄像头,暂时根据名称过滤设备
+ ///
+ ///
+ ///
+ bool FilterDevice(string deviceName)
+ {
+ Debug.Log(deviceName+" :"+ (deviceName == "/dev/bus/usb/002/008"));
+ return deviceName == "/dev/bus/usb/002/008";
+ }
+
/**
* UVC機器が取り外されたときの処理の実体
* @param info
diff --git a/Assets/_VoiceAssistant/Scenes/ChatScene.unity b/Assets/_VoiceAssistant/Scenes/ChatScene.unity
index 095d975..4553564 100644
--- a/Assets/_VoiceAssistant/Scenes/ChatScene.unity
+++ b/Assets/_VoiceAssistant/Scenes/ChatScene.unity
@@ -3338,8 +3338,8 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
maxRecordingLength: 20
- maxVolumn: 0.008
- minVolumn: 0.002
+ maxVolume: 0.008
+ minVolume: 0.002
invalidWaitTime: 1.5
startWaitingTime: 5
--- !u!4 &830768048
@@ -4826,7 +4826,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
key: 82cc4e6b21cc49358f93f7196effc0c1
ServiceRegion: eastasia
- kwsModelFile: 715948c4-7d2a-423c-8f7f-7a82c44ee5de.table
+ kwsModelFile: hey care bot.table
--- !u!4 &1674986170
Transform:
m_ObjectHideFlags: 0
@@ -5560,7 +5560,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
url: https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/eb-instant
- m_Prompt: "\u4F60\u626E\u6F14\u540D\u53EBmike\u7684\u5927\u4F17\u6C7D\u8F66\u673A\u5668\u4EBA\u52A9\u624B\u548C\u6211\u5BF9\u8BDD\uFF0C100\u5B57\u4EE5\u5185\uFF0C\u4E0D\u8981\u4F7F\u7528\u8868\u60C5"
+ m_Prompt: "\u4F60\u626E\u6F14\u540D\u53EBcare bot\u7684\u5927\u4F17\u6C7D\u8F66\u673A\u5668\u4EBA\u52A9\u624B\u548C\u6211\u5BF9\u8BDD\uFF0C100\u5B57\u4EE5\u5185\uFF0C\u4E0D\u8981\u4F7F\u7528\u8868\u60C5"
lan: english
m_HistoryKeepCount: 15
m_DataList: []
diff --git a/Assets/_VoiceAssistant/Scripts/Development.meta b/Assets/_VoiceAssistant/Scripts/Development.meta
new file mode 100644
index 0000000..3379d4b
--- /dev/null
+++ b/Assets/_VoiceAssistant/Scripts/Development.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 06b419732fd762b4cb4a9fdf1a236371
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/_VoiceAssistant/Scripts/Development/DevelopmentOptions.cs b/Assets/_VoiceAssistant/Scripts/Development/DevelopmentOptions.cs
new file mode 100644
index 0000000..b20e2c8
--- /dev/null
+++ b/Assets/_VoiceAssistant/Scripts/Development/DevelopmentOptions.cs
@@ -0,0 +1,60 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using SRDebugger;
+using System.ComponentModel;
+
+public partial class SROptions
+{
+ [Category("语音助手设置"), DisplayName("小于此音量一定时间后停止"), NumberRange(0, 0.008),Increment(0.001)]
+ public float MinVolume
+ {
+ get
+ {
+ return PlayerPrefs.GetFloat("minVolume", 0.002f);
+ }
+ set
+ {
+ PlayerPrefs.SetFloat("minVolume", value);
+ AudioRecorder recorder = GameObject.FindObjectOfType();
+ if (recorder)
+ {
+ recorder.minVolume = value;
+ }
+ }
+ }
+ [Category("语音助手设置"), DisplayName("大于此音量为有效"), NumberRange(0, 0.01), Increment(0.001)]
+ public float maxVolume
+ {
+ get
+ {
+ return PlayerPrefs.GetFloat("maxVolume", 0.008f);
+ }
+ set
+ {
+ PlayerPrefs.SetFloat("maxVolume", value);
+ AudioRecorder recorder = GameObject.FindObjectOfType();
+ if (recorder)
+ {
+ recorder.maxVolume = value;
+ }
+ }
+ }
+ [Category("语音助手设置"),DisplayName("最大语音录制时长"),NumberRange(5,20)]
+ public int maxRecordingLength
+ {
+ get
+ {
+ return PlayerPrefs.GetInt("maxRecordingLength", 20);
+ }
+ set
+ {
+ PlayerPrefs.SetInt("maxRecordingLength", value);
+ AudioRecorder recorder = GameObject.FindObjectOfType();
+ if(recorder)
+ {
+ recorder.maxRecordingLength = value;
+ }
+ }
+ }
+}
diff --git a/Assets/_VoiceAssistant/Scripts/Development/DevelopmentOptions.cs.meta b/Assets/_VoiceAssistant/Scripts/Development/DevelopmentOptions.cs.meta
new file mode 100644
index 0000000..497ed50
--- /dev/null
+++ b/Assets/_VoiceAssistant/Scripts/Development/DevelopmentOptions.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 951c88941f5b8404990d7a6c627bee41
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/_VoiceAssistant/Scripts/Voice/Utils/AudioRecorder.cs b/Assets/_VoiceAssistant/Scripts/Voice/Utils/AudioRecorder.cs
index 8dc6145..5ca9570 100644
--- a/Assets/_VoiceAssistant/Scripts/Voice/Utils/AudioRecorder.cs
+++ b/Assets/_VoiceAssistant/Scripts/Voice/Utils/AudioRecorder.cs
@@ -46,23 +46,23 @@ public class AudioRecorder : MonoBehaviour
///
/// 最大录制时长。
///
- public int maxRecordingLength = 10;
+ public int maxRecordingLength = 20;
///
/// 大于此音量开始正式录音
///
- public float maxVolumn = 0.75f;
+ public float maxVolume = 0.008f;
///
/// 小于此音量为无效状态
///
- public float minVolumn = 0.25f;
+ public float minVolume = 0.002f;
///
/// 无效时长大于这个值,停止录音
///
- public float invalidWaitTime = 0.5f;
+ public float invalidWaitTime = 1.5f;
///
/// 开始等待时长。
///
- public float startWaitingTime = 2;
+ public float startWaitingTime = 5;
public event Action onRecordOver;
AudioClip audioClip;
float[] samples = new float[0];
@@ -73,6 +73,13 @@ public class AudioRecorder : MonoBehaviour
{
Init();
}
+
+ void ReadConfig()
+ {
+ minVolume = PlayerPrefs.GetFloat("minVolume", 0.002f);
+ maxVolume = PlayerPrefs.GetFloat("maxVolume", 0.008f);
+ maxRecordingLength = PlayerPrefs.GetInt("maxRecordingLength", 20);
+ }
void Init()
{
@@ -90,6 +97,7 @@ public class AudioRecorder : MonoBehaviour
{
Debug.LogError("设备没有麦克风!");
}
+ ReadConfig();
}
public void StartRecordAudio()
@@ -137,7 +145,7 @@ public class AudioRecorder : MonoBehaviour
float volume = GetMaxVolume();
if (status == Status.Waiting)
{
- if (volume > maxVolumn)
+ if (volume > maxVolume)
{
status = Status.Recording;
invalidTimer = 0;
@@ -153,7 +161,7 @@ public class AudioRecorder : MonoBehaviour
}
else if (status == Status.Recording)
{
- if (volume < minVolumn)
+ if (volume < minVolume)
{
invalidTimer += Time.deltaTime;
}
diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset
index c795736..39632e9 100644
--- a/ProjectSettings/ProjectSettings.asset
+++ b/ProjectSettings/ProjectSettings.asset
@@ -48,7 +48,6 @@ PlayerSettings:
defaultScreenHeightWeb: 600
m_StereoRenderingPath: 0
m_ActiveColorSpace: 0
- unsupportedMSAAFallback: 0
m_SpriteBatchVertexThreshold: 300
m_MTRendering: 1
mipStripping: 0