clean project
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 10a5b9b665ad462cb8d1e8d6cde9bc11
|
||||
timeCreated: 1630370518
|
||||
@@ -0,0 +1,75 @@
|
||||
/**************************************************************************************************
|
||||
* 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.Configuration;
|
||||
using Oculus.Voice.Core.Bindings.Android;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Oculus.Voice.Bindings.Android
|
||||
{
|
||||
public class VoiceSDKBinding : BaseServiceBinding
|
||||
{
|
||||
public VoiceSDKBinding(AndroidJavaObject sdkInstance) : base(sdkInstance)
|
||||
{
|
||||
}
|
||||
|
||||
public bool Active => binding.Call<bool>("isActive");
|
||||
public bool IsRequestActive => binding.Call<bool>("isRequestActive");
|
||||
public bool MicActive => binding.Call<bool>("isMicActive");
|
||||
public bool PlatformSupportsWit => binding.Call<bool>("platformSupportsWit");
|
||||
|
||||
public void Activate(string text)
|
||||
{
|
||||
binding.Call("activate", text);
|
||||
}
|
||||
|
||||
public void Activate(string text, WitRequestOptions options)
|
||||
{
|
||||
binding.Call("activate", text);
|
||||
}
|
||||
|
||||
public void Activate()
|
||||
{
|
||||
binding.Call("activate");
|
||||
}
|
||||
|
||||
public void Activate(WitRequestOptions options)
|
||||
{
|
||||
binding.Call("activate");
|
||||
}
|
||||
|
||||
public void ActivateImmediately()
|
||||
{
|
||||
binding.Call("activateImmediately");
|
||||
}
|
||||
|
||||
public void ActivateImmediately(WitRequestOptions options)
|
||||
{
|
||||
binding.Call("activateImmediately");
|
||||
}
|
||||
|
||||
public void Deactivate()
|
||||
{
|
||||
binding.Call("deactivate");
|
||||
}
|
||||
|
||||
public void SetRuntimeConfiguration(WitRuntimeConfiguration configuration)
|
||||
{
|
||||
binding.Call("setRuntimeConfig", new VoiceSDKConfigBinding(configuration).ToJavaObject());
|
||||
}
|
||||
|
||||
public void SetListener(VoiceSDKListenerBinding listener)
|
||||
{
|
||||
binding.Call("setListener", listener);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0d8c1d6d5b8545cfb741ca067158491a
|
||||
timeCreated: 1630371197
|
||||
@@ -0,0 +1,55 @@
|
||||
/**************************************************************************************************
|
||||
* 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.Configuration;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Oculus.Voice.Bindings.Android
|
||||
{
|
||||
public class VoiceSDKConfigBinding
|
||||
{
|
||||
private WitRuntimeConfiguration configuration;
|
||||
|
||||
public VoiceSDKConfigBinding(WitRuntimeConfiguration config)
|
||||
{
|
||||
configuration = config;
|
||||
}
|
||||
|
||||
public AndroidJavaObject ToJavaObject()
|
||||
{
|
||||
AndroidJavaObject witConfig =
|
||||
new AndroidJavaObject("com.oculus.voice.sdk.api.WitConfiguration");
|
||||
witConfig.Set("clientAccessToken", configuration.witConfiguration.clientAccessToken);
|
||||
|
||||
AndroidJavaObject witRuntimeConfig = new AndroidJavaObject("com.oculus.voice.sdk.api.WitRuntimeConfiguration");
|
||||
witRuntimeConfig.Set("witConfiguration", witConfig);
|
||||
|
||||
witRuntimeConfig.Set("minKeepAliveVolume", configuration.minKeepAliveVolume);
|
||||
witRuntimeConfig.Set("minKeepAliveTimeInSeconds",
|
||||
configuration.minKeepAliveTimeInSeconds);
|
||||
witRuntimeConfig.Set("minTranscriptionKeepAliveTimeInSeconds",
|
||||
configuration.minTranscriptionKeepAliveTimeInSeconds);
|
||||
witRuntimeConfig.Set("maxRecordingTime",
|
||||
configuration.maxRecordingTime);
|
||||
witRuntimeConfig.Set("soundWakeThreshold",
|
||||
configuration.soundWakeThreshold);
|
||||
witRuntimeConfig.Set("sampleLengthInMs",
|
||||
configuration.sampleLengthInMs);
|
||||
witRuntimeConfig.Set("micBufferLengthInSeconds",
|
||||
configuration.micBufferLengthInSeconds);
|
||||
witRuntimeConfig.Set("sendAudioToWit",
|
||||
configuration.sendAudioToWit);
|
||||
|
||||
return witRuntimeConfig;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 114218fd50f24874adaaf0e91a865d75
|
||||
timeCreated: 1630370973
|
||||
@@ -0,0 +1,93 @@
|
||||
/**************************************************************************************************
|
||||
* 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.Configuration;
|
||||
using Facebook.WitAi.Events;
|
||||
using Facebook.WitAi.Interfaces;
|
||||
using Oculus.Voice.Core.Bindings.Android;
|
||||
using Oculus.Voice.Interfaces;
|
||||
|
||||
namespace Oculus.Voice.Bindings.Android
|
||||
{
|
||||
public class VoiceSDKImpl : BaseAndroidConnectionImpl<VoiceSDKBinding>,
|
||||
IPlatformVoiceService
|
||||
{
|
||||
public VoiceSDKImpl() : base(
|
||||
"com.oculus.voice.sdk.unity.UnityVoiceSDKServiceFragment")
|
||||
{
|
||||
}
|
||||
|
||||
public bool PlatformSupportsWit => service.PlatformSupportsWit;
|
||||
|
||||
public bool Active => service.Active;
|
||||
public bool IsRequestActive => service.IsRequestActive;
|
||||
public bool MicActive => service.MicActive;
|
||||
public void SetRuntimeConfiguration(WitRuntimeConfiguration configuration)
|
||||
{
|
||||
service.SetRuntimeConfiguration(configuration);
|
||||
}
|
||||
|
||||
private VoiceSDKListenerBinding eventBinding;
|
||||
|
||||
public VoiceEvents VoiceEvents
|
||||
{
|
||||
get => eventBinding.VoiceEvents;
|
||||
set
|
||||
{
|
||||
eventBinding = new VoiceSDKListenerBinding(value);
|
||||
service.SetListener(eventBinding);
|
||||
}
|
||||
}
|
||||
|
||||
public ITranscriptionProvider TranscriptionProvider { get; set; }
|
||||
|
||||
public void Activate(string text)
|
||||
{
|
||||
service.Activate(text);
|
||||
}
|
||||
|
||||
public void Activate(string text, WitRequestOptions requestOptions)
|
||||
{
|
||||
service.Activate(text, requestOptions);
|
||||
}
|
||||
|
||||
public void Activate()
|
||||
{
|
||||
service.Activate();
|
||||
}
|
||||
|
||||
public void Activate(WitRequestOptions requestOptions)
|
||||
{
|
||||
service.Activate(requestOptions);
|
||||
}
|
||||
|
||||
public void ActivateImmediately()
|
||||
{
|
||||
service.ActivateImmediately();
|
||||
}
|
||||
|
||||
public void ActivateImmediately(WitRequestOptions requestOptions)
|
||||
{
|
||||
service.ActivateImmediately(requestOptions);
|
||||
}
|
||||
|
||||
public void Deactivate()
|
||||
{
|
||||
service.Deactivate();
|
||||
}
|
||||
|
||||
public void DeactivateAndAbortRequest()
|
||||
{
|
||||
service.Deactivate();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a3943048f6aa4a49977131e8fb7f677d
|
||||
timeCreated: 1630370598
|
||||
@@ -0,0 +1,96 @@
|
||||
/************************************************************************************
|
||||
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.Events;
|
||||
using Facebook.WitAi.Lib;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Oculus.Voice.Bindings.Android
|
||||
{
|
||||
public class VoiceSDKListenerBinding : AndroidJavaProxy
|
||||
{
|
||||
private VoiceEvents voiceEvents;
|
||||
|
||||
public VoiceEvents VoiceEvents => voiceEvents;
|
||||
|
||||
public VoiceSDKListenerBinding(VoiceEvents voiceEvents) : base(
|
||||
"com.oculus.assistant.api.unity.dictation.UnityDictationListener")
|
||||
{
|
||||
this.voiceEvents = voiceEvents;
|
||||
}
|
||||
|
||||
public void onResponse(string response)
|
||||
{
|
||||
voiceEvents.OnResponse?.Invoke(WitResponseNode.Parse(response));
|
||||
}
|
||||
|
||||
public void onError(string error, string message)
|
||||
{
|
||||
voiceEvents.OnError?.Invoke(error, message);
|
||||
}
|
||||
|
||||
public void onMicLevelChanged(float level)
|
||||
{
|
||||
voiceEvents.OnMicLevelChanged?.Invoke(level);
|
||||
}
|
||||
|
||||
public void onRequestCreated()
|
||||
{
|
||||
voiceEvents.OnRequestCreated?.Invoke(null);
|
||||
}
|
||||
|
||||
public void onStartListening()
|
||||
{
|
||||
voiceEvents.OnStartListening?.Invoke();
|
||||
}
|
||||
|
||||
public void onStoppedListening()
|
||||
{
|
||||
voiceEvents.OnStoppedListening?.Invoke();
|
||||
}
|
||||
|
||||
public void onStoppedListeningDueToInactivity()
|
||||
{
|
||||
voiceEvents.OnStoppedListeningDueToInactivity?.Invoke();
|
||||
}
|
||||
|
||||
public void onStoppedListeningDueToTimeout()
|
||||
{
|
||||
voiceEvents.OnStoppedListeningDueToTimeout?.Invoke();
|
||||
}
|
||||
|
||||
public void onStoppedListeningDueToDeactivation()
|
||||
{
|
||||
voiceEvents.OnStoppedListeningDueToDeactivation?.Invoke();
|
||||
}
|
||||
|
||||
public void onMicDataSent()
|
||||
{
|
||||
voiceEvents.OnMicDataSent?.Invoke();
|
||||
}
|
||||
|
||||
public void onMinimumWakeThresholdHit()
|
||||
{
|
||||
voiceEvents.OnMinimumWakeThresholdHit?.Invoke();
|
||||
}
|
||||
|
||||
public void onPartialTranscription(string transcription)
|
||||
{
|
||||
voiceEvents.OnPartialTranscription?.Invoke(transcription);
|
||||
}
|
||||
|
||||
public void onFullTranscription(string transcription)
|
||||
{
|
||||
voiceEvents.OnFullTranscription?.Invoke(transcription);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c4812e4a88b84256a571c7253e27799f
|
||||
timeCreated: 1630371293
|
||||
Reference in New Issue
Block a user