Esempio n. 1
0
        public Sync(SyncOp pOp)
        {
            AudioStream = new MemoryStream();
            Synth       = new SpeechSynthesizer();

            ReloadLexicons();

            Synth.SetOutputToAudioStream(AudioStream, new SpeechAudioFormatInfo(44100, AudioBitsPerSample.Sixteen, AudioChannel.Stereo)
            {
            });
            _voices    = Synth.GetInstalledVoices();
            voiceArray = _voices?.Select(s => s.VoiceInfo.Name).ToArray();

            _op = pOp;
            _op(this, true);
        }
Esempio n. 2
0
        public object RunSync(SyncOp cb, object state)
        {
            SyncTask task = new SyncTask();

            task.cb             = cb;
            task.state          = state;
            task.caller_context = new SynchronizationContext();

            next_operation.WaitOne();
            this.task = task;
            if (exiting)
            {
                throw new ThreadExitingException();
            }

            start_operation.Set();

            task.done.WaitOne();
            if (task.ex != null)
            {
                throw task.ex;
            }
            return(task.result);
        }