Sdílet prostřednictvím


SpeechAudioFormatInfo Konstruktory

Definice

Inicializuje novou instanci SpeechAudioFormatInfo třídy.

Přetížení

SpeechAudioFormatInfo(Int32, AudioBitsPerSample, AudioChannel)

Inicializuje novou instanci SpeechAudioFormatInfo třídy a určuje vzorky za sekundu, bity na vzorek a počet kanálů.

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

Inicializuje novou instanci SpeechAudioFormatInfo třídy a určuje formát kódování, vzorky za sekundu, bity na vzorek, počet kanálů, průměrné bajty za sekundu, hodnotu zarovnání bloku a pole obsahující data specifická pro formát.

SpeechAudioFormatInfo(Int32, AudioBitsPerSample, AudioChannel)

Zdroj:
SpeechAudioFormatInfo.cs
Zdroj:
SpeechAudioFormatInfo.cs
Zdroj:
SpeechAudioFormatInfo.cs
Zdroj:
SpeechAudioFormatInfo.cs

Inicializuje novou instanci SpeechAudioFormatInfo třídy a určuje vzorky za sekundu, bity na vzorek a počet kanálů.

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)

Parametry

samplesPerSecond
Int32

Hodnota vzorků za sekundu

bitsPerSample
AudioBitsPerSample

Hodnota bitů na vzorek.

channel
AudioChannel

Člen výčtu AudioChannel (označující Mono nebo Stereo).

Příklady

Následující příklad ukazuje typické použití SpeechAudioFormatInfo k určení formátu zvuku pro výstup do souboru WAV. Instance SpeechAudioFormatInfo je argumentem SetOutputToWaveFile metody.

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();  
    }  
  }  
}  

Platí pro

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

Zdroj:
SpeechAudioFormatInfo.cs
Zdroj:
SpeechAudioFormatInfo.cs
Zdroj:
SpeechAudioFormatInfo.cs
Zdroj:
SpeechAudioFormatInfo.cs

Inicializuje novou instanci SpeechAudioFormatInfo třídy a určuje formát kódování, vzorky za sekundu, bity na vzorek, počet kanálů, průměrné bajty za sekundu, hodnotu zarovnání bloku a pole obsahující data specifická pro formát.

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())

Parametry

encodingFormat
EncodingFormat

Formát kódování.

samplesPerSecond
Int32

Hodnota vzorků za sekundu

bitsPerSample
Int32

Hodnota bitů na vzorek.

channelCount
Int32

Hodnota pro počet kanálů.

averageBytesPerSecond
Int32

Hodnota průměrného bajtu za sekundu

blockAlign
Int32

Hodnota BlockAlign.

formatSpecificData
Byte[]

Pole bajtů obsahující data specifická pro formát.

Platí pro