Initialer Upload neues Unity-Projekt
This commit is contained in:
8
Assets/Oculus/Voice/Lib/PlatformCompatibility.meta
Normal file
8
Assets/Oculus/Voice/Lib/PlatformCompatibility.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e6b205bdeb6af41b78c76b629f0634a6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d59650563232a0b4d842f7e0557cf0a2
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@ -0,0 +1,32 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6ed8e0fc79c6b704499850c068ba0ac1
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@ -0,0 +1,32 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 86e073f28b6dd8c4d9b6b3b6fe638b31
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 89232d6dd6475634a989a733ca609d72
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8af63f3a49855bc49ab30a54897228fc
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "AssistantCoreSDKEditor",
|
||||
"references": [
|
||||
"GUID:a7c32ded21d3b9b42a71cdf39f2ed8da"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a32f21e557428c84e845c18e46d9284f
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 13ae9debef50c7e46a015123dfc48813
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,126 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Oculus SDK License Agreement (the "License");
|
||||
* you may not use the Oculus SDK except in compliance with the License,
|
||||
* which is provided at the time of installation or download, or which
|
||||
* otherwise accompanies this software in either electronic or hard copy form.
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Oculus SDK
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Based off Unity forum post https://forum.unity.com/threads/how-to-change-the-name-of-list-elements-in-the-inspector.448910/
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Oculus.Voice.Core.Utilities
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(ArrayElementTitleAttribute))]
|
||||
public class ArrayElementTitleDrawer : PropertyDrawer
|
||||
{
|
||||
public override float GetPropertyHeight(SerializedProperty property,
|
||||
GUIContent label)
|
||||
{
|
||||
return EditorGUI.GetPropertyHeight(property, label, true);
|
||||
}
|
||||
|
||||
protected virtual ArrayElementTitleAttribute Attribute
|
||||
{
|
||||
get { return (ArrayElementTitleAttribute) attribute; }
|
||||
}
|
||||
|
||||
SerializedProperty titleNameProp;
|
||||
|
||||
public override void OnGUI(Rect position,
|
||||
SerializedProperty property,
|
||||
GUIContent label)
|
||||
{
|
||||
string name = null;
|
||||
if (string.IsNullOrEmpty(Attribute.varname))
|
||||
{
|
||||
titleNameProp = property.serializedObject.FindProperty(property.propertyPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
string fullPathName = property.propertyPath + "." + Attribute.varname;
|
||||
titleNameProp = property.serializedObject.FindProperty(fullPathName);
|
||||
}
|
||||
|
||||
if (null != titleNameProp)
|
||||
{
|
||||
name = GetTitle();
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(Attribute.fallbackName))
|
||||
{
|
||||
name = Attribute.fallbackName;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
name = label.text;
|
||||
}
|
||||
|
||||
EditorGUI.PropertyField(position, property, new GUIContent(name, label.tooltip), true);
|
||||
}
|
||||
|
||||
private string GetTitle()
|
||||
{
|
||||
switch (titleNameProp.propertyType)
|
||||
{
|
||||
case SerializedPropertyType.Generic:
|
||||
break;
|
||||
case SerializedPropertyType.Integer:
|
||||
return titleNameProp.intValue.ToString();
|
||||
case SerializedPropertyType.Boolean:
|
||||
return titleNameProp.boolValue.ToString();
|
||||
case SerializedPropertyType.Float:
|
||||
return titleNameProp.floatValue.ToString();
|
||||
case SerializedPropertyType.String:
|
||||
return titleNameProp.stringValue;
|
||||
case SerializedPropertyType.Color:
|
||||
return titleNameProp.colorValue.ToString();
|
||||
case SerializedPropertyType.ObjectReference:
|
||||
return titleNameProp.objectReferenceValue?.ToString();
|
||||
case SerializedPropertyType.LayerMask:
|
||||
break;
|
||||
case SerializedPropertyType.Enum:
|
||||
return titleNameProp.enumNames[titleNameProp.enumValueIndex];
|
||||
case SerializedPropertyType.Vector2:
|
||||
return titleNameProp.vector2Value.ToString();
|
||||
case SerializedPropertyType.Vector3:
|
||||
return titleNameProp.vector3Value.ToString();
|
||||
case SerializedPropertyType.Vector4:
|
||||
return titleNameProp.vector4Value.ToString();
|
||||
case SerializedPropertyType.Rect:
|
||||
break;
|
||||
case SerializedPropertyType.ArraySize:
|
||||
break;
|
||||
case SerializedPropertyType.Character:
|
||||
break;
|
||||
case SerializedPropertyType.AnimationCurve:
|
||||
break;
|
||||
case SerializedPropertyType.Bounds:
|
||||
break;
|
||||
case SerializedPropertyType.Gradient:
|
||||
break;
|
||||
case SerializedPropertyType.Quaternion:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 99800bf0e26831a41983faa658759631
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fa3bcde078d02604fb774938a2a9ea66
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Oculus SDK License Agreement (the "License");
|
||||
* you may not use the Oculus SDK except in compliance with the License,
|
||||
* which is provided at the time of installation or download, or which
|
||||
* otherwise accompanies this software in either electronic or hard copy form.
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Oculus SDK
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
using System.Reflection;
|
||||
|
||||
namespace Oculus.Voice.Core.Utilities
|
||||
{
|
||||
public class AssistantEditorUtils
|
||||
{
|
||||
public static T GetFieldValue<T>(object obj, string name)
|
||||
{
|
||||
// Set the flags so that private and public fields from instances will be found
|
||||
var bindingFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;
|
||||
var field = obj.GetType().GetField(name, bindingFlags);
|
||||
return (T) field?.GetValue(obj);
|
||||
}
|
||||
|
||||
public static void SetFieldValue<T>(object obj, string name, T value)
|
||||
{
|
||||
// Set the flags so that private and public fields from instances will be found
|
||||
var bindingFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;
|
||||
var field = obj.GetType().GetField(name, bindingFlags);
|
||||
field?.SetValue(obj, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 91dbfa5ea168d9444aeca84e19716861
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 08b982f4564aa084e9f123b2855d6881
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 719ae09d6be753e46845c9b349912e3e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Oculus SDK License Agreement (the "License");
|
||||
* you may not use the Oculus SDK except in compliance with the License,
|
||||
* which is provided at the time of installation or download, or which
|
||||
* otherwise accompanies this software in either electronic or hard copy form.
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Oculus SDK
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
using Oculus.Voice.Core.Bindings.Interfaces;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Oculus.Voice.Core.Bindings.Android
|
||||
{
|
||||
public class AndroidServiceConnection : IConnection
|
||||
{
|
||||
private AndroidJavaObject mAssistantServiceConnection;
|
||||
|
||||
private string serviceFragmentClass;
|
||||
private string serviceGetter;
|
||||
|
||||
public bool IsConnected => null != mAssistantServiceConnection;
|
||||
|
||||
public AndroidJavaObject AssistantServiceConnection => mAssistantServiceConnection;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a connection manager of the given type
|
||||
/// </summary>
|
||||
/// <param name="serviceFragmentClassName">The fully qualified class name of the service fragment that will manage this connection</param>
|
||||
/// <param name="serviceGetterMethodName">The name of the method that will return an instance of the service</param>
|
||||
/// TODO: We should make the getBlahService simply getService() within each fragment implementation.
|
||||
public AndroidServiceConnection(string serviceFragmentClassName, string serviceGetterMethodName)
|
||||
{
|
||||
serviceFragmentClass = serviceFragmentClassName;
|
||||
serviceGetter = serviceGetterMethodName;
|
||||
}
|
||||
|
||||
public void Connect(string version)
|
||||
{
|
||||
if (null == mAssistantServiceConnection)
|
||||
{
|
||||
AndroidJNIHelper.debug = true;
|
||||
|
||||
AndroidJavaClass unityPlayerClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
|
||||
AndroidJavaObject activity = unityPlayerClass.GetStatic<AndroidJavaObject>("currentActivity");
|
||||
|
||||
using (AndroidJavaClass assistantBackgroundFragment = new AndroidJavaClass(serviceFragmentClass))
|
||||
{
|
||||
mAssistantServiceConnection =
|
||||
assistantBackgroundFragment.CallStatic<AndroidJavaObject>("createAndAttach", activity, version);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Disconnect()
|
||||
{
|
||||
mAssistantServiceConnection.Call("detach");
|
||||
}
|
||||
|
||||
public AndroidJavaObject GetService()
|
||||
{
|
||||
return mAssistantServiceConnection.Call<AndroidJavaObject>(serviceGetter);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 85f4ff04745e1ab459e49eb38bc288b9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Oculus SDK License Agreement (the "License");
|
||||
* you may not use the Oculus SDK except in compliance with the License,
|
||||
* which is provided at the time of installation or download, or which
|
||||
* otherwise accompanies this software in either electronic or hard copy form.
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Oculus SDK
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Oculus.Voice.Core.Bindings.Android
|
||||
{
|
||||
public class BaseAndroidConnectionImpl<T> where T : BaseServiceBinding
|
||||
{
|
||||
private string fragmentClassName;
|
||||
protected T service;
|
||||
protected readonly AndroidServiceConnection serviceConnection;
|
||||
|
||||
public bool IsConnected => serviceConnection.IsConnected;
|
||||
|
||||
public BaseAndroidConnectionImpl(string className)
|
||||
{
|
||||
fragmentClassName = className;
|
||||
serviceConnection = new AndroidServiceConnection(className, "getService");
|
||||
}
|
||||
|
||||
#region Service Connection
|
||||
|
||||
public virtual void Connect(string version)
|
||||
{
|
||||
serviceConnection.Connect(version);
|
||||
var serviceInstance = serviceConnection.GetService();
|
||||
if (null == serviceInstance)
|
||||
{
|
||||
throw new Exception("Unable to get service connection from " + fragmentClassName);
|
||||
}
|
||||
|
||||
service = (T) Activator.CreateInstance(typeof(T), serviceInstance);
|
||||
}
|
||||
|
||||
public virtual void Disconnect()
|
||||
{
|
||||
service.Shutdown();
|
||||
serviceConnection.Disconnect();
|
||||
service = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class BaseServiceBinding
|
||||
{
|
||||
protected AndroidJavaObject binding;
|
||||
|
||||
protected BaseServiceBinding(AndroidJavaObject sdkInstance)
|
||||
{
|
||||
binding = sdkInstance;
|
||||
}
|
||||
|
||||
public void Shutdown()
|
||||
{
|
||||
binding.Call("shutdown");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aa5e9cb2d6b763f4c983b82092bb192d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9e17b7500d9de2e4fbb25afa6264094e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Oculus SDK License Agreement (the "License");
|
||||
* you may not use the Oculus SDK except in compliance with the License,
|
||||
* which is provided at the time of installation or download, or which
|
||||
* otherwise accompanies this software in either electronic or hard copy form.
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Oculus SDK
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
using Oculus.Voice.Core.Bindings.Interfaces;
|
||||
using Oculus.Voice.Core.Utilities;
|
||||
using UnityEngine;
|
||||
using Debug = UnityEngine.Debug;
|
||||
|
||||
namespace Oculus.Voice.Core.Bindings.Android.PlatformLogger
|
||||
{
|
||||
public class VoiceSDKConsoleLoggerImpl : IVoiceSDKLogger
|
||||
{
|
||||
public bool IsUsingPlatformIntegration { get; set; }
|
||||
public string WitApplication { get; set; }
|
||||
public bool ShouldLogToConsole { get; set; }
|
||||
private static readonly string TAG = "VoiceSDKConsoleLogger";
|
||||
|
||||
private bool loggedFirstTranscriptionTime = false;
|
||||
public void LogInteractionStart(string requestId, string witApi)
|
||||
{
|
||||
if (!ShouldLogToConsole) return;
|
||||
loggedFirstTranscriptionTime = false;
|
||||
Debug.Log($"{TAG}: Interaction started with request ID: " + requestId);
|
||||
Debug.Log($"{TAG}: WitApi: " + witApi);
|
||||
Debug.Log($"{TAG}: request_start_time: " + DateTimeUtility.ElapsedMilliseconds.ToString());
|
||||
Debug.Log($"{TAG}: WitAppID: " + WitApplication);
|
||||
Debug.Log($"{TAG}: PackageName: " + Application.identifier);
|
||||
}
|
||||
|
||||
public void LogInteractionEndSuccess()
|
||||
{
|
||||
if (!ShouldLogToConsole) return;
|
||||
Debug.Log($"{TAG}: Interaction finished successfully");
|
||||
Debug.Log($"{TAG}: request_end_time: " + DateTimeUtility.ElapsedMilliseconds.ToString());
|
||||
}
|
||||
|
||||
public void LogInteractionEndFailure(string errorMessage)
|
||||
{
|
||||
if (!ShouldLogToConsole) return;
|
||||
Debug.Log($"{TAG}: Interaction finished with error: " + errorMessage);
|
||||
Debug.Log($"{TAG}: request_end_time: " + DateTimeUtility.ElapsedMilliseconds.ToString());
|
||||
}
|
||||
|
||||
public void LogInteractionPoint(string interactionPoint)
|
||||
{
|
||||
if (!ShouldLogToConsole) return;
|
||||
Debug.Log($"{TAG}: Interaction point: " + interactionPoint);
|
||||
Debug.Log($"{TAG}: {interactionPoint}_start_time: " + DateTimeUtility.ElapsedMilliseconds.ToString());
|
||||
}
|
||||
|
||||
public void LogAnnotation(string annotationKey, string annotationValue)
|
||||
{
|
||||
if (!ShouldLogToConsole) return;
|
||||
Debug.Log($"{TAG}: Logging key-value pair: {annotationKey}::{annotationValue}");
|
||||
}
|
||||
|
||||
public void LogFirstTranscriptionTime()
|
||||
{
|
||||
if (!loggedFirstTranscriptionTime)
|
||||
{
|
||||
loggedFirstTranscriptionTime = true;
|
||||
LogInteractionPoint("firstPartialTranscriptionTime");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cbb89bbe77dad204f9e4a1322943320d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Oculus SDK License Agreement (the "License");
|
||||
* you may not use the Oculus SDK except in compliance with the License,
|
||||
* which is provided at the time of installation or download, or which
|
||||
* otherwise accompanies this software in either electronic or hard copy form.
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Oculus SDK
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace Oculus.Voice.Core.Bindings.Android.PlatformLogger
|
||||
{
|
||||
public class VoiceSDKLoggerBinding : BaseServiceBinding
|
||||
{
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
public VoiceSDKLoggerBinding(AndroidJavaObject loggerInstance) : base(loggerInstance) {}
|
||||
|
||||
public void Connect()
|
||||
{
|
||||
binding.Call<bool>("connect");
|
||||
}
|
||||
|
||||
public void LogInteractionStart(string requestId, string startTime)
|
||||
{
|
||||
binding.Call("logInteractionStart", requestId, startTime);
|
||||
}
|
||||
|
||||
public void LogInteractionEndSuccess(string endTime)
|
||||
{
|
||||
binding.Call("logInteractionEndSuccess", endTime);
|
||||
}
|
||||
|
||||
public void LogInteractionEndFailure(string endTime, string errorMessage)
|
||||
{
|
||||
binding.Call("logInteractionEndFailure", endTime, errorMessage);
|
||||
}
|
||||
|
||||
public void LogInteractionPoint(string interactionPoint, string time)
|
||||
{
|
||||
binding.Call("logInteractionPoint", interactionPoint, time);
|
||||
}
|
||||
|
||||
public void LogAnnotation(string annotationKey, string annotationValue)
|
||||
{
|
||||
binding.Call("logAnnotation", annotationKey, annotationValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 02f219e3a02e4055b3df9be4f5786e5a
|
||||
timeCreated: 1652919643
|
||||
@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Oculus SDK License Agreement (the "License");
|
||||
* you may not use the Oculus SDK except in compliance with the License,
|
||||
* which is provided at the time of installation or download, or which
|
||||
* otherwise accompanies this software in either electronic or hard copy form.
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Oculus SDK
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
using Oculus.Voice.Core.Bindings.Interfaces;
|
||||
using Oculus.Voice.Core.Utilities;
|
||||
using UnityEngine;
|
||||
using Debug = UnityEngine.Debug;
|
||||
|
||||
namespace Oculus.Voice.Core.Bindings.Android.PlatformLogger
|
||||
{
|
||||
public class VoiceSDKPlatformLoggerImpl : BaseAndroidConnectionImpl<VoiceSDKLoggerBinding>, IVoiceSDKLogger
|
||||
{
|
||||
public bool IsUsingPlatformIntegration { get; set; }
|
||||
public string WitApplication { get; set; }
|
||||
public bool ShouldLogToConsole
|
||||
{
|
||||
get => consoleLoggerImpl.ShouldLogToConsole;
|
||||
set => consoleLoggerImpl.ShouldLogToConsole = value;
|
||||
}
|
||||
private VoiceSDKConsoleLoggerImpl consoleLoggerImpl = new VoiceSDKConsoleLoggerImpl();
|
||||
public VoiceSDKPlatformLoggerImpl() : base(
|
||||
"com.oculus.assistant.api.unity.logging.UnityPlatformLoggerServiceFragment")
|
||||
{
|
||||
}
|
||||
|
||||
private bool loggedFirstTranscriptionTime = false;
|
||||
|
||||
public override void Connect(string version)
|
||||
{
|
||||
base.Connect(version);
|
||||
service.Connect();
|
||||
Debug.Log(
|
||||
$"Logging Platform integration initialization complete.");
|
||||
}
|
||||
|
||||
public override void Disconnect()
|
||||
{
|
||||
Debug.Log("Logging Platform integration shutdown");
|
||||
base.Disconnect();
|
||||
}
|
||||
|
||||
public void LogInteractionStart(string requestId, string witApi)
|
||||
{
|
||||
loggedFirstTranscriptionTime = false;
|
||||
consoleLoggerImpl.LogInteractionStart(requestId, witApi);
|
||||
service.LogInteractionStart(requestId, DateTimeUtility.ElapsedMilliseconds.ToString());
|
||||
LogAnnotation("isUsingPlatform", IsUsingPlatformIntegration.ToString());
|
||||
LogAnnotation("witApi", witApi);
|
||||
LogAnnotation("witAppId", WitApplication);
|
||||
LogAnnotation("package", Application.identifier);
|
||||
}
|
||||
|
||||
public void LogInteractionEndSuccess()
|
||||
{
|
||||
consoleLoggerImpl.LogInteractionEndSuccess();
|
||||
service.LogInteractionEndSuccess(DateTimeUtility.ElapsedMilliseconds.ToString());
|
||||
}
|
||||
|
||||
public void LogInteractionEndFailure(string errorMessage)
|
||||
{
|
||||
consoleLoggerImpl.LogInteractionEndFailure(errorMessage);
|
||||
service.LogInteractionEndFailure(DateTimeUtility.ElapsedMilliseconds.ToString(), errorMessage);
|
||||
}
|
||||
|
||||
public void LogInteractionPoint(string interactionPoint)
|
||||
{
|
||||
consoleLoggerImpl.LogInteractionPoint(interactionPoint);
|
||||
service.LogInteractionPoint(interactionPoint, DateTimeUtility.ElapsedMilliseconds.ToString());
|
||||
}
|
||||
|
||||
public void LogAnnotation(string annotationKey, string annotationValue)
|
||||
{
|
||||
consoleLoggerImpl.LogAnnotation(annotationKey, annotationValue);
|
||||
service.LogAnnotation(annotationKey, annotationValue);
|
||||
}
|
||||
|
||||
public void LogFirstTranscriptionTime()
|
||||
{
|
||||
if (!loggedFirstTranscriptionTime)
|
||||
{
|
||||
loggedFirstTranscriptionTime = true;
|
||||
LogInteractionPoint("firstPartialTranscriptionTime");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eee6ea0d8b185f54b8cba025115dea67
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,3 @@
|
||||
{
|
||||
"name": "AssistantCoreSDKRuntime"
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a7c32ded21d3b9b42a71cdf39f2ed8da
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5a116b0921542354a9d57799cba768bd
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Oculus SDK License Agreement (the "License");
|
||||
* you may not use the Oculus SDK except in compliance with the License,
|
||||
* which is provided at the time of installation or download, or which
|
||||
* otherwise accompanies this software in either electronic or hard copy form.
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Oculus SDK
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Oculus.Voice.Core.Bindings.Interfaces
|
||||
{
|
||||
public interface IConnection
|
||||
{
|
||||
void Connect(string version);
|
||||
void Disconnect();
|
||||
|
||||
bool IsConnected { get; }
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0a8340504b2574441afe16939acde7ae
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Oculus SDK License Agreement (the "License");
|
||||
* you may not use the Oculus SDK except in compliance with the License,
|
||||
* which is provided at the time of installation or download, or which
|
||||
* otherwise accompanies this software in either electronic or hard copy form.
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Oculus SDK
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Oculus.Voice.Core.Bindings.Interfaces
|
||||
{
|
||||
public interface IVoiceSDKLogger
|
||||
{
|
||||
bool IsUsingPlatformIntegration { get; set; }
|
||||
bool ShouldLogToConsole { get; set; }
|
||||
string WitApplication { get; set; }
|
||||
void LogInteractionStart(string requestId, string witApi);
|
||||
void LogInteractionEndSuccess();
|
||||
void LogInteractionEndFailure(string errorMessage);
|
||||
void LogInteractionPoint(string interactionPoint);
|
||||
void LogAnnotation(string annotationKey, string annotationValue);
|
||||
void LogFirstTranscriptionTime();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e1120ad58e6347809f136d52caa7638f
|
||||
timeCreated: 1652979217
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 48dd050ce4e9b904fa2888ae3c2724d2
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Licensed under the Oculus SDK License Agreement (the "License");
|
||||
* you may not use the Oculus SDK except in compliance with the License,
|
||||
* which is provided at the time of installation or download, or which
|
||||
* otherwise accompanies this software in either electronic or hard copy form.
|
||||
*
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Oculus SDK
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Based off Unity forum post https://forum.unity.com/threads/how-to-change-the-name-of-list-elements-in-the-inspector.448910/
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace Oculus.Voice.Core.Utilities
|
||||
{
|
||||
public class ArrayElementTitleAttribute : PropertyAttribute
|
||||
{
|
||||
public string varname;
|
||||
public string fallbackName;
|
||||
|
||||
public ArrayElementTitleAttribute(string elementTitleVar = null, string fallbackName = null)
|
||||
{
|
||||
varname = elementTitleVar;
|
||||
this.fallbackName = fallbackName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cd85a8631126f474f8d69375b5cc2bf4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
using System;
|
||||
|
||||
namespace Oculus.Voice.Core.Utilities
|
||||
{
|
||||
public class DateTimeUtility
|
||||
{
|
||||
public static DateTime UtcNow
|
||||
{
|
||||
get => DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public static long ElapsedMilliseconds
|
||||
{
|
||||
get => UtcNow.Ticks / TimeSpan.TicksPerMillisecond;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 572733f79a0d4ca698f549719e65df51
|
||||
timeCreated: 1653065378
|
||||
8
Assets/Oculus/Voice/Lib/Wit.ai.meta
Normal file
8
Assets/Oculus/Voice/Lib/Wit.ai.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d0506c1dcc88b4d2db266065e8aa3deb
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Oculus/Voice/Lib/Wit.ai/Documentation.meta
Normal file
8
Assets/Oculus/Voice/Lib/Wit.ai/Documentation.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bbef58853aa598f48a7c33ac1f6aee0f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8eb9498a67cb0d640aafac2c509b1272
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Oculus/Voice/Lib/Wit.ai/Documentation/VoiceEventsDiagram.png
(Stored with Git LFS)
Normal file
BIN
Assets/Oculus/Voice/Lib/Wit.ai/Documentation/VoiceEventsDiagram.png
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,128 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f9d0f3319db97e04181db42930d90a4f
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
applyGammaDecoding: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 4096
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 4096
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 4096
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 4096
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Oculus/Voice/Lib/Wit.ai/Features.meta
Normal file
8
Assets/Oculus/Voice/Lib/Wit.ai/Features.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aabf1e81ff2442d499f8b3d7b9b8e340
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Oculus/Voice/Lib/Wit.ai/Features/Dictation.meta
Normal file
8
Assets/Oculus/Voice/Lib/Wit.ai/Features/Dictation.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8848dd0aaf9c1cd49bd992656eebb954
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 64b5e4399ce1894409af2cf7dcab6365
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7913ff34317620543add7ccf91153f48
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "Facebook.Wit.Dictation.Editor",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:910a956078d2ff4429c717211dcfaecb",
|
||||
"GUID:fa958eb9f0171754fb207d563a15ddfa"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f8a301fcccd2a404a9820dc1e9c0d5c3
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ce420a201d5144a44b4c15f1b9c4cff5
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
using Meta.WitAi.Events.Editor;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Meta.WitAi.Dictation.Events.Editor
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(DictationEvents))]
|
||||
public class DictationEventPropertyDrawer : EventPropertyDrawer<DictationEvents>
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4b8f297a827717846a390137480216b9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7000a4548ba72474f9222567d06a50fc
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 110ee5aeb672b914bbc92f92061bcbd4
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8f0c2fb9674b409c869f53df88912235
|
||||
timeCreated: 1657568993
|
||||
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using Meta.WitAi.Data;
|
||||
|
||||
namespace Meta.WitAi.Dictation.Data
|
||||
{
|
||||
[Serializable]
|
||||
public class DictationSession : VoiceSession
|
||||
{
|
||||
/// <summary>
|
||||
/// Dictation service being used
|
||||
/// </summary>
|
||||
public IDictationService dictationService;
|
||||
/// <summary>
|
||||
/// Collection of Request IDs generated from client for Wit requests
|
||||
/// </summary>
|
||||
public string[] clientRequestId;
|
||||
/// <summary>
|
||||
/// An identifier for the current dictation session
|
||||
/// </summary>
|
||||
public string sessionId = Guid.NewGuid().ToString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9809a25e34ab45d6a522b8f43e4c3703
|
||||
timeCreated: 1657569002
|
||||
@ -0,0 +1,173 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
using Meta.WitAi.Configuration;
|
||||
using Meta.WitAi.Dictation.Events;
|
||||
using Meta.WitAi.Events;
|
||||
using Meta.WitAi.Events.UnityEventListeners;
|
||||
using Meta.WitAi.Interfaces;
|
||||
using Meta.WitAi.Requests;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Meta.WitAi.Dictation
|
||||
{
|
||||
public abstract class DictationService : MonoBehaviour, IDictationService, IAudioEventProvider, ITranscriptionEventProvider
|
||||
{
|
||||
[Tooltip("Events that will fire before, during and after an activation")]
|
||||
[SerializeField] protected DictationEvents dictationEvents = new DictationEvents();
|
||||
|
||||
///<summary>
|
||||
/// Internal events used to report telemetry. These events are reserved for internal
|
||||
/// use only and should not be used for any other purpose.
|
||||
/// </summary>
|
||||
protected TelemetryEvents telemetryEvents = new TelemetryEvents();
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if this voice service is currently active and listening with the mic
|
||||
/// </summary>
|
||||
public abstract bool Active { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the service is actively communicating with Wit.ai during an Activation. The mic may or may not still be active while this is true.
|
||||
/// </summary>
|
||||
public abstract bool IsRequestActive { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets/Sets a custom transcription provider. This can be used to replace any built in asr
|
||||
/// with an on device model or other provided source
|
||||
/// </summary>
|
||||
public abstract ITranscriptionProvider TranscriptionProvider { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if this voice service is currently reading data from the microphone
|
||||
/// </summary>
|
||||
public abstract bool MicActive { get; }
|
||||
|
||||
public virtual DictationEvents DictationEvents
|
||||
{
|
||||
get => dictationEvents;
|
||||
set => dictationEvents = value;
|
||||
}
|
||||
|
||||
public TelemetryEvents TelemetryEvents { get => telemetryEvents; set => telemetryEvents = value; }
|
||||
|
||||
/// <summary>
|
||||
/// A subset of events around collection of audio data
|
||||
/// </summary>
|
||||
public IAudioInputEvents AudioEvents => DictationEvents;
|
||||
|
||||
/// <summary>
|
||||
/// A subset of events around receiving transcriptions
|
||||
/// </summary>
|
||||
public ITranscriptionEvent TranscriptionEvents => DictationEvents;
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the audio input should be read in an activation
|
||||
/// </summary>
|
||||
protected abstract bool ShouldSendMicData { get; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Activate the microphone and send data for NLU processing. Includes optional additional request parameters like dynamic entities and maximum results.
|
||||
/// </summary>
|
||||
public void Activate() => Activate(new WitRequestOptions(), new VoiceServiceRequestEvents());
|
||||
/// <summary>
|
||||
/// Activate the microphone and send data for NLU processing. Includes optional additional request parameters like dynamic entities and maximum results.
|
||||
/// </summary>
|
||||
/// <param name="requestOptions">Additional options such as custom request id</param>
|
||||
public void Activate(WitRequestOptions requestOptions) => Activate(requestOptions, new VoiceServiceRequestEvents());
|
||||
/// <summary>
|
||||
/// Activate the microphone and send data for NLU processing. Includes optional additional request parameters like dynamic entities and maximum results.
|
||||
/// </summary>
|
||||
/// <param name="requestOptions">Additional options such as custom request id</param>
|
||||
public VoiceServiceRequest Activate(VoiceServiceRequestEvents requestEvents) => Activate(new WitRequestOptions(), requestEvents);
|
||||
/// <summary>
|
||||
/// Activate the microphone and send data for NLU processing. Includes optional additional request parameters like dynamic entities and maximum results.
|
||||
/// </summary>
|
||||
/// <param name="requestOptions">Additional options such as custom request id</param>
|
||||
/// <param name="requestEvents">Events specific to the request's lifecycle</param>
|
||||
public abstract VoiceServiceRequest Activate(WitRequestOptions requestOptions, VoiceServiceRequestEvents requestEvents);
|
||||
|
||||
/// <summary>
|
||||
/// Activate the microphone and send data for NLU processing immediately without waiting for sound/speech from the user to begin. Includes optional additional request parameters like dynamic entities and maximum results.
|
||||
/// </summary>
|
||||
public void ActivateImmediately() => ActivateImmediately(new WitRequestOptions(), new VoiceServiceRequestEvents());
|
||||
/// <summary>
|
||||
/// Activate the microphone and send data for NLU processing immediately without waiting for sound/speech from the user to begin. Includes optional additional request parameters like dynamic entities and maximum results.
|
||||
/// </summary>
|
||||
/// <param name="requestOptions">Additional options such as custom request id</param>
|
||||
public void ActivateImmediately(WitRequestOptions requestOptions) => ActivateImmediately(requestOptions, new VoiceServiceRequestEvents());
|
||||
/// <summary>
|
||||
/// Activate the microphone and send data for NLU processing immediately without waiting for sound/speech from the user to begin. Includes optional additional request parameters like dynamic entities and maximum results.
|
||||
/// </summary>
|
||||
/// <param name="requestOptions">Additional options such as custom request id</param>
|
||||
public VoiceServiceRequest ActivateImmediately(VoiceServiceRequestEvents requestEvents) => ActivateImmediately(new WitRequestOptions(), requestEvents);
|
||||
/// <summary>
|
||||
/// Activate the microphone and send data for NLU processing immediately without waiting for sound/speech from the user to begin. Includes optional additional request parameters like dynamic entities and maximum results.
|
||||
/// </summary>
|
||||
/// <param name="requestOptions">Additional options such as custom request id</param>
|
||||
/// <param name="requestEvents">Events specific to the request's lifecycle</param>
|
||||
public abstract VoiceServiceRequest ActivateImmediately(WitRequestOptions requestOptions, VoiceServiceRequestEvents requestEvents);
|
||||
|
||||
/// <summary>
|
||||
/// Stop listening and submit any remaining buffered microphone data for processing.
|
||||
/// </summary>
|
||||
public abstract void Deactivate();
|
||||
|
||||
/// <summary>
|
||||
/// Cancels the current transcription. No FullTranscription event will fire.
|
||||
/// </summary>
|
||||
public abstract void Cancel();
|
||||
|
||||
protected virtual void Awake()
|
||||
{
|
||||
var audioEventListener = GetComponent<AudioEventListener>();
|
||||
if (!audioEventListener)
|
||||
{
|
||||
gameObject.AddComponent<AudioEventListener>();
|
||||
}
|
||||
|
||||
var transcriptionEventListener = GetComponent<TranscriptionEventListener>();
|
||||
if (!transcriptionEventListener)
|
||||
{
|
||||
gameObject.AddComponent<TranscriptionEventListener>();
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnEnable()
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual void OnDisable()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public interface IDictationService: ITelemetryEventsProvider
|
||||
{
|
||||
bool Active { get; }
|
||||
|
||||
bool IsRequestActive { get; }
|
||||
|
||||
bool MicActive { get; }
|
||||
|
||||
ITranscriptionProvider TranscriptionProvider { get; set; }
|
||||
|
||||
DictationEvents DictationEvents { get; set; }
|
||||
|
||||
new TelemetryEvents TelemetryEvents { get; set; }
|
||||
|
||||
VoiceServiceRequest Activate(WitRequestOptions requestOptions, VoiceServiceRequestEvents requestEvents);
|
||||
|
||||
VoiceServiceRequest ActivateImmediately(WitRequestOptions requestOptions, VoiceServiceRequestEvents requestEvents);
|
||||
|
||||
void Deactivate();
|
||||
|
||||
void Cancel();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2d481126888a4412939f6940b2fa3950
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b23994c7bbf9462ca7b6939d3d364e7c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using Meta.WitAi.Events;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
namespace Meta.WitAi.Dictation.Events
|
||||
{
|
||||
[Serializable]
|
||||
public class DictationEvents : SpeechEvents
|
||||
{
|
||||
private const string EVENT_CATEGORY_DICTATION_EVENTS = "Dictation Events";
|
||||
|
||||
/// <summary>
|
||||
/// Called when an individual dictation session has started. This can include multiple server activations if
|
||||
/// dictation is set up to automatically reactivate when the server endpoints an utterance.
|
||||
/// </summary>
|
||||
[Tooltip("Called when an individual dictation session has started. This can include multiple server activations if dictation is set up to automatically reactivate when the server endpoints an utterance.")]
|
||||
[EventCategory(EVENT_CATEGORY_DICTATION_EVENTS)]
|
||||
[FormerlySerializedAs("onDictationSessionStarted")] [SerializeField] [HideInInspector]
|
||||
private DictationSessionEvent _onDictationSessionStarted = new DictationSessionEvent();
|
||||
public DictationSessionEvent OnDictationSessionStarted => _onDictationSessionStarted;
|
||||
|
||||
/// <summary>
|
||||
/// Called when a dictation is completed after Deactivate has been called or auto-reactivate is disabled.
|
||||
/// </summary>
|
||||
[Tooltip("Called when a dictation is completed after Deactivate has been called or auto-reactivate is disabled.")]
|
||||
[EventCategory(EVENT_CATEGORY_DICTATION_EVENTS)]
|
||||
[FormerlySerializedAs("onDictationSessionStopped")] [SerializeField] [HideInInspector]
|
||||
private DictationSessionEvent _onDictationSessionStopped = new DictationSessionEvent();
|
||||
public DictationSessionEvent OnDictationSessionStopped => _onDictationSessionStopped;
|
||||
|
||||
// Deprecated events
|
||||
[Obsolete("Deprecated for 'OnDictationSessionStarted' event")]
|
||||
public DictationSessionEvent onDictationSessionStarted => OnDictationSessionStarted;
|
||||
[Obsolete("Deprecated for 'OnDictationSessionStopped' event")]
|
||||
public DictationSessionEvent onDictationSessionStopped => OnDictationSessionStopped;
|
||||
[Obsolete("Deprecated for 'OnStartListening' event")]
|
||||
public UnityEvent onStart => OnStartListening;
|
||||
[Obsolete("Deprecated for 'OnStoppedListening' event")]
|
||||
public UnityEvent onStopped => OnStoppedListening;
|
||||
[Obsolete("Deprecated for 'OnMicLevelChanged' event")]
|
||||
public WitMicLevelChangedEvent onMicAudioLevel => OnMicLevelChanged;
|
||||
[Obsolete("Deprecated for 'OnError' event")]
|
||||
public WitErrorEvent onError => OnError;
|
||||
[Obsolete("Deprecated for 'OnResponse' event")]
|
||||
public WitResponseEvent onResponse => OnResponse;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 866a0a2cd26dd0c469bb96bf7be7ec27
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using Meta.WitAi.Dictation.Data;
|
||||
using UnityEngine.Events;
|
||||
|
||||
namespace Meta.WitAi.Dictation.Events
|
||||
{
|
||||
[Serializable]
|
||||
public class DictationSessionEvent : UnityEvent<DictationSession>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c8d63aebd47343999a855f5eff93e7a2
|
||||
timeCreated: 1657570491
|
||||
@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "Facebook.Wit.Dictation",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:1c28d8b71ced07540b7c271537363cc6",
|
||||
"GUID:4504b1a6e0fdcc3498c30b266e4a63bf"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 910a956078d2ff4429c717211dcfaecb
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,109 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using Meta.WitAi.Events;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Meta.WitAi.Dictation
|
||||
{
|
||||
public class MultiRequestTranscription : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private DictationService witDictation;
|
||||
[SerializeField] private int linesBetweenActivations = 2;
|
||||
[Multiline]
|
||||
[SerializeField] private string activationSeparator = String.Empty;
|
||||
|
||||
[Header("Events")]
|
||||
[SerializeField] private WitTranscriptionEvent onTranscriptionUpdated = new
|
||||
WitTranscriptionEvent();
|
||||
|
||||
private StringBuilder _text;
|
||||
private string _activeText;
|
||||
private bool _newSection;
|
||||
|
||||
private StringBuilder _separator;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (!witDictation) witDictation = FindObjectOfType<DictationService>();
|
||||
|
||||
_text = new StringBuilder();
|
||||
_separator = new StringBuilder();
|
||||
for (int i = 0; i < linesBetweenActivations; i++)
|
||||
{
|
||||
_separator.AppendLine();
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(activationSeparator))
|
||||
{
|
||||
_separator.Append(activationSeparator);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
witDictation.DictationEvents.OnFullTranscription.AddListener(OnFullTranscription);
|
||||
witDictation.DictationEvents.OnPartialTranscription.AddListener(OnPartialTranscription);
|
||||
witDictation.DictationEvents.OnAborting.AddListener(OnCancelled);
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
_activeText = string.Empty;
|
||||
witDictation.DictationEvents.OnFullTranscription.RemoveListener(OnFullTranscription);
|
||||
witDictation.DictationEvents.OnPartialTranscription.RemoveListener(OnPartialTranscription);
|
||||
witDictation.DictationEvents.OnAborting.RemoveListener(OnCancelled);
|
||||
}
|
||||
|
||||
private void OnCancelled()
|
||||
{
|
||||
_activeText = string.Empty;
|
||||
OnTranscriptionUpdated();
|
||||
}
|
||||
|
||||
private void OnFullTranscription(string text)
|
||||
{
|
||||
_activeText = string.Empty;
|
||||
|
||||
if (_text.Length > 0)
|
||||
{
|
||||
_text.Append(_separator);
|
||||
}
|
||||
|
||||
_text.Append(text);
|
||||
|
||||
OnTranscriptionUpdated();
|
||||
}
|
||||
|
||||
private void OnPartialTranscription(string text)
|
||||
{
|
||||
_activeText = text;
|
||||
OnTranscriptionUpdated();
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
_text.Clear();
|
||||
onTranscriptionUpdated.Invoke(string.Empty);
|
||||
}
|
||||
|
||||
private void OnTranscriptionUpdated()
|
||||
{
|
||||
var transcription = new StringBuilder();
|
||||
transcription.Append(_text);
|
||||
if (!string.IsNullOrEmpty(_activeText))
|
||||
{
|
||||
if (transcription.Length > 0)
|
||||
{
|
||||
transcription.Append(_separator);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(_activeText))
|
||||
{
|
||||
transcription.Append(_activeText);
|
||||
}
|
||||
}
|
||||
|
||||
onTranscriptionUpdated.Invoke(transcription.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a960272debaf35b4f8df9292e4191044
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3e507c9f16a2497a940845bf47606a99
|
||||
timeCreated: 1656528581
|
||||
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
using Meta.WitAi.Interfaces;
|
||||
using Meta.WitAi.Utilities;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Meta.WitAi.ServiceReferences
|
||||
{
|
||||
public class DictationServiceAudioEventReference : AudioInputServiceReference
|
||||
{
|
||||
[SerializeField] private DictationServiceReference _dictationServiceReference;
|
||||
|
||||
public override IAudioInputEvents AudioEvents =>
|
||||
_dictationServiceReference.DictationService.AudioEvents;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e2029a881fa07405c941899ca44707e0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using Meta.WitAi.Dictation;
|
||||
using UnityEngine;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
namespace Meta.WitAi.Utilities
|
||||
{
|
||||
[Serializable]
|
||||
public struct DictationServiceReference
|
||||
{
|
||||
[SerializeField] internal DictationService dictationService;
|
||||
|
||||
public DictationService DictationService
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!dictationService)
|
||||
{
|
||||
DictationService[] services = Resources.FindObjectsOfTypeAll<DictationService>();
|
||||
if (services != null)
|
||||
{
|
||||
// Set as first instance that isn't a prefab
|
||||
dictationService = Array.Find(services, (o) => o.gameObject.scene.rootCount != 0);
|
||||
}
|
||||
}
|
||||
|
||||
return dictationService;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
[CustomPropertyDrawer(typeof(DictationServiceReference))]
|
||||
public class DictationServiceReferenceDrawer : PropertyDrawer
|
||||
{
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
return EditorGUIUtility.singleLineHeight;
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
var refProp = property.FindPropertyRelative("DictationService");
|
||||
var reference = refProp.objectReferenceValue as DictationService;
|
||||
var dictationServices = GameObject.FindObjectsOfType<DictationService>();
|
||||
var dictationServiceNames = new string[dictationServices.Length + 1];
|
||||
int index = 0;
|
||||
dictationServiceNames[0] = "Autodetect";
|
||||
if (dictationServices.Length == 1)
|
||||
{
|
||||
dictationServiceNames[0] = $"{dictationServiceNames[0]} - {dictationServices[0].name}";
|
||||
}
|
||||
for (int i = 0; i < dictationServices.Length; i++)
|
||||
{
|
||||
dictationServiceNames[i + 1] = dictationServices[i].name;
|
||||
if (dictationServices[i] == reference)
|
||||
{
|
||||
index = i + 1;
|
||||
}
|
||||
}
|
||||
EditorGUI.BeginProperty(position, label, property);
|
||||
var updatedIndex = EditorGUI.Popup(position, index, dictationServiceNames);
|
||||
if (index != updatedIndex)
|
||||
{
|
||||
if (updatedIndex > 0)
|
||||
{
|
||||
refProp.objectReferenceValue = dictationServices[updatedIndex - 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
refProp.objectReferenceValue = null;
|
||||
}
|
||||
|
||||
property.serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
EditorGUI.EndProperty();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a487e94faee3e430989a08cd6d770e3d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,153 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
using System.IO;
|
||||
using Meta.WitAi.Configuration;
|
||||
using Meta.WitAi.Data.Configuration;
|
||||
using Meta.WitAi.Dictation.Events;
|
||||
using Meta.WitAi.Events;
|
||||
using Meta.WitAi.Interfaces;
|
||||
using Meta.WitAi.Requests;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Meta.WitAi.Dictation
|
||||
{
|
||||
public class WitDictation : DictationService, IWitRuntimeConfigProvider, IVoiceEventProvider, IWitRequestProvider, IWitConfigurationProvider
|
||||
{
|
||||
[SerializeField] private WitRuntimeConfiguration witRuntimeConfiguration;
|
||||
|
||||
private WitService witService;
|
||||
|
||||
public WitRuntimeConfiguration RuntimeConfiguration
|
||||
{
|
||||
get => witRuntimeConfiguration;
|
||||
set => witRuntimeConfiguration = value;
|
||||
}
|
||||
public WitConfiguration Configuration => RuntimeConfiguration?.witConfiguration;
|
||||
|
||||
#region Voice Service Properties
|
||||
|
||||
public override bool Active => null != witService && witService.Active;
|
||||
public override bool IsRequestActive => null != witService && witService.IsRequestActive;
|
||||
|
||||
public override ITranscriptionProvider TranscriptionProvider
|
||||
{
|
||||
get => witService.TranscriptionProvider;
|
||||
set => witService.TranscriptionProvider = value;
|
||||
|
||||
}
|
||||
|
||||
public override bool MicActive => null != witService && witService.MicActive;
|
||||
|
||||
protected override bool ShouldSendMicData => witRuntimeConfiguration.sendAudioToWit ||
|
||||
null == TranscriptionProvider;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Events specific to wit voice activation.
|
||||
/// </summary>
|
||||
public VoiceEvents VoiceEvents => _voiceEvents;
|
||||
private readonly VoiceEvents _voiceEvents = new VoiceEvents();
|
||||
|
||||
public override DictationEvents DictationEvents
|
||||
{
|
||||
get => dictationEvents;
|
||||
set
|
||||
{
|
||||
DictationEvents oldEvents = dictationEvents;
|
||||
dictationEvents = value;
|
||||
if (gameObject.activeSelf)
|
||||
{
|
||||
VoiceEvents.RemoveListener(oldEvents);
|
||||
VoiceEvents.AddListener(dictationEvents);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IWitRequestProvider
|
||||
public WitRequest CreateWitRequest(WitConfiguration config, WitRequestOptions requestOptions,
|
||||
VoiceServiceRequestEvents requestEvents,
|
||||
IDynamicEntitiesProvider[] additionalEntityProviders = null)
|
||||
{
|
||||
return config.CreateDictationRequest(requestOptions, requestEvents);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Voice Service Methods
|
||||
/// <summary>
|
||||
/// Activates and waits for the user to exceed the min wake threshold before data is sent to the server.
|
||||
/// </summary>
|
||||
/// <param name="requestOptions">Additional options such as custom request id</param>
|
||||
/// <param name="requestEvents">Events specific to the request's lifecycle</param>
|
||||
public override VoiceServiceRequest Activate(WitRequestOptions requestOptions, VoiceServiceRequestEvents requestEvents)
|
||||
{
|
||||
return witService.Activate(requestOptions, requestEvents);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Activates immediately and starts sending data to the server. This will not wait for min wake threshold
|
||||
/// </summary>
|
||||
/// <param name="requestOptions">Additional options such as custom request id</param>
|
||||
/// <param name="requestEvents">Events specific to the request's lifecycle</param>
|
||||
public override VoiceServiceRequest ActivateImmediately(WitRequestOptions requestOptions, VoiceServiceRequestEvents requestEvents)
|
||||
{
|
||||
return witService.ActivateImmediately(requestOptions, requestEvents);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deactivates. If a transcription is in progress the network request will complete and any additional
|
||||
/// transcription values will be returned.
|
||||
/// </summary>
|
||||
public override void Deactivate()
|
||||
{
|
||||
witService.Deactivate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deactivates and ignores any pending transcription content.
|
||||
/// </summary>
|
||||
public override void Cancel()
|
||||
{
|
||||
witService.DeactivateAndAbortRequest();
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
witService = gameObject.AddComponent<WitService>();
|
||||
witService.VoiceEventProvider = this;
|
||||
witService.ConfigurationProvider = this;
|
||||
witService.WitRequestProvider = this;
|
||||
witService.TelemetryEventsProvider = this;
|
||||
}
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
VoiceEvents.AddListener(DictationEvents);
|
||||
}
|
||||
|
||||
protected override void OnDisable()
|
||||
{
|
||||
base.OnDisable();
|
||||
VoiceEvents.RemoveListener(DictationEvents);
|
||||
}
|
||||
|
||||
public void TranscribeFile(string fileName)
|
||||
{
|
||||
var request = CreateWitRequest(witRuntimeConfiguration.witConfiguration, new WitRequestOptions(), new VoiceServiceRequestEvents());
|
||||
var data = File.ReadAllBytes(fileName);
|
||||
request.postData = data;
|
||||
witService.ExecuteRequest(request);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4398589986ec92e46a7e1585e63ff2a5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Oculus/Voice/Lib/Wit.ai/Features/TTS.meta
Normal file
8
Assets/Oculus/Voice/Lib/Wit.ai/Features/TTS.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cce4aa4005d374a4b94f0b4d6edc298d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e18f1785366987e4886fb11f30d70040
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cde9306012742314db5ada2fe0d9bff2
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Oculus/Voice/Lib/Wit.ai/Features/TTS/Documentation/Images/tts_service_cachesettings.png
(Stored with Git LFS)
Normal file
BIN
Assets/Oculus/Voice/Lib/Wit.ai/Features/TTS/Documentation/Images/tts_service_cachesettings.png
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,128 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 701ca4114422ead418e08b1c0bc26348
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
applyGammaDecoding: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Oculus/Voice/Lib/Wit.ai/Features/TTS/Documentation/Images/tts_service_settings.png
(Stored with Git LFS)
Normal file
BIN
Assets/Oculus/Voice/Lib/Wit.ai/Features/TTS/Documentation/Images/tts_service_settings.png
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,128 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a3ec408155652024f94168a419eabdcc
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
applyGammaDecoding: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Oculus/Voice/Lib/Wit.ai/Features/TTS/Documentation/Images/tts_speaker_audiosource.png
(Stored with Git LFS)
Normal file
BIN
Assets/Oculus/Voice/Lib/Wit.ai/Features/TTS/Documentation/Images/tts_speaker_audiosource.png
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,128 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3387a752287aa7845892fd1c1ca0eb8f
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
applyGammaDecoding: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Oculus/Voice/Lib/Wit.ai/Features/TTS/Documentation/Images/tts_speaker_voicesettings.png
(Stored with Git LFS)
Normal file
BIN
Assets/Oculus/Voice/Lib/Wit.ai/Features/TTS/Documentation/Images/tts_speaker_voicesettings.png
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,128 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 45b126b5c88878b42840b8dd157251b6
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
applyGammaDecoding: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,40 @@
|
||||
# Text-to-Speech Overview
|
||||
|
||||
|
||||
## Overview
|
||||
|
||||
Voice SDK’s Text-to-Speech (TTS) feature uses a Wit.ai based service to provide audio files for text strings. It’s handled by a single TTSService prefab for all TTS settings and you can use a simple TTSSpeaker script for each scene location in which a TTS clip can be played.
|
||||
|
||||
To keep TTS working smoothly, Voice SDK handles the caching of TTS files during runtime (or when otherwise needed). If streaming TTS audio files is not an option for your application, however, you can set it to use preloaded static TTS files prior to building your app.
|
||||
|
||||
<b>Note:</b> With this initial release of TTS, only a few Wit.ai TTS voice settings are adjustable, but the package will be updated as more voices become available.
|
||||
|
||||
|
||||
## Setup
|
||||
|
||||
Use the following steps to set up TTS for your app once the plugin has been imported:
|
||||
1. Open the scene you want to use TTS within.
|
||||
2. Generate a new Wit Configuration using the Wit Configurations menu within the Oculus > Voice SDK > Voice HUB. Ensure it refreshes successfully and displays all voices available for your configuration.
|
||||
2. Navigate to Assets > Create > Voice SDK > TTS > Add Default TTS Setup
|
||||
3. In your scene heirarchy navigate inside the newly generated TTS GameObject to select the TTSWitService gameobject and adjust the inspector to fit your needs:
|
||||
3a. Use TTSWit > Request Settings > Configuration to select the Wit Configuration asset generated in step 2.
|
||||
3b. Once your configuration is setup, go to 'Preset Voice Settings' and setup any voices that might be shared by multiple TTSSpeakers.
|
||||
For more information, see TTS Voice Customization: https://developer.oculus.com/documentation/unity/voice-sdk-tts-voice-customization
|
||||

|
||||
3c. Under TTS Runtime Cache (Script), adjust the settings to indicate how often clips will be automatically uploaded from memory.
|
||||
For more information, see TTS Cache Options: https://developer.oculus.com/documentation/unity/voice-sdk-tts-cache-options
|
||||
3d. If needed, adjust your disk cache directory location and name in the tree under TTS Disk Cache (Script).
|
||||
For more information, see TTS Cache Options: https://developer.oculus.com/documentation/unity/voice-sdk-tts-cache-options/
|
||||

|
||||
4. Move & duplicate the TTSSpeaker to all the locations in your app where you would like TTS to be played.
|
||||
5. Modify each TTSSpeaker via the Inspector to fit your needs:
|
||||
5a. Under Voice Settings, select the Voice Preset for the specific speaker or select Custom to apply speaker specific settings.
|
||||
5b. Adjust the AudioSource in order to add the TTSSpeaker to a custom audio group or set audio from 2D to 3D.
|
||||
6. Via a script use the following TTSSpeaker methods to load and play text.
|
||||
6a. Use the TTSSpeaker script’s Speak(textToSpeak : string) method to request and say specified text on load.
|
||||
6b. Use the TTSSpeaker script’s SpeakQueued(textToSpeak : string) method to request and say specified text.
|
||||
6c. Send a custom TTSSpeakerClipEvents into any Speak/SpeakQueued method for request specific text load & playback event callbacks.
|
||||
6d. Use the TTSSpeaker script’s Stop() method to immediately stop all loading & playing TTS clips.
|
||||
6e. Use TTSSpeaker's Stop(textToSpeak : string) to immediately stop loading & playing of a specific text string.
|
||||
|
||||
<b>Note:</b> Check out TTS/Samples/Scenes/TTSSample.unity for an example of TTS implementation. Ensure that you set your WitConfiguration to the sample prior to running.
|
||||
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0a78e70d61637eb498ee552bab9479ab
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Oculus/Voice/Lib/Wit.ai/Features/TTS/Documentation/TTS Overview Readme.asset
(Stored with Git LFS)
Normal file
BIN
Assets/Oculus/Voice/Lib/Wit.ai/Features/TTS/Documentation/TTS Overview Readme.asset
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c745949bbb55f7b4dba6eeac61f4a7bd
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Oculus/Voice/Lib/Wit.ai/Features/TTS/Samples.meta
Normal file
8
Assets/Oculus/Voice/Lib/Wit.ai/Features/TTS/Samples.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d5d4d513ffe662a4db92f38c8468357e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 68d2ecf49ba62e0408b8f86acb9b103c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 748ff8d1d0d4814429b86058a56a3ee4
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5e581f7e133ba2048995048327a1ef85
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Oculus/Voice/Lib/Wit.ai/Features/TTS/Scripts.meta
Normal file
8
Assets/Oculus/Voice/Lib/Wit.ai/Features/TTS/Scripts.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 466ea4f9ad1762f41a5effc0e1985b21
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4b1da9fac71952343b124f3771afe034
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user