Skip to content

Commit

Permalink
1. Fix RecordBtn Err. 2. Update API for SendTriggers
Browse files Browse the repository at this point in the history
  • Loading branch information
Juniverse committed May 12, 2023
1 parent c4b871c commit 9c5fc51
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Assets/Inworld.AI/Scripts/Runtime/Audio/AudioCapture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public class AudioCapture : MonoBehaviour

public void StartRecording(bool autoPush = true)
{
if (!Microphone.IsRecording(null))
m_Recording = Microphone.Start(null, true, m_BufferSeconds, m_AudioRate);
m_LastPosition = Microphone.GetPosition(null);
m_AudioToPush.Clear();
IsCapturing = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Inworld.Packets;
using Inworld.Util;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Serialization;
Expand Down Expand Up @@ -372,10 +373,14 @@ public void SendText(string text)
/// The trigger to send. Both formats are acceptable.
/// You could send either whole string from CharacterData.trigger, or the trigger's shortName.
/// </param>
public void SendTrigger(string triggerName)
/// <param name="param">A Dictionary with its param name, and its value.</param>
public void SendTrigger(string triggerName, Dictionary<string, string> param = null)
{
string[] trigger = triggerName.Split("triggers/");
SendEventToAgent(trigger.Length == 2 ? new CustomEvent(trigger[1]) : new CustomEvent(triggerName));
CustomEvent evt = trigger.Length == 2 ? new CustomEvent(trigger[1]) : new CustomEvent(triggerName);
if (param != null)
evt.Parameters = param;
SendEventToAgent(evt);
}
/// <summary>
/// Send general events to this Character.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ void _StartSession()
m_Client.StartSession();
#pragma warning restore 4014
State = ControllerStates.Connected;
InworldAI.Log("InworldController Connected");
InworldAI.Log($"InworldController Connected {m_Client.SessionID}");
StartCoroutine(InteractionCoroutine());
}
IEnumerator SwitchAudioCapture()
Expand Down

0 comments on commit 9c5fc51

Please sign in to comment.