示例#1
0
        private void Init(string lang)
        {
            _callback     = TtsCallback;
            _buffer       = null;
            _bufferStream = null;

            if (lang != LanguageCode.None)
            {
                var langid = TextToSpeechStartLang(lang);

                if ((langid & TtsLangError) != 0)
                {
                    switch (langid)
                    {
                    case TtsNotSupported:
                        throw new FonixTalkException("This version of DECtalk does not support multiple languages.");

                    case TtsNotAvailable:
                        throw new FonixTalkException("The specified language was not found.");
                    }
                }

                if (!TextToSpeechSelectLang(IntPtr.Zero, langid))
                {
                    throw new FonixTalkException("The specified language failed to load.");
                }
            }

            Check(TextToSpeechStartupEx(out _handle, 0xFFFFFFFF, 0, _callback, ref _handle));

            Speak("[:phone on]"); // Enable singing by default
        }
示例#2
0
 private BufferRaiiHelper ReadyBuffer()
 {
     if (_buffer != null)
     {
         // Buffer was created by previous call to this method
         throw new InvalidOperationException("Buffer already exists.");
     }
     _buffer = new TtsBufferManaged();
     unsafe { Check(TextToSpeechAddBuffer(_handle, _buffer.ValuePointer)); }
     return(new BufferRaiiHelper(this));
 }
示例#3
0
 private void FreeBuffer()
 {
     _buffer.Dispose();
     _buffer = null;
 }
示例#4
0
 private BufferRaiiHelper ReadyBuffer()
 {
     if (_buffer != null)
     {
         // Buffer was created by previous call to this method
         throw new InvalidOperationException("Buffer already exists.");
     }
     _buffer = new TtsBufferManaged();
     unsafe { Check(TextToSpeechAddBuffer(_handle, _buffer.ValuePointer)); }
     return new BufferRaiiHelper(this);
 }
示例#5
0
        private void Init(string lang)
        {
            _callback = TtsCallback;
            _buffer = null;
            _bufferStream = null;

            if (lang != LanguageCode.None)
            {
                var langid = TextToSpeechStartLang(lang);

                if ((langid & TtsLangError) != 0)
                {
                    switch (langid)
                    {
                        case TtsNotSupported:
                            throw new FonixTalkException("This version of DECtalk does not support multiple languages.");
                        case TtsNotAvailable:
                            throw new FonixTalkException("The specified language was not found.");
                    }
                }

                if (!TextToSpeechSelectLang(IntPtr.Zero, langid))
                {
                    throw new FonixTalkException("The specified language failed to load.");
                }
            }

            Check(TextToSpeechStartupEx(out _handle, 0xFFFFFFFF, 0, _callback, ref _handle));

            Speak("[:phone on]"); // Enable singing by default
        }
示例#6
0
 private void FreeBuffer()
 {
     _buffer.Dispose();
     _buffer = null;
 }
示例#7
0
 static unsafe extern MMRESULT TextToSpeechAddBuffer(IntPtr handle, TtsBufferManaged.TTS_BUFFER_T* buffer);