clean project
This commit is contained in:
163
Assets/Oculus/Voice/Scripts/Runtime/Service/AppBuiltIns.cs
Normal file
163
Assets/Oculus/Voice/Scripts/Runtime/Service/AppBuiltIns.cs
Normal file
@@ -0,0 +1,163 @@
|
||||
/**************************************************************************************************
|
||||
* Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
|
||||
*
|
||||
* Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Utilities 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.Collections.Generic;
|
||||
|
||||
namespace Oculus.Voice
|
||||
{
|
||||
public static class AppBuiltIns
|
||||
{
|
||||
public static string builtInPrefix = "builtin:";
|
||||
private static string modelName = "Built-in Models";
|
||||
|
||||
public static readonly Dictionary<string, Dictionary<string, string>>
|
||||
apps = new Dictionary<string, Dictionary<string, string>>
|
||||
{
|
||||
{
|
||||
"Chinese", new Dictionary<string, string>
|
||||
{
|
||||
{"id", "voiceSDK_zh"},
|
||||
{"name", modelName},
|
||||
{"lang", "zh"},
|
||||
{"clientToken", "3KQH33637TAT7WD4TG7T65SDRO73WZGY"},
|
||||
}
|
||||
},
|
||||
{
|
||||
"Dutch", new Dictionary<string, string>
|
||||
{
|
||||
{"id", "voiceSDK_nl"},
|
||||
{"name", modelName},
|
||||
{"lang", "nl"},
|
||||
{"clientToken", "ZCD6HCNCL6GTJKZ3QKWNKQVEDI4GUL7C"},
|
||||
}
|
||||
},
|
||||
{
|
||||
"English", new Dictionary<string, string>
|
||||
{
|
||||
{"id", "voiceSDK_en"},
|
||||
{"name", modelName},
|
||||
{"lang", "en"},
|
||||
{"clientToken", "HOKEABS7HPIQVSRSVWRPTTV75TQJ5QBP"},
|
||||
}
|
||||
},
|
||||
{
|
||||
"French", new Dictionary<string, string>
|
||||
{
|
||||
{"id", "voiceSDK_fr"},
|
||||
{"name", modelName},
|
||||
{"lang", "fr"},
|
||||
{"clientToken", "7PP7NK2QAH67MREGZV6SB6RIEWAYDNRY"},
|
||||
}
|
||||
},
|
||||
{
|
||||
"German", new Dictionary<string, string>
|
||||
{
|
||||
{"id", "voiceSDK_de"},
|
||||
{"name", modelName},
|
||||
{"lang", "de"},
|
||||
{"clientToken", "7LXOOB4JC7MXPUTTGQHDVQMHGEEJT6LE"},
|
||||
}
|
||||
},
|
||||
{
|
||||
"Italian", new Dictionary<string, string>
|
||||
{
|
||||
{"id", "voiceSDK_it"},
|
||||
{"name", modelName},
|
||||
{"lang", "it"},
|
||||
{"clientToken", "KELCNR4DCCPPOCF2RDFS4M6JOCWWIFII"},
|
||||
}
|
||||
},
|
||||
{
|
||||
"Japanese", new Dictionary<string, string>
|
||||
{
|
||||
{"id", "voiceSDK_ja"},
|
||||
{"name", modelName},
|
||||
{"lang", "ja"},
|
||||
{"clientToken", "TPJGLBBCHJ5F7BVVN5XLEGP6YDQRUE3P"},
|
||||
}
|
||||
},
|
||||
{
|
||||
"Korean", new Dictionary<string, string>
|
||||
{
|
||||
{"id", "voiceSDK_ko"},
|
||||
{"name", modelName},
|
||||
{"lang", "ko"},
|
||||
{"clientToken", "NT4WJLL7ACMFBXS4B7W5GRLTKDZQ36R4"},
|
||||
}
|
||||
},
|
||||
{
|
||||
"Polish", new Dictionary<string, string>
|
||||
{
|
||||
{"id", "voiceSDK_pl"},
|
||||
{"name", modelName},
|
||||
{"lang", "pl"},
|
||||
{"clientToken", "DMDRHGYDYN33D3IKCX5BG5R57EL2IIC4"},
|
||||
}
|
||||
},
|
||||
{
|
||||
"Portuguese", new Dictionary<string, string>
|
||||
{
|
||||
{"id", "voiceSDK_pt"},
|
||||
{"name", modelName},
|
||||
{"lang", "pt"},
|
||||
{"clientToken", "W4W3BSKL72HZC5MXLILONJUCG732SQQN"},
|
||||
}
|
||||
},
|
||||
{
|
||||
"Russian", new Dictionary<string, string>
|
||||
{
|
||||
{"id", "voiceSDK_ru"},
|
||||
{"name", modelName},
|
||||
{"lang", "ru"},
|
||||
{"clientToken", "W67HLUWA3MBYVEKRW3VVWUKSNZGAOFBI"},
|
||||
}
|
||||
},
|
||||
{
|
||||
"Spanish", new Dictionary<string, string>
|
||||
{
|
||||
{"id", "voiceSDK_es"},
|
||||
{"name", modelName},
|
||||
{"lang", "es"},
|
||||
{"clientToken", "YW7AM5OOVSW5XKGYKFE2S2HLC2WHC3UI"},
|
||||
}
|
||||
},
|
||||
{
|
||||
"Swedish", new Dictionary<string, string>
|
||||
{
|
||||
{"id", "voiceSDK_sv"},
|
||||
{"name", modelName},
|
||||
{"lang", "sv"},
|
||||
{"clientToken", "NPE3UJ7Y4NIVTUOZ7QPPAP3TY6FYPXJY"},
|
||||
}
|
||||
},
|
||||
{
|
||||
"Turkish", new Dictionary<string, string>
|
||||
{
|
||||
{"id", "voiceSDK_tr"},
|
||||
{"name", modelName},
|
||||
{"lang", "tr"},
|
||||
{"clientToken", "ZCISEDXESLYJOROLNOODCGGPZXHLUAEE"},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
public static string[] appNames
|
||||
{
|
||||
get
|
||||
{
|
||||
string[] keys = new string[apps.Keys.Count];
|
||||
apps.Keys.CopyTo(keys, 0);
|
||||
return keys;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6483d6b21054c4e07acfd6c1c43c4e0b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,153 @@
|
||||
/**************************************************************************************************
|
||||
* Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
|
||||
*
|
||||
* Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
|
||||
* https://developer.oculus.com/licenses/oculussdk/
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, the Utilities 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 Facebook.WitAi;
|
||||
using Facebook.WitAi.Configuration;
|
||||
using Facebook.WitAi.Interfaces;
|
||||
#if UNITY_ANDROID
|
||||
using Oculus.Voice.Bindings.Android;
|
||||
#endif
|
||||
using Oculus.Voice.Interfaces;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Oculus.Voice
|
||||
{
|
||||
[HelpURL("https://developer.oculus.com/experimental/voice-sdk/tutorial-overview/")]
|
||||
public class AppVoiceExperience : VoiceService, IWitRuntimeConfigProvider
|
||||
{
|
||||
[SerializeField] private WitRuntimeConfiguration witRuntimeConfiguration;
|
||||
|
||||
public WitRuntimeConfiguration RuntimeConfiguration
|
||||
{
|
||||
get => witRuntimeConfiguration;
|
||||
set => witRuntimeConfiguration = value;
|
||||
}
|
||||
|
||||
private IPlatformVoiceService platformService;
|
||||
private IVoiceService voiceServiceImpl;
|
||||
|
||||
#region Voice Service Properties
|
||||
public override bool Active => null != voiceServiceImpl && voiceServiceImpl.Active;
|
||||
public override bool IsRequestActive => null != voiceServiceImpl && voiceServiceImpl.IsRequestActive;
|
||||
public override ITranscriptionProvider TranscriptionProvider
|
||||
{
|
||||
get => voiceServiceImpl.TranscriptionProvider;
|
||||
set => voiceServiceImpl.TranscriptionProvider = value;
|
||||
|
||||
}
|
||||
public override bool MicActive => null != voiceServiceImpl && voiceServiceImpl.MicActive;
|
||||
protected override bool ShouldSendMicData => witRuntimeConfiguration.sendAudioToWit ||
|
||||
null == TranscriptionProvider;
|
||||
#endregion
|
||||
|
||||
public bool HasPlatformIntegrations => false;
|
||||
|
||||
#region Voice Service Methods
|
||||
|
||||
public override void Activate()
|
||||
{
|
||||
voiceServiceImpl.Activate();
|
||||
}
|
||||
|
||||
public override void Activate(WitRequestOptions options)
|
||||
{
|
||||
voiceServiceImpl.Activate(options);
|
||||
}
|
||||
|
||||
public override void ActivateImmediately()
|
||||
{
|
||||
voiceServiceImpl.ActivateImmediately();
|
||||
}
|
||||
|
||||
public override void ActivateImmediately(WitRequestOptions options)
|
||||
{
|
||||
voiceServiceImpl.ActivateImmediately(options);
|
||||
}
|
||||
|
||||
public override void Deactivate()
|
||||
{
|
||||
voiceServiceImpl.Deactivate();
|
||||
}
|
||||
|
||||
public override void DeactivateAndAbortRequest()
|
||||
{
|
||||
voiceServiceImpl.DeactivateAndAbortRequest();
|
||||
}
|
||||
|
||||
public override void Activate(string text)
|
||||
{
|
||||
voiceServiceImpl.Activate(text);
|
||||
}
|
||||
|
||||
public override void Activate(string text, WitRequestOptions requestOptions)
|
||||
{
|
||||
voiceServiceImpl.Activate(text, requestOptions);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
void Start()
|
||||
{
|
||||
InitVoiceSDK();
|
||||
}
|
||||
|
||||
private void InitVoiceSDK()
|
||||
{
|
||||
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
if (HasPlatformIntegrations)
|
||||
{
|
||||
IPlatformVoiceService platformImpl = new VoiceSDKImpl();
|
||||
if (platformImpl.PlatformSupportsWit)
|
||||
{
|
||||
voiceServiceImpl = platformImpl;
|
||||
}
|
||||
else
|
||||
{
|
||||
RevertToWitUnity();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RevertToWitUnity();
|
||||
}
|
||||
#else
|
||||
RevertToWitUnity();
|
||||
#endif
|
||||
|
||||
if (voiceServiceImpl is Wit wit)
|
||||
{
|
||||
wit.RuntimeConfiguration = witRuntimeConfiguration;
|
||||
}
|
||||
|
||||
voiceServiceImpl.VoiceEvents = VoiceEvents;
|
||||
}
|
||||
|
||||
private void RevertToWitUnity()
|
||||
{
|
||||
voiceServiceImpl = GetComponent<Wit>();
|
||||
if (null == voiceServiceImpl)
|
||||
{
|
||||
voiceServiceImpl = gameObject.AddComponent<Wit>();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
if(null == voiceServiceImpl) InitVoiceSDK();
|
||||
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
platformService?.SetRuntimeConfiguration(witRuntimeConfiguration);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 28779cfed47441a42a6cd4fb49c8dc89
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user