Exemple #1
0
    private void SubscribeToPocketSphinxEvents()
    {
        EM_UnityPocketsphinx em = _pocketSphinx.EventManager;

        em.OnBeginningOfSpeech += OnBeginningOfSpeech;
        em.OnEndOfSpeech       += OnEndOfSpeech;
        em.OnError             += OnError;
        em.OnInitializeFailed  += OnInitializeFailed;
        em.OnInitializeSuccess += OnInitializeSuccess;
        em.OnPartialResult     += OnPartialResult;
        em.OnPocketSphinxError += OnPocketSphinxError;
        em.OnResult            += OnResult;
        em.OnTimeout           += OnTimeout;
    }
Exemple #2
0
    private void UnsubscribeFromPocketSphinxEvents()
    {
        EM_UnityPocketsphinx em = _pocketSphinx.EventManager;

        em.OnBeginningOfSpeech -= OnBeginningOfSpeech;
        em.OnEndOfSpeech       -= OnEndOfSpeech;
        em.OnError             -= OnError;
        em.OnInitializeFailed  -= OnInitializeFailed;
        em.OnInitializeSuccess -= OnInitializeSuccess;
        em.OnPartialResult     -= OnPartialResult;
        em.OnPocketSphinxError -= OnPocketSphinxError;
        em.OnResult            -= OnResult;
        em.OnTimeout           -= OnTimeout;
    }
        void Awake()
        {
            UnityEngine.Assertions.Assert.IsNotNull(_eventManagerPrefab, "UnityPocketSphinx Event Manager is not assigned.");
            var obj = Instantiate(_eventManagerPrefab, this.transform) as GameObject;

            _eventManager = obj.GetComponent <EM_UnityPocketsphinx>();

            if (_eventManager == null)
            {
                Debug.LogError("[PocketSphinx] No EM_UnityPocketsphinx component found. Did you assign the right eventManager prefab???");
            }

            #if UNITY_ANDROID && !UNITY_EDITOR
            _pocketSphinxInst = new PocketSphinx_Android();
            #elif UNITY_IOS
            Debug.LogError("[PocketSphinx] IOS version not yet implemented.");
            _pocketSphinxInst = null;
            #endif
        }