Condividi tramite


PromptSelectFunction Property

  Microsoft Speech Technologies Homepage

Gets or sets the name of a client-side function that selects or modifies the DialogPrompt control text before playback. Read/write.

Usage

ASP.NET markup: <speech:Prompt PromptSelectFunction="..." />
Get value: String = DialogPrompt.PromptSelectFunction;
Set value: DialogPrompt.PromptSelectFunction = String;
Data type: String
Required: No

Remarks

The text returned by the PromptSelectFunction property may contain HTML-encoded markup elements of the following types:

  • Speech Synthesis Markup Language (SSML)
    SSML enables developers to customize the playing of prompt text by the Text-To-Speech (TTS) engine. SSML elements can modify the pitch, rate, volume, pronunciation and other characteristics of the TTS engine.

    Authors should not use ssml:speak tags in the PromptSelectFunction text. When Speech Controls play prompts, they automatically enclose prompt text elements within ssml:speak tags as needed. If the prompt text already contains ssml:speak tags, the resulting prompt will fail to play.

  • Prompt Engine Markup Language (PEML)
    PEML enables developers to customize the playing of prompt text by the Prompt engine. SSML elements provide developers with control of all Prompt engine functionality.

  • Speech Application Language Tags (SALT)
    SALT value elements enable developers to insert text from HTML controls into the prompt text.

When an application page is rendered, Speech Controls generate namespace declarations for the three types of markup elements. When creating markup elements, developers must use markup element namespaces exactly as shown in the following table.

Markup type Namespace Example (before HTML-encoding)
SSML ssml <ssml:sub alias="Speech A.P.I.">SAPI</ssml:sub>
PEML peml <peml:div />
SALT salt <salt:value targetelement="txtSize" targetattribute="value"> </salt:value>

The value of the PromptSelectFunction property is the name of a custom client-side script function, without parameters or parentheses. The client-side dialog manager calls this function, using the following syntax, after the QA has been activated and before the prompt playback begins.

The script block that contains this function should be placed before the control that calls the function. For more information, see "Placement of Script Blocks" in Authoring Notes.

string FunctionName ()
{
     // Client-side code referenced by DialogPrompt.PromptSelectFunction
}

Parameters

None.

Return Value

The routine specified by the PromptSelectFunction property must always return a value. To play silence, return an empty string.

Example

<form id="Form1" method="post" runat="server">
  <script>
  function ConfirmDialogPrompt ()
  {
    var myDialogPrompt = "please confirm that you wish to fly from ";
    myDialogPrompt = myDialogPrompt + RunSpeech.GetSemanticItem("siOrig").value + " to ";
    myDialogPrompt = myDialogPrompt + RunSpeech.GetSemanticItem("siDest").value + ". ";
    return myDialogPrompt;
  }
  </script>
  ...
  <speech:qa ID="qaOrig" runat="server">
    <Prompt ID="prmptOrig" InlinePrompt="What is your originating city?" BargeIn="False">
    </DialogPrompt>
    <Reco ID="recoOrig">
      <Grammars>
        <speech:Grammar Src="grammars/cities.xml" runat="server"></speech:grammar>
      </Grammars>
    </Reco>
    <Answers>
      <speech:Answer ID="ansOrig" XPathTrigger="/sml/origcity" SemItem="siOrig" runat="server">
      </speech:Answer>
    </Answers>
  </speech:qa>
  
  <speech:qa ID="qaDest" runat="server">
    <Prompt ID="prmptDest" InlinePrompt="What is your destination city?" BargeIn="False">
    </DialogPrompt>
    <Reco ID="recoDest">
      <Grammars>
        <speech:Grammar Src="grammars/cities.xml" runat="server"></speech:grammar>
      </Grammars>
    </Reco>
    <Answers>
      <speech:Answer ID="ansDest" XPathTrigger="/sml/destcity" SemItem="siDest" runat="server">
      </speech:Answer>
    </Answers>
  </speech:qa>
  
  <speech:qa ID="qaConf" xpathDenyConfirms="/sml/deny" xpathAcceptConfirms="/sml/accept runat="server" ">
    <Prompt id="prmptConf" PromptSelectFunction="ConfirmDialogPrompt" BargeIn="False">
    </DialogPrompt>
    <Reco ID="recoConf">
      <Grammars>
        <speech:grammar src="grammars/cities.xml" runat="server"></speech:grammar>
      </Grammars>
    </Reco>
    <Confirms>
      <speech:answer ID="confOrig" XPathTrigger="/sml/origcity" SemItem="siOrig" runat="server">
      </speech:Answer>
      <speech:answer ID="confDest" XPathTrigger="/sml/destcity" SemItem="siDest" runat="server">
      </speech:Answer>
    </Confirms>
  </speech:qa>
  
</form>

See Also

DialogPrompt Class | DialogPrompt Constructor | DialogPrompt Members | DialogPrompt Properties | DialogPrompt Methods | DialogPrompt Events | DialogPrompt Remarks