@@ -44,7 +44,7 @@ public partial class SpeechToTextService : BaseService
44
44
private const float WsKeepAliveInterval = 20.0f ;
45
45
/// <summary>
46
46
/// If no listen state is received after start is sent within this time, we will timeout
47
- /// and stop listening.
47
+ /// and stop listening.
48
48
/// </summary>
49
49
private const float ListenTimeout = 10.0f ;
50
50
/// <summary>
@@ -77,9 +77,9 @@ public partial class SpeechToTextService : BaseService
77
77
#endregion
78
78
79
79
#region Private Data
80
- private OnRecognize _listenCallback = null ; // Callback is set by StartListening()
80
+ private OnRecognize _listenCallback = null ; // Callback is set by StartListening()
81
81
private OnRecognizeSpeaker _speakerLabelCallback = null ;
82
- private WSConnector _listenSocket = null ; // WebSocket object used when StartListening() is invoked
82
+ private WSConnector _listenSocket = null ; // WebSocket object used when StartListening() is invoked
83
83
private bool _listenActive = false ;
84
84
private bool _audioSent = false ;
85
85
private bool _isListening = false ;
@@ -541,6 +541,8 @@ private IEnumerator KeepAlive()
541
541
// Temporary clip to use for KeepAlive
542
542
// TODO: Generate small sound clip to send to the service to keep alive.
543
543
AudioClip _keepAliveClip = Resources . Load < AudioClip > ( "highHat" ) ;
544
+ while ( _keepAliveClip . loadState != AudioDataLoadState . Loaded )
545
+ yield return null ;
544
546
545
547
#if ENABLE_DEBUGGING
546
548
Log . Debug ( "SpeechToText.KeepAlive()" , "Sending keep alive." ) ;
0 commit comments