Author Topic: What am I doing wrong? VC.SetSpeechInput doesn't appear to switch  (Read 9346 times)

0 Members and 1 Guest are viewing this topic.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: What am I doing wrong? VC.SetSpeechInput doesn't appear to switch
« Reply #15 on: April 11, 2014, 01:51:03 PM »
By the way the keys are stored here in the registry (for the normal speech engine, not for SP):

HKEY_CURRENT_USER\Software\Microsoft\Speech\AudioInput\TokenEnums\MMAudioIn

It really keeps everything in there.  I believe it is safe to go in and delete any tokens you are not using if you want to clean it up a bit.  At some point I'll see if there is anything I can do to make the selection process more robust...

garryjw

  • $upporter
  • Contributor
  • *****
  • Posts: 59
  • Karma: 5
    • View Profile
Re: What am I doing wrong? VC.SetSpeechInput doesn't appear to switch
« Reply #16 on: April 11, 2014, 05:11:58 PM »
Maybe put something in the documentation along the lines of

VC.SetSpeechInput will look for the name you specify in both the 'friendly' name of the sound device and the internal device name. In the sound panel these are shown with the Friendly name above the internal device name for each device. For example if you have an Amulet device this will by default have a friendly name of Microphone and an internal name of Amulet Devices Remote Control and will show as:

Microphone
Amulet Devices Remote Control


VC.SetSpeechInput will switch to the first device in the list that matches the parameter.

In this example doing a VC.SetSpeechInput with a parameter of Amulet will find this device. Equally if the parameter was Microphone, and as long as the amulet was the first device in the list with Microphone in the friendly or device name, then the Amulet device will be switched to. Unfortunately most devices are by default name Microphone so it is probably unwise to rely on this and instead rename your devices to something unique -you cann to this within the properties of the device in the sound control panel.

One thing to note is that renaming a device can sometimes leave internal traces of the original device leading to unexpected results. In the above case it is possible if the device was renamed from Microphone to Amulet then unexpected results might occur. Doing a VC.SetSpeechInput to Amulet might not switch to the device instead the old traces of the Microphone-Amulet Devices Remote Control might be found first instead.

To avoid this we advise only renaming devices to a unique name different to any internal device name. For example changing the name to Amulet1 and doing a VC.SetSpeechInput Amulet1 would work.


Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: What am I doing wrong? VC.SetSpeechInput doesn't appear to switch
« Reply #17 on: April 12, 2014, 05:58:38 AM »
Thanks Garry, great tutorial  ::bow
I have one hint: When the VC.SetSpeechInput action is executed, you can see this in the VC history window. Then you can move your mouse over this command in the history window and will see the result to which input VC has changed (friendly name and also the internal device name in brackets)
***********  get excited and make things  **********

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: What am I doing wrong? VC.SetSpeechInput doesn't appear to switch
« Reply #18 on: April 12, 2014, 08:15:15 AM »
Thanks. Added this to the wiki.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: What am I doing wrong? VC.SetSpeechInput doesn't appear to switch
« Reply #19 on: April 12, 2014, 08:22:23 AM »
To test I went in and deleted all these token keys from my registry. Windows did not mind, creating new keys for each device the first time I manually selected it as an input.

I found a method that enumerates all active input devices.  If this works reliably, and if it uses a naming system that matches the tokens, I might be able to use this to filter out unused devices.