parent
e52d0b8f55
commit
dfc4c12f8e
Binary file not shown.
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f541e80887be9b841a5f1d73f29ec235
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -1,4 +1,4 @@
|
||||||
#define ENABLE_LOG
|
#define ENABLE_LOG
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2014 - 2022 t_saki@serenegiant.com
|
* Copyright (c) 2014 - 2022 t_saki@serenegiant.com
|
||||||
*/
|
*/
|
||||||
|
@ -493,6 +493,7 @@ namespace Serenegiant.UVC
|
||||||
*/
|
*/
|
||||||
private bool HandleOnAttachEvent(UVCDevice device/*NonNull*/)
|
private bool HandleOnAttachEvent(UVCDevice device/*NonNull*/)
|
||||||
{
|
{
|
||||||
|
return FilterDevice(device.name);
|
||||||
if ((UVCDrawers == null) || (UVCDrawers.Length == 0))
|
if ((UVCDrawers == null) || (UVCDrawers.Length == 0))
|
||||||
{ // IUVCDrawerが割り当てられていないときはtrue(接続されたUVC機器を使用する)を返す
|
{ // IUVCDrawerが割り当てられていないときはtrue(接続されたUVC機器を使用する)を返す
|
||||||
return true;
|
return true;
|
||||||
|
@ -517,6 +518,17 @@ namespace Serenegiant.UVC
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 由于USB相机有两个摄像头,暂时根据名称过滤设备
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="deviceName"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
bool FilterDevice(string deviceName)
|
||||||
|
{
|
||||||
|
Debug.Log(deviceName+" :"+ (deviceName == "/dev/bus/usb/002/008"));
|
||||||
|
return deviceName == "/dev/bus/usb/002/008";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UVC機器が取り外されたときの処理の実体
|
* UVC機器が取り外されたときの処理の実体
|
||||||
* @param info
|
* @param info
|
||||||
|
|
|
@ -3338,8 +3338,8 @@ MonoBehaviour:
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
maxRecordingLength: 20
|
maxRecordingLength: 20
|
||||||
maxVolumn: 0.008
|
maxVolume: 0.008
|
||||||
minVolumn: 0.002
|
minVolume: 0.002
|
||||||
invalidWaitTime: 1.5
|
invalidWaitTime: 1.5
|
||||||
startWaitingTime: 5
|
startWaitingTime: 5
|
||||||
--- !u!4 &830768048
|
--- !u!4 &830768048
|
||||||
|
@ -4826,7 +4826,7 @@ MonoBehaviour:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
key: 82cc4e6b21cc49358f93f7196effc0c1
|
key: 82cc4e6b21cc49358f93f7196effc0c1
|
||||||
ServiceRegion: eastasia
|
ServiceRegion: eastasia
|
||||||
kwsModelFile: 715948c4-7d2a-423c-8f7f-7a82c44ee5de.table
|
kwsModelFile: hey care bot.table
|
||||||
--- !u!4 &1674986170
|
--- !u!4 &1674986170
|
||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -5560,7 +5560,7 @@ MonoBehaviour:
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
url: https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/eb-instant
|
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
|
lan: english
|
||||||
m_HistoryKeepCount: 15
|
m_HistoryKeepCount: 15
|
||||||
m_DataList: []
|
m_DataList: []
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 06b419732fd762b4cb4a9fdf1a236371
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -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<AudioRecorder>();
|
||||||
|
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<AudioRecorder>();
|
||||||
|
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<AudioRecorder>();
|
||||||
|
if(recorder)
|
||||||
|
{
|
||||||
|
recorder.maxRecordingLength = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 951c88941f5b8404990d7a6c627bee41
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -46,23 +46,23 @@ public class AudioRecorder : MonoBehaviour
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 最大录制时长。
|
/// 最大录制时长。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int maxRecordingLength = 10;
|
public int maxRecordingLength = 20;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 大于此音量开始正式录音
|
/// 大于此音量开始正式录音
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float maxVolumn = 0.75f;
|
public float maxVolume = 0.008f;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 小于此音量为无效状态
|
/// 小于此音量为无效状态
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float minVolumn = 0.25f;
|
public float minVolume = 0.002f;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 无效时长大于这个值,停止录音
|
/// 无效时长大于这个值,停止录音
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float invalidWaitTime = 0.5f;
|
public float invalidWaitTime = 1.5f;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 开始等待时长。
|
/// 开始等待时长。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float startWaitingTime = 2;
|
public float startWaitingTime = 5;
|
||||||
public event Action<AudioClip,StopReason> onRecordOver;
|
public event Action<AudioClip,StopReason> onRecordOver;
|
||||||
AudioClip audioClip;
|
AudioClip audioClip;
|
||||||
float[] samples = new float[0];
|
float[] samples = new float[0];
|
||||||
|
@ -73,6 +73,13 @@ public class AudioRecorder : MonoBehaviour
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ReadConfig()
|
||||||
|
{
|
||||||
|
minVolume = PlayerPrefs.GetFloat("minVolume", 0.002f);
|
||||||
|
maxVolume = PlayerPrefs.GetFloat("maxVolume", 0.008f);
|
||||||
|
maxRecordingLength = PlayerPrefs.GetInt("maxRecordingLength", 20);
|
||||||
|
}
|
||||||
void Init()
|
void Init()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -90,6 +97,7 @@ public class AudioRecorder : MonoBehaviour
|
||||||
{
|
{
|
||||||
Debug.LogError("设备没有麦克风!");
|
Debug.LogError("设备没有麦克风!");
|
||||||
}
|
}
|
||||||
|
ReadConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartRecordAudio()
|
public void StartRecordAudio()
|
||||||
|
@ -137,7 +145,7 @@ public class AudioRecorder : MonoBehaviour
|
||||||
float volume = GetMaxVolume();
|
float volume = GetMaxVolume();
|
||||||
if (status == Status.Waiting)
|
if (status == Status.Waiting)
|
||||||
{
|
{
|
||||||
if (volume > maxVolumn)
|
if (volume > maxVolume)
|
||||||
{
|
{
|
||||||
status = Status.Recording;
|
status = Status.Recording;
|
||||||
invalidTimer = 0;
|
invalidTimer = 0;
|
||||||
|
@ -153,7 +161,7 @@ public class AudioRecorder : MonoBehaviour
|
||||||
}
|
}
|
||||||
else if (status == Status.Recording)
|
else if (status == Status.Recording)
|
||||||
{
|
{
|
||||||
if (volume < minVolumn)
|
if (volume < minVolume)
|
||||||
{
|
{
|
||||||
invalidTimer += Time.deltaTime;
|
invalidTimer += Time.deltaTime;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,6 @@ PlayerSettings:
|
||||||
defaultScreenHeightWeb: 600
|
defaultScreenHeightWeb: 600
|
||||||
m_StereoRenderingPath: 0
|
m_StereoRenderingPath: 0
|
||||||
m_ActiveColorSpace: 0
|
m_ActiveColorSpace: 0
|
||||||
unsupportedMSAAFallback: 0
|
|
||||||
m_SpriteBatchVertexThreshold: 300
|
m_SpriteBatchVertexThreshold: 300
|
||||||
m_MTRendering: 1
|
m_MTRendering: 1
|
||||||
mipStripping: 0
|
mipStripping: 0
|
||||||
|
|
Loading…
Reference in New Issue