예제 #1
0
        private void ãáøToolStripMenuItem_Click(object sender, EventArgs e)
        {
            InitTTSObjects();
            string text = textBox1.Text;

            if (textBox1.SelectionLength > 0)
            {
                text = textBox1.SelectedText;
            }

            target = new DSoundAudioTarget(this);
            target.AudioFinished += OnDSoundAudioFinished;
            tokenizer.Run(text);
            parser.Run(tokenizer);
            segmenter.Run(parser);
            phonetizer.Run(segmenter);
            fujisaki.Run(phonetizer);
            translator.Run(fujisaki);
            synth.Run(translator);
            target.Run(synth);
        }
        void ITTSCentral.TextData(VOICECHARSET eCharacterSet, uint dwFlags, SDATA dText, object pNotifyInterface, Guid IIDNotifyInterface)
        {
            try
            {
                miniLog("TextData " + dText.AsString);
                StringCharProducer scp         = new StringCharProducer(dText.AsString);
                Tokenizer          tokenizer   = new Tokenizer();
                Parser             parser      = new Parser();
                Segmenter          segmenter   = new Segmenter();
                Phonetizer         phonetizer  = new Phonetizer();
                FujisakiProcessor  fujisaki    = new FujisakiProcessor();
                MBROLATranslator   translator  = new MBROLATranslator();
                MBROLASynthesizer  synthesizer = new MBROLASynthesizer();
                synthesizer.Voice = translator.Voice = modeInfo.Voice;
                tokenizer.Run(scp);
                parser.Run(tokenizer);
                segmenter.Run(parser);
                phonetizer.Run(segmenter);
                fujisaki.Run(phonetizer);
                translator.Run(fujisaki);
                synthesizer.Run(translator);

                /*                DelegateConsumer<MBROLAElement> delegc = new DelegateConsumer<MBROLAElement>();
                 *              delegc.ItemConsumed += delegate(MBROLAElement item)
                 *              {
                 *                  miniLog("dummy sees: " + item.ToString());
                 *              };
                 *              delegc.Run(translator);
                 *              delegc.Join();*/
                Sapi4AudioTarget target = new Sapi4AudioTarget(audioObject);
                target.Run(synthesizer);
            }
            catch (Exception e)
            {
                Sapi4Engine.miniLog(e + ": " + e.Message);
            }
        }