JBTALKS.CC

标题: 【疑问】SAPI 的 volume 和 interval [打印本页]

作者: maple迷    时间: 2010-5-1 08:05 PM
标题: 【疑问】SAPI 的 volume 和 interval
这个是 code

  1. Public Class Form1

  2.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  3.         Dim SAPI
  4.         SAPI = CreateObject("sapi.spvoice")
  5.         SAPI.speak(RichTextBox1.Text)
  6.     End Sub
  7. End Class
复制代码
然后 , 疑问是怎么调 volume 和 interval 呢?
找了 Google 找不到

本来放了

  1. SAPI.voice.interval = 350
复制代码
然后下面没有出红线

debug 后
到这段时
就 highlight 起来了
作者: Super-Tomato    时间: 2010-5-1 08:56 PM
这个是 code然后 , 疑问是怎么调 volume 和 interval 呢?
找了 Google 找不到

本来放了然后下面没有出 ...
maple迷 发表于 2010-5-1 08:05 PM



學習前應該看看有哪些属性和函数可以讓你使用及說明
http://msdn.microsoft.com/en-us/library/ms723602%28VS.85%29.aspx
作者: maple迷    时间: 2010-5-1 09:46 PM
谢谢番茄大大
这个网址很有帮助
___________________________________

如果直接用 dim 和用 import 会有不同吗?
作者: maple迷    时间: 2010-5-1 10:01 PM

  1. Public Class Form1

  2.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  3.         Dim Spvoice
  4.         Spvoice = CreateObject("sapi.spvoice")
  5.         Spvoice.speak(RichTextBox1.Text)
  6.     End Sub

  7.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  8.         Dim spvoice
  9.         spvoice = Created
  10.         spvoice.volume = TextBox1.Text
  11.     End Sub
  12. End Class
复制代码
换了 code
button1 正常

button2 还是 error 在
spvoice.volume
error 说 volume 在 boolean 找不到
作者: Super-Tomato    时间: 2010-5-2 03:59 AM
换了 code
button1 正常

button2 还是 error 在
spvoice.volume
error 说 volume 在 boolean 找不到
maple迷 发表于 2010-5-1 10:01 PM



spvoice.volume = TextBox1.Text

應該是資料型態問題, documentation 中已經說明需賦予 Long 型態


Volume Property

The Volume property gets and sets the base volume (loudness) level of the voice.
Values for the Volume property range from 0 to 100, representing the minimum and maximum volume levels, respectively.
At the beginning of each Speak or SpeakStream method, the voice sets the volume level according to the value of the Volume property, and speaks the entire stream at that level. The voice's Volume property can be changed at any time, but the actual volume level will not reflect the changed property value until it begins a new stream.Syntax
Set:SpVoice.Volume = Long
Get:Long = SpVoice.Volume
PartsSpVoiceThe owning object.LongSet:   A Long variable that sets the property value.
Get:   A Long variable that gets the property value.
作者: goodhermit95    时间: 2010-5-2 10:35 AM
我说你啊,用华文的VisualBasic比较好,上次他问我为什么这个Code不可以
msgbox("message",msgboxstyle.information("title"))

作者: maple迷    时间: 2010-5-2 12:17 PM
@番茄大人
好的 , 我试试

@松哥
那次是随便看到的 , 随意随便 try try ==




欢迎光临 JBTALKS.CC (https://www.jbtalks.cc/) Powered by Discuz! X2.5