Compartilhar via


SpeechAudioFormatInfo Construtores

Definição

Inicializa uma nova instância da classe SpeechAudioFormatInfo.

Sobrecargas

SpeechAudioFormatInfo(Int32, AudioBitsPerSample, AudioChannel)

Inicializa uma nova instância da classe SpeechAudioFormatInfo e especifica as amostras por segundo, bits por amostra e o número de canais.

SpeechAudioFormatInfo(EncodingFormat, Int32, Int32, Int32, Int32, Int32, Byte[])

Inicializa uma nova instância da classe SpeechAudioFormatInfo e especifica o formato de codificação, amostras por segundo, bits por amostra, número de canais, média de bytes por segundo, valor de alinhamento de bloco e uma matriz que contém dados específicos a um formato.

SpeechAudioFormatInfo(Int32, AudioBitsPerSample, AudioChannel)

Inicializa uma nova instância da classe SpeechAudioFormatInfo e especifica as amostras por segundo, bits por amostra e o número de canais.

public:
 SpeechAudioFormatInfo(int samplesPerSecond, System::Speech::AudioFormat::AudioBitsPerSample bitsPerSample, System::Speech::AudioFormat::AudioChannel channel);
public SpeechAudioFormatInfo (int samplesPerSecond, System.Speech.AudioFormat.AudioBitsPerSample bitsPerSample, System.Speech.AudioFormat.AudioChannel channel);
new System.Speech.AudioFormat.SpeechAudioFormatInfo : int * System.Speech.AudioFormat.AudioBitsPerSample * System.Speech.AudioFormat.AudioChannel -> System.Speech.AudioFormat.SpeechAudioFormatInfo
Public Sub New (samplesPerSecond As Integer, bitsPerSample As AudioBitsPerSample, channel As AudioChannel)

Parâmetros

samplesPerSecond
Int32

O valor das amostras por segundo.

bitsPerSample
AudioBitsPerSample

O valor de bits por amostra.

channel
AudioChannel

Um membro da enumeração de AudioChannel (indicando Mono ou Estéreo).

Exemplos

O exemplo a seguir mostra um uso típico do SpeechAudioFormatInfo para especificar o formato do áudio para saída para um arquivo WAV. A SpeechAudioFormatInfo instância é um argumento para o SetOutputToWaveFile método.

using System;  
using System.IO;  
using System.Speech.Synthesis;  
using System.Speech.AudioFormat;  

namespace SampleSynthesis  
{  
  class Program  
  {  
    static void Main(string[] args)  
    {  

      // Initialize a new instance of the SpeechSynthesizer.  
      using (SpeechSynthesizer synth = new SpeechSynthesizer())  
      {  

        // Configure the audio output.   
        synth.SetOutputToWaveFile(@"C:\temp\test.wav",   
          new SpeechAudioFormatInfo(32000, AudioBitsPerSample.Sixteen, AudioChannel.Mono));  

        // Create a SoundPlayer instance to play output audio file.  
        System.Media.SoundPlayer m_SoundPlayer =   
          new System.Media.SoundPlayer(@"C:\temp\test.wav");  

        // Build a prompt.  
        PromptBuilder builder = new PromptBuilder();  
        builder.AppendText("This is sample output to a WAVE file.");  

        // Speak the prompt.  
        synth.Speak(builder);  
        m_SoundPlayer.Play();  
      }  

      Console.WriteLine();  
      Console.WriteLine("Press any key to exit...");  
      Console.ReadKey();  
    }  
  }  
}  

Aplica-se a

SpeechAudioFormatInfo(EncodingFormat, Int32, Int32, Int32, Int32, Int32, Byte[])

Inicializa uma nova instância da classe SpeechAudioFormatInfo e especifica o formato de codificação, amostras por segundo, bits por amostra, número de canais, média de bytes por segundo, valor de alinhamento de bloco e uma matriz que contém dados específicos a um formato.

public:
 SpeechAudioFormatInfo(System::Speech::AudioFormat::EncodingFormat encodingFormat, int samplesPerSecond, int bitsPerSample, int channelCount, int averageBytesPerSecond, int blockAlign, cli::array <System::Byte> ^ formatSpecificData);
public SpeechAudioFormatInfo (System.Speech.AudioFormat.EncodingFormat encodingFormat, int samplesPerSecond, int bitsPerSample, int channelCount, int averageBytesPerSecond, int blockAlign, byte[] formatSpecificData);
new System.Speech.AudioFormat.SpeechAudioFormatInfo : System.Speech.AudioFormat.EncodingFormat * int * int * int * int * int * byte[] -> System.Speech.AudioFormat.SpeechAudioFormatInfo
Public Sub New (encodingFormat As EncodingFormat, samplesPerSecond As Integer, bitsPerSample As Integer, channelCount As Integer, averageBytesPerSecond As Integer, blockAlign As Integer, formatSpecificData As Byte())

Parâmetros

encodingFormat
EncodingFormat

O formato de codificação.

samplesPerSecond
Int32

O valor das amostras por segundo.

bitsPerSample
Int32

O valor de bits por amostra.

channelCount
Int32

O valor da contagem de canal.

averageBytesPerSecond
Int32

O valor da média de bytes por segundo.

blockAlign
Int32

O valor do BlockAlign.

formatSpecificData
Byte[]

Uma matriz de bytes que contém os dados específicos a um formato.

Aplica-se a