wpf语音播报暂停

NOTE: If you haven't read the first post in this series, I would encourage you do to that first, or check out the BabySmash category. Also check out http://windowsclient.net/ for more developer info on WPF.

注意:如果您还没有阅读本系列第一篇文章,我建议您先阅读该文章,或者查看BabySmash类别 另请访问http://windowsclient.net/以获取有关WPF的更多开发人员信息。

BACKGROUND: This is one of a series of posts on learning WPF. I wrote an application for my 2 year old using WPF, but as I'm a Win32-minded programmer, my working app is full of Win32-isms. It's not a good example of a WPF application even though it uses the technology. I'm calling on community (that's you, Dear Reader) to blog about your solutions to different (horrible) selections of my code. You can get the code http://www.codeplex.com/babysmash. Post your solutions on your blog, in the comments, or in the Issue Tracker and we'll all learn WPF together. Pick a single line, a section, or subsystem or the whole app!

背景:这是有关学习WPF的一系列文章之一。 我使用WPF为2岁的孩子编写了一个应用程序,但是由于我是位Win32程序员,所以我的工作应用程序充满了Win32-ism。 即使它使用WPF技术,也不是WPF应用程序的好例子。 我正在呼吁社区(即您,亲爱的读者)在博客中介绍您针对我的代码的不同(糟糕)选择的解决方案。 您可以获取代码http://www.codeplex.com/babysmash 。 将您的解决方案发布到您的博客,评论或问题跟踪器中,我们将一起学习WPF。 选择一条线,一个部分,子系统或整个应用程序!

There's been a flood of interesting content coming in around BabySmash, including WPF Expert Karl Shifflett who found the original code so nasty that he rewrote it from scratch! I'll do a whole post analyzing his code and how I can refactor my own.

BabySmash周围到处都有大量有趣的内容,包括WPF专家Karl Shifflett ,他发现原始代码是如此讨厌,以至于他从头重写了代码! 我将在整篇文章中分析他的代码以及如何重构自己的代码。

Before that, I wanted to share one little tidbit that isn't explicit to WPF but rather to the .NET Framework 3.0. Most folks think of .NET 3.0 (myself included) as being WPF (Windows Presentation Foundation), WCF (Windows Communication Foundation) and WF (Windows Workflow). However, there's a bunch of miscellaneous goodness in in .NET 3.0 that I always forget about.

在此之前,我想分享一个对WPF并不明确但对.NET Framework 3.0明确的提示。 大多数人认为.NET 3.0(包括我自己)是WPF(Windows Presentation Foundation),WCF(Windows Communication Foundation)和WF(Windows Workflow)。 但是,.NET 3.0中有很多其他优点,我总是会忘记。

In BabySmash I wanted to have the letters and shapes spoken when they appear on the screen, and lazily, rather than recording the sounds, I thought to myself, "self, why not text to speech?"

在BabySmash中,我想让字母和形状在屏幕上出现时能说出来,而且我懒洋洋地而不是录制声音,而是对自己说:“我自己,为什么不文本到语音?”

I know there's TTS (Text to Speech) stuff in Windows as COM Objects, so I went into Add Reference in Visual Studio, found the component and added it. A .NET wrapper got created that makes the COM object look like .NET and off I went.

我知道Windows中有TTS(文本到语音)内容作为COM对象,因此我进入了Visual Studio中的“添加引用”,找到了该组件并将其添加。 创建了一个.NET包装器,使COM对象看起来像.NET,然后我离开了。

Turns out that .NET 3.0 includes System.Speech, an official component that does all this for me. I yanked out the COM stuff and put System.Speech in, and got the added benefit of a Cancel method to stop any current speech. This is particularly helpful for BabySmash because when kids hit the keyboard fast the speech system slowed down as words to say queued up. It couldn't say the words as fast as they were said.

事实证明.NET 3.0包含System.Speech,这是为我完成所有这些工作的官方组件。 我拉出COM组件,然后放入System.Speech,并获得了Cancel方法来停止任何当前语音的附加好处。 这对BabySmash尤其有用,因为当孩子们快速按下键盘时,语音系统会因为说的单词排队而变慢。 它不能像说的那样快。

objSpeech = new SpeechSynthesizer();objSpeech.SpeakAsyncCancelAll();objSpeech.Rate = -1;objSpeech.Volume = 100;objSpeech.SpeakAsync(s);

//REMOVED COM STUFF//objSpeech.WaitUntilDone(Timeout.Infinite);//objSpeech.Speak(s, SpeechVoiceSpeakFlags.SVSFlagsAsync);

Additionally, by using the COM Component, I got into trouble where Vista has version 5.3 and XP had version 5.0. This made it difficult for developers using XP to build the program. This goes away when using the .NET assembly.

另外,通过使用COM组件,我遇到了麻烦,其中Vista的版本为5.3,而XP的版本为5.0。 这使得使用XP的开发人员难以构建程序。 使用.NET程序集时,这种情况消失了。

Hopefully I'll get to do more "refactoring via subtraction" as I dig deeper into .NET 3.x.

希望随着我对.NET 3.x的深入研究,能够做更多的“减法重构”。

Also, thanks to Gina at LifeHacker for her post on BabySmash! The comments are pretty good, but the best interaction was these two comments:

另外,还要感谢LifeHacker的Gina在BabySmash上的帖子! 这些评论非常好,但是最好的交互是这两个评论:

"Wow, 15 years of progress with Windows and this is all we have to show for it? No wonder Windows is teh suckage."

“哇,Windows已经有了15年的进步,这就是我们要做的一切?难怪Windows真是吸引人。”

Very supportive! ;) And a response from another random commenter:

非常支持! ;)和另一个随机评论者的回应:

"Wow, I've seen people take cheap shots at Windows, but this is the winner! A dad who writes a program for his son suddenly contributing to windows being 'teh suckage' ..."

“哇,我见过人们在Windows上拍便宜的照片,但这是赢家!一位父亲为他的儿子写了一个程序,突然导致Windows成为'吸盘'……”

Bam. Baby! Smash!

am 宝宝! 粉碎!

翻译自: https://www.hanselman.com/blog/learning-wpf-with-babysmash-speech-synthesis

wpf语音播报暂停

wpf语音播报暂停_使用BabySmash学习WPF-语音合成相关推荐

  1. java语音播报源代码_详解Android 语音播报实现方案(无SDK)

    本文介绍了详解Android 语音播报实现方案(无SDK),分享给大家,具体如下: 功能描述 类似支付宝收款时候的语音播报功能:当别人扫描你的收款码,你收到钱之后,就会听到"支付宝到账12. ...

  2. php加入语音播报功能_一个有语音播报功能的网络聊天室PHP源码

    二次元作风..语音播报的功用贼欢乐,妹子说脏话的时分太逗了,演示站(明天估量就删了)能够测试下这个语音播报的功用: 以下装置过程基于一个洁净的CentOS7X64Minimal. 装置Nodejs: ...

  3. python 语音播报库_基于python GUI开发的点名小程序(语音播报)

    #实现名单轮播.点名.语音播报功能 #优化版本1 # -*- coding:utf8 -*- # # ------------------------------------------------- ...

  4. python语音播报天气预报_树莓派之天气预报语音播报

    目录 树莓派之天气预报语音播报 方案选定 项目基调 需求分析 解决方案 具体实施 step1天气信息 安装ilang软件 json解析和文字组合 定时任务 树莓派之天气预报语音播报 前几天跟同事在聊家 ...

  5. php加入语音播报功能_如何使用PHP实现智能语音播报

    如何使用PHP实现智能语音播报 发布时间:2020-08-03 16:01:13 来源:亿速云 阅读:59 如何使用PHP实现智能语音播报?相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原 ...

  6. java语音播报天气_语音播报实时天气

    一. 让文本变成声音 .Net里面自带了一个语音类库:System.Speech,调用系统的语音功能,就能实现string到语音的转换,很简单(记得先把电脑音量调大一下): //Add System. ...

  7. wpf展开树节点_【转】WPF TreeView如何展开到某个节点

    初用WPF的TreeView控件,需要将树展开到某个特定的TreeViewItem,各种方法都尝试过,却发现代码总在某些情况下出错,然后仔细研究,才发现其中的曲折. 解决问题的思路是,得到从树的根节点 ...

  8. 一起学WPF系列(2):第一个WPF应用程序

    概述 Windows Presentation Foundation (WPF) 是下一代显示系统,用于生成能带给用户震撼视觉体验的 Windows 客户端应用程序.使用 WPF,您可以创建广泛的独立 ...

  9. 2019-详细Android Studio开发百度地图(5)—百度地图_导航和TTS语音播报的实现

    百度地图_导航和TTS语音播报的实现 前言 从小白一步步开始,很多资源是很久以前的,而且没有操作配套截图和资源分享.现在本踩过了很多坑,现在开发完成后决定重新写一份教程,希望能借此帮助到许多其他有这方 ...

最新文章

  1. Java stream! Kafka steam!流式处理这么火!它究竟是个啥?
  2. [Android]ListView中分割线的设置
  3. Java得到请求的IP地址
  4. 组件 -- Alert
  5. Python-Matplotlib可视化(番外篇)——Matplotlib中的事件处理详解与实战
  6. 绿联蓝牙驱动 linux,Ugreen绿联蓝牙驱动下载
  7. 银行业如何搭建自服务的数据平台?
  8. redis问题及答案
  9. 今日发现一个挺好的软件,控制音量 App音量控制(App Volume Control)v2.17 安卓版
  10. [转载] 杜拉拉升职记——14 猜猜为啥请晚餐
  11. 成功解决win7安装python过程,Setup failed,需要安装Windows 7 Service Pack 1
  12. ADSL宽带共享问题
  13. (附源码)springboot电影院售票与管理系统 毕业设计011449
  14. css箭头图片方向转换
  15. WOW技术---2, 骨骼动画
  16. 基于安卓的四六级英语学习小助手app(android毕业设计)
  17. 安装官方 Synaptics 驱动,终于解决 HP Pavilion G4 笔记本 讨厌的触摸板锁定问题!
  18. 启发:从MNS事务消息谈分布式事务
  19. java怎么创建二进制文件_如何为Java应用程序创建本机二进制文件?
  20. 电话号码区号插件vue-country-diacode-selector

热门文章

  1. js判断网页是否在微信打开
  2. 1. 考研常见问题总结 从择校到复试
  3. font-family解惑
  4. 自动驾驶感知——激光雷达物体检测算法
  5. 三极管放大电路仿真模拟
  6. 路由基础之基本的路由策略配置
  7. kylin云平台搭建问题
  8. java ipv6校验_IPv6验证
  9. 庄子,以自然之道,养自然之身
  10. solo升级以及自动化更新的方法