Initial Commit

This commit is contained in:
2025-07-04 20:33:06 +03:00
commit 8f09347ae0
9219 changed files with 2447903 additions and 0 deletions
@@ -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.Interfaces;
using UnityEngine;
namespace Meta.WitAi.ServiceReferences
{
public abstract class AudioInputServiceReference : MonoBehaviour, IAudioEventProvider
{
public abstract IAudioInputEvents AudioEvents { get; }
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4a3a148ab10644f4fb39b62a492a409f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,64 @@
/*
* 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;
using Meta.WitAi.Events.UnityEventListeners;
using Meta.WitAi.Interfaces;
using UnityEngine.Events;
namespace Meta.WitAi.ServiceReferences
{
/// <summary>
/// Finds all audio event listeners in the scene and subscribes to them.
/// This is good for creating generic attention systems that are shown for
/// the same way for any voice based service active in the scene.
/// </summary>
//[Tooltip("Finds all voice based services and listens for changes in their audio input state.")]
public class CombinedAudioEventReference : AudioInputServiceReference, IAudioInputEvents
{
public override IAudioInputEvents AudioEvents => this;
private WitMicLevelChangedEvent _onMicAudioLevelChanged = new WitMicLevelChangedEvent();
private UnityEvent _onMicStartedListening = new UnityEvent();
private UnityEvent _onMicStoppedListening = new UnityEvent();
private AudioEventListener[] _sourceListeners;
private void Awake()
{
#if UNITY_2020_1_OR_NEWER
_sourceListeners = FindObjectsOfType<AudioEventListener>(true);
#else
_sourceListeners = FindObjectsOfType<AudioEventListener>();
#endif
}
private void OnEnable()
{
foreach (var listener in _sourceListeners)
{
listener.OnMicAudioLevelChanged.AddListener(OnMicAudioLevelChanged.Invoke);
listener.OnMicStartedListening.AddListener(OnMicStartedListening.Invoke);
listener.OnMicStoppedListening.AddListener(OnMicStoppedListening.Invoke);
}
}
private void OnDisable()
{
foreach (var listener in _sourceListeners)
{
listener.OnMicAudioLevelChanged.RemoveListener(OnMicAudioLevelChanged.Invoke);
listener.OnMicStartedListening.RemoveListener(OnMicStartedListening.Invoke);
listener.OnMicStoppedListening.RemoveListener(OnMicStoppedListening.Invoke);
}
}
public WitMicLevelChangedEvent OnMicAudioLevelChanged => _onMicAudioLevelChanged;
public UnityEvent OnMicStartedListening => _onMicStartedListening;
public UnityEvent OnMicStoppedListening => _onMicStoppedListening;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 80d212d929af8425e9c85933a3e2129f
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 Meta.WitAi.Interfaces;
using Meta.WitAi.Utilities;
using UnityEngine;
namespace Meta.WitAi.ServiceReferences
{
public class VoiceServiceAudioEventReference : AudioInputServiceReference
{
[SerializeField] private VoiceServiceReference _voiceServiceReference;
public override IAudioInputEvents AudioEvents => _voiceServiceReference.VoiceService.AudioEvents;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5043dd44ef87a4361af6bc4f3be2da5d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: