private void Dispose(bool disposing) { if (!_isDisposed && disposing && _voiceSynthesis != null) { _isDisposed = true; SpeakAsyncCancelAll(); if (_outputStream != null) { if (_closeStreamOnExit) { _outputStream.Close(); } else { _outputStream.Flush(); } _outputStream = null; } } if (_voiceSynthesis != null) { _voiceSynthesis.Dispose(); _voiceSynthesis = null; } _isDisposed = true; }
void OnDestroy() { if (theVoice == this) { Debug.Log("Destroying speech"); destroySpeech(); theVoice = null; } }
// Use this for initialization void Start() { if (theVoice == null) { theVoice = this; DontDestroyOnLoad(gameObject); initSpeech(); } //else //Destroy(gameObject); }
/// <param name="voiceSynthesis">Voice synthesizer used</param> /// <param name="ttsVoice">Default engine to use</param> internal SpeakInfo(VoiceSynthesis voiceSynthesis, TTSVoice ttsVoice) { _voiceSynthesis = voiceSynthesis; _ttsVoice = ttsVoice; }
internal InstalledVoice(VoiceSynthesis voiceSynthesizer, VoiceInfo voice) { _voiceSynthesizer = voiceSynthesizer; _voice = voice; _enabled = true; }